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 


Alloc for variables

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Diambro
Newbie cheater
Reputation: 0

Joined: 12 Sep 2023
Posts: 23
Location: Austria

PostPosted: Sun Sep 29, 2024 10:58 am    Post subject: Alloc for variables Reply with quote

Hey Community!

Im fond of adding my variables in the already allocated memory. However when im doing Pointers, they sometimes overwrite stuff since they do add/sub ect. commands.

Code:

alloc(code,$1000)
....
somevar:
dd 0             //say for a check - switches 0 and 1
somepointer:
dd 0            //gets some address
somepointer2:
dd 0            //sometimes gets overwritten by above one


Is there a way to bypass that, or should i just alloc new memory for the Pointers?

Thanks in advance!
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4695

PostPosted: Sun Sep 29, 2024 11:25 am    Post subject: Reply with quote

Pointers are 8 bytes in 64-bit processes. Use `dq 0` instead

Also if those are allocs and not labels, allocate 8 bytes instead of 4

_________________
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
Diambro
Newbie cheater
Reputation: 0

Joined: 12 Sep 2023
Posts: 23
Location: Austria

PostPosted: Mon Sep 30, 2024 3:43 am    Post subject: Reply with quote

Thanks for the reply!

ParkourPenguin wrote:
Pointers are 8 bytes in 64-bit processes. Use `dq 0` instead...


Overwrite probably was the wrong description, cause i use dq when necessary, but maybe i didnt see it or had a brainlag, ill remember that in the future!

ParkourPenguin wrote:
...Also if those are allocs and not labels, allocate 8 bytes instead of 4


Thats the thing, i never alloc anything extra for these pointers. I let them use the memory under the normal code. So i shouldnt do that?

Thanks!
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4695

PostPosted: Mon Sep 30, 2024 10:16 am    Post subject: Reply with quote

Using labels is fine, but you have to use `dq` so CE places the labels at the correct addresses
Code:
alloc(newmem,1024)
label(foo)
label(bar)

newmem:  // 07C00000

foo:     // 07C00000
  dd 0   // 4 bytes

bar:     // 07C00004
  dd 0
Storing an 8-byte value at `foo` will overwrite the value in `bar`. Use `dq 0` instead and the label `bar` would've been assigned the address 8 bytes after `foo`.
_________________
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
Diambro
Newbie cheater
Reputation: 0

Joined: 12 Sep 2023
Posts: 23
Location: Austria

PostPosted: Mon Sep 30, 2024 11:38 am    Post subject: Reply with quote

Thanks for the easy to understand explanation, gonna remember that.
Thanks again ParkourPenguin!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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