 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Xblade Of Heaven Master Cheater
Reputation: 0
Joined: 16 Oct 2005 Posts: 395 Location: DEAD
|
Posted: Fri Sep 16, 2016 1:20 pm Post subject: Comparing Unicode String error |
|
|
Hi guys, i have a small problem and i havent idea why.
I try cmp a UnicodeString:
This code crash the game... no idea why.
| Code: | push eax
mov eax,dword ptr[ecx]
or eax,eax
jz code
cmp word ptr[eax+4d8],'A'//"AShockPlayer" Unicode String
jne code
cmp word ptr[eax+4da],'S'
jne code
cmp word ptr[eax+4dc],'h'
jne code
cmp word ptr[eax+4de],'o'
jne code
cmp word ptr[eax+4e0],'c'
jne code
cmp word ptr[eax+4e2],'k'
jne code
cmp word ptr[eax+4e4],'P'
jne code
cmp word ptr[eax+4e6],'l'
jne code
cmp word ptr[eax+4e8],'a'
jne code
cmp word ptr[eax+4ea],'y'
jne code
cmp word ptr[eax+4ec],'e'
jne code
cmp word ptr[eax+4ee],'r'
jne code
MY CODE HERE
code:
pop eax |
and this another code no crash the game... the unicode string is correct, somebody can help me for see why game crash using the entire unicodestring comparation?
| Code: | push eax
mov eax,dword ptr[ecx]
or eax,eax
jz code
cmp word ptr[eax+4d8],'A'//"AShock" Unicode String
jne code
cmp word ptr[eax+4da],'S'
jne code
cmp word ptr[eax+4dc],'h'
jne code
cmp word ptr[eax+4de],'o'
jne code
cmp word ptr[eax+4e0],'c'
jne code
cmp word ptr[eax+4e2],'k'
jne code
MY CODE HERE
code:
pop eax |
regards!
_________________
Welcome to the Hell.
 |
|
| Back to top |
|
 |
STN I post too much
Reputation: 43
Joined: 09 Nov 2005 Posts: 2676
|
Posted: Fri Sep 16, 2016 5:41 pm Post subject: |
|
|
Maybe the pointer is invalid for the rest of the offsets (doesn't always contain the string). That'd be my guess
You probably don't need to compare the full string by the way depending on if it's a unique occurrence.
_________________
|
|
| Back to top |
|
 |
sbryzl Master Cheater
Reputation: 6
Joined: 25 Jul 2016 Posts: 252
|
Posted: Fri Sep 16, 2016 6:23 pm Post subject: |
|
|
Try using byt ptr instead and jumping backward. I don't know how your script is set up but I trivially used a return and textreader label incase your code label can't be moved.
| Code: |
return:
jmp code
textreader:
push eax
mov eax,dword ptr[ecx]
or eax,eax
jz return
cmp byte ptr[eax+4d8],'A'//"AShockPlayer" Unicode String
jne return
cmp byte ptr[eax+4da],'S'
jne return
cmp byte ptr[eax+4dc],'h'
jne return
cmp byte ptr[eax+4de],'o'
jne return
cmp byte ptr[eax+4e0],'c'
jne return
cmp byte ptr[eax+4e2],'k'
jne return
cmp byte ptr[eax+4e4],'P'
jne return
cmp byte ptr[eax+4e6],'l'
jne return
cmp byte ptr[eax+4e8],'a'
jne return
cmp byte ptr[eax+4ea],'y'
jne return
cmp byte ptr[eax+4ec],'e'
jne return
cmp byte ptr[eax+4ee],'r'
jne return
MY CODE HERE
code:
pop eax |
|
|
| Back to top |
|
 |
kuntz Cheater
Reputation: 0
Joined: 29 Aug 2016 Posts: 44 Location: Canada
|
Posted: Fri Sep 16, 2016 6:39 pm Post subject: |
|
|
It's important for us to know what line of code is causing the crash. Nothing in the code you posted is invalid, so it's impossible to say what the problem is.
You can try replacing the push/pop eax with pushad/popad but I doubt that is the issue.
|
|
| 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
|
|