Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "Windows.h"
- HHOOK hHook;
- // Define the DLL's main function
- LRESULT CALLBACK KeyHook(int nCode, WPARAM wParam, LPARAM lParam)
- {
- MessageBox(0, "Key Hooked.", "HookeD!", 0);
- return 0;
- }
- BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReason, LPVOID lpReserved)
- {
- // Get rid of compiler warnings since we do not use this parameter
- UNREFERENCED_PARAMETER(lpReserved);
- // If we are attaching to a process
- if(ulReason == DLL_PROCESS_ATTACH)
- {
- // Do not need the thread based attach/detach messages in this DLL
- DisableThreadLibraryCalls(hModule);
- }
- // Signal for Loading/Unloading
- return (TRUE);
- }
- extern "C" __declspec(dllexport) void Initialize()
- {
- hHook=SetWindowsHookEx(WH_KEYBOARD, KeyHook, (HINSTANCE) NULL, GetCurrentThreadId());
- MessageBox(0, "Locked and Loaded.", "DLL Injection Successful!", 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment