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 use getasynckeystate in a 64 bit platform?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
PlzSuckMaDuck
How do I cheat?
Reputation: 0

Joined: 01 Feb 2019
Posts: 4

PostPosted: Sat Feb 02, 2019 12:16 am    Post subject: How to use getasynckeystate in a 64 bit platform? Reply with quote

I've tried to find tutorials for using getasynckeystate but most of the aritcles are about 32bit platforms which doesn't work on a 64 bit platform. Any help will be appreciated.

Quote:

[ENABLE]
alloc(newmem,2048,"re2.exe"+B8BC63A)
label(returnhere)
label(originalcode)
label(exit)

newmem:

originalcode:
mov [rax+20],ebx //This is the code that i want to fiddle with
mov rsi,[rsp+30]

exit:
jmp returnhere

"re2.exe"+B8BC63A:
jmp newmem
nop
nop
nop
returnhere:

[DISABLE]
dealloc(newmem)
"re2.exe"+B8BC63A:
mov [rax+20],ebx
mov rsi,[rsp+30]
//Alt: db 89 58 20 48 8B 74 24 30


I want to disable this code mov [rax+20],ebx when the assigned key (right mouse key for me) is pressed & the code gets reverted when the button is released.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 373

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

PostPosted: Sat Feb 02, 2019 4:16 am    Post subject: Reply with quote

something like this
Code:

[ENABLE]
alloc(newmem,2048,"re2.exe"+B8BC63A)
label(returnhere)
label(originalcode)
label(exit)

newmem:

push RAX
push RCX
push RDX
push R8
push R9
push R10
push R11
sub rsp,28 //7 pushes before, so uneven.  Instead of sub rsp,20 use sub rsp,28
mov rcx,2
call GetAsyncKeyState
add rsp,28
pop r11
pop r10
pop r9
pop r8
pop rdx
pop rcx

test ax,8001
pop rax

jnz originalcode

mov [rax+20],ebx //This is the code that i want to fiddle with

originalcode:
mov rsi,[rsp+30]

exit:
jmp returnhere

"re2.exe"+B8BC63A:
jmp newmem
nop
nop
nop
returnhere:

[DISABLE]
dealloc(newmem)
"re2.exe"+B8BC63A:
mov [rax+20],ebx
mov rsi,[rsp+30]
//Alt: db 89 58 20 48 8B 74 24 30

_________________
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
PlzSuckMaDuck
How do I cheat?
Reputation: 0

Joined: 01 Feb 2019
Posts: 4

PostPosted: Sun Feb 03, 2019 12:47 am    Post subject: Reply with quote

Dark Byte wrote:
something like this
Code:

[ENABLE]
alloc(newmem,2048,"re2.exe"+B8BC63A)
label(returnhere)
label(originalcode)
label(exit)

newmem:

push RAX
push RCX
push RDX
push R8
push R9
push R10
push R11
sub rsp,28 //7 pushes before, so uneven.  Instead of sub rsp,20 use sub rsp,28
mov rcx,2
call GetAsyncKeyState
add rsp,28
pop r11
pop r10
pop r9
pop r8
pop rdx
pop rcx

test ax,8001
pop rax

jnz originalcode

mov [rax+20],ebx //This is the code that i want to fiddle with

originalcode:
mov rsi,[rsp+30]

exit:
jmp returnhere

"re2.exe"+B8BC63A:
jmp newmem
nop
nop
nop
returnhere:

[DISABLE]
dealloc(newmem)
"re2.exe"+B8BC63A:
mov [rax+20],ebx
mov rsi,[rsp+30]
//Alt: db 89 58 20 48 8B 74 24 30


Thank you. The code is working properly now. Btw is there any place where a newb can learn about this stuff?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 373

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

PostPosted: Sun Feb 03, 2019 1:37 am    Post subject: Reply with quote

Not really noob-friendly but https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=vs-2017
_________________
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
PlzSuckMaDuck
How do I cheat?
Reputation: 0

Joined: 01 Feb 2019
Posts: 4

PostPosted: Sun Feb 03, 2019 4:57 am    Post subject: Reply with quote

btw how can i switch the trigger from right mouse button to left mouse button?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 373

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

PostPosted: Sun Feb 03, 2019 5:21 am    Post subject: Reply with quote

yes, change the parameter passed to the function to that of the left mouse button (rcx to 1 instead if 2)
_________________
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