Today i got troubles with detouring GetGuidByKeyword function for C#
PHP Code:
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int GetGuidByKeywordDelegate(string token, ref int128 guid, int unk, int unk2); // int128 = struct with 2 ulong
public static GetGuidByKeywordDelegate GetGuidByKeywordHandler;
private static Detour GetGuidByKeywordDetour;
GetGuidByKeywordDetour = Memory.Instance.Detours.CreateAndApply(GetGuidByKeywordHandler, new GetGuidByKeywordDelegate((string token, ref int128 guid, int unk1, int unk2) =>
{
int ret = (int)GetGuidByKeywordDetour.CallOriginal(token, guid, unk1, unk2); // object ret = _targetDelegate.DynamicInvoke(args); where params object[] args
return ret;
}), "GetGuidByKeywordDetour");
just hook and call original. It dont crash the game but return guid as null, and all functions using unit return 0.
What i doing wrong?
Want to pass pointer for lua functions