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 


codecave - game crashes

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
661089799107
Expert Cheater
Reputation: 3

Joined: 25 Jan 2009
Posts: 186

PostPosted: Sun Jan 23, 2011 2:41 am    Post subject: codecave - game crashes Reply with quote

The game is crashing immediately after changing the opcodes to a jump.

Here are the opcodes that I am trying to change:



After the change:



And the function it jumps to:



Code:

void jump() {
   __asm {
      mov [edi], ecx
      and ecx, 0xF8
   }
}


For some reason the opcodes are different, as you can see above. (83 E1 F8 and 81 E1 F800000)

And here is the function that I'm using to change to a jump: (Both functions 'change' & 'jump' are in a dll, which is injected into the game)

Code:

// change((BYTE*) 0x1038B626, (BYTE*) jump);

void change(BYTE *src, const BYTE *dst) {
   BYTE* jmp = (BYTE*) malloc(5);
   
   DWORD previous;

   VirtualProtect(src, 5, PAGE_READWRITE, &previous);
   
   memcpy(jmp, src, 5);
   jmp += 5;
 
   jmp[0] = 0xE9; // E9 = jump
   *(DWORD*)(jmp+1) = (DWORD)(src+5 - jmp) - 5;
   
   src[0] = 0xE9; // E9 = jump
   *(DWORD*)(src+1) = (DWORD)(dst - src) - 5;
   
   VirtualProtect(src, 5, previous, &previous);
}
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25806
Location: The netherlands

PostPosted: Sun Jan 23, 2011 7:14 am    Post subject: Reply with quote

the jump back is generated properly ? And you're not on a system that supports the no execute protection ?


anyhow, try mov ecx,0xfffffff8 instead of f8

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
661089799107
Expert Cheater
Reputation: 3

Joined: 25 Jan 2009
Posts: 186

PostPosted: Sun Jan 23, 2011 2:41 pm    Post subject: Reply with quote

Dark Byte wrote:
the jump back is generated properly ? And you're not on a system that supports the no execute protection ?


anyhow, try mov ecx,0xfffffff8 instead of f8


Thanks Smile. The problem was I forgot to add a jump back..

Also changing 0xf8 to 0xfffffff8 fixed that problem as well.

Code:

void jump() {
   static DWORD returnAddress = 0x1038B62B;

   __asm {
      mov [edi], ecx
      and ecx, 0xfffffff8
      
      pop ebp
      jmp returnAddress
   }
}
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