I've spending the last few days messing with random hooking tutorials, and I even made the InsertDateTime redirect for Notepad and scared a few people by thinking I gave them a virus xD
I'm moved back to CoD and I used OllyDBG to locate the "WEAPON_FIRING" function in cgamex86.dll. but I'm not sure the adress is correct... because when I inject my DLL without any function hooking, CoD starts up, but when I add my hooks, it doesn't start up.
Adresses:
dllmain.cpp:Code:3000CCC5 |. E8 26C50000 CALL cgamex86.300191F0 3000CCCA |. 83C4 04 ADD ESP,4 3000CCCD |. 5E POP ESI 3000CCCE |. C3 RETN 3000CCCF 68 E46D0530 PUSH cgamex86.30056DE4 ASCII"WEAPON_FIRING"
dll.h:Code:#include <windows.h> #include <stdio.h> #include <stdlib.h> #include "detours.h" #include "dll.h" BOOL APIENTRY DllMain (HINSTANCE hInst /* Library instance handle. */ , DWORD reason /* Reason this function is being called. */ , LPVOID reserved /* Not used. */ ) { switch (reason) { case DLL_PROCESS_ATTACH: MessageBox(0, "Injected!", "TehBlizzy's CoDHook", MB_OK); WEAPON_FIRING = (int (__stdcall*)(void))DetourFunction((PBYTE)<adress?>, (PBYTE)HookWEAPON_FIRING); break; case DLL_PROCESS_DETACH: break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: DetourRemove((PBYTE)<adress?>, (PBYTE)WEAPON_FIRING); //Remove hook break; } /* Returns TRUE on success, FALSE on failure */ return TRUE; }
Can anyone point me in the right direction of what address(es) I'm supposed to hook and get this to work?Code:#ifndef _DLL_H_ #define _DLL_H_ #if BUILDING_DLL # define DLLIMPORT __declspec (dllexport) #else /* Not BUILDING_DLL */ # define DLLIMPORT __declspec (dllimport) #endif /* Not BUILDING_DLL */ int (__stdcall* WEAPON_FIRING)(void); void HookWEAPON_FIRING(void) { MessageBox(0, "You just fired a round.", "Function Called", MB_OK); return; } #endif /* _DLL_H_ */


LinkBack URL
About LinkBacks
Reply With Quote



Bookmarks