From fb6e4d255ff27a86aa87327de573371c83ecc5e4 Mon Sep 17 00:00:00 2001 From: Ren Date: Sun, 8 Oct 2023 04:35:01 +0700 Subject: [PATCH] RawHook update. --- Detours.cpp | 1733 ++++++++++++++++++--------------------------------- Detours.h | 265 ++++---- asm.asm | 31 +- asm64.asm | 31 +- main.cpp | 45 +- 5 files changed, 776 insertions(+), 1329 deletions(-) diff --git a/Detours.cpp b/Detours.cpp index 84fc154..e8daff0 100644 --- a/Detours.cpp +++ b/Detours.cpp @@ -153,6 +153,7 @@ namespace Detours { // ---------------------------------------------------------------- const volatile KUSER_SHARED_DATA& KUserSharedData = *reinterpret_cast(0x7FFE0000); + //const volatile UNKNOWN& KUserSharedDataUnknown = *reinterpret_cast(0x7FFEA000); // ---------------------------------------------------------------- // PEB @@ -82379,7 +82380,7 @@ namespace Detours { return true; } - bool RawHook::Hook(const fnRawHookCallBack pCallBack) { + bool RawHook::Hook(const fnRawHookCallBack pCallBack, bool bNative) { if (!g_ThreadSuspender.SuspendThreads()) { return false; } @@ -82411,20 +82412,19 @@ namespace Detours { int cpuinfo[4]; __cpuid(cpuinfo, 1); - const bool bHaveMMX = (cpuinfo[3] & (1 << 23)) != 0; - const bool bHaveSSE = (cpuinfo[3] & (1 << 25)) != 0; - const bool bHaveFPU = (cpuinfo[3] & 1) != 0; - const bool bHaveAVX = (cpuinfo[2] & (1 << 28)) != 0; + const bool bHaveSSE = ((cpuinfo[3] & (1 << 25)) != 0) && !bNative; + const bool bHaveFPU = ((cpuinfo[3] & 1) != 0) && !bNative; + const bool bHaveAVX = ((cpuinfo[2] & (1 << 28)) != 0) && !bNative; __cpuidex(cpuinfo, 7, 0); - const bool bHaveAVX512 = (cpuinfo[1] & (1 << 16)) != 0; + const bool bHaveAVX512 = ((cpuinfo[1] & (1 << 16)) != 0) && !bNative; - const unsigned int unContextSize = __align_up(sizeof(RAW_HOOK_CONTEXT) + sizeof(void*), alignof(RAW_HOOK_CONTEXT)); + const unsigned int unContextSize = __align_up((bNative ? sizeof(RAW_NATIVE_CONTEXT) : sizeof(RAW_CONTEXT)) + sizeof(void*), (bNative ? alignof(RAW_NATIVE_CONTEXT) : alignof(RAW_CONTEXT))); #ifdef _M_X64 if (bHaveAVX512) { - static const unsigned char pWrapperCode[] = { 0x48, 0x81, 0xEC, 0xFF, 0xFF, 0xFF, 0x7F, 0x9C, 0x8F, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x81, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0xBC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x4C, 0x89, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x4C, 0x89, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x4C, 0x89, 0x94, 0x24, 0xFF, 0xFF, 0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0x00, 0x00, 0x58, 0x59, 0x48, 0x81, 0xC4, 0xFF, 0xFF, 0xFF, 0x7F }; memcpy(m_pWrapper, pWrapperCode, sizeof(pWrapperCode)); // Stack Allocation @@ -82433,186 +82433,151 @@ namespace Detours { // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unRFLAGS); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unCS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x16 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x24 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2B + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unFS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x32 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8 + 0x3) = offsetof(RAW_CONTEXT, m_unRFLAGS); // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x39 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRAX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x41 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRCX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x49 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x51 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBX); - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x59 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x61 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x69) = unContextSize; - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x75 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x85 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x95 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x9D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xB5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xBD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR15); - - // MMX - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xC5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xCD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xDD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xED + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xFD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF + 0x4) = offsetof(RAW_CONTEXT, m_unRAX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17 + 0x4) = offsetof(RAW_CONTEXT, m_unRCX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F + 0x4) = offsetof(RAW_CONTEXT, m_unRDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x27 + 0x4) = offsetof(RAW_CONTEXT, m_unRBX); + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2F + 0x4) = offsetof(RAW_CONTEXT, m_unRSP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x37 + 0x4) = offsetof(RAW_CONTEXT, m_unRSP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3F) = unContextSize; + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x43 + 0x4) = offsetof(RAW_CONTEXT, m_unRBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4B + 0x4) = offsetof(RAW_CONTEXT, m_unRSI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x53 + 0x4) = offsetof(RAW_CONTEXT, m_unRDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x5B + 0x4) = offsetof(RAW_CONTEXT, m_unR8); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x63 + 0x4) = offsetof(RAW_CONTEXT, m_unR9); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6B + 0x4) = offsetof(RAW_CONTEXT, m_unR10); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x73 + 0x4) = offsetof(RAW_CONTEXT, m_unR11); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7B + 0x4) = offsetof(RAW_CONTEXT, m_unR12); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x83 + 0x4) = offsetof(RAW_CONTEXT, m_unR13); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8B + 0x4) = offsetof(RAW_CONTEXT, m_unR14); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x93 + 0x4) = offsetof(RAW_CONTEXT, m_unR15); // ZMM - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x105 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x110 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x11B + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x126 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x131 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x13C + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x147 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x152 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15D + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x168 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x173 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17E + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x189 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x194 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x19F + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1AA + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM15); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1B5 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM16); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C0 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM17); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1CB + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM18); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D6 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM19); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1E1 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM20); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1EC + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM21); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F7 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM22); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x202 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM23); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x20D + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM24); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x218 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM25); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x223 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM26); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x22E + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM27); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x239 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM28); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x244 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM29); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x24F + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM30); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x25A + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM31); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x9B + 0x4) = offsetof(RAW_CONTEXT, m_unMXCSR); + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA3 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM0); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAE + 0x7) = offsetof(RAW_CONTEXT, m_ZMM1); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xB9 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM2); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xC4 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM3); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xCF + 0x7) = offsetof(RAW_CONTEXT, m_ZMM4); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xDA + 0x7) = offsetof(RAW_CONTEXT, m_ZMM5); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE5 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM6); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF0 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xFB + 0x7) = offsetof(RAW_CONTEXT, m_ZMM8); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x106 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM9); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x111 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM10); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x11C + 0x7) = offsetof(RAW_CONTEXT, m_ZMM11); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x127 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM12); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x132 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM13); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x13D + 0x7) = offsetof(RAW_CONTEXT, m_ZMM14); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x148 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM15); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x153 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM16); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15E + 0x7) = offsetof(RAW_CONTEXT, m_ZMM17); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x169 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM18); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x174 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM19); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17F + 0x7) = offsetof(RAW_CONTEXT, m_ZMM20); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x18A + 0x7) = offsetof(RAW_CONTEXT, m_ZMM21); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x195 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM22); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1A0 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM23); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1AB + 0x7) = offsetof(RAW_CONTEXT, m_ZMM24); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1B6 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM25); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C1 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM26); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1CC + 0x7) = offsetof(RAW_CONTEXT, m_ZMM27); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D7 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM28); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1E2 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM29); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1ED + 0x7) = offsetof(RAW_CONTEXT, m_ZMM30); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F8 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM31); // FPU - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x265 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_FPU); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x203 + 0x4) = offsetof(RAW_CONTEXT, m_FPU); // CallBack const size_t unAddress = reinterpret_cast(pCallBack); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x274 + 0x4) = unAddress & 0xFFFFFFFF; - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x27C + 0x4) = (unAddress >> 32) & 0xFFFFFFFF; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x212 + 0x4) = unAddress & 0xFFFFFFFF; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x21A + 0x4) = (unAddress >> 32) & 0xFFFFFFFF; // FPU - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x295 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_FPU); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x233 + 0x3) = offsetof(RAW_CONTEXT, m_FPU); // ZMM - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x29C + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM31); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2A7 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM30); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2B2 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM29); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2BD + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM28); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2C8 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM27); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2D3 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM26); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2DE + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM25); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2E9 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM24); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2F4 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM23); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2FF + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM22); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x30A + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM21); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x315 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM20); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x320 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM19); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x32B + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM18); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x336 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM17); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x341 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM16); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x34C + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM15); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x357 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x362 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x36D + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x378 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x383 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x38E + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x399 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3A4 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3AF + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3BA + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3C5 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3D0 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3DB + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3E6 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3F1 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM0); - - // MMX - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3FC + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x404 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x40C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x414 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x41C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x424 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x42C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x434 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x23A + 0x7) = offsetof(RAW_CONTEXT, m_ZMM31); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x245 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM30); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x250 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM29); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x25B + 0x7) = offsetof(RAW_CONTEXT, m_ZMM28); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x266 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM27); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x271 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM26); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x27C + 0x7) = offsetof(RAW_CONTEXT, m_ZMM25); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x287 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM24); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x292 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM23); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x29D + 0x7) = offsetof(RAW_CONTEXT, m_ZMM22); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2A8 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM21); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2B3 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM20); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2BE + 0x7) = offsetof(RAW_CONTEXT, m_ZMM19); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2C9 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM18); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2D4 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM17); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2DF + 0x7) = offsetof(RAW_CONTEXT, m_ZMM16); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2EA + 0x7) = offsetof(RAW_CONTEXT, m_ZMM15); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2F5 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM14); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x300 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM13); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x30B + 0x7) = offsetof(RAW_CONTEXT, m_ZMM12); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x316 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM11); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x321 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM10); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x32C + 0x7) = offsetof(RAW_CONTEXT, m_ZMM9); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x337 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM8); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x342 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x34D + 0x7) = offsetof(RAW_CONTEXT, m_ZMM6); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x358 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM5); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x363 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM4); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x36E + 0x7) = offsetof(RAW_CONTEXT, m_ZMM3); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x379 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM2); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x384 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM1); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x38F + 0x7) = offsetof(RAW_CONTEXT, m_ZMM0); + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x39A + 0x4) = offsetof(RAW_CONTEXT, m_unMXCSR); // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x43C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR15); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x444 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x44C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x454 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x45C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x464 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x46C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x474 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x47C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x484 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x48C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x494 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x49C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4A4 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRCX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4AC + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRAX); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4B4 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4BB + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unFS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4C2 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4C9 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4D0 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3A2 + 0x4) = offsetof(RAW_CONTEXT, m_unR15); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3AA + 0x4) = offsetof(RAW_CONTEXT, m_unR14); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3B2 + 0x4) = offsetof(RAW_CONTEXT, m_unR13); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3BA + 0x4) = offsetof(RAW_CONTEXT, m_unR12); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3C2 + 0x4) = offsetof(RAW_CONTEXT, m_unR11); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3CA + 0x4) = offsetof(RAW_CONTEXT, m_unR10); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3D2 + 0x4) = offsetof(RAW_CONTEXT, m_unR9); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3DA + 0x4) = offsetof(RAW_CONTEXT, m_unR8); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3E2 + 0x4) = offsetof(RAW_CONTEXT, m_unRDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3EA + 0x4) = offsetof(RAW_CONTEXT, m_unRSI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3F2 + 0x4) = offsetof(RAW_CONTEXT, m_unRBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3FA + 0x4) = offsetof(RAW_CONTEXT, m_unRBX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x402 + 0x4) = offsetof(RAW_CONTEXT, m_unRDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x40A + 0x4) = offsetof(RAW_CONTEXT, m_unRCX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x412 + 0x4) = offsetof(RAW_CONTEXT, m_unRAX); // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4D7 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unRFLAGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x41A + 0x3) = offsetof(RAW_CONTEXT, m_unRFLAGS); // Stack Modification - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4DF + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x422 + 0x4) = offsetof(RAW_CONTEXT, m_unRSP); // Stack Deallocation - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4EC + 0x3) = unContextSize; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x42F + 0x3) = unContextSize; } else if (bHaveAVX) { - static const unsigned char pWrapperCode[] = { 0x48, 0x81, 0xEC, 0xFF, 0xFF, 0xFF, 0x7F, 0x9C, 0x8F, 0x84, 0x24, 0xFF, 0xFF, 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, 0x48, 0x8B, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x9D, 0x48, 0x8B, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xC2, 0x00, 0x00, 0x58, 0x59, 0x48, 0x81, 0xC4, 0xFF, 0xFF, 0xFF, 0x7F }; memcpy(m_pWrapper, pWrapperCode, sizeof(pWrapperCode)); // Stack Allocation @@ -82621,154 +82586,119 @@ namespace Detours { // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unRFLAGS); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unCS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x16 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x24 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2B + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unFS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x32 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8 + 0x3) = offsetof(RAW_CONTEXT, m_unRFLAGS); // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x39 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRAX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x41 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRCX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x49 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x51 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBX); - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x59 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x61 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x69) = unContextSize; - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x75 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x85 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x95 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x9D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xB5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xBD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR15); - - // MMX - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xC5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xCD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xDD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xED + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xFD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF + 0x4) = offsetof(RAW_CONTEXT, m_unRAX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17 + 0x4) = offsetof(RAW_CONTEXT, m_unRCX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F + 0x4) = offsetof(RAW_CONTEXT, m_unRDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x27 + 0x4) = offsetof(RAW_CONTEXT, m_unRBX); + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2F + 0x4) = offsetof(RAW_CONTEXT, m_unRSP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x37 + 0x4) = offsetof(RAW_CONTEXT, m_unRSP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3F) = unContextSize; + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x43 + 0x4) = offsetof(RAW_CONTEXT, m_unRBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4B + 0x4) = offsetof(RAW_CONTEXT, m_unRSI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x53 + 0x4) = offsetof(RAW_CONTEXT, m_unRDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x5B + 0x4) = offsetof(RAW_CONTEXT, m_unR8); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x63 + 0x4) = offsetof(RAW_CONTEXT, m_unR9); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6B + 0x4) = offsetof(RAW_CONTEXT, m_unR10); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x73 + 0x4) = offsetof(RAW_CONTEXT, m_unR11); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7B + 0x4) = offsetof(RAW_CONTEXT, m_unR12); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x83 + 0x4) = offsetof(RAW_CONTEXT, m_unR13); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8B + 0x4) = offsetof(RAW_CONTEXT, m_unR14); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x93 + 0x4) = offsetof(RAW_CONTEXT, m_unR15); // YMM - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x105 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x10E + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x117 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x120 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x129 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x132 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x13B + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x144 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x14D + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x156 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15F + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x168 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x171 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17A + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x183 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x18C + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM15); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x9B + 0x4) = offsetof(RAW_CONTEXT, m_unMXCSR); + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA3 + 0x5) = offsetof(RAW_CONTEXT, m_YMM0); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAC + 0x5) = offsetof(RAW_CONTEXT, m_YMM1); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xB5 + 0x5) = offsetof(RAW_CONTEXT, m_YMM2); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xBE + 0x5) = offsetof(RAW_CONTEXT, m_YMM3); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xC7 + 0x5) = offsetof(RAW_CONTEXT, m_YMM4); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD0 + 0x5) = offsetof(RAW_CONTEXT, m_YMM5); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD9 + 0x5) = offsetof(RAW_CONTEXT, m_YMM6); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE2 + 0x5) = offsetof(RAW_CONTEXT, m_YMM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xEB + 0x5) = offsetof(RAW_CONTEXT, m_YMM8); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF4 + 0x5) = offsetof(RAW_CONTEXT, m_YMM9); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xFD + 0x5) = offsetof(RAW_CONTEXT, m_YMM10); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x106 + 0x5) = offsetof(RAW_CONTEXT, m_YMM11); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x10F + 0x5) = offsetof(RAW_CONTEXT, m_YMM12); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x118 + 0x5) = offsetof(RAW_CONTEXT, m_YMM13); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x121 + 0x5) = offsetof(RAW_CONTEXT, m_YMM14); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x12A + 0x5) = offsetof(RAW_CONTEXT, m_YMM15); // FPU - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x195 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_FPU); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x133 + 0x4) = offsetof(RAW_CONTEXT, m_FPU); // CallBack const size_t unAddress = reinterpret_cast(pCallBack); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1A4 + 0x4) = unAddress & 0xFFFFFFFF; - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1AC + 0x4) = (unAddress >> 32) & 0xFFFFFFFF; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x142 + 0x4) = unAddress & 0xFFFFFFFF; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x14A + 0x4) = (unAddress >> 32) & 0xFFFFFFFF; // FPU - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C5 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_FPU); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x163 + 0x3) = offsetof(RAW_CONTEXT, m_FPU); // YMM - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1CC + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM15); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D5 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1DE + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1E7 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F0 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F9 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x202 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x20B + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x214 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x21D + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x226 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x22F + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x238 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x241 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x24A + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x253 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM0); - - // MMX - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x25C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x264 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x26C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x274 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x27C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x284 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x28C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x294 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x16A + 0x5) = offsetof(RAW_CONTEXT, m_YMM15); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x173 + 0x5) = offsetof(RAW_CONTEXT, m_YMM14); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17C + 0x5) = offsetof(RAW_CONTEXT, m_YMM13); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x185 + 0x5) = offsetof(RAW_CONTEXT, m_YMM12); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x18E + 0x5) = offsetof(RAW_CONTEXT, m_YMM11); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x197 + 0x5) = offsetof(RAW_CONTEXT, m_YMM10); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1A0 + 0x5) = offsetof(RAW_CONTEXT, m_YMM9); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1A9 + 0x5) = offsetof(RAW_CONTEXT, m_YMM8); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1B2 + 0x5) = offsetof(RAW_CONTEXT, m_YMM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1BB + 0x5) = offsetof(RAW_CONTEXT, m_YMM6); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C4 + 0x5) = offsetof(RAW_CONTEXT, m_YMM5); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1CD + 0x5) = offsetof(RAW_CONTEXT, m_YMM4); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D6 + 0x5) = offsetof(RAW_CONTEXT, m_YMM3); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1DF + 0x5) = offsetof(RAW_CONTEXT, m_YMM2); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1E8 + 0x5) = offsetof(RAW_CONTEXT, m_YMM1); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F1 + 0x5) = offsetof(RAW_CONTEXT, m_YMM0); + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1FA + 0x4) = offsetof(RAW_CONTEXT, m_unMXCSR); // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x29C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR15); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2A4 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2AC + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2B4 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2BC + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2C4 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2CC + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2D4 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2DC + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2E4 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2EC + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2F4 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2FC + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x304 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRCX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x30C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRAX); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x314 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x31B + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unFS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x322 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x329 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x330 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x202 + 0x4) = offsetof(RAW_CONTEXT, m_unR15); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x20A + 0x4) = offsetof(RAW_CONTEXT, m_unR14); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x212 + 0x4) = offsetof(RAW_CONTEXT, m_unR13); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x21A + 0x4) = offsetof(RAW_CONTEXT, m_unR12); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x222 + 0x4) = offsetof(RAW_CONTEXT, m_unR11); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x22A + 0x4) = offsetof(RAW_CONTEXT, m_unR10); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x232 + 0x4) = offsetof(RAW_CONTEXT, m_unR9); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x23A + 0x4) = offsetof(RAW_CONTEXT, m_unR8); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x242 + 0x4) = offsetof(RAW_CONTEXT, m_unRDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x24A + 0x4) = offsetof(RAW_CONTEXT, m_unRSI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x252 + 0x4) = offsetof(RAW_CONTEXT, m_unRBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x25A + 0x4) = offsetof(RAW_CONTEXT, m_unRBX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x262 + 0x4) = offsetof(RAW_CONTEXT, m_unRDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x26A + 0x4) = offsetof(RAW_CONTEXT, m_unRCX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x272 + 0x4) = offsetof(RAW_CONTEXT, m_unRAX); // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x337 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unRFLAGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x27A + 0x3) = offsetof(RAW_CONTEXT, m_unRFLAGS); // Stack Modification - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x33F + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x282 + 0x4) = offsetof(RAW_CONTEXT, m_unRSP); // Stack Deallocation - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x34C + 0x3) = unContextSize; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x28F + 0x3) = unContextSize; } else if (bHaveFPU) { - static const unsigned char pWrapperCode[] = { 0x48, 0x81, 0xEC, 0xFF, 0xFF, 0xFF, 0x7F, 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7F, 0x48, 0x8B, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x9D, 0x48, 0x8B, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xC2, 0x00, 0x00, 0x58, 0x59, 0x48, 0x81, 0xC4, 0xFF, 0xFF, 0xFF, 0x7F }; memcpy(m_pWrapper, pWrapperCode, sizeof(pWrapperCode)); // Stack Allocation @@ -82777,154 +82707,119 @@ namespace Detours { // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unRFLAGS); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unCS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x16 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x24 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2B + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unFS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x32 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8 + 0x3) = offsetof(RAW_CONTEXT, m_unRFLAGS); // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x39 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRAX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x41 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRCX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x49 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x51 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBX); - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x59 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x61 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x69) = unContextSize; - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x75 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x85 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x95 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x9D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xB5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xBD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR15); - - // MMX - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xC5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xCD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xDD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xED + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xFD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF + 0x4) = offsetof(RAW_CONTEXT, m_unRAX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17 + 0x4) = offsetof(RAW_CONTEXT, m_unRCX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F + 0x4) = offsetof(RAW_CONTEXT, m_unRDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x27 + 0x4) = offsetof(RAW_CONTEXT, m_unRBX); + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2F + 0x4) = offsetof(RAW_CONTEXT, m_unRSP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x37 + 0x4) = offsetof(RAW_CONTEXT, m_unRSP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3F) = unContextSize; + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x43 + 0x4) = offsetof(RAW_CONTEXT, m_unRBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4B + 0x4) = offsetof(RAW_CONTEXT, m_unRSI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x53 + 0x4) = offsetof(RAW_CONTEXT, m_unRDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x5B + 0x4) = offsetof(RAW_CONTEXT, m_unR8); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x63 + 0x4) = offsetof(RAW_CONTEXT, m_unR9); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6B + 0x4) = offsetof(RAW_CONTEXT, m_unR10); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x73 + 0x4) = offsetof(RAW_CONTEXT, m_unR11); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7B + 0x4) = offsetof(RAW_CONTEXT, m_unR12); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x83 + 0x4) = offsetof(RAW_CONTEXT, m_unR13); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8B + 0x4) = offsetof(RAW_CONTEXT, m_unR14); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x93 + 0x4) = offsetof(RAW_CONTEXT, m_unR15); // XMM - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x105 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x10E + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x117 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x120 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x129 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x132 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x13B + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x144 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x14D + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x156 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15F + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x168 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x171 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17A + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x183 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x18C + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM15); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x9B + 0x4) = offsetof(RAW_CONTEXT, m_unMXCSR); + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA3 + 0x5) = offsetof(RAW_CONTEXT, m_XMM0); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAC + 0x5) = offsetof(RAW_CONTEXT, m_XMM1); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xB5 + 0x5) = offsetof(RAW_CONTEXT, m_XMM2); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xBE + 0x5) = offsetof(RAW_CONTEXT, m_XMM3); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xC7 + 0x5) = offsetof(RAW_CONTEXT, m_XMM4); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD0 + 0x5) = offsetof(RAW_CONTEXT, m_XMM5); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD9 + 0x5) = offsetof(RAW_CONTEXT, m_XMM6); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE2 + 0x5) = offsetof(RAW_CONTEXT, m_XMM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xEB + 0x5) = offsetof(RAW_CONTEXT, m_XMM8); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF4 + 0x5) = offsetof(RAW_CONTEXT, m_XMM9); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xFD + 0x5) = offsetof(RAW_CONTEXT, m_XMM10); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x106 + 0x5) = offsetof(RAW_CONTEXT, m_XMM11); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x10F + 0x5) = offsetof(RAW_CONTEXT, m_XMM12); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x118 + 0x5) = offsetof(RAW_CONTEXT, m_XMM13); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x121 + 0x5) = offsetof(RAW_CONTEXT, m_XMM14); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x12A + 0x5) = offsetof(RAW_CONTEXT, m_XMM15); // FPU - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x195 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_FPU); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x133 + 0x4) = offsetof(RAW_CONTEXT, m_FPU); // CallBack const size_t unAddress = reinterpret_cast(pCallBack); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1A4 + 0x4) = unAddress & 0xFFFFFFFF; - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1AC + 0x4) = (unAddress >> 32) & 0xFFFFFFFF; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x142 + 0x4) = unAddress & 0xFFFFFFFF; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x14A + 0x4) = (unAddress >> 32) & 0xFFFFFFFF; // FPU - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C5 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_FPU); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x163 + 0x3) = offsetof(RAW_CONTEXT, m_FPU); // XMM - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1CC + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM15); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D5 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1DE + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1E7 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F0 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F9 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x202 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x20B + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x214 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x21D + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x226 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x22F + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x238 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x241 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x24A + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x253 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM0); - - // MMX - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x25C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x264 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x26C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x274 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x27C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x284 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x28C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x294 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x16A + 0x5) = offsetof(RAW_CONTEXT, m_XMM15); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x173 + 0x5) = offsetof(RAW_CONTEXT, m_XMM14); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17C + 0x5) = offsetof(RAW_CONTEXT, m_XMM13); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x185 + 0x5) = offsetof(RAW_CONTEXT, m_XMM12); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x18E + 0x5) = offsetof(RAW_CONTEXT, m_XMM11); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x197 + 0x5) = offsetof(RAW_CONTEXT, m_XMM10); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1A0 + 0x5) = offsetof(RAW_CONTEXT, m_XMM9); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1A9 + 0x5) = offsetof(RAW_CONTEXT, m_XMM8); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1B2 + 0x5) = offsetof(RAW_CONTEXT, m_XMM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1BB + 0x5) = offsetof(RAW_CONTEXT, m_XMM6); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C4 + 0x5) = offsetof(RAW_CONTEXT, m_XMM5); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1CD + 0x5) = offsetof(RAW_CONTEXT, m_XMM4); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D6 + 0x5) = offsetof(RAW_CONTEXT, m_XMM3); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1DF + 0x5) = offsetof(RAW_CONTEXT, m_XMM2); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1E8 + 0x5) = offsetof(RAW_CONTEXT, m_XMM1); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F1 + 0x5) = offsetof(RAW_CONTEXT, m_XMM0); + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1FA + 0x4) = offsetof(RAW_CONTEXT, m_unMXCSR); // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x29C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR15); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2A4 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2AC + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2B4 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2BC + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2C4 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2CC + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2D4 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2DC + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2E4 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2EC + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2F4 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2FC + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x304 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRCX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x30C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRAX); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x314 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x31B + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unFS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x322 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x329 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x330 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x202 + 0x4) = offsetof(RAW_CONTEXT, m_unR15); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x20A + 0x4) = offsetof(RAW_CONTEXT, m_unR14); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x212 + 0x4) = offsetof(RAW_CONTEXT, m_unR13); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x21A + 0x4) = offsetof(RAW_CONTEXT, m_unR12); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x222 + 0x4) = offsetof(RAW_CONTEXT, m_unR11); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x22A + 0x4) = offsetof(RAW_CONTEXT, m_unR10); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x232 + 0x4) = offsetof(RAW_CONTEXT, m_unR9); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x23A + 0x4) = offsetof(RAW_CONTEXT, m_unR8); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x242 + 0x4) = offsetof(RAW_CONTEXT, m_unRDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x24A + 0x4) = offsetof(RAW_CONTEXT, m_unRSI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x252 + 0x4) = offsetof(RAW_CONTEXT, m_unRBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x25A + 0x4) = offsetof(RAW_CONTEXT, m_unRBX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x262 + 0x4) = offsetof(RAW_CONTEXT, m_unRDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x26A + 0x4) = offsetof(RAW_CONTEXT, m_unRCX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x272 + 0x4) = offsetof(RAW_CONTEXT, m_unRAX); // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x337 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unRFLAGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x27A + 0x3) = offsetof(RAW_CONTEXT, m_unRFLAGS); // Stack Modification - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x33F + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x282 + 0x4) = offsetof(RAW_CONTEXT, m_unRSP); // Stack Deallocation - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x34C + 0x3) = unContextSize; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x28F + 0x3) = unContextSize; } else if (bHaveSSE) { - static const unsigned char pWrapperCode[] = { 0x48, 0x81, 0xEC, 0xFF, 0xFF, 0xFF, 0x7F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0xFF, 0x7F, 0x48, 0x8B, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x9D, 0x48, 0x8B, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xC2, 0x00, 0x00, 0x58, 0x59, 0x48, 0x81, 0xC4, 0xFF, 0xFF, 0xFF, 0x7F }; memcpy(m_pWrapper, pWrapperCode, sizeof(pWrapperCode)); // Stack Allocation @@ -82933,256 +82828,111 @@ namespace Detours { // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unRFLAGS); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unCS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x16 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x24 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2B + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unFS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x32 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8 + 0x3) = offsetof(RAW_CONTEXT, m_unRFLAGS); // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x39 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRAX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x41 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRCX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x49 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x51 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBX); - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x59 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x61 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x69) = unContextSize; - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x75 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x85 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x95 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x9D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xB5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xBD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR15); - - // MMX - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xC5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xCD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xDD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xED + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xFD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF + 0x4) = offsetof(RAW_CONTEXT, m_unRAX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17 + 0x4) = offsetof(RAW_CONTEXT, m_unRCX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F + 0x4) = offsetof(RAW_CONTEXT, m_unRDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x27 + 0x4) = offsetof(RAW_CONTEXT, m_unRBX); + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2F + 0x4) = offsetof(RAW_CONTEXT, m_unRSP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x37 + 0x4) = offsetof(RAW_CONTEXT, m_unRSP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3F) = unContextSize; + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x43 + 0x4) = offsetof(RAW_CONTEXT, m_unRBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4B + 0x4) = offsetof(RAW_CONTEXT, m_unRSI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x53 + 0x4) = offsetof(RAW_CONTEXT, m_unRDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x5B + 0x4) = offsetof(RAW_CONTEXT, m_unR8); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x63 + 0x4) = offsetof(RAW_CONTEXT, m_unR9); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6B + 0x4) = offsetof(RAW_CONTEXT, m_unR10); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x73 + 0x4) = offsetof(RAW_CONTEXT, m_unR11); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7B + 0x4) = offsetof(RAW_CONTEXT, m_unR12); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x83 + 0x4) = offsetof(RAW_CONTEXT, m_unR13); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8B + 0x4) = offsetof(RAW_CONTEXT, m_unR14); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x93 + 0x4) = offsetof(RAW_CONTEXT, m_unR15); // XMM - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x105 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x10E + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x117 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x120 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x129 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x132 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x13B + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x144 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x14D + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x156 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15F + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x168 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x171 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17A + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x183 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x18C + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM15); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x9B + 0x4) = offsetof(RAW_CONTEXT, m_unMXCSR); + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA3 + 0x5) = offsetof(RAW_CONTEXT, m_XMM0); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAC + 0x5) = offsetof(RAW_CONTEXT, m_XMM1); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xB5 + 0x5) = offsetof(RAW_CONTEXT, m_XMM2); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xBE + 0x5) = offsetof(RAW_CONTEXT, m_XMM3); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xC7 + 0x5) = offsetof(RAW_CONTEXT, m_XMM4); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD0 + 0x5) = offsetof(RAW_CONTEXT, m_XMM5); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD9 + 0x5) = offsetof(RAW_CONTEXT, m_XMM6); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE2 + 0x5) = offsetof(RAW_CONTEXT, m_XMM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xEB + 0x5) = offsetof(RAW_CONTEXT, m_XMM8); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF4 + 0x5) = offsetof(RAW_CONTEXT, m_XMM9); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xFD + 0x5) = offsetof(RAW_CONTEXT, m_XMM10); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x106 + 0x5) = offsetof(RAW_CONTEXT, m_XMM11); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x10F + 0x5) = offsetof(RAW_CONTEXT, m_XMM12); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x118 + 0x5) = offsetof(RAW_CONTEXT, m_XMM13); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x121 + 0x5) = offsetof(RAW_CONTEXT, m_XMM14); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x12A + 0x5) = offsetof(RAW_CONTEXT, m_XMM15); // CallBack const size_t unAddress = reinterpret_cast(pCallBack); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x19C + 0x4) = unAddress & 0xFFFFFFFF; - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1A4 + 0x4) = (unAddress >> 32) & 0xFFFFFFFF; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x13A + 0x4) = unAddress & 0xFFFFFFFF; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x142 + 0x4) = (unAddress >> 32) & 0xFFFFFFFF; // XMM - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1BD + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM15); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C6 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1CF + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D8 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1E1 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1EA + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F3 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1FC + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x205 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x20E + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x217 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x220 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x229 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x232 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x23B + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x244 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM0); - - // MMX - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x24D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x255 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x25D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x265 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x26D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x275 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x27D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x285 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15B + 0x5) = offsetof(RAW_CONTEXT, m_XMM15); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x164 + 0x5) = offsetof(RAW_CONTEXT, m_XMM14); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x16D + 0x5) = offsetof(RAW_CONTEXT, m_XMM13); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x176 + 0x5) = offsetof(RAW_CONTEXT, m_XMM12); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17F + 0x5) = offsetof(RAW_CONTEXT, m_XMM11); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x188 + 0x5) = offsetof(RAW_CONTEXT, m_XMM10); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x191 + 0x5) = offsetof(RAW_CONTEXT, m_XMM9); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x19A + 0x5) = offsetof(RAW_CONTEXT, m_XMM8); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1A3 + 0x5) = offsetof(RAW_CONTEXT, m_XMM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1AC + 0x5) = offsetof(RAW_CONTEXT, m_XMM6); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1B5 + 0x5) = offsetof(RAW_CONTEXT, m_XMM5); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1BE + 0x5) = offsetof(RAW_CONTEXT, m_XMM4); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C7 + 0x5) = offsetof(RAW_CONTEXT, m_XMM3); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D0 + 0x5) = offsetof(RAW_CONTEXT, m_XMM2); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D9 + 0x5) = offsetof(RAW_CONTEXT, m_XMM1); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1E2 + 0x5) = offsetof(RAW_CONTEXT, m_XMM0); + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1EB + 0x4) = offsetof(RAW_CONTEXT, m_unMXCSR); // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x28D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR15); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x295 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x29D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2A5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2AD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2B5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2BD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2C5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2CD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2D5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2DD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2E5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2ED + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2F5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRCX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2FD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRAX); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x305 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x30C + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unFS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x313 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x31A + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x321 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F3 + 0x4) = offsetof(RAW_CONTEXT, m_unR15); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1FB + 0x4) = offsetof(RAW_CONTEXT, m_unR14); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x203 + 0x4) = offsetof(RAW_CONTEXT, m_unR13); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x20B + 0x4) = offsetof(RAW_CONTEXT, m_unR12); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x213 + 0x4) = offsetof(RAW_CONTEXT, m_unR11); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x21B + 0x4) = offsetof(RAW_CONTEXT, m_unR10); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x223 + 0x4) = offsetof(RAW_CONTEXT, m_unR9); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x22B + 0x4) = offsetof(RAW_CONTEXT, m_unR8); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x233 + 0x4) = offsetof(RAW_CONTEXT, m_unRDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x23B + 0x4) = offsetof(RAW_CONTEXT, m_unRSI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x243 + 0x4) = offsetof(RAW_CONTEXT, m_unRBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x24B + 0x4) = offsetof(RAW_CONTEXT, m_unRBX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x253 + 0x4) = offsetof(RAW_CONTEXT, m_unRDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x25B + 0x4) = offsetof(RAW_CONTEXT, m_unRCX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x263 + 0x4) = offsetof(RAW_CONTEXT, m_unRAX); // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x328 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unRFLAGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x26B + 0x3) = offsetof(RAW_CONTEXT, m_unRFLAGS); // Stack Modification - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x330 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x273 + 0x4) = offsetof(RAW_CONTEXT, m_unRSP); // Stack Deallocation - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x33D + 0x3) = unContextSize; - } else if (bHaveMMX) { - static unsigned char pWrapperCode[] = { 0x48, 0x81, 0xEC, 0xFF, 0xFF, 0xFF, 0x7F, 0x9C, 0x8F, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0xA4, 0x24, 0x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 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8E, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8E, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8E, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8E, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8E, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x9D, 0x48, 0x8B, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xC2, 0x00, 0x00, 0x58, 0x59, 0x48, 0x81, 0xC4, 0xFF, 0xFF, 0xFF, 0x7F }; - memcpy(m_pWrapper, pWrapperCode, sizeof(pWrapperCode)); - - // Stack Allocation - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3) = unContextSize; - - // Flags - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unRFLAGS); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unCS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x16 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x24 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2B + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unFS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x32 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); - - // Registers - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x39 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRAX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x41 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRCX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x49 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x51 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBX); - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x59 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x61 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x69) = unContextSize; - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x75 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x85 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x95 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x9D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xB5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xBD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR15); - - // MMX - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xC5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xCD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xDD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xED + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xFD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); - - // CallBack - - const size_t unAddress = reinterpret_cast(pCallBack); - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x10C + 0x4) = unAddress & 0xFFFFFFFF; - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x114 + 0x4) = (unAddress >> 32) & 0xFFFFFFFF; - - // MMX - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x12D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x135 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x13D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x145 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x14D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x155 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x165 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); - - // Registers - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x16D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR15); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x175 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x185 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x18D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x195 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x19D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1A5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1AD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1B5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1BD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1CD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRCX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1DD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRAX); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1E5 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1EC + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unFS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F3 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1FA + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x201 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); - - // Flags - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x208 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unRFLAGS); - - // Stack Modification - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x210 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSP); - - // Stack Deallocation - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x21D + 0x3) = unContextSize; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x280 + 0x3) = unContextSize; } else { - static const unsigned char pWrapperCode[] = { 0x48, 0x81, 0xEC, 0xFF, 0xFF, 0xFF, 0x7F, 0x9C, 0x8F, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x81, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x89, 0xBC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x4C, 0x89, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x4C, 0x89, 0x8C, 0x24, 0xFF, 0xF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 0xBC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x48, 0x8B, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x9D, 0x48, 0x8B, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xC2, 0x00, 0x00, 0x58, 0x59, 0x48, 0x81, 0xC4, 0xFF, 0xFF, 0xFF, 0x7F }; memcpy(m_pWrapper, pWrapperCode, sizeof(pWrapperCode)); // Stack Allocation @@ -83191,88 +82941,73 @@ namespace Detours { // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unRFLAGS); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unCS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x16 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x24 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2B + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unFS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x32 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8 + 0x3) = offsetof(RAW_CONTEXT, m_unRFLAGS); // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x39 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRAX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x41 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRCX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x49 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x51 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBX); - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x59 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x61 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x69) = unContextSize; - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x75 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x85 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x95 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x9D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xB5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xBD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR15); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF + 0x4) = offsetof(RAW_CONTEXT, m_unRAX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17 + 0x4) = offsetof(RAW_CONTEXT, m_unRCX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F + 0x4) = offsetof(RAW_CONTEXT, m_unRDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x27 + 0x4) = offsetof(RAW_CONTEXT, m_unRBX); + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2F + 0x4) = offsetof(RAW_CONTEXT, m_unRSP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x37 + 0x4) = offsetof(RAW_CONTEXT, m_unRSP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3F) = unContextSize; + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x43 + 0x4) = offsetof(RAW_CONTEXT, m_unRBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4B + 0x4) = offsetof(RAW_CONTEXT, m_unRSI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x53 + 0x4) = offsetof(RAW_CONTEXT, m_unRDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x5B + 0x4) = offsetof(RAW_CONTEXT, m_unR8); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x63 + 0x4) = offsetof(RAW_CONTEXT, m_unR9); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6B + 0x4) = offsetof(RAW_CONTEXT, m_unR10); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x73 + 0x4) = offsetof(RAW_CONTEXT, m_unR11); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7B + 0x4) = offsetof(RAW_CONTEXT, m_unR12); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x83 + 0x4) = offsetof(RAW_CONTEXT, m_unR13); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8B + 0x4) = offsetof(RAW_CONTEXT, m_unR14); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x93 + 0x4) = offsetof(RAW_CONTEXT, m_unR15); // CallBack const size_t unAddress = reinterpret_cast(pCallBack); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xCC + 0x4) = unAddress & 0xFFFFFFFF; - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD4 + 0x4) = (unAddress >> 32) & 0xFFFFFFFF; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA2 + 0x4) = unAddress & 0xFFFFFFFF; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAA + 0x4) = (unAddress >> 32) & 0xFFFFFFFF; + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1EB + 0x4) = offsetof(RAW_CONTEXT, m_unMXCSR); // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xED + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR15); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF5 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR14); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xFD + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR13); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x105 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR12); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x10D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR11); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x115 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR10); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x11D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR9); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x125 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unR8); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x12D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x135 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x13D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x145 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRBX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x14D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x155 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRCX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15D + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRAX); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x165 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x16C + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unFS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x173 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17A + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x181 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xC3 + 0x4) = offsetof(RAW_CONTEXT, m_unR15); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xCB + 0x4) = offsetof(RAW_CONTEXT, m_unR14); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD3 + 0x4) = offsetof(RAW_CONTEXT, m_unR13); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xDB + 0x4) = offsetof(RAW_CONTEXT, m_unR12); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE3 + 0x4) = offsetof(RAW_CONTEXT, m_unR11); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xEB + 0x4) = offsetof(RAW_CONTEXT, m_unR10); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF3 + 0x4) = offsetof(RAW_CONTEXT, m_unR9); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xFB + 0x4) = offsetof(RAW_CONTEXT, m_unR8); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x103 + 0x4) = offsetof(RAW_CONTEXT, m_unRDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x10B + 0x4) = offsetof(RAW_CONTEXT, m_unRSI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x113 + 0x4) = offsetof(RAW_CONTEXT, m_unRBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x11B + 0x4) = offsetof(RAW_CONTEXT, m_unRBX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x123 + 0x4) = offsetof(RAW_CONTEXT, m_unRDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x12B + 0x4) = offsetof(RAW_CONTEXT, m_unRCX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x133 + 0x4) = offsetof(RAW_CONTEXT, m_unRAX); // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x188 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unRFLAGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x13B + 0x3) = offsetof(RAW_CONTEXT, m_unRFLAGS); // Stack Modification - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x190 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_unRSP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x143 + 0x4) = offsetof(RAW_CONTEXT, m_unRSP); // Stack Deallocation - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x19D + 0x3) = unContextSize; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x150 + 0x3) = unContextSize; } #elif _M_IX86 if (bHaveAVX512) { - static const unsigned char pWrapperCode[] = { 0x81, 0xEC, 0xFF, 0xFF, 0xFF, 0x7F, 0x9C, 0x8F, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x81, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x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0x7C, 0x48, 0x10, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x62, 0xF1, 0x7C, 0x48, 0x10, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x62, 0xF1, 0x7C, 0x48, 0x10, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x62, 0xF1, 0x7C, 0x48, 0x10, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x62, 0xF1, 0x7C, 0x48, 0x10, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x62, 0xF1, 0x7C, 0x48, 0x10, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x0F, 0xAE, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0xBC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x9D, 0x8B, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xC2, 0x00, 0x00, 0x58, 0x81, 0xC4, 0xFF, 0xFF, 0xFF, 0x7F }; memcpy(m_pWrapper, pWrapperCode, sizeof(pWrapperCode)); // Stack Allocation @@ -83281,118 +83016,84 @@ namespace Detours { // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEFLAGS); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unCS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x23 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2A + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unFS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x31 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7 + 0x3) = offsetof(RAW_CONTEXT, m_unEFLAGS); // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x38 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEAX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3F + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unECX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x46 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBX); - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x54 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x5B + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x62) = unContextSize; - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x66 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x74 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE + 0x3) = offsetof(RAW_CONTEXT, m_unEAX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15 + 0x3) = offsetof(RAW_CONTEXT, m_unECX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C + 0x3) = offsetof(RAW_CONTEXT, m_unEDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x23 + 0x3) = offsetof(RAW_CONTEXT, m_unEBX); - // MMX + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2A + 0x3) = offsetof(RAW_CONTEXT, m_unESP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x31 + 0x3) = offsetof(RAW_CONTEXT, m_unESP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x38) = unContextSize; - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x83 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x93 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x9B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA3 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAB + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xB3 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3C + 0x3) = offsetof(RAW_CONTEXT, m_unEBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x43 + 0x3) = offsetof(RAW_CONTEXT, m_unESI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4A + 0x3) = offsetof(RAW_CONTEXT, m_unEDI); // ZMM - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xBB + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xC6 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD1 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xDC + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE7 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF2 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xFD + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x108 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x51 + 0x4) = offsetof(RAW_CONTEXT, m_unMXCSR); + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x59 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM0); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x64 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM1); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6F + 0x7) = offsetof(RAW_CONTEXT, m_ZMM2); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7A + 0x7) = offsetof(RAW_CONTEXT, m_ZMM3); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x85 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM4); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x90 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM5); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x9B + 0x7) = offsetof(RAW_CONTEXT, m_ZMM6); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA6 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM7); // FPU - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x113 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_FPU); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xB1 + 0x4) = offsetof(RAW_CONTEXT, m_FPU); // CallBack - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x121 + 0x4) = reinterpret_cast(pCallBack); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xBF + 0x4) = reinterpret_cast(pCallBack); // FPU - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x13C + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_FPU); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xDA + 0x3) = offsetof(RAW_CONTEXT, m_FPU); // ZMM - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x143 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x14E + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x159 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x164 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x16F + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17A + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x185 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x190 + 0x7) = offsetof(RAW_HOOK_CONTEXT, m_ZMM0); - - // MMX - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x19B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1A3 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1AB + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1B3 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1BB + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C3 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1CB + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D3 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); - - // Registers + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE1 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xEC + 0x7) = offsetof(RAW_CONTEXT, m_ZMM6); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF7 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM5); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x102 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM4); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x10D + 0x7) = offsetof(RAW_CONTEXT, m_ZMM3); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x118 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM2); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x123 + 0x7) = offsetof(RAW_CONTEXT, m_ZMM1); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x12E + 0x7) = offsetof(RAW_CONTEXT, m_ZMM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1DB + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1E2 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1E9 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F0 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F7 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1FE + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unECX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x205 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEAX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x139 + 0x4) = offsetof(RAW_CONTEXT, m_unMXCSR); - // Segments + // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x20C + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x213 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x21A + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x221 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x141 + 0x3) = offsetof(RAW_CONTEXT, m_unEDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x148 + 0x3) = offsetof(RAW_CONTEXT, m_unESI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x14F + 0x3) = offsetof(RAW_CONTEXT, m_unEBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x156 + 0x3) = offsetof(RAW_CONTEXT, m_unEBX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15D + 0x3) = offsetof(RAW_CONTEXT, m_unEDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x164 + 0x3) = offsetof(RAW_CONTEXT, m_unECX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x16B + 0x3) = offsetof(RAW_CONTEXT, m_unEAX); // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x228 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEFLAGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x172 + 0x3) = offsetof(RAW_CONTEXT, m_unEFLAGS); // Stack Modification - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x230 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17A + 0x3) = offsetof(RAW_CONTEXT, m_unESP); // Stack Deallocation - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x23B + 0x2) = unContextSize; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x185 + 0x2) = unContextSize; } else if (bHaveAVX) { - static const unsigned char pWrapperCode[] = { 0x81, 0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, 0xFF, 0x7F, 0x9D, 0x8B, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xC2, 0x00, 0x00, 0x58, 0x81, 0xC4, 0xFF, 0xFF, 0xFF, 0x7F }; memcpy(m_pWrapper, pWrapperCode, sizeof(pWrapperCode)); // Stack Allocation @@ -83401,118 +83102,84 @@ namespace Detours { // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEFLAGS); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unCS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x23 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2A + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unFS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x31 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7 + 0x3) = offsetof(RAW_CONTEXT, m_unEFLAGS); // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x38 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEAX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3F + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unECX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x46 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBX); - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x54 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x5B + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x62) = unContextSize; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE + 0x3) = offsetof(RAW_CONTEXT, m_unEAX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15 + 0x3) = offsetof(RAW_CONTEXT, m_unECX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C + 0x3) = offsetof(RAW_CONTEXT, m_unEDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x23 + 0x3) = offsetof(RAW_CONTEXT, m_unEBX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x66 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x74 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2A + 0x3) = offsetof(RAW_CONTEXT, m_unESP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x31 + 0x3) = offsetof(RAW_CONTEXT, m_unESP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x38) = unContextSize; - // MMX - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x83 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x93 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x9B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA3 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAB + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xB3 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3C + 0x3) = offsetof(RAW_CONTEXT, m_unEBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x43 + 0x3) = offsetof(RAW_CONTEXT, m_unESI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4A + 0x3) = offsetof(RAW_CONTEXT, m_unEDI); // YMM - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xBB + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xC4 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xCD + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD6 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xDF + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE8 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF1 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xFA + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x51 + 0x4) = offsetof(RAW_CONTEXT, m_unMXCSR); + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x59 + 0x5) = offsetof(RAW_CONTEXT, m_YMM0); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x62 + 0x5) = offsetof(RAW_CONTEXT, m_YMM1); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6B + 0x5) = offsetof(RAW_CONTEXT, m_YMM2); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x74 + 0x5) = offsetof(RAW_CONTEXT, m_YMM3); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7D + 0x5) = offsetof(RAW_CONTEXT, m_YMM4); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x86 + 0x5) = offsetof(RAW_CONTEXT, m_YMM5); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8F + 0x5) = offsetof(RAW_CONTEXT, m_YMM6); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x98 + 0x5) = offsetof(RAW_CONTEXT, m_YMM7); // FPU - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x103 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_FPU); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA1 + 0x4) = offsetof(RAW_CONTEXT, m_FPU); // CallBack - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x111 + 0x4) = reinterpret_cast(pCallBack); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAF + 0x4) = reinterpret_cast(pCallBack); // FPU - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x12C + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_FPU); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xCA + 0x3) = offsetof(RAW_CONTEXT, m_FPU); // YMM - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x133 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x13C + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x145 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x14E + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x157 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x160 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x169 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x172 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_YMM0); - - // MMX - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x183 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x18B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x193 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x19B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1A3 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1AB + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1B3 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD1 + 0x5) = offsetof(RAW_CONTEXT, m_YMM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xDA + 0x5) = offsetof(RAW_CONTEXT, m_YMM6); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE3 + 0x5) = offsetof(RAW_CONTEXT, m_YMM5); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xEC + 0x5) = offsetof(RAW_CONTEXT, m_YMM4); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF5 + 0x5) = offsetof(RAW_CONTEXT, m_YMM3); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xFE + 0x5) = offsetof(RAW_CONTEXT, m_YMM2); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x107 + 0x5) = offsetof(RAW_CONTEXT, m_YMM1); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x110 + 0x5) = offsetof(RAW_CONTEXT, m_YMM0); - // Registers + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x119 + 0x4) = offsetof(RAW_CONTEXT, m_unMXCSR); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1BB + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C2 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C9 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D0 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D7 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1DE + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unECX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1E5 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEAX); - - // Segments + // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1EC + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F3 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1FA + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x201 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x121 + 0x3) = offsetof(RAW_CONTEXT, m_unEDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x128 + 0x3) = offsetof(RAW_CONTEXT, m_unESI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x12F + 0x3) = offsetof(RAW_CONTEXT, m_unEBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x136 + 0x3) = offsetof(RAW_CONTEXT, m_unEBX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x13D + 0x3) = offsetof(RAW_CONTEXT, m_unEDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x144 + 0x3) = offsetof(RAW_CONTEXT, m_unECX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x14B + 0x3) = offsetof(RAW_CONTEXT, m_unEAX); // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x208 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEFLAGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x152 + 0x3) = offsetof(RAW_CONTEXT, m_unEFLAGS); // Stack Modification - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x210 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15A + 0x3) = offsetof(RAW_CONTEXT, m_unESP); // Stack Deallocation - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x21B + 0x2) = unContextSize; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x165 + 0x2) = unContextSize; } else if (bHaveFPU) { - static const unsigned char pWrapperCode[] = { 0x81, 0xEC, 0xFF, 0xFF, 0xFF, 0x7F, 0x9C, 0x8F, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x81, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0xBC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x0F, 0x7F, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x0F,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, 0x8B, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x9D, 0x8B, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xC2, 0x00, 0x00, 0x58, 0x81, 0xC4, 0xFF, 0xFF, 0xFF, 0x7F }; memcpy(m_pWrapper, pWrapperCode, sizeof(pWrapperCode)); // Stack Allocation @@ -83521,118 +83188,84 @@ namespace Detours { // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEFLAGS); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unCS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x23 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2A + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unFS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x31 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7 + 0x3) = offsetof(RAW_CONTEXT, m_unEFLAGS); // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x38 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEAX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3F + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unECX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x46 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE + 0x3) = offsetof(RAW_CONTEXT, m_unEAX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15 + 0x3) = offsetof(RAW_CONTEXT, m_unECX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C + 0x3) = offsetof(RAW_CONTEXT, m_unEDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x23 + 0x3) = offsetof(RAW_CONTEXT, m_unEBX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x54 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x5B + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x62) = unContextSize; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2A + 0x3) = offsetof(RAW_CONTEXT, m_unESP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x31 + 0x3) = offsetof(RAW_CONTEXT, m_unESP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x38) = unContextSize; - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x66 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x74 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDI); - - // MMX - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x83 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x93 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x9B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA3 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAB + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xB3 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3C + 0x3) = offsetof(RAW_CONTEXT, m_unEBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x43 + 0x3) = offsetof(RAW_CONTEXT, m_unESI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4A + 0x3) = offsetof(RAW_CONTEXT, m_unEDI); // XMM - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xBB + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xC4 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xCD + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD6 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xDF + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE8 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF1 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xFA + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x51 + 0x4) = offsetof(RAW_CONTEXT, m_unMXCSR); + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x59 + 0x5) = offsetof(RAW_CONTEXT, m_XMM0); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x62 + 0x5) = offsetof(RAW_CONTEXT, m_XMM1); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6B + 0x5) = offsetof(RAW_CONTEXT, m_XMM2); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x74 + 0x5) = offsetof(RAW_CONTEXT, m_XMM3); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7D + 0x5) = offsetof(RAW_CONTEXT, m_XMM4); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x86 + 0x5) = offsetof(RAW_CONTEXT, m_XMM5); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8F + 0x5) = offsetof(RAW_CONTEXT, m_XMM6); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x98 + 0x5) = offsetof(RAW_CONTEXT, m_XMM7); // FPU - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x103 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_FPU); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA1 + 0x4) = offsetof(RAW_CONTEXT, m_FPU); // CallBack - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x111 + 0x4) = reinterpret_cast(pCallBack); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAF + 0x4) = reinterpret_cast(pCallBack); // FPU - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x12C + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_FPU); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xCA + 0x3) = offsetof(RAW_CONTEXT, m_FPU); // XMM - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x133 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x13C + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x145 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x14E + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x157 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x160 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x169 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x172 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM0); - - // MMX - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x183 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x18B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x193 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x19B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1A3 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1AB + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1B3 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD1 + 0x5) = offsetof(RAW_CONTEXT, m_XMM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xDA + 0x5) = offsetof(RAW_CONTEXT, m_XMM6); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE3 + 0x5) = offsetof(RAW_CONTEXT, m_XMM5); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xEC + 0x5) = offsetof(RAW_CONTEXT, m_XMM4); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF5 + 0x5) = offsetof(RAW_CONTEXT, m_XMM3); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xFE + 0x5) = offsetof(RAW_CONTEXT, m_XMM2); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x107 + 0x5) = offsetof(RAW_CONTEXT, m_XMM1); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x110 + 0x5) = offsetof(RAW_CONTEXT, m_XMM0); - // Registers - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1BB + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C2 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C9 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D0 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D7 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1DE + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unECX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1E5 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEAX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x119 + 0x4) = offsetof(RAW_CONTEXT, m_unMXCSR); - // Segments + // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1EC + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F3 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1FA + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x201 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x121 + 0x3) = offsetof(RAW_CONTEXT, m_unEDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x128 + 0x3) = offsetof(RAW_CONTEXT, m_unESI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x12F + 0x3) = offsetof(RAW_CONTEXT, m_unEBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x136 + 0x3) = offsetof(RAW_CONTEXT, m_unEBX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x13D + 0x3) = offsetof(RAW_CONTEXT, m_unEDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x144 + 0x3) = offsetof(RAW_CONTEXT, m_unECX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x14B + 0x3) = offsetof(RAW_CONTEXT, m_unEAX); // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x208 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEFLAGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x152 + 0x3) = offsetof(RAW_CONTEXT, m_unEFLAGS); // Stack Modification - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x210 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15A + 0x3) = offsetof(RAW_CONTEXT, m_unESP); // Stack Deallocation - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x21B + 0x2) = unContextSize; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x165 + 0x2) = unContextSize; } else if (bHaveSSE) { - static const unsigned char pWrapperCode[] = { 0x81, 0xEC, 0xFF, 0xFF, 0xFF, 0x7F, 0x9C, 0x8F, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0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xFF, 0x7F, 0x0F, 0xAE, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0xBC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x9D, 0x8B, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xC2, 0x00, 0x00, 0x58, 0x81, 0xC4, 0xFF, 0xFF, 0xFF, 0x7F }; memcpy(m_pWrapper, pWrapperCode, sizeof(pWrapperCode)); // Stack Allocation @@ -83641,200 +83274,76 @@ namespace Detours { // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEFLAGS); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unCS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x23 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2A + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unFS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x31 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7 + 0x3) = offsetof(RAW_CONTEXT, m_unEFLAGS); // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x38 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEAX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3F + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unECX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x46 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBX); - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x54 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x5B + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x62) = unContextSize; - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x66 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x74 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE + 0x3) = offsetof(RAW_CONTEXT, m_unEAX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15 + 0x3) = offsetof(RAW_CONTEXT, m_unECX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C + 0x3) = offsetof(RAW_CONTEXT, m_unEDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x23 + 0x3) = offsetof(RAW_CONTEXT, m_unEBX); - // MMX + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2A + 0x3) = offsetof(RAW_CONTEXT, m_unESP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x31 + 0x3) = offsetof(RAW_CONTEXT, m_unESP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x38) = unContextSize; - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x83 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x93 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x9B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA3 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAB + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xB3 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3C + 0x3) = offsetof(RAW_CONTEXT, m_unEBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x43 + 0x3) = offsetof(RAW_CONTEXT, m_unESI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4A + 0x3) = offsetof(RAW_CONTEXT, m_unEDI); // XMM - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xBB + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xC4 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xCD + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD6 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xDF + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE8 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF1 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xFA + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x51 + 0x4) = offsetof(RAW_CONTEXT, m_unMXCSR); + + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x59 + 0x5) = offsetof(RAW_CONTEXT, m_XMM0); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x62 + 0x5) = offsetof(RAW_CONTEXT, m_XMM1); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6B + 0x5) = offsetof(RAW_CONTEXT, m_XMM2); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x74 + 0x5) = offsetof(RAW_CONTEXT, m_XMM3); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7D + 0x5) = offsetof(RAW_CONTEXT, m_XMM4); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x86 + 0x5) = offsetof(RAW_CONTEXT, m_XMM5); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8F + 0x5) = offsetof(RAW_CONTEXT, m_XMM6); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x98 + 0x5) = offsetof(RAW_CONTEXT, m_XMM7); // CallBack - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x109 + 0x4) = reinterpret_cast(pCallBack); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA7 + 0x4) = reinterpret_cast(pCallBack); // XMM - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x124 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x12D + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x136 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x13F + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x148 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x151 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15A + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x163 + 0x5) = offsetof(RAW_HOOK_CONTEXT, m_XMM0); - - // MMX - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x16C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x174 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x184 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x18C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x194 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x19C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1A4 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); - - // Registers - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1AC + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1B3 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1BA + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C1 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C8 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1CF + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unECX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1D6 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEAX); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1DD + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1E4 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1EB + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F2 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); - - // Flags - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1F9 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEFLAGS); - - // Stack Modification - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x201 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESP); - - // Stack Deallocation - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x20C + 0x2) = unContextSize; - } else if (bHaveMMX) { - static const unsigned char pWrapperCode[] = { 0x81, 0xEC, 0xFF, 0xFF, 0xFF, 0x7F, 0x9C, 0x8F, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x81, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0xBC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x0F, 0x7F, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x0F, 0x7F, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x0F, 0x7F, 0x94, 0x24, 0xFF, 0xF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, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8E, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8E, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8E, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8E, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x9D, 0x8B, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xC2, 0x00, 0x00, 0x58, 0x81, 0xC4, 0xFF, 0xFF, 0xFF, 0x7F }; - memcpy(m_pWrapper, pWrapperCode, sizeof(pWrapperCode)); - - // Stack Allocation - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2) = unContextSize; - - // Flags - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEFLAGS); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unCS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x23 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2A + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unFS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x31 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); - - // Registers - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x38 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEAX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3F + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unECX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x46 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xC2 + 0x5) = offsetof(RAW_CONTEXT, m_XMM7); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xCB + 0x5) = offsetof(RAW_CONTEXT, m_XMM6); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD4 + 0x5) = offsetof(RAW_CONTEXT, m_XMM5); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xDD + 0x5) = offsetof(RAW_CONTEXT, m_XMM4); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE6 + 0x5) = offsetof(RAW_CONTEXT, m_XMM3); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xEF + 0x5) = offsetof(RAW_CONTEXT, m_XMM2); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF8 + 0x5) = offsetof(RAW_CONTEXT, m_XMM1); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x101 + 0x5) = offsetof(RAW_CONTEXT, m_XMM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x54 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x5B + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x62) = unContextSize; - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x66 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x74 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDI); - - // MMX - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x83 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x93 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x9B + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA3 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAB + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xB3 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); - - // CallBack - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xC1 + 0x4) = reinterpret_cast(pCallBack); - - // MMX - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xDC + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM7); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE4 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM6); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xEC + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM5); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF4 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM4); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xFC + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM3); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x104 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM2); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x10C + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM1); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x114 + 0x4) = offsetof(RAW_HOOK_CONTEXT, m_MM0); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x10A + 0x4) = offsetof(RAW_CONTEXT, m_unMXCSR); // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x11C + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x123 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x12A + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x131 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x138 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x13F + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unECX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x146 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEAX); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x14D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x154 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15B + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x162 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x112 + 0x3) = offsetof(RAW_CONTEXT, m_unEDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x119 + 0x3) = offsetof(RAW_CONTEXT, m_unESI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x120 + 0x3) = offsetof(RAW_CONTEXT, m_unEBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x127 + 0x3) = offsetof(RAW_CONTEXT, m_unEBX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x12E + 0x3) = offsetof(RAW_CONTEXT, m_unEDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x135 + 0x3) = offsetof(RAW_CONTEXT, m_unECX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x13C + 0x3) = offsetof(RAW_CONTEXT, m_unEAX); // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x169 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEFLAGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x143 + 0x3) = offsetof(RAW_CONTEXT, m_unEFLAGS); // Stack Modification - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x171 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x14B + 0x3) = offsetof(RAW_CONTEXT, m_unESP); // Stack Deallocation - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x17C + 0x2) = unContextSize; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x156 + 0x2) = unContextSize; } else { - static const unsigned char pWrapperCode[] = { 0x81, 0xEC, 0xFF, 0xFF, 0xFF, 0x7F, 0x9C, 0x8F, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8C, 0x9C,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8B, 0xAC, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0x9C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0x94, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0x8C, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x8B, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xB4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0x9D, 0x8B, 0xA4, 0x24, 0xFF, 0xFF, 0xFF, 0x7F, 0xC2, 0x00, 0x00, 0x58, 0x81, 0xC4, 0xFF, 0xFF, 0xFF, 0x7F }; memcpy(m_pWrapper, pWrapperCode, sizeof(pWrapperCode)); // Stack Allocation @@ -83843,64 +83352,48 @@ namespace Detours { // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEFLAGS); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unCS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x23 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2A + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unFS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x31 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7 + 0x3) = offsetof(RAW_CONTEXT, m_unEFLAGS); // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x38 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEAX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3F + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unECX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x46 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE + 0x3) = offsetof(RAW_CONTEXT, m_unEAX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x15 + 0x3) = offsetof(RAW_CONTEXT, m_unECX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x1C + 0x3) = offsetof(RAW_CONTEXT, m_unEDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x23 + 0x3) = offsetof(RAW_CONTEXT, m_unEBX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x54 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x5B + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x62) = unContextSize; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x2A + 0x3) = offsetof(RAW_CONTEXT, m_unESP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x31 + 0x3) = offsetof(RAW_CONTEXT, m_unESP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x38) = unContextSize; - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x66 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6D + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x74 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x3C + 0x3) = offsetof(RAW_CONTEXT, m_unEBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x43 + 0x3) = offsetof(RAW_CONTEXT, m_unESI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x4A + 0x3) = offsetof(RAW_CONTEXT, m_unEDI); // CallBack - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x81 + 0x4) = reinterpret_cast(pCallBack); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x57 + 0x4) = reinterpret_cast(pCallBack); // Registers - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x98 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x9F + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESI); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA6 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBP); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xAD + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEBX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xB4 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEDX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xBB + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unECX); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xC2 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEAX); - - // Segments - - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xC9 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unGS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD0 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unES); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xD7 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unSS); - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xDE + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unDS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x6E + 0x3) = offsetof(RAW_CONTEXT, m_unEDI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x75 + 0x3) = offsetof(RAW_CONTEXT, m_unESI); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x7C + 0x3) = offsetof(RAW_CONTEXT, m_unEBP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x83 + 0x3) = offsetof(RAW_CONTEXT, m_unEBX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x8A + 0x3) = offsetof(RAW_CONTEXT, m_unEDX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x91 + 0x3) = offsetof(RAW_CONTEXT, m_unECX); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x98 + 0x3) = offsetof(RAW_CONTEXT, m_unEAX); // Flags - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xE5 + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unEFLAGS); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0x9F + 0x3) = offsetof(RAW_CONTEXT, m_unEFLAGS); // Stack Modification - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xED + 0x3) = offsetof(RAW_HOOK_CONTEXT, m_unESP); + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xA7 + 0x3) = offsetof(RAW_CONTEXT, m_unESP); // Stack Deallocation - *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xF8 + 0x2) = unContextSize; + *reinterpret_cast(reinterpret_cast(m_pWrapper) + 0xB2 + 0x2) = unContextSize; } #endif @@ -83968,31 +83461,27 @@ namespace Detours { #ifdef _M_X64 if (bHaveAVX512) { - pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x4F3; + pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x436; } else if (bHaveAVX) { - pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x353; + pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x296; } else if (bHaveFPU) { - pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x353; + pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x296; } else if (bHaveSSE) { - pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x344; - } else if (bHaveMMX) { - pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x224; + pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x287; } else { - pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x1A4; + pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x157; } #elif _M_IX86 if (bHaveAVX512) { - pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x241; + pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x18B; } else if (bHaveAVX) { - pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x221; + pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x16B; } else if (bHaveFPU) { - pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x221; + pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x16B; } else if (bHaveSSE) { - pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x212; - } else if (bHaveMMX) { - pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x182; + pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0x15C; } else { - pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0xFE; + pJumpToTrampoline = reinterpret_cast(m_pWrapper) + 0xB8; } #endif diff --git a/Detours.h b/Detours.h index 52a8feb..0ab39dc 100644 --- a/Detours.h +++ b/Detours.h @@ -5029,7 +5029,7 @@ namespace Detours { }; // ---------------------------------------------------------------- - // RAW_HOOK_CONTEXT + // RAW_CONTEXT // ---------------------------------------------------------------- #pragma pack(push, r1, 1) @@ -5041,9 +5041,43 @@ namespace Detours { } RAW_HOOK_FPU_REGISTER, *PRAW_HOOK_FPU_REGISTER; typedef struct _RAW_HOOK_FPU { - unsigned short m_unControlWord; + union { + unsigned short m_unControlWord; + struct { + unsigned int m_unInvalidOperation : 1; + unsigned int m_unDenormalizedOperand : 1; + unsigned int m_unDivideByZero : 1; + unsigned int m_unOverflow : 1; + unsigned int m_unUnderflow : 1; + unsigned int m_unPrecision : 1; + unsigned int m_unReserved6 : 1; + unsigned int m_unReserved7 : 1; + unsigned int m_unPrecisionControl0 : 1; + unsigned int m_unPrecisionControl1 : 1; + unsigned int m_unRoundingControl0 : 1; + unsigned int m_unRoundingControl1 : 1; + unsigned int m_unInfinityControl : 1; + } ControlWord; + }; unsigned short m_unReserved1; - unsigned short m_unStatusWord; + union { + unsigned short m_unStatusWord; + struct { + unsigned int m_unInvalidOperation : 1; + unsigned int m_unDenormalizedOperand : 1; + unsigned int m_unDivideByZero : 1; + unsigned int m_unOverflow : 1; + unsigned int m_unUnderflow : 1; + unsigned int m_unPrecision : 1; + unsigned int m_unStackFault : 1; + unsigned int m_unExceptionSummary : 1; + unsigned int m_unCondition0 : 1; + unsigned int m_unCondition1 : 1; + unsigned int m_unCondition2 : 1; + unsigned int m_unCondition3 : 1; + unsigned int m_unFPUBusy : 1; + } StatusWord; + }; unsigned short m_unReserved2; unsigned short m_unTagWord; unsigned short m_unReserved3; @@ -5056,19 +5090,6 @@ namespace Detours { RAW_HOOK_FPU_REGISTER m_Registers[8]; } RAW_HOOK_FPU, *PRAW_HOOK_FPU; - typedef union _RAW_HOOK_M64 { - unsigned long long m_un64; - unsigned int m_un32[2]; - unsigned short m_un16[4]; - unsigned char m_un8[8]; - long long m_n64; - int m_n32[2]; - short m_n16[4]; - char m_n8[8]; - double m_f64; - float m_f32[2]; - } RAW_HOOK_M64, *PRAW_HOOK_M64; - typedef union _RAW_HOOK_M128 { unsigned long long m_un64[2]; unsigned int m_un32[4]; @@ -5110,7 +5131,7 @@ namespace Detours { #pragma pack(pop, r1) - typedef struct _RAW_HOOK_CONTEXT32 { + typedef struct _RAW_NATIVE_CONTEXT32 { // ---------------------------------------------------------------- // Flags @@ -5120,44 +5141,33 @@ namespace Detours { unsigned int m_unEFLAGS; unsigned short m_unFLAGS; struct { - unsigned int m_unCF : 1; // Bit 0: Carry Flag - unsigned int : 1; // Bit 1: Reserved - unsigned int m_unPF : 1; // Bit 2: Parity Flag - unsigned int : 1; // Bit 3: Reserved - unsigned int m_unAF : 1; // Bit 4: Auxiliary Carry Flag - unsigned int : 1; // Bit 5: Reserved - unsigned int m_unZF : 1; // Bit 6: Zero Flag - unsigned int m_unSF : 1; // Bit 7: Sign Flag - unsigned int m_unTF : 1; // Bit 8: Trap Flag - unsigned int m_unIF : 1; // Bit 9: Interrupt Enable Flag - unsigned int m_unDF : 1; // Bit 10: Direction Flag - unsigned int m_unOF : 1; // Bit 11: Overflow Flag + unsigned int m_unCF : 1; // Bit 0: Carry Flag + unsigned int : 1; // Bit 1: Reserved + unsigned int m_unPF : 1; // Bit 2: Parity Flag + unsigned int : 1; // Bit 3: Reserved + unsigned int m_unAF : 1; // Bit 4: Auxiliary Carry Flag + unsigned int : 1; // Bit 5: Reserved + unsigned int m_unZF : 1; // Bit 6: Zero Flag + unsigned int m_unSF : 1; // Bit 7: Sign Flag + unsigned int m_unTF : 1; // Bit 8: Trap Flag + unsigned int m_unIF : 1; // Bit 9: Interrupt Enable Flag + unsigned int m_unDF : 1; // Bit 10: Direction Flag + unsigned int m_unOF : 1; // Bit 11: Overflow Flag unsigned int m_unIOPL : 2; // Bit 12-13: I/O Privilege Level - unsigned int m_unNT : 1; // Bit 14: Nested Task - unsigned int m_unMD : 1; // Bit 15: Mode Flag - unsigned int m_unRF : 1; // Bit 16: Resume Flag - unsigned int m_unVM : 1; // Bit 17: Virtual 8086 Mode Flag - unsigned int m_unAC : 1; // Bit 18: Alignment Check - unsigned int m_unVIF : 1; // Bit 19: Virtual Interrupt Flag - unsigned int m_unVIP : 1; // Bit 20: Virtual Interrupt Pending - unsigned int m_unID : 1; // Bit 21: ID Flag - unsigned int : 8; // Bit 22-29: Reserved - unsigned int : 1; // Bit 30: Reserved - unsigned int m_unAI : 1; // Bit 31: Alignment Indicator + unsigned int m_unNT : 1; // Bit 14: Nested Task + unsigned int m_unMD : 1; // Bit 15: Mode Flag + unsigned int m_unRF : 1; // Bit 16: Resume Flag + unsigned int m_unVM : 1; // Bit 17: Virtual 8086 Mode Flag + unsigned int m_unAC : 1; // Bit 18: Alignment Check + unsigned int m_unVIF : 1; // Bit 19: Virtual Interrupt Flag + unsigned int m_unVIP : 1; // Bit 20: Virtual Interrupt Pending + unsigned int m_unID : 1; // Bit 21: ID Flag + unsigned int : 8; // Bit 22-29: Reserved + unsigned int : 1; // Bit 30: Reserved + unsigned int m_unAI : 1; // Bit 31: Alignment Indicator }; }; - // ---------------------------------------------------------------- - // Segments - // ---------------------------------------------------------------- - - unsigned short m_unCS; - unsigned short m_unDS; - unsigned short m_unSS; - unsigned short m_unES; - unsigned short m_unFS; - unsigned short m_unGS; - // ---------------------------------------------------------------- // Registers (General) // ---------------------------------------------------------------- @@ -5229,24 +5239,36 @@ namespace Detours { unsigned short m_unDI; unsigned char m_unDIL; }; + } RAW_NATIVE_CONTEXT32, *PRAW_NATIVE_CONTEXT32; - // ---------------------------------------------------------------- - // Registers (MMX) - // ---------------------------------------------------------------- - - RAW_HOOK_M64 m_MM0; - RAW_HOOK_M64 m_MM1; - RAW_HOOK_M64 m_MM2; - RAW_HOOK_M64 m_MM3; - RAW_HOOK_M64 m_MM4; - RAW_HOOK_M64 m_MM5; - RAW_HOOK_M64 m_MM6; - RAW_HOOK_M64 m_MM7; + typedef struct _RAW_CONTEXT32 : public RAW_NATIVE_CONTEXT32 { // ---------------------------------------------------------------- // Registers (SIMD) // ---------------------------------------------------------------- + union { + unsigned int m_unMXCSR; + struct { + unsigned int m_unInvalidOperation : 1; + unsigned int m_unDenormalizedOperand : 1; + unsigned int m_unDivideByZero : 1; + unsigned int m_unOverflow : 1; + unsigned int m_unUnderflow : 1; + unsigned int m_unPrecision : 1; + unsigned int m_unDenormalsAreZeros : 1; + unsigned int m_unInvalidOperationMask : 1; + unsigned int m_unDenormalMask : 1; + unsigned int m_unDivideByZeroMask : 1; + unsigned int m_unOverflowMask : 1; + unsigned int m_unUnderflowMask : 1; + unsigned int m_unPrecisionMask : 1; + unsigned int m_unRoundingControl0 : 1; + unsigned int m_unRoundingControl1 : 1; + unsigned int m_unFlushToZero : 1; + } MXCSR; + }; + union { RAW_HOOK_M512 m_ZMM0; RAW_HOOK_M256 m_YMM0; @@ -5300,9 +5322,9 @@ namespace Detours { // ---------------------------------------------------------------- RAW_HOOK_FPU m_FPU; - } RAW_HOOK_CONTEXT32, *PRAW_HOOK_CONTEXT32; + } RAW_CONTEXT32, *PRAW_CONTEXT32; - typedef struct _RAW_HOOK_CONTEXT64 { + typedef struct _RAW_NATIVE_CONTEXT64 { // ---------------------------------------------------------------- // Flags @@ -5313,45 +5335,34 @@ namespace Detours { unsigned int m_unEFLAGS; unsigned short m_unFLAGS; struct { - unsigned int m_unCF : 1; // Bit 0: Carry Flag - unsigned int : 1; // Bit 1: Reserved - unsigned int m_unPF : 1; // Bit 2: Parity Flag - unsigned int : 1; // Bit 3: Reserved - unsigned int m_unAF : 1; // Bit 4: Auxiliary Carry Flag - unsigned int : 1; // Bit 5: Reserved - unsigned int m_unZF : 1; // Bit 6: Zero Flag - unsigned int m_unSF : 1; // Bit 7: Sign Flag - unsigned int m_unTF : 1; // Bit 8: Trap Flag - unsigned int m_unIF : 1; // Bit 9: Interrupt Enable Flag - unsigned int m_unDF : 1; // Bit 10: Direction Flag - unsigned int m_unOF : 1; // Bit 11: Overflow Flag + unsigned int m_unCF : 1; // Bit 0: Carry Flag + unsigned int : 1; // Bit 1: Reserved + unsigned int m_unPF : 1; // Bit 2: Parity Flag + unsigned int : 1; // Bit 3: Reserved + unsigned int m_unAF : 1; // Bit 4: Auxiliary Carry Flag + unsigned int : 1; // Bit 5: Reserved + unsigned int m_unZF : 1; // Bit 6: Zero Flag + unsigned int m_unSF : 1; // Bit 7: Sign Flag + unsigned int m_unTF : 1; // Bit 8: Trap Flag + unsigned int m_unIF : 1; // Bit 9: Interrupt Enable Flag + unsigned int m_unDF : 1; // Bit 10: Direction Flag + unsigned int m_unOF : 1; // Bit 11: Overflow Flag unsigned int m_unIOPL : 2; // Bit 12-13: I/O Privilege Level - unsigned int m_unNT : 1; // Bit 14: Nested Task - unsigned int m_unMD : 1; // Bit 15: Mode Flag - unsigned int m_unRF : 1; // Bit 16: Resume Flag - unsigned int m_unVM : 1; // Bit 17: Virtual 8086 Mode Flag - unsigned int m_unAC : 1; // Bit 18: Alignment Check - unsigned int m_unVIF : 1; // Bit 19: Virtual Interrupt Flag - unsigned int m_unVIP : 1; // Bit 20: Virtual Interrupt Pending - unsigned int m_unID : 1; // Bit 21: ID Flag - unsigned int : 8; // Bit 22-29: Reserved - unsigned int : 1; // Bit 30: Reserved - unsigned int m_unAI : 1; // Bit 31: Alignment Indicator - unsigned int : 32; // Bit 32-63: Reserved + unsigned int m_unNT : 1; // Bit 14: Nested Task + unsigned int m_unMD : 1; // Bit 15: Mode Flag + unsigned int m_unRF : 1; // Bit 16: Resume Flag + unsigned int m_unVM : 1; // Bit 17: Virtual 8086 Mode Flag + unsigned int m_unAC : 1; // Bit 18: Alignment Check + unsigned int m_unVIF : 1; // Bit 19: Virtual Interrupt Flag + unsigned int m_unVIP : 1; // Bit 20: Virtual Interrupt Pending + unsigned int m_unID : 1; // Bit 21: ID Flag + unsigned int : 8; // Bit 22-29: Reserved + unsigned int : 1; // Bit 30: Reserved + unsigned int m_unAI : 1; // Bit 31: Alignment Indicator + unsigned int : 32; // Bit 32-63: Reserved }; }; - // ---------------------------------------------------------------- - // Segments - // ---------------------------------------------------------------- - - unsigned short m_unCS; - unsigned short m_unDS; - unsigned short m_unSS; - unsigned short m_unES; - unsigned short m_unFS; - unsigned short m_unGS; - // ---------------------------------------------------------------- // Registers (General) // ---------------------------------------------------------------- @@ -5495,24 +5506,36 @@ namespace Detours { unsigned short m_unR15W; unsigned char m_unR15B; }; + } RAW_NATIVE_CONTEXT64, *PRAW_NATIVE_CONTEXT64; - // ---------------------------------------------------------------- - // Registers (MMX) - // ---------------------------------------------------------------- - - RAW_HOOK_M64 m_MM0; - RAW_HOOK_M64 m_MM1; - RAW_HOOK_M64 m_MM2; - RAW_HOOK_M64 m_MM3; - RAW_HOOK_M64 m_MM4; - RAW_HOOK_M64 m_MM5; - RAW_HOOK_M64 m_MM6; - RAW_HOOK_M64 m_MM7; + typedef struct _RAW_CONTEXT64 : public RAW_NATIVE_CONTEXT64 { // ---------------------------------------------------------------- // Registers (SIMD) // ---------------------------------------------------------------- + union { + unsigned int m_unMXCSR; + struct { + unsigned int m_unInvalidOperation : 1; + unsigned int m_unDenormalizedOperand : 1; + unsigned int m_unDivideByZero : 1; + unsigned int m_unOverflow : 1; + unsigned int m_unUnderflow : 1; + unsigned int m_unPrecision : 1; + unsigned int m_unDenormalsAreZeros : 1; + unsigned int m_unInvalidOperationMask : 1; + unsigned int m_unDenormalMask : 1; + unsigned int m_unDivideByZeroMask : 1; + unsigned int m_unOverflowMask : 1; + unsigned int m_unUnderflowMask : 1; + unsigned int m_unPrecisionMask : 1; + unsigned int m_unRoundingControl0 : 1; + unsigned int m_unRoundingControl1 : 1; + unsigned int m_unFlushToZero : 1; + } MXCSR; + }; + union { RAW_HOOK_M512 m_ZMM0; RAW_HOOK_M256 m_YMM0; @@ -5710,14 +5733,16 @@ namespace Detours { // ---------------------------------------------------------------- RAW_HOOK_FPU m_FPU; - } RAW_HOOK_CONTEXT64, *PRAW_HOOK_CONTEXT64; + } RAW_CONTEXT64, *PRAW_CONTEXT64; #ifdef _M_X64 - typedef RAW_HOOK_CONTEXT64 RAW_HOOK_CONTEXT; - typedef PRAW_HOOK_CONTEXT64 PRAW_HOOK_CONTEXT; + typedef RAW_NATIVE_CONTEXT64 RAW_NATIVE_CONTEXT; + typedef RAW_CONTEXT64 RAW_CONTEXT; + typedef PRAW_CONTEXT64 PRAW_CONTEXT; #elif _M_IX86 - typedef RAW_HOOK_CONTEXT32 RAW_HOOK_CONTEXT; - typedef PRAW_HOOK_CONTEXT32 PRAW_HOOK_CONTEXT; + typedef RAW_NATIVE_CONTEXT32 RAW_NATIVE_CONTEXT; + typedef RAW_CONTEXT32 RAW_CONTEXT; + typedef PRAW_CONTEXT32 PRAW_CONTEXT; #endif // ---------------------------------------------------------------- @@ -5725,9 +5750,9 @@ namespace Detours { // ---------------------------------------------------------------- #ifdef _M_X64 - using fnRawHookCallBack = bool(__fastcall*)(PRAW_HOOK_CONTEXT pCTX); + using fnRawHookCallBack = bool(__fastcall*)(PRAW_CONTEXT pCTX); #elif _M_IX86 - using fnRawHookCallBack = bool(__cdecl*)(PRAW_HOOK_CONTEXT pCTX); + using fnRawHookCallBack = bool(__cdecl*)(PRAW_CONTEXT pCTX); #endif // ---------------------------------------------------------------- @@ -5745,7 +5770,7 @@ namespace Detours { bool Release(); public: - bool Hook(const fnRawHookCallBack pCallBack); + bool Hook(const fnRawHookCallBack pCallBack, bool bNative = false); bool UnHook(); public: diff --git a/asm.asm b/asm.asm index 4f8a087..5aab212 100644 --- a/asm.asm +++ b/asm.asm @@ -4,13 +4,6 @@ sub esp, 0x7FFFFFFF pushfd pop dword ptr [esp+0x7FFFFFFF] -mov word ptr [esp+0x7FFFFFFF], cs -mov word ptr [esp+0x7FFFFFFF], ds -mov word ptr [esp+0x7FFFFFFF], ss -mov word ptr [esp+0x7FFFFFFF], es -mov word ptr [esp+0x7FFFFFFF], fs -mov word ptr [esp+0x7FFFFFFF], gs - mov dword ptr [esp+0x7FFFFFFF], eax mov dword ptr [esp+0x7FFFFFFF], ecx mov dword ptr [esp+0x7FFFFFFF], edx @@ -21,14 +14,7 @@ mov dword ptr [esp+0x7FFFFFFF], ebp mov dword ptr [esp+0x7FFFFFFF], esi mov dword ptr [esp+0x7FFFFFFF], edi -movq [esp+0x7FFFFFFF], mm0 -movq [esp+0x7FFFFFFF], mm1 -movq [esp+0x7FFFFFFF], mm2 -movq [esp+0x7FFFFFFF], mm3 -movq [esp+0x7FFFFFFF], mm4 -movq [esp+0x7FFFFFFF], mm5 -movq [esp+0x7FFFFFFF], mm6 -movq [esp+0x7FFFFFFF], mm7 +stmxcsr [esp+0x7FFFFFFF] vmovups [esp+0x7FFFFFFF], xmm0 vmovups [esp+0x7FFFFFFF], xmm1 @@ -101,14 +87,7 @@ vmovups xmm2, [esp+0x7FFFFFFF] vmovups xmm1, [esp+0x7FFFFFFF] vmovups xmm0, [esp+0x7FFFFFFF] -movq mm7, [esp+0x7FFFFFFF] -movq mm6, [esp+0x7FFFFFFF] -movq mm5, [esp+0x7FFFFFFF] -movq mm4, [esp+0x7FFFFFFF] -movq mm3, [esp+0x7FFFFFFF] -movq mm2, [esp+0x7FFFFFFF] -movq mm1, [esp+0x7FFFFFFF] -movq mm0, [esp+0x7FFFFFFF] +ldmxcsr [esp+0x7FFFFFFF] mov edi, dword ptr [esp+0x7FFFFFFF] mov esi, dword ptr [esp+0x7FFFFFFF] @@ -119,12 +98,6 @@ mov edx, dword ptr [esp+0x7FFFFFFF] mov ecx, dword ptr [esp+0x7FFFFFFF] mov eax, dword ptr [esp+0x7FFFFFFF] -mov gs, word ptr [esp+0x7FFFFFFF] - -mov es, word ptr [esp+0x7FFFFFFF] -mov ss, word ptr [esp+0x7FFFFFFF] -mov ds, word ptr [esp+0x7FFFFFFF] - push dword ptr [esp+0x7FFFFFFF] popfd diff --git a/asm64.asm b/asm64.asm index c16b2c6..c971034 100644 --- a/asm64.asm +++ b/asm64.asm @@ -4,13 +4,6 @@ sub rsp, 0x7FFFFFFF pushfq pop qword ptr [rsp+0x7FFFFFFF] -mov word ptr [rsp+0x7FFFFFFF], cs -mov word ptr [rsp+0x7FFFFFFF], ds -mov word ptr [rsp+0x7FFFFFFF], ss -mov word ptr [rsp+0x7FFFFFFF], es -mov word ptr [rsp+0x7FFFFFFF], fs -mov word ptr [rsp+0x7FFFFFFF], gs - mov qword ptr [rsp+0x7FFFFFFF], rax mov qword ptr [rsp+0x7FFFFFFF], rcx mov qword ptr [rsp+0x7FFFFFFF], rdx @@ -29,14 +22,7 @@ mov qword ptr [rsp+0x7FFFFFFF], r13 mov qword ptr [rsp+0x7FFFFFFF], r14 mov qword ptr [rsp+0x7FFFFFFF], r15 -movq [rsp+0x7FFFFFFF], mm0 -movq [rsp+0x7FFFFFFF], mm1 -movq [rsp+0x7FFFFFFF], mm2 -movq [rsp+0x7FFFFFFF], mm3 -movq [rsp+0x7FFFFFFF], mm4 -movq [rsp+0x7FFFFFFF], mm5 -movq [rsp+0x7FFFFFFF], mm6 -movq [rsp+0x7FFFFFFF], mm7 +stmxcsr [rsp+0x7FFFFFFF] vmovups [rsp+0x7FFFFFFF], xmm0 vmovups [rsp+0x7FFFFFFF], xmm1 @@ -190,14 +176,7 @@ vmovups xmm2, [rsp+0x7FFFFFFF] vmovups xmm1, [rsp+0x7FFFFFFF] vmovups xmm0, [rsp+0x7FFFFFFF] -movq mm7, [rsp+0x7FFFFFFF] -movq mm6, [rsp+0x7FFFFFFF] -movq mm5, [rsp+0x7FFFFFFF] -movq mm4, [rsp+0x7FFFFFFF] -movq mm3, [rsp+0x7FFFFFFF] -movq mm2, [rsp+0x7FFFFFFF] -movq mm1, [rsp+0x7FFFFFFF] -movq mm0, [rsp+0x7FFFFFFF] +ldmxcsr [rsp+0x7FFFFFFF] mov r15, qword ptr [rsp+0x7FFFFFFF] mov r14, qword ptr [rsp+0x7FFFFFFF] @@ -216,12 +195,6 @@ mov rdx, qword ptr [rsp+0x7FFFFFFF] mov rcx, qword ptr [rsp+0x7FFFFFFF] mov rax, qword ptr [rsp+0x7FFFFFFF] -mov gs, word ptr [rsp+0x7FFFFFFF] -mov fs, word ptr [rsp+0x7FFFFFFF] -mov es, word ptr [rsp+0x7FFFFFFF] -mov ss, word ptr [rsp+0x7FFFFFFF] -mov ds, word ptr [rsp+0x7FFFFFFF] - push qword ptr [rsp+0x7FFFFFFF] popfq diff --git a/main.cpp b/main.cpp index b9cdfb7..516426b 100644 --- a/main.cpp +++ b/main.cpp @@ -648,9 +648,9 @@ void WINAPI Sleep_Hook(DWORD dwMilliseconds) { Detours::Hook::RawHook RawSleepHook; #ifdef _M_X64 -bool __fastcall Sleep_RawHook(Detours::Hook::PRAW_HOOK_CONTEXT pCTX) { +bool __fastcall Sleep_RawHook(Detours::Hook::PRAW_CONTEXT pCTX) { #elif _M_IX86 -bool __cdecl Sleep_RawHook(Detours::Hook::PRAW_HOOK_CONTEXT pCTX) { +bool __cdecl Sleep_RawHook(Detours::Hook::PRAW_CONTEXT pCTX) { #endif #if defined(_DEBUG) || !defined(_M_X64) // NOTE: Using a stack inside a RawHook callback will produce unpredictable results. _tprintf_s(_T("[Sleep_RawHook] Hook called!\n")); @@ -659,7 +659,6 @@ bool __cdecl Sleep_RawHook(Detours::Hook::PRAW_HOOK_CONTEXT pCTX) { __cpuid(cpuinfo, 1); const bool bHaveFPU = (cpuinfo[3] & 1) != 0; - const bool bHaveMMX = (cpuinfo[3] & (1 << 23)) != 0; const bool bHaveSSE = (cpuinfo[3] & (1 << 25)) != 0; const bool bHaveAVX = (cpuinfo[2] & (1 << 28)) != 0; @@ -692,13 +691,6 @@ bool __cdecl Sleep_RawHook(Detours::Hook::PRAW_HOOK_CONTEXT pCTX) { _tprintf_s(_T(" -> ID = %hhu\n"), pCTX->m_unID); _tprintf_s(_T(" -> AI = %hhu\n"), pCTX->m_unAI); - _tprintf_s(_T(" -> CS = 0x%04X\n"), pCTX->m_unCS); - _tprintf_s(_T(" -> DS = 0x%04X\n"), pCTX->m_unDS); - _tprintf_s(_T(" -> SS = 0x%04X\n"), pCTX->m_unSS); - _tprintf_s(_T(" -> ES = 0x%04X\n"), pCTX->m_unES); - _tprintf_s(_T(" -> FS = 0x%04X\n"), pCTX->m_unFS); - _tprintf_s(_T(" -> GS = 0x%04X\n"), pCTX->m_unGS); - #ifdef _M_X64 _tprintf_s(_T(" -> RAX = 0x%016llX\n"), pCTX->m_unRAX); _tprintf_s(_T(" -> RCX = 0x%016llX\n"), pCTX->m_unRCX); @@ -737,18 +729,9 @@ bool __cdecl Sleep_RawHook(Detours::Hook::PRAW_HOOK_CONTEXT pCTX) { } } - if (bHaveMMX) { - _tprintf_s(_T(" -> MM0 = 0x%016llX\n"), pCTX->m_MM0.m_un64); - _tprintf_s(_T(" -> MM1 = 0x%016llX\n"), pCTX->m_MM1.m_un64); - _tprintf_s(_T(" -> MM2 = 0x%016llX\n"), pCTX->m_MM2.m_un64); - _tprintf_s(_T(" -> MM3 = 0x%016llX\n"), pCTX->m_MM3.m_un64); - _tprintf_s(_T(" -> MM4 = 0x%016llX\n"), pCTX->m_MM4.m_un64); - _tprintf_s(_T(" -> MM5 = 0x%016llX\n"), pCTX->m_MM5.m_un64); - _tprintf_s(_T(" -> MM6 = 0x%016llX\n"), pCTX->m_MM6.m_un64); - _tprintf_s(_T(" -> MM7 = 0x%016llX\n"), pCTX->m_MM7.m_un64); - } - if (bHaveAVX512) { + _tprintf_s(_T(" -> MXCSR = 0x%08X\n"), pCTX->m_unMXCSR); + _tprintf_s(_T(" -> ZMM0 = 0x")); for (int i = 63; i >= 0; --i) { _tprintf_s(_T("%02X"), pCTX->m_ZMM0.m_un8[i]); @@ -943,6 +926,8 @@ bool __cdecl Sleep_RawHook(Detours::Hook::PRAW_HOOK_CONTEXT pCTX) { _tprintf_s(_T("\n")); #endif } else if (bHaveAVX) { + _tprintf_s(_T(" -> MXCSR = 0x%08X\n"), pCTX->m_unMXCSR); + _tprintf_s(_T(" -> YMM0 = 0x")); for (int i = 31; i >= 0; --i) { _tprintf_s(_T("%02X"), pCTX->m_YMM0.m_un8[i]); @@ -1041,6 +1026,8 @@ bool __cdecl Sleep_RawHook(Detours::Hook::PRAW_HOOK_CONTEXT pCTX) { _tprintf_s(_T("\n")); #endif } else if (bHaveSSE) { + _tprintf_s(_T(" -> MXCSR = 0x%08X\n"), pCTX->m_unMXCSR); + _tprintf_s(_T(" -> XMM0 = 0x")); for (int i = 15; i >= 0; --i) { _tprintf_s(_T("%02X"), pCTX->m_XMM0.m_un8[i]); @@ -1156,9 +1143,9 @@ bool __cdecl Sleep_RawHook(Detours::Hook::PRAW_HOOK_CONTEXT pCTX) { Detours::Hook::RAW_HOOK_M128 g_LastXMM7; #ifdef _M_X64 -bool __fastcall Sleep_RawHookMod(Detours::Hook::PRAW_HOOK_CONTEXT pCTX) { +bool __fastcall Sleep_RawHookMod(Detours::Hook::PRAW_CONTEXT pCTX) { #elif _M_IX86 -bool __cdecl Sleep_RawHookMod(Detours::Hook::PRAW_HOOK_CONTEXT pCTX) { +bool __cdecl Sleep_RawHookMod(Detours::Hook::PRAW_CONTEXT pCTX) { #endif g_LastXMM7 = pCTX->m_XMM7; pCTX->m_XMM7.m_un64[0] = 0x1122334455667788; @@ -1179,9 +1166,9 @@ bool __cdecl Sleep_RawHookMod(Detours::Hook::PRAW_HOOK_CONTEXT pCTX) { Detours::Hook::RawHook RawCPUIDHook; #ifdef _M_X64 -bool __fastcall CPUID_RawHook(Detours::Hook::PRAW_HOOK_CONTEXT pCTX) { +bool __fastcall CPUID_RawHook(Detours::Hook::PRAW_CONTEXT pCTX) { #elif _M_IX86 -bool __cdecl CPUID_RawHook(Detours::Hook::PRAW_HOOK_CONTEXT pCTX) { +bool __cdecl CPUID_RawHook(Detours::Hook::PRAW_CONTEXT pCTX) { #endif #ifdef _M_X64 pCTX->m_unEBX = 0x11223344; @@ -1225,7 +1212,7 @@ void DemoRawHook() { SELF_EXPORT("DemoHook"); } _tprintf_s(_T("RawCPUIDHook.Set = %d\n"), RawCPUIDHook.Set(pFoundCPUID)); - _tprintf_s(_T("RawCPUIDHook.Hook = %d\n"), RawCPUIDHook.Hook(CPUID_RawHook)); + _tprintf_s(_T("RawCPUIDHook.Hook = %d\n"), RawCPUIDHook.Hook(CPUID_RawHook, true)); int cpuinfo[4]; __cpuidex(cpuinfo, 7, 0); // Hooking `cpuid` in this function. @@ -1253,9 +1240,9 @@ bool __cdecl new_foo(void* pThis) { Detours::Hook::RawHook RawHook_CallConv_Convert; #ifdef _M_X64 -bool __fastcall CallConv_Convert_RawHook(Detours::Hook::PRAW_HOOK_CONTEXT pCTX) { +bool __fastcall CallConv_Convert_RawHook(Detours::Hook::PRAW_CONTEXT pCTX) { #elif _M_IX86 -bool __cdecl CallConv_Convert_RawHook(Detours::Hook::PRAW_HOOK_CONTEXT pCTX) { +bool __cdecl CallConv_Convert_RawHook(Detours::Hook::PRAW_CONTEXT pCTX) { #endif // Converting __thiscall to __fastcall/__cdecl and redirect it @@ -1828,7 +1815,7 @@ int _tmain(int nArguments, PTCHAR* pArguments) { void** pHookingVTable = pHookingObject->GetVTable(); _tprintf_s(_T("RawHook_CallConv_Convert.Set = %d\n"), RawHook_CallConv_Convert.Set(pHookingVTable[0])); - _tprintf_s(_T("RawHook_CallConv_Convert.Hook = %d\n"), RawHook_CallConv_Convert.Hook(CallConv_Convert_RawHook)); + _tprintf_s(_T("RawHook_CallConv_Convert.Hook = %d\n"), RawHook_CallConv_Convert.Hook(CallConv_Convert_RawHook, true)); _tprintf_s(_T("g_pTestingRTTI->foo = %d\n"), g_pTestingRTTI->foo());