View previous topic :: View next topic |
Author |
Message |
yazigegeda Expert Cheater Reputation: 0
Joined: 22 Jan 2019 Posts: 159
|
Posted: Wed Apr 03, 2019 3:08 am Post subject: How to use executeCodeEx? |
|
|
I want to use executeCodeEx to call setwindowstext, how to write code?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Wed Apr 03, 2019 3:59 am Post subject: |
|
|
example on the tutorial first window:
Code: |
if hwnd==nil then hwnd=findWindow(nil,"Cheat Engine Tutorial v3.4") end
executeCodeEx(0, nil,'setwindowtexta',{0,hwnd},{3,"Some text"})
|
it uses the stdcall calling convention, waits until return or target crash, and calls setwindowtexta
it provides 2 parameters: a window handle, and a text
the window handle is an integer, so type 0
the text is a pointer to a string, so type 3 (CE allocates and injects the string into the target and then passes that address as parameters, afterwards CE will clean it up)
Note that there is currently an issue with functions with more than 4 parameters, but is fixed in the next version
_________________
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 |
|
|
yazigegeda Expert Cheater Reputation: 0
Joined: 22 Jan 2019 Posts: 159
|
Posted: Wed Apr 03, 2019 5:00 pm Post subject: help |
|
|
For example, mouse_event can't be used? These 5 parameters? He said up to 4 parameters?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Wed Apr 03, 2019 11:01 pm Post subject: |
|
|
correct, but then again, most of the common functions already have a celua implementation (like mouse_event)
_________________
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 |
|
|
Oxijen Expert Cheater Reputation: 0
Joined: 07 May 2020 Posts: 163 Location: On The Moon
|
Posted: Fri Jan 15, 2021 8:47 am Post subject: |
|
|
I used your code
Code: |
if hwnd==nil then hwnd=findWindow(nil,"Cheat Engine 7.2") end
executeCodeEx(0, nil,'setwindowtexta',{0,hwnd},{3,"Some text"}) |
but i got an error "Error:Failure allocating memory near 00010000".
am i doing something wrong?
_________________
I can see you Hitler
Especially When I am On the Moon!!
You are Right now in cheat engine forum |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Fri Jan 15, 2021 4:00 pm Post subject: |
|
|
Try a different process not CE
_________________
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 |
|
|
wulfcare Advanced Cheater Reputation: 0
Joined: 27 Feb 2023 Posts: 59
|
Posted: Thu Mar 02, 2023 1:32 pm Post subject: |
|
|
What if we need to use __fastcall calling convention? It seems that executeCodeEx can only use stdcall or cdecl calling conventions.
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Thu Mar 02, 2023 3:16 pm Post subject: |
|
|
for custom types of calling conventions you'll have to write a wrapper using auto assembler or C that converts the provided parameters to the required calling mechanism
e.g: call for a 2 param __fastcall call it like a 2 param stdcall
Code: |
alloc(caller2param,,256)
caller2param:
mov ecx,[esp+4]
mov edx,[esp+8]
call hardcodedfunctionaddress
ret 8
|
And are you sure it's fastcall and not just a method call ? (both use ecx for instance)
_________________
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 |
|
|
wulfcare Advanced Cheater Reputation: 0
Joined: 27 Feb 2023 Posts: 59
|
Posted: Thu Mar 02, 2023 3:22 pm Post subject: |
|
|
IDA disassembler determined it to be a fastcall function, it uses the registers ECX, EDX, R8, R9.
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Thu Mar 02, 2023 3:56 pm Post subject: |
|
|
r8 and r9? So it's 64-bit?
In that case it's normal 64-bit calling abi. You can pick whatever calling convention, it won't affect the result
_________________
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 |
|
|
wulfcare Advanced Cheater Reputation: 0
Joined: 27 Feb 2023 Posts: 59
|
Posted: Fri Mar 03, 2023 12:28 am Post subject: |
|
|
Thank you so much Dark Byte, this is saving me so much time now that I can call functions for testing within cheat engine. <3
|
|
Back to top |
|
|
|