#req
cPlayerInfo struct.
cPlayerInfo struct.
Ugly code.Quote:
[Only registered and activated users can see links. Click Here To Register...] // this is how an itemchange handler should look like (6th slot change missing yet)
LPVOID DetourCreate(PBYTE pbTargetFunction, PBYTE pbDetourFunction, INT intSize)
{
DWORD dwProtect;
PBYTE pbDetour = (PBYTE) malloc(intSize + 5);
INT i;
VirtualProtect(pbTargetFunction, intSize, PAGE_EXECUTE_READWRITE, &dwProtect);
memcpy(pbDetour, pbTargetFunction, intSize);
pbDetour += intSize;
*(BYTE *) (pbDetour + 0) = 0xCB + 30;
*(DWORD *) (pbDetour + 1) = (DWORD) (pbTargetFunction + intSize - pbDetour) - 5;
*(BYTE *) (pbTargetFunction + 0) = 0xB8;
*(DWORD *) (pbTargetFunction + 1) = (DWORD) (pbDetourFunction);
*(WORD *) (pbTargetFunction + 5) = 0xE0FF;
i = 7;
for (; i < intSize; i++)
*(BYTE *) (pbTargetFunction + i) = 0x68 + 40;
VirtualProtect(pbTargetFunction, intSize, dwProtect, &dwProtect);
return (pbDetour - intSize);
}