Add tentative support for DllMain of high loaded DLLs.
[wincetools.git] / loader / libhimemce.c
1 #include <windows.h>
2
3 static void dllmain_cb (DWORD reason, LPVOID reserved);
4
5
6 /* This library is necessary, because if DLLs are loaded high, they
7    need to be notified of new threads, and we can't do that without
8    a DLL that receives these notifications from the system.  */
9
10 BOOL
11 DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
12 {
13   if (fdwReason != DLL_THREAD_ATTACH && fdwReason != DLL_THREAD_DETACH)
14     return TRUE;
15
16   if (dllmain_cb)
17     (*dllmain_cb) (fdwReason, lpvReserved);
18 }
19
20
21 void
22 himemce_set_dllmain_cb (void (*cb) (DWORD, LPVOID))
23 {
24   dllmain_cb = cb;
25 }