Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 8th, 2012  |  syntax: D  |  size: 0.62 KB  |  views: 73  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. module dllmain;
  2.  
  3. import std.c.windows.windows;
  4. import core.sys.windows.dll;
  5.  
  6. __gshared HINSTANCE g_hInst;
  7.  
  8. extern (Windows)
  9. BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
  10. {
  11.     final switch (ulReason)
  12.     {
  13.         case DLL_PROCESS_ATTACH:
  14.             g_hInst = hInstance;
  15.             dll_process_attach( hInstance, true );
  16.             break;
  17.  
  18.         case DLL_PROCESS_DETACH:
  19.             dll_process_detach( hInstance, true );
  20.             break;
  21.  
  22.         case DLL_THREAD_ATTACH:
  23.             dll_thread_attach( true, true );
  24.             break;
  25.  
  26.         case DLL_THREAD_DETACH:
  27.             dll_thread_detach( true, true );
  28.             break;
  29.     }
  30.     return true;
  31. }
clone this paste RAW Paste Data