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 


__fastcall call conv C Code

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Frouk
Grandmaster Cheater
Reputation: 5

Joined: 22 Jun 2021
Posts: 507

PostPosted: Tue Jul 08, 2025 4:57 am    Post subject: __fastcall call conv C Code Reply with quote

So I guess it isn't supported yet, I've tried to call a function with __fastcall calling convention and after compilation I was searching for the call in the compiled code - nothing
Back to top
View user's profile Send private message
Eggs_
How do I cheat?
Reputation: 0

Joined: 19 Jun 2025
Posts: 7

PostPosted: Thu Jul 10, 2025 2:20 am    Post subject: Re: __fastcall call conv C Code Reply with quote

Frouk wrote:
So I guess it isn't supported yet, I've tried to call a function with __fastcall calling convention and after compilation I was searching for the call in the compiled code - nothing

Unless you are on 32 bit version of windows the fastcall and stdcall should have the same params.
i don't quiet get what you are doing, did you compile something yourself using a third party compiler and are using CE to check on the code in runtime? (there's way better methods)
Back to top
View user's profile Send private message
Frouk
Grandmaster Cheater
Reputation: 5

Joined: 22 Jun 2021
Posts: 507

PostPosted: Thu Jul 10, 2025 2:21 am    Post subject: Reply with quote

64 bit always has __fastcall convention instead of __thiscall
Back to top
View user's profile Send private message
Eggs_
How do I cheat?
Reputation: 0

Joined: 19 Jun 2025
Posts: 7

PostPosted: Thu Jul 10, 2025 2:36 am    Post subject: Reply with quote

Frouk wrote:
64 bit always has __fastcall convention instead of __thiscall

if you are using for instance IDA64, it will always decompile functions to __fastcall by default (which is not the case)

but the calling conversion doesn't matter for 64x windows anymore it's all the same your c++ code you can use __fastcall or __cdecl or __stdcall, as long as the app runs in windows 64 it will use the microsoft x64 abi (learn.microsoft com/en-us/cpp/build/x64-calling-convention?view=msvc-170). With Simd calls being the only exception.
So in Cheat engine, the way to check for "thiscall" is to check wether RCX is related to the functions usually if it's a nonstatic class method ull see something like
mov rbx, rcx //backing up rcx
,,stuff..
cmp [rbx+10],1 //do stuff with rcx+offset
...
mov rax,[rbx+28] //do stuff with rcx+offset
test rax,rax

if you see alot of RCX+OFFSET operations you can be 90% sure that this is a "thiscall"

you can also check the RCX address (if its a valid address) if the first pointer [rcx+0x0] leads to a vtable than it's 99% a thiscall.

or if you are using IDA or any other static deassemblers you can just crossreference the function address to check if it's in any Vtable, than you can be 100% sure that it's a thiscall
Back to top
View user's profile Send private message
Frouk
Grandmaster Cheater
Reputation: 5

Joined: 22 Jun 2021
Posts: 507

PostPosted: Sun Jul 13, 2025 5:24 am    Post subject: Reply with quote

ofc it's __thiscall, I'm actually trying to call the function from vftable

I'm saying that you can't actually call it in {$ccode}, I've managed to get the virtual table index for a function and am trying to call it as __fastcall(usually it shouldn't care, the rdx register is already being used here)
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sun Jul 13, 2025 6:00 am    Post subject: Reply with quote

in 64 bit parameter 1 is passed in rcx, the rdx, r8, r9 and the rest in stack

so if the class method is : myclass:mymethod(int x, int y) then to call it with ccode you'd do
int myclass_mymethod(void *myclassinstance, int x, int y)

that way myclassinstance will be in rcx

_________________
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


Last edited by Dark Byte on Sun Jul 13, 2025 6:02 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
Frouk
Grandmaster Cheater
Reputation: 5

Joined: 22 Jun 2021
Posts: 507

PostPosted: Sun Jul 13, 2025 6:02 am    Post subject: Reply with quote

can you give an example of calling it like this?:
Code:

((rettype(callconv)(args))(targetAddress))(args);


EDIT:
okay, nevermind, already figured it out, and it seems it is correct this time(used __stdcall to call it, because it will reserve the parameters into a stack if the rcx, rdx, r8, r9 registers were used)
Back to top
View user's profile Send private message
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