CE Tutorial - How to find __fastcall function parameters in 64 bit process and call it
in this video, we call the Give Weapon function in GTA 3 to give ourselves any weapon.
how do i know i'm looking at a __fastcall? since this is a 64-bit application, it natively uses the x64 calling convention, which is based on __fastcall. it's a 64-bit process, 99% of them are gonna be __fastcalls. i was calling it the standalone give weapon function, but LibertyCity.exe+10D5B00 can also be known as the give weapon 'helper function'.
GTA 3 weapon modding resource: https://wiki.gtaconnected.com/Resources/GTA3/Weapons
script for Give Weapon:
Code: Select all
[ENABLE]
alloc(GiveWeapon, 2048)
CreateThread(GiveWeapon)
registersymbol(GiveWeapon)
GiveWeapon:
sub rsp, 28 // allocate 40 bytes shadow space
mov rcx,["LibertyCity.exe"+4D9FC88] // player base/localplayer pointer
mov rdx, #6 // weapon ID
mov r8, #250 // ammo
call LibertyCity.exe+10D5B00
// clean up stack frame and exit thread
add rsp, 28
ret
[DISABLE]
unregistersymbol(GiveWeapon)
dealloc(GiveWeapon)