GetProcAddress fails with ERROR_PROC_NOT_FOUND.
What am I overlooking within the DLL?
Inject
DLL
Read more ...»
What am I overlooking within the DLL?
Inject
Code: |
void Injector::Inject(void){ if(CheckProcess()){ HMODULE dll = LoadLibrary(dll_name); FARPROC proc = GetProcAddress(dll, "GetMsgProc"); HHOOK hh = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)proc, dll, te.th32ThreadID); UnhookWindowsHookEx(hh); } } |
DLL
Code: |
#include extern "C" __declspec(dllexport)LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam){ return CallNextHookEx(0, nCode, wParam, lParam); } BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved){ UNREFERENCED_PARAMETER(hinstDLL); UNREFERENCED_PARAMETER(fdwReason); switch(fdwReason) { case DLL_PROCESS_ATTACH: MessageBox(0, "Hi", "Sup", MB_OK); return TRUE; case DLL_PROCESS_DETACH: return TRUE; } return ERROR_SUCCESS; } |