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 


Can't allocate near, so far jump in x64?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
jgoemat
Master Cheater
Reputation: 23

Joined: 25 Sep 2011
Posts: 264

PostPosted: Wed Feb 10, 2021 6:39 pm    Post subject: Can't allocate near, so far jump in x64? Reply with quote

I've been getting some weird crashes occasionally in 7 days to die and tracked it down to it requiring a large jmp instruction. My scripts expect 5 bytes are required, but this is what's generated:

Code:
ItemValue:get_PercentUsesLeft - FF25 00000000 00008AB4C0010000 - jmp 1C0B48A0000


The game is using 8gb so I assume there's just not a place close to that function where it can allocate memory. I haven't seen that before, seems to be a jmp to [rip+0] with the address after the jump?

Just want to make sure I'm not doing anything wrong, and that I should assume the jump instructions take up 14 bytes, and there's not another way around it:

Code:
define(hook,"ItemValue:get_PercentUsesLeft")
define(bytes,55 48 8B EC 48 83 EC 40)

[enable]

assert(hook, bytes)
alloc(newmem,500, hook)

// ... omitted code

hook:
  jmp newmem


It looks like in the memory regions there are plenty of areas in range of a relative jump marked with no 'Allocation Protect', state 'Free', Protect 'No Access', Type '-' and it looks like 'newmem' was allocated in the middle of such a region (has regions like that on either side)
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Wed Feb 10, 2021 9:00 pm    Post subject: Reply with quote

look at the memory regions of ItemValue:get_PercentUsesLeft and check if there is free memory within a 2GB range of that address

but yes, if it's not possible you should expect a 14 byte jmp

you will have to adjust the return jump to not use the label and nops, but the direct relative distance of the hook address to the first instruction that is not overwritten

_________________
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
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