Advertisement
Rapptz

MainDLL

Aug 13th, 2012
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1.  #include <windows.h>
  2.  
  3. extern void Main(void);
  4.  
  5. ::BOOL WINAPI DllWork(__in::HMODULE hModule) {
  6.     Main();
  7.     return true;
  8. }
  9.  
  10. ::BOOL WINAPI DllMain(__in::HMODULE hModule, __in::DWORD dwReason, __in __reserved::LPVOID lpvReserved) {
  11.     ::HANDLE hThread = NULL;
  12.     if (dwReason == DLL_PROCESS_ATTACH) {
  13.         if ((hThread = ::CreateThread(NULL, 0, (::LPTHREAD_START_ROUTINE) & DllWork, (::HMODULE)hModule, 0, NULL)) == NULL) {
  14.             return FALSE;
  15.         }
  16.         if (::CloseHandle(hThread) == FALSE) {
  17.             //do nothing
  18.         }
  19.     }
  20.     return TRUE;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement