 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
jaros1024 How do I cheat?
Reputation: 0
Joined: 28 Aug 2016 Posts: 2
|
Posted: Sun Aug 28, 2016 11:38 am Post subject: Code injection crashes app |
|
|
Hello, I'm trying to inject some code to an application, I've found an address that I want to take over (unfortunately it's not static and finding a pointer is probably impossible - anyway, I can't), and I know what instructions are writing to the address, but every time I do an injection, the app crashes as soon as I switch the window and select the app's one. Even if I don't add any instructions, for example
| Code: | alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
newmem: //this is allocated memory, you have read,write,execute access
//place your code here
originalcode:
mov [edi+ecx*4-10],eax
mov eax,[esi+ecx*4-0C]
exit:
jmp returnhere
"MSVCR80.dll"+150F4:
jmp newmem
nop
nop
nop
returnhere:
|
if I execute that, the app crashes.
Of course I know that the code is copying memory, but I may check with a cmp instruction if it contains any data that interests me and if not, just jump to original code.
So what should I do to deal with the problem? |
|
| Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sun Aug 28, 2016 12:16 pm Post subject: |
|
|
Try moving the injection point up 1 instruction.
It's possible the game's original code is attempting to jump to that second instruction you are overwriting.
When that happens, it starts in the middle of the instruction and executes the wrong bytes.
Also, use the AOB Injection template, instead of Code Injection.
It will find the instruction's new location for you. |
|
| Back to top |
|
 |
STN I post too much
Reputation: 43
Joined: 09 Nov 2005 Posts: 2676
|
Posted: Sun Aug 28, 2016 4:14 pm Post subject: |
|
|
CE can't compile the instructions
mov [edi+ecx*4-10],eax
mov eax,[esi+ecx*4-0C]
So are you sure you are re-creating the bytes properly ? I think that's what happening. Post the instructions around where you are injecting.
If CE compiles them for you, it's possible the bytes aren't proper so make sure the generated code at code-cave is exactly like it should be (check the bytes) _________________
|
|
| Back to top |
|
 |
jaros1024 How do I cheat?
Reputation: 0
Joined: 28 Aug 2016 Posts: 2
|
Posted: Sun Aug 28, 2016 4:54 pm Post subject: |
|
|
| Zanzer wrote: | | Try moving the injection point up 1 instruction. |
That's it, thank you!  |
|
| Back to top |
|
 |
sbryzl Master Cheater
Reputation: 6
Joined: 25 Jul 2016 Posts: 252
|
Posted: Sun Aug 28, 2016 8:04 pm Post subject: |
|
|
code should look more like this in order to run right I would think
| Code: | originalcode:
push ecx
imul ecx,ecx,4
add ecx,edi
mov [ecx-10],eax
sub ecx,edi
add ecx,esi
mov eax,[ecx-0c]
pop ecx |
|
|
| 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
|
|