blob: 1e7d64793788638096abd51fcbea425c1e8cd63d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock.h>
#include "win32.h"
BOOL WINAPI
DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
LPVOID lpReserved)
{
WSADATA wsaData;
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
if (WSAStartup(MAKEWORD(1, 1), &wsaData))
{
/*
* No really good way to do error handling here, since we
* don't know how we were loaded
*/
return FALSE;
}
if (netmsgModule == NULL){
netmsgModule=LoadLibraryEx("netmsg.dll",NULL,LOAD_LIBRARY_AS_DATAFILE);
}
break;
case DLL_PROCESS_DETACH:
if (netmsgModule != NULL)
FreeLibrary(netmsgModule);
WSACleanup();
break;
}
return TRUE;
}
|