diff options
Diffstat (limited to 'src/lib/win_glue.c')
-rw-r--r-- | src/lib/win_glue.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/lib/win_glue.c b/src/lib/win_glue.c new file mode 100644 index 0000000000..ae49472383 --- /dev/null +++ b/src/lib/win_glue.c @@ -0,0 +1,54 @@ +/* + * WinSock support. + * + * Do the WinSock initialization call, keeping all the hair here. + * + * This routine is called by SOCKET_INITIALIZE in include/c-windows.h. + * The code is pretty much copied from winsock.txt from winsock-1.1, + * available from: + * ftp://sunsite.unc.edu/pub/micro/pc-stuff/ms-windows/winsock/winsock-1.1 + */ + +/* We can't include winsock.h directly because of /Za (stdc) options */ +#define NEED_SOCKETS +#include "krb5.h" + +int +win_socket_initialize() +{ + WORD wVersionRequested; + WSADATA wsaData; + int err; + + wVersionRequested = 0x0101; /* We need version 1.1 */ + + err = WSAStartup (wVersionRequested, &wsaData); + if (err != 0) + return err; /* Library can't initialize */ + + if (wVersionRequested != wsaData.wVersion) { + /* DLL couldn't support our version of the spec */ + WSACleanup (); + return -104; /* FIXME -- better error? */ + } + + return 0; +} + +BOOL CALLBACK +LibMain (hInst, wDataSeg, cbHeap, CmdLine) +HINSTANCE hInst; +WORD wDataSeg; +WORD cbHeap; +LPSTR CmdLine; +{ + win_socket_initialize (); + return 1; +} + +int CALLBACK __export +WEP(nParam) + int nParam; +{ + return 1; +} |