-
Member
|1.12.1] - GetObjectPtr error The value of ESP was not properly saved
I have another question regarding the function GetObjectPtr, when I use this in c# it works fine:
Code:
const int GET_OBJECT_PTR_FUN_PTR = 0x00464870;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
delegate IntPtr GetObjectPtrDelegate(ulong guid);
static readonly GetObjectPtrDelegate GetObjectPtrFunction =
Marshal.GetDelegateForFunctionPointer<GetObjectPtrDelegate>((IntPtr)GET_OBJECT_PTR_FUN_PTR);
internal static IntPtr GetObjectPtr(ulong guid) {
return GetObjectPtrFunction(guid);
}
But when I use this in C++ it returns the error: "The value of ESP was not properly saved across a function call"
Code:
intptr_t Functions::GetObjectPtr(unsigned long guid) {
typedef intptr_t __stdcall func(unsigned long);
func* function = (func*)GET_OBJECT_PTR_FUN_PTR;
intptr_t ptr = function(guid);
return ptr;
}
I tried using different conventions for GetObjectPtr like __fastcall or __cdecl but nothing is working !
EDIT:
Found my error, you can delete this post, I'm sorry for spam !
It was:
Code:
typedef intptr_t __stdcall func(unsigned long);
to
Code:
typedef intptr_t __stdcall func(unsigned long long);
Last edited by Lywbringer; 09-17-2022 at 05:33 AM.
-
Post Thanks / Like - 1 Thanks
Hazzbazzy (1 members gave Thanks to Lywbringer for this useful post)