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 


Need help understanding an error in a script

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Kajih
Cheater
Reputation: 1

Joined: 08 Feb 2021
Posts: 32

PostPosted: Mon Oct 31, 2022 8:08 am    Post subject: Need help understanding an error in a script Reply with quote

I found a bit of code from another table and I am trying to understand how to read the part where its getting the address, however I ran into a problem where i am getting this error when attempting to add it to my table:

Quote:

Error in line 7 ( 00000000+(DWORD)[00000000+03]+03+04:):This address specifier is not valid


From what I gather the table seems to work fine for others, See code below:

Code:

[ENABLE]
aobscanmodule(aobResourceHook,ExpeditionsRome-Win64-Shipping.exe,48 8D 0D 4D 4F ED 02)

label(pResources)
registersymbol(pResources)

aobResourceHook+(DWORD)[aobResourceHook+03]+03+04:
  pResources:

[DISABLE]
unregistersymbol(*)


I have two questions:
1 - why am I getting this error
2- can someone explain to me the line aobResourceHook+(DWORD)[aobResourceHook+03]+03+04. are all the '+' signs offsets?

Any help would be appreciated. Thanks!
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4702

PostPosted: Mon Oct 31, 2022 11:05 am    Post subject: Reply with quote

This is probably a bug in CE.

CE may give an error when it tries to save the script to the address list, but when the script is enabled, it runs perfectly fine. Assign an empty script with only [ENABLE] / [DISABLE] tags to the address list first, then edit that. CE will still complain, but it will at least let you save it to the address list anyway.


To explain: that `lea` instruction is using an RIP-relative addressing mode. The signed 4-byte integer 0x02ED4F4D (aob `4D 4F ED 02`) is added to RIP (address of next instruction) to calculate the final address.

The symbol `aobResourceHook` is the address of the `lea` instruction. The address of the next instruction would be `aobResourceHook+7`. To add the 4-byte integer, you need to read the dword (4 bytes) at `aobResourceHook+3`: that's what the (DWORD) and square brackets are for.

It's weird the author used `+03+04` instead of simply `+7`.
I also wouldn't include the relative displacement in the aob signature (i.e. I'd use `48 8D 0D ?? ?? ?? ?? ...`, plus extra bytes to ensure it's unique)- that is less likely to break on a game update.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Kajih
Cheater
Reputation: 1

Joined: 08 Feb 2021
Posts: 32

PostPosted: Mon Oct 31, 2022 12:05 pm    Post subject: Reply with quote

ohhh ok, gotcha. Perfect explanation, I was a little confused because of the '+03+04' and will test with '+07' to see if I get the same address.

Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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