2 * Microsoft Windows specifics for LIBLDAP DLL
10 /* Lifted from Q125688
11 * How to Port a 16-bit DLL to a Win32 DLL
14 BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
18 case DLL_PROCESS_ATTACH:
19 /* Code from LibMain inserted here. Return TRUE to keep the
20 DLL loaded or return FALSE to fail loading the DLL.
22 You may have to modify the code in your original LibMain to
23 account for the fact that it may be called more than once.
24 You will get one DLL_PROCESS_ATTACH for each process that
25 loads the DLL. This is different from LibMain which gets
26 called only once when the DLL is loaded. The only time this
27 is critical is when you are using shared data sections.
28 If you are using shared data sections for statically
29 allocated data, you will need to be careful to initialize it
30 only once. Check your code carefully.
32 Certain one-time initializations may now need to be done for
33 each process that attaches. You may also not need code from
34 your original LibMain because the operating system may now
38 * 16 bit code calls UnlockData()
39 * which is mapped to UnlockSegment in windows.h
40 * in 32 bit world UnlockData is not defined anywhere
41 * UnlockSegment is mapped to GlobalUnfix in winbase.h
42 * and the docs for both UnlockSegment and GlobalUnfix say
43 * ".. function is oboslete. Segments have no meaning
44 * in the 32-bit environment". So we do nothing here.
48 case DLL_THREAD_ATTACH:
49 /* Called each time a thread is created in a process that has
50 already loaded (attached to) this DLL. Does not get called
51 for each thread that exists in the process before it loaded
54 Do thread-specific initialization here.
58 case DLL_THREAD_DETACH:
59 /* Same as above, but called when a thread in the process
62 Do thread-specific cleanup here.
66 case DLL_PROCESS_DETACH:
67 /* Code from _WEP inserted here. This code may (like the
68 LibMain) not be necessary. Check to make certain that the
69 operating system is not doing it for you.
73 /* The return value is only used for DLL_PROCESS_ATTACH; all other
74 conditions are ignored. */
75 return TRUE; // successful DLL_PROCESS_ATTACH
79 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
88 ldap_memfree( void *p )