 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
661089799107 Expert Cheater
Reputation: 3
Joined: 25 Jan 2009 Posts: 186
|
Posted: Sun Jan 23, 2011 2:41 am Post subject: codecave - game crashes |
|
|
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 |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25806 Location: The netherlands
|
Posted: Sun Jan 23, 2011 7:14 am Post subject: |
|
|
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 |
|
 |
661089799107 Expert Cheater
Reputation: 3
Joined: 25 Jan 2009 Posts: 186
|
Posted: Sun Jan 23, 2011 2:41 pm Post subject: |
|
|
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 . 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 |
|
 |
|
|
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
|
|