diff options
Diffstat (limited to '')
-rw-r--r-- | src/win32_compatibility.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/win32_compatibility.cpp b/src/win32_compatibility.cpp index 0ef3abc..083925b 100644 --- a/src/win32_compatibility.cpp +++ b/src/win32_compatibility.cpp | |||
@@ -2,6 +2,59 @@ | |||
2 | 2 | ||
3 | #ifdef WIN32 | 3 | #ifdef WIN32 |
4 | 4 | ||
5 | typedef int (__cdecl *FNDEF_DYN_WSAStartup)(WORD,LPWSADATA); | ||
6 | int DynamicWinsock2::WSAStartup( | ||
7 | WORD wVersionRequested,LPWSADATA lpWSAData) | ||
8 | { | ||
9 | int out=0; | ||
10 | HINSTANCE Ws2_32 = LoadLibrary(TEXT("WS2_32.DLL")); | ||
11 | printf("ws2_32 dll: %08x\n", (int) Ws2_32); | ||
12 | if( Ws2_32 != NULL ) | ||
13 | { | ||
14 | FNDEF_DYN_WSAStartup fn = (FNDEF_DYN_WSAStartup) | ||
15 | GetProcAddress( Ws2_32, "WSAStartup" ); | ||
16 | printf("WSAStartup function pointer: %08x\n", (int)fn); | ||
17 | if( fn != NULL ) | ||
18 | out = (fn)(wVersionRequested,lpWSAData); | ||
19 | } | ||
20 | return out; | ||
21 | } | ||
22 | |||
23 | typedef int (__cdecl *FNDEF_DYN_WSACleanup)(); | ||
24 | int DynamicWinsock2::WSACleanup() | ||
25 | { | ||
26 | int out=0; | ||
27 | HINSTANCE Ws2_32 = LoadLibrary(TEXT("WS2_32.DLL")); | ||
28 | printf("ws2_32 dll: %08x\n", (int) Ws2_32); | ||
29 | if( Ws2_32 != NULL ) | ||
30 | { | ||
31 | FNDEF_DYN_WSACleanup fn = (FNDEF_DYN_WSACleanup) | ||
32 | GetProcAddress( Ws2_32, "WSACleanup" ); | ||
33 | printf("WSACleanup function pointer: %08x\n", (int)fn); | ||
34 | if( fn != NULL ) | ||
35 | out = (fn)(); | ||
36 | } | ||
37 | return out; | ||
38 | } | ||
39 | |||
40 | //typedef char * (__cdecl *FNDEF_DYN_gai_strerrorA)( int ecode ); | ||
41 | typedef int (__cdecl *FNDEF_DYN_WSAGetLastError)(void); | ||
42 | int DynamicWinsock2::WSAGetLastError() | ||
43 | { | ||
44 | int out=0; | ||
45 | HINSTANCE Ws2_32 = LoadLibrary(TEXT("WS2_32.DLL")); | ||
46 | printf("ws2_32 dll: %08x\n", (int) Ws2_32); | ||
47 | if( Ws2_32 != NULL ) | ||
48 | { | ||
49 | FNDEF_DYN_WSAGetLastError fn = (FNDEF_DYN_WSAGetLastError) | ||
50 | GetProcAddress( Ws2_32, "WSAGetLastError" ); | ||
51 | printf("WSAGetLastError function pointer: %08x\n", (int)fn); | ||
52 | if( fn != NULL ) | ||
53 | out = (fn)(); | ||
54 | } | ||
55 | return out; | ||
56 | } | ||
57 | |||
5 | typedef char * (__cdecl *FNDEF_DYN_inet_ntoa)( struct in_addr ); | 58 | typedef char * (__cdecl *FNDEF_DYN_inet_ntoa)( struct in_addr ); |
6 | void DynamicWinsock2::inet_ntoa( Bu::FString &out, struct in_addr addr_in ) | 59 | void DynamicWinsock2::inet_ntoa( Bu::FString &out, struct in_addr addr_in ) |
7 | { | 60 | { |