aboutsummaryrefslogtreecommitdiff
path: root/src/win32_compatibility.cpp
diff options
context:
space:
mode:
authorDavid <david@xagasoft.com>2009-01-14 21:06:20 +0000
committerDavid <david@xagasoft.com>2009-01-14 21:06:20 +0000
commitb49973db8489f02e10e3475b6a8a199d919a6efa (patch)
tree3aff4a0ea51c91445f236cd75b52a716a87625e2 /src/win32_compatibility.cpp
parent13de3079105d65f130db04adc9d3004f4651cd69 (diff)
downloadlibbu++-b49973db8489f02e10e3475b6a8a199d919a6efa.tar.gz
libbu++-b49973db8489f02e10e3475b6a8a199d919a6efa.tar.bz2
libbu++-b49973db8489f02e10e3475b6a8a199d919a6efa.tar.xz
libbu++-b49973db8489f02e10e3475b6a8a199d919a6efa.zip
david - WSA functions
Diffstat (limited to 'src/win32_compatibility.cpp')
-rw-r--r--src/win32_compatibility.cpp53
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
5typedef int (__cdecl *FNDEF_DYN_WSAStartup)(WORD,LPWSADATA);
6int 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
23typedef int (__cdecl *FNDEF_DYN_WSACleanup)();
24int 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 );
41typedef int (__cdecl *FNDEF_DYN_WSAGetLastError)(void);
42int 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
5typedef char * (__cdecl *FNDEF_DYN_inet_ntoa)( struct in_addr ); 58typedef char * (__cdecl *FNDEF_DYN_inet_ntoa)( struct in_addr );
6void DynamicWinsock2::inet_ntoa( Bu::FString &out, struct in_addr addr_in ) 59void DynamicWinsock2::inet_ntoa( Bu::FString &out, struct in_addr addr_in )
7{ 60{