Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Access violation mid function hook

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Hush1
How do I cheat?
Reputation: 0

Joined: 01 Sep 2016
Posts: 2

PostPosted: Sun Nov 06, 2016 5:48 am    Post subject: Access violation mid function hook Reply with quote

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.



ollydbgmid.png
 Description:
 Filesize:  125.73 KB
 Viewed:  3657 Time(s)

ollydbgmid.png


Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites