Skip to content

Instantly share code, notes, and snippets.

@yuiAs
Created July 9, 2015 05:07
Show Gist options
  • Select an option

  • Save yuiAs/ef5c9dfc5fd1784dc522 to your computer and use it in GitHub Desktop.

Select an option

Save yuiAs/ef5c9dfc5fd1784dc522 to your computer and use it in GitHub Desktop.
ULONG GetZoneProcedure(USHORT Op)
{
ULONG Table = g_Ctx.Addr[VA_ZONETABLE];
__asm
{
mov esi, Table
movsx eax, word ptr [Op]
add eax, 0FFFFFF8Dh
mov edi, [esi+eax*4]
xor eax, eax
mov al, byte ptr [edi+9]
cmp eax, 0E8h
mov eax, 0
jne _DO_NOT_MATCH
mov edx, [edi+0Ah]
lea eax, [edi+edx+0Eh]
_DO_NOT_MATCH:
}
}
void ClCallZoneProcedure(USHORT Op, PVOID Buffer)
{
ULONG Function = GetZoneProcedure(Op);
if (Function == 0) {
return;
}
ULONG PtrThis = g_Ctx.Addr[VA_GAMEBASE];
__try
{
__asm
{
mov eax, PtrThis
mov ecx, [eax+4]
push Buffer
call dword ptr [Function]
}
}
__except (OutputExceptionInfo(GetExceptionInformation()))
{
DbgPrintW(_L("EXCEPTION ClCallZoneProcedure OP=%04X BUFFER=%08X\n"), Op, Buffer);
}
}
void ClSetEffectState(ULONG ObjectID, USHORT StateType, UCHAR Flag)
{
UCHAR Buffer[9];
*reinterpret_cast<USHORT*>(Buffer) = PACKET_ZC_EFFECT_STATE;
*reinterpret_cast<USHORT*>(Buffer+2) = StateType;
*reinterpret_cast<ULONG*>(Buffer+4) = ObjectID;
*reinterpret_cast<UCHAR*>(Buffer+8) = Flag;
ClCallZoneProcedure(PACKET_ZC_EFFECT_STATE, Buffer);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment