OSDN Git Service

post WM_NULL to attached threads on yamy exit to unmap mayu{32,64}.dll
[yamy/yamy.git] / yamyd.cpp
1 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
2 // yamyd.cpp\r
3 \r
4 #include "mayu.h"\r
5 #include "hook.h"\r
6 \r
7 /// main\r
8 int WINAPI _tWinMain(HINSTANCE /* i_hInstance */, HINSTANCE /* i_hPrevInstance */,\r
9                                          LPTSTR /* i_lpszCmdLine */, int /* i_nCmdShow */)\r
10 {\r
11         HANDLE mutex = OpenMutex(SYNCHRONIZE, FALSE, MUTEX_YAMYD_BLOCKER);\r
12         if (mutex != NULL) {\r
13                 CHECK_FALSE( installMessageHook(0) );\r
14 \r
15                 // wait for master process exit\r
16                 WaitForSingleObject(mutex, INFINITE);\r
17                 CHECK_FALSE( uninstallMessageHook() );\r
18                 ReleaseMutex(mutex);\r
19         }\r
20 \r
21         return 0;\r
22 }\r