Guest User

Untitled

a guest
Jun 21st, 2010
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "Windows.h"
  3. HHOOK hHook;
  4. // Define the DLL's main function
  5. LRESULT CALLBACK KeyHook(int nCode, WPARAM wParam, LPARAM lParam)
  6. {
  7.      MessageBox(0, "Key Hooked.", "HookeD!", 0);
  8. return 0;
  9. }
  10.  
  11. BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReason, LPVOID lpReserved)
  12. {
  13.     // Get rid of compiler warnings since we do not use this parameter
  14.  
  15.     UNREFERENCED_PARAMETER(lpReserved);
  16.  
  17.     // If we are attaching to a process
  18.  
  19.     if(ulReason == DLL_PROCESS_ATTACH)
  20.     {
  21.         // Do not need the thread based attach/detach messages in this DLL
  22.         DisableThreadLibraryCalls(hModule);
  23.     }
  24.  
  25.     // Signal for Loading/Unloading
  26.  
  27.     return (TRUE);
  28. }
  29.  
  30. extern "C" __declspec(dllexport) void Initialize()
  31. {
  32.     hHook=SetWindowsHookEx(WH_KEYBOARD, KeyHook, (HINSTANCE) NULL, GetCurrentThreadId());
  33.     MessageBox(0, "Locked and Loaded.", "DLL Injection Successful!", 0);
  34.    
  35. }
Advertisement
Add Comment
Please, Sign In to add comment