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 


How to store a pointer into a symbol in an x64 application

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
diamondwolf.c
Newbie cheater
Reputation: 1

Joined: 11 Sep 2010
Posts: 12

PostPosted: Wed Feb 17, 2016 10:56 am    Post subject: How to store a pointer into a symbol in an x64 application Reply with quote

Hello folks,
i have a problem storing an 64bit register into an registered symbol to use it as a pointer.

e.g.
Code:

[ENABLE]

aobscanmodule(INJECT,Tutorial-x86_64.exe,29 93 90 07 00 00)
alloc(newmem,$1000,"Tutorial-x86_64.exe"+2A8B7)

label(code)
label(return)

registersymbol(POINTER)
label(POINTER)

newmem:
POINTER:
dd 0
//dq 0

code:
  mov [rbx+00000790],rax
  mov [POINTER],rbx
  jmp return

INJECT:
  jmp code
  nop
return:
registersymbol(INJECT)

[DISABLE]

INJECT:
  mov [rbx+00000790],rax

unregistersymbol(INJECT)
unregistersymbol(POINTER)
dealloc(newmem)


I can execute this script but when i wanna use my POINTER in a cheat table as a pointer it points to somewhere but the correct address (using the correct offset, here +790). Like an address with 16chars (64bit address?)
I also tried qword instead of dword. getAddress(), getPointer() and so on

The same procedure works flawless in an 32bit application but not with 64bit.

Do I somehow have to convert the address or what?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4724

PostPosted: Wed Feb 17, 2016 11:04 am    Post subject: Reply with quote

In 64-bit applications, memory locations take up 8 bytes of space. So use dq 0 to reserve that space.

If that doesn't work, then either that section of ASM isn't being run, or you're not adding the pointer correctly.

_________________
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
diamondwolf.c
Newbie cheater
Reputation: 1

Joined: 11 Sep 2010
Posts: 12

PostPosted: Wed Feb 17, 2016 11:13 am    Post subject: Reply with quote

When i use dq 0 the pointer points to 00000000, using dd 0 I end up somwhere like 7909329000000790"
I'm adding a pointer the normal way through "Add Address Manually" using my symbol as the base address and adding the offset.
Like i said it works with a 32bit application just fine
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Wed Feb 17, 2016 11:24 am    Post subject: Reply with quote

when you use dd the other 4 bytes are part of the code of the code: section

just use dq and make sure your code is executed once

_________________
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
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Wed Feb 17, 2016 11:25 am    Post subject: Reply with quote

Code:
[ENABLE]

aobscanmodule(INJECT,Tutorial-x86_64.exe,29 93 90 07 00 00)
alloc(newmem,$1000,INJECT)
label(code)
label(return)
label(POINTER)

newmem:

code:
mov [rbx+00000790],rax
mov [POINTER],rbx
jmp return

POINTER:
dq 00

INJECT:
jmp newmem
nop

return:
registersymbol(INJECT)
registersymbol(POINTER)

[DISABLE]

INJECT:
mov [rbx+00000790],rax

unregistersymbol(INJECT)
unregistersymbol(POINTER)
dealloc(newmem)

Works fine for me ...
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4724

PostPosted: Wed Feb 17, 2016 11:29 am    Post subject: Reply with quote

Pretty much the same exact script is working for me on step 2 of the CE tutorial (x64). The reason why it's showing you a ridiculous pointer path when using dd is because it's trying to read 8 bytes long and you only allocated 4 bytes. Hence, it's reading the ASM after that and interpreting that as a part of the pointer. Also, it will absolutely point to 0 until that section of ASM is run. So, do something that makes the application run that code, and you'll have your pointer.

Are you sure you're using CE 6.5? IIRC there was a bug in CE 6.4 where readPointer sometimes didn't work correctly in 64 bit targets.

_________________
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
diamondwolf.c
Newbie cheater
Reputation: 1

Joined: 11 Sep 2010
Posts: 12

PostPosted: Wed Feb 17, 2016 1:04 pm    Post subject: Reply with quote

Shame on me... yeah the problem was, the code didn't get executed. I somehow thought just activating the script would be enough. And because I first used dd I didn't recognize at first that it was pointing to 0.
So i guess I have to run a small script to get the code executed as soon as I activate the script.
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