This isn't the same function but I think my problem may be similiar to yours. I am trying to call the settarget function and I am nearly certain my issue is TLS related I am just unsure how to fix it.
Code:
__asm {PUSHAD}
__asm {PUSHFD}
void * AsContext;
*(DWORD*)AsContext = 0x01733970;
typedef void (__thiscall *SetTarget)(void*,DWORD);
void *vtable=(void*)(*(void **)AsContext);
void *addr=((void**)vtable)[0x58];
((SetTarget)addr)(AsContext, 0);
__asm {POPAD}
__asm {POPFD}
I get a crash when i try to call like this and the function I am hooking to do the call from is located by this pattern:
Code:
byte GameHookPattern[] = { 0xD9, 0x5F, 0x78, 0xD9, 0x46, 0x04 };
I can call the sendpacket function fine from this hook but no success with the set target or castspell functions. I would be quite happy if someone could help me out with my TLS issues.