Hush1 How do I cheat?
Reputation: 0
Joined: 01 Sep 2016 Posts: 2
|
Posted: Sun Nov 06, 2016 5:48 am Post subject: Access violation mid function hook |
|
|
Hello everyone, I have a problem:
I'm trying to make a trainer in CoD4 for learning purposes;
I need to store the data 0x005BF454 that contains ammo counter so I can use it later.
| Code: | void Hooks()
{ DWORD ammoAddyB = FindPattern("iw3sp.exe", "\x2B\xD1\x89\x94\xB8\x00\x00\x00\x00", "xxxxx????");
ammoAddyB += 2;
GetPAmmoJmpBack = ammoAddyB + 0xC;
PlaceJMP((BYTE*)ammoAddyB, (DWORD)GetPlayerAmmo, 12);
}
DWORD WINAPI OverwriteValues()
{
Hooks();
for (;; Sleep(150))
{
if (GetAsyncKeyState(VK_F1))
{
AmmoPtr = AmmoRegister;
*(int *)AmmoPtr += 100;
}
}
|
So, I need to store EDX value into AmmoRegister in the debugger it return the right value but when i try to writing with another value i get "access violation reading location".
| Code: |
DWORD GetPAmmoJmpBack = 0;
DWORD AmmoRegister = 0x0;
DWORD AmmoPtr;
__declspec(naked) void GetPlayerAmmo()
{
__asm MOV[EAX + EDI * 0x4 + 0x134], EDX
__asm MOV AmmoRegister, EDX
__asm ADD[EAX + ESI * 0x4 + 0x334], ECX
__asm jmp[GetPAmmoJmpBack]
}
|
What am I doing wrong? Thanks in advance.
| Description: |
|
| Filesize: |
125.73 KB |
| Viewed: |
3657 Time(s) |

|
|
|