From 886796d6e66113b458a0866decf1efb824171136 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 29 Mar 2018 13:48:15 +0000 Subject: [PATCH 01/12] Trace package: use base-on-api to base breakpoints bp0-bp3 in options, 64 instructions traced for each bp. --- CAPE/CAPE.c | 14 +-- CAPE/CAPE.h | 4 +- CAPE/Trace.c | 194 ++++++++++++++++++++++++++++++++++++++ config.c | 42 ++++++--- config.h | 1 + cuckoomon.vcxproj | 5 +- cuckoomon.vcxproj.filters | 3 + hook_special.c | 2 +- hooking.c | 46 +++++++++ 9 files changed, 286 insertions(+), 25 deletions(-) create mode 100644 CAPE/Trace.c diff --git a/CAPE/CAPE.c b/CAPE/CAPE.c index c6ffd91..0257181 100644 --- a/CAPE/CAPE.c +++ b/CAPE/CAPE.c @@ -205,13 +205,13 @@ LPVOID GetReturnAddress(hook_info_t *hookinfo) } //************************************************************************************** -void GetHookCallerBase() +PVOID GetHookCallerBase() //************************************************************************************** { PVOID ReturnAddress, AllocationBase; if (CallingModule) - return; + return NULL; ReturnAddress = GetReturnAddress(hook_info()); @@ -225,13 +225,13 @@ void GetHookCallerBase() if (AllocationBase) { CallingModule = AllocationBase; - // Base-dependent breakpoints can be activated now + return CallingModule; } } else DoOutputDebugString("GetHookCallerBase: failed to get return address.\n"); - return; + return NULL; } //************************************************************************************** @@ -1886,7 +1886,7 @@ void init_CAPE() // made at the end of a process' lifetime. // It is normally only set in the base packages, // or upon submission. (This overrides submission.) - // g_config.procmemdump = 0; + g_config.procdump = 0; // Cuckoo debug output level for development (0=none, 2=max) // g_config.debug = 2; @@ -1900,9 +1900,9 @@ void init_CAPE() DoOutputDebugString("Failed to initialise debugger.\n"); #ifdef _WIN64 - DoOutputDebugString("CAPE initialised: 64-bit base package loaded at 0x%p, process image base 0x%p\n", g_our_dll_base, GetModuleHandle(NULL)); + DoOutputDebugString("CAPE initialised: 64-bit Trace package loaded at 0x%p, process image base 0x%p\n", g_our_dll_base, GetModuleHandle(NULL)); #else - DoOutputDebugString("CAPE initialised: 32-bit base package loaded at 0x%p, process image base 0x%p\n", g_our_dll_base, GetModuleHandle(NULL)); + DoOutputDebugString("CAPE initialised: 32-bit Trace package loaded at 0x%p, process image base 0x%p\n", g_our_dll_base, GetModuleHandle(NULL)); #endif return; diff --git a/CAPE/CAPE.h b/CAPE/CAPE.h index e24309b..633d0de 100644 --- a/CAPE/CAPE.h +++ b/CAPE/CAPE.h @@ -20,9 +20,9 @@ extern WCHAR s_wzDllPath[MAX_PATH]; extern CHAR s_szDllPath[MAX_PATH]; //Global debugger switch -#define DEBUGGER_ENABLED 0 +#define DEBUGGER_ENABLED 1 -void GetHookCallerBase(); +PVOID GetHookCallerBase(); PVOID GetPageAddress(PVOID Address); PVOID GetAllocationBase(PVOID Address); BOOL TranslatePathFromDeviceToLetter(__in TCHAR *DeviceFilePath, __out TCHAR* DriveLetterFilePath, __inout LPDWORD lpdwBufferSize); diff --git a/CAPE/Trace.c b/CAPE/Trace.c new file mode 100644 index 0000000..0300d28 --- /dev/null +++ b/CAPE/Trace.c @@ -0,0 +1,194 @@ +/* +CAPE - Config And Payload Extraction +Copyright(C) 2015 - 2018 Context Information Security. (kevin.oreilly@contextis.com) + +This program is free software : you can redistribute it and / or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program.If not, see . +*/ +#include "..\hooking.h" +#include +#include "Debugger.h" +#include "CAPE.h" + +#define MAX_INSTRUCTIONS 0x10 +#define SINGLE_STEP_LIMIT 0x80 +#define CHUNKSIZE 0x10 * MAX_INSTRUCTIONS + +extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); +extern void DoOutputErrorString(_In_ LPCTSTR lpOutputString, ...); +extern int DumpModuleInCurrentProcess(LPVOID ModuleBase); +extern int DumpMemory(LPVOID Buffer, SIZE_T Size); + +extern DWORD_PTR FileOffsetToVA(DWORD_PTR modBase, DWORD_PTR dwOffset); +BOOL BreakpointSet; +unsigned int DumpCount, Correction, StepCount; +PVOID ModuleBase, DumpAddress; +SIZE_T DumpSize; +BOOL GetSystemTimeAsFileTimeImported, PayloadMarker, PayloadDumped; + + +BOOL Trace(struct _EXCEPTION_POINTERS* ExceptionInfo) +{ + + _DecodeResult Result; + _OffsetType Offset = 0; + _DecodedInst DecodedInstruction; + unsigned int DecodedInstructionsCount = 0; + +#ifdef _WIN64 + _DecodeType DecodeType = Decode64Bits; +#else + _DecodeType DecodeType = Decode32Bits; +#endif + + StepCount++; + + if (StepCount > SINGLE_STEP_LIMIT) + { + DoOutputDebugString("Trace: single-step limit reached, releasing."); + + return TRUE; + } + +#ifdef _WIN64 + Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Rip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); +#else + Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Eip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); +#endif + + //DoOutputDebugString("%0*I64x ", 8, ExceptionInfo->ContextRecord->Eip); + //DoOutputDebugString("(%02d) ", DecodedInstruction.size); + //DoOutputDebugString("%-24s ", (char*)DecodedInstruction.instructionHex.p); + //DoOutputDebugString("%s", (char*)DecodedInstruction.mnemonic.p); + //DoOutputDebugString("%s", DecodedInstruction.operands.length != 0 ? " " : ""); + //DoOutputDebugString("%s\n", (char*)DecodedInstruction.operands.p); + + DoOutputDebugString("0x%x (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Eip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); + + SetSingleStepMode(ExceptionInfo->ContextRecord, Trace); + + return TRUE; +} + +BOOL BreakpointCallback(PBREAKPOINTINFO pBreakpointInfo, struct _EXCEPTION_POINTERS* ExceptionInfo) +{ + if (pBreakpointInfo == NULL) + { + DoOutputDebugString("BreakpointCallback executed with pBreakpointInfo NULL.\n"); + return FALSE; + } + + if (pBreakpointInfo->ThreadHandle == NULL) + { + DoOutputDebugString("BreakpointCallback executed with NULL thread handle.\n"); + return FALSE; + } + + DoOutputDebugString("BreakpointCallback: Breakpoint %i Size=0x%x and Address=0x%p.\n", pBreakpointInfo->Register, pBreakpointInfo->Size, pBreakpointInfo->Address); + + StepCount = 0; + + //ContextClearCurrentBreakpoint(ExceptionInfo->ContextRecord); + + StepOverExecutionBreakpoint(ExceptionInfo->ContextRecord, pBreakpointInfo); + + SetSingleStepMode(ExceptionInfo->ContextRecord, Trace); + + return TRUE; +} + +BOOL SetInitialBreakpoints(PVOID ImageBase) +{ + DWORD_PTR BreakpointVA; + DWORD Register; + + if (!bp0 && !bp1 && !bp2 && !bp3) + { + DoOutputDebugString("SetInitialBreakpoints: Error - No address specified for Trace breakpoints.\n"); + return FALSE; + } + + if (bp0) + { + Register = 0; + BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp0; + + if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) + { + DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p\n", Register, BreakpointVA); + BreakpointSet = TRUE; + } + else + { + DoOutputDebugString("SetInitialBreakpoints: SetBreakpoint failed.\n"); + BreakpointSet = FALSE; + return FALSE; + } + } + + if (bp1) + { + Register = 1; + BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp1; + + if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) + { + DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p\n", Register, BreakpointVA); + BreakpointSet = TRUE; + } + else + { + DoOutputDebugString("SetInitialBreakpoints: SetBreakpoint failed.\n"); + BreakpointSet = FALSE; + return FALSE; + } + } + + if (bp2) + { + Register = 2; + BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp2; + + if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) + { + DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p\n", Register, BreakpointVA); + BreakpointSet = TRUE; + } + else + { + DoOutputDebugString("SetInitialBreakpoints: SetBreakpoint failed.\n"); + BreakpointSet = FALSE; + return FALSE; + } + } + + if (bp3) + { + Register = 3; + BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp3; + + if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) + { + DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p\n", Register, BreakpointVA); + BreakpointSet = TRUE; + } + else + { + DoOutputDebugString("SetInitialBreakpoints: SetBreakpoint failed.\n"); + BreakpointSet = FALSE; + return FALSE; + } + } + + return BreakpointSet; +} diff --git a/config.c b/config.c index f4df68a..e82e07c 100644 --- a/config.c +++ b/config.c @@ -24,7 +24,7 @@ along with this program. If not, see . #include "hooking.h" extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); -extern DWORD_PTR CAPE_var1, CAPE_var2, CAPE_var3, CAPE_var4; +extern PVOID bp0, bp1, bp2, bp3; int read_config(void) { @@ -218,21 +218,37 @@ int read_config(void) p = p2 + 1; } } - else if (!strcmp(key, "CAPE_var1")) { - CAPE_var1 = (DWORD_PTR)strtoul(value, NULL, 10); - DoOutputDebugString("CAPE_var1 set to 0x%x", CAPE_var1); + else if (!strcmp(key, "base-on-api")) { + unsigned int x = 0; + char *p2; + p = value; + while (p && x < EXCLUSION_MAX) { + p2 = strchr(p, ':'); + if (p2) { + *p2 = '\0'; + } + g_config.base_on_apiname[x++] = strdup(p); + DoOutputDebugString("Added '%s' to base-on-API list.\n", p); + if (p2 == NULL) + break; + p = p2 + 1; + } + } + else if (!strcmp(key, "bp0")) { + bp0 = (PVOID)strtoul(value, NULL, 10); + DoOutputDebugString("bp0 set to 0x%x", bp0); } - else if (!strcmp(key, "CAPE_var2")) { - CAPE_var2 = (DWORD_PTR)strtoul(value, NULL, 10); - DoOutputDebugString("CAPE_var2 set to 0x%x", CAPE_var2); + else if (!strcmp(key, "bp1")) { + bp1 = (PVOID)strtoul(value, NULL, 10); + DoOutputDebugString("bp1 set to 0x%x", bp1); } - else if (!strcmp(key, "CAPE_var3")) { - CAPE_var3 = (DWORD_PTR)strtoul(value, NULL, 10); - DoOutputDebugString("CAPE_var3 set to 0x%x", CAPE_var3); + else if (!strcmp(key, "bp2")) { + bp2 = (PVOID)strtoul(value, NULL, 10); + DoOutputDebugString("bp2 set to 0x%x", bp2); } - else if (!strcmp(key, "CAPE_var4")) { - CAPE_var4 = (DWORD_PTR)strtoul(value, NULL, 10); - DoOutputDebugString("CAPE_var4 set to 0x%x", CAPE_var4); + else if (!strcmp(key, "bp3")) { + bp3 = (PVOID)strtoul(value, NULL, 10); + DoOutputDebugString("bp3 set to 0x%x", bp3); } else if (!strcmp(key, "procdump")) { g_config.procdump = value[0] == '1'; diff --git a/config.h b/config.h index 2d67042..d60503f 100644 --- a/config.h +++ b/config.h @@ -104,6 +104,7 @@ struct _g_config { char *excluded_apinames[EXCLUSION_MAX]; wchar_t *excluded_dllnames[EXCLUSION_MAX]; + char *base_on_apiname[EXCLUSION_MAX]; // should we dump each process on exit/analysis timeout? int procdump; diff --git a/cuckoomon.vcxproj b/cuckoomon.vcxproj index 5670e78..acbaa72 100644 --- a/cuckoomon.vcxproj +++ b/cuckoomon.vcxproj @@ -78,14 +78,14 @@ true AllRules.ruleset false - CAPE + Trace $(VC_IncludePath);$(WindowsSdk_71A_IncludePath);C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\WTL91\Include; true AllRules.ruleset false - CAPE_x64 + Trace_x64 .dll $(VC_IncludePath);$(WindowsSdk_71A_IncludePath);C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\WTL91\Include; @@ -213,6 +213,7 @@ + diff --git a/cuckoomon.vcxproj.filters b/cuckoomon.vcxproj.filters index 1f7f83a..6478be1 100644 --- a/cuckoomon.vcxproj.filters +++ b/cuckoomon.vcxproj.filters @@ -276,6 +276,9 @@ Source Files\CAPE + + Source Files\CAPE + diff --git a/hook_special.c b/hook_special.c index a134e89..cb67047 100644 --- a/hook_special.c +++ b/hook_special.c @@ -124,7 +124,7 @@ HOOKDEF_NOTAIL(WINAPI, LdrUnloadDll, RoutineProcessDump(); } - DoOutputDebugString("DLL unloaded from 0x%p.\n", DllImageBase); + //DoOutputDebugString("DLL unloaded from 0x%p.\n", DllImageBase); return 0; } diff --git a/hooking.c b/hooking.c index f97aaba..3ea7f6b 100644 --- a/hooking.c +++ b/hooking.c @@ -28,6 +28,13 @@ along with this program. If not, see . extern DWORD g_tls_hook_index; +extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); +extern PVOID GetAllocationBase(PVOID Address); +extern SIZE_T GetAllocationSize(PVOID Address); +extern PVOID GetHookCallerBase(); +extern BOOL SetInitialBreakpoints(PVOID ImageBase); +BOOL BreakpointsSet; + #ifdef _WIN64 #define TLS_LAST_WIN32_ERROR 0x68 #define TLS_LAST_NTSTATUS_ERROR 0x1250 @@ -59,6 +66,43 @@ static int set_caller_info(void *unused, ULONG_PTR addr) return 0; } +void base_on_api(hook_t *h) +{ + unsigned int i; + hook_info_t *hookinfo = hook_info(); + + for (i = 0; i < ARRAYSIZE(g_config.base_on_apiname); i++) { + if (!g_config.base_on_apiname[i]) + break; + if (!BreakpointsSet && !stricmp(h->funcname, g_config.base_on_apiname[i])) { + if (hookinfo->main_caller_retaddr) { + BreakpointsSet = SetInitialBreakpoints((PVOID)hookinfo->main_caller_retaddr); + if (BreakpointsSet) { + DoOutputDebugString("Base-on-API: Breakpoints set.\n"); + } + else + DoOutputDebugString("Base-on-API: Failed to set breakpoints.\n"); + } + else + DoOutputDebugString("Base-on-API: No main_caller_retaddr to get caller base.\n"); + PVOID ImageBase = GetHookCallerBase(); + if (ImageBase) { + BreakpointsSet = SetInitialBreakpoints((PVOID)ImageBase); + if (BreakpointsSet) { + DoOutputDebugString("Base-on-API: GetHookCallerBase success 0x%p - Breakpoints set.\n", ImageBase); + } + else + DoOutputDebugString("Base-on-API: Failed to set breakpoints on 0x%p.\n", ImageBase); + } + else + DoOutputDebugString("Base-on-API: GetHookCallerBase fail.\n"); + return; + } + } + + return; +} + int hook_is_excluded(hook_t *h) { unsigned int i; @@ -144,6 +188,8 @@ int WINAPI enter_hook(hook_t *h, ULONG_PTR sp, ULONG_PTR ebp_or_rip) operate_on_backtrace(sp, ebp_or_rip, NULL, set_caller_info); + base_on_api(h); + return 1; } From ff05ca89dc9daad40338b53e2e46a1e7e4aecd3e Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 29 Mar 2018 16:44:24 +0100 Subject: [PATCH 02/12] Complete basic functionality for both 32 & 64 bit. --- CAPE/Trace.c | 25 +++++++++---------------- hooking.c | 8 +++++--- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/CAPE/Trace.c b/CAPE/Trace.c index 0300d28..f7cdfa6 100644 --- a/CAPE/Trace.c +++ b/CAPE/Trace.c @@ -45,12 +45,6 @@ BOOL Trace(struct _EXCEPTION_POINTERS* ExceptionInfo) _DecodedInst DecodedInstruction; unsigned int DecodedInstructionsCount = 0; -#ifdef _WIN64 - _DecodeType DecodeType = Decode64Bits; -#else - _DecodeType DecodeType = Decode32Bits; -#endif - StepCount++; if (StepCount > SINGLE_STEP_LIMIT) @@ -61,19 +55,14 @@ BOOL Trace(struct _EXCEPTION_POINTERS* ExceptionInfo) } #ifdef _WIN64 + _DecodeType DecodeType = Decode64Bits; Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Rip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); + DoOutputDebugString("0x%p (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Rip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); #else + _DecodeType DecodeType = Decode32Bits; Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Eip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); -#endif - - //DoOutputDebugString("%0*I64x ", 8, ExceptionInfo->ContextRecord->Eip); - //DoOutputDebugString("(%02d) ", DecodedInstruction.size); - //DoOutputDebugString("%-24s ", (char*)DecodedInstruction.instructionHex.p); - //DoOutputDebugString("%s", (char*)DecodedInstruction.mnemonic.p); - //DoOutputDebugString("%s", DecodedInstruction.operands.length != 0 ? " " : ""); - //DoOutputDebugString("%s\n", (char*)DecodedInstruction.operands.p); - DoOutputDebugString("0x%x (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Eip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); +#endif SetSingleStepMode(ExceptionInfo->ContextRecord, Trace); @@ -121,11 +110,12 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) if (bp0) { Register = 0; + if (!ImageBase) ImageBase = GetModuleHandle(NULL); BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp0; if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) { - DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p\n", Register, BreakpointVA); + DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p (image base 0x%p, RVA 0x%x)\n", Register, BreakpointVA, ImageBase, bp0); BreakpointSet = TRUE; } else @@ -139,6 +129,7 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) if (bp1) { Register = 1; + if (!ImageBase) ImageBase = GetModuleHandle(NULL); BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp1; if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) @@ -157,6 +148,7 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) if (bp2) { Register = 2; + if (!ImageBase) ImageBase = GetModuleHandle(NULL); BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp2; if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) @@ -175,6 +167,7 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) if (bp3) { Register = 3; + if (!ImageBase) ImageBase = GetModuleHandle(NULL); BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp3; if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) diff --git a/hooking.c b/hooking.c index 3ea7f6b..59fb7b7 100644 --- a/hooking.c +++ b/hooking.c @@ -74,9 +74,10 @@ void base_on_api(hook_t *h) for (i = 0; i < ARRAYSIZE(g_config.base_on_apiname); i++) { if (!g_config.base_on_apiname[i]) break; - if (!BreakpointsSet && !stricmp(h->funcname, g_config.base_on_apiname[i])) { + if (!BreakpointsSet && !called_by_hook() && !stricmp(h->funcname, g_config.base_on_apiname[i])) { if (hookinfo->main_caller_retaddr) { - BreakpointsSet = SetInitialBreakpoints((PVOID)hookinfo->main_caller_retaddr); + if (!BreakpointsSet) + BreakpointsSet = SetInitialBreakpoints(GetAllocationBase((PVOID)hookinfo->main_caller_retaddr)); if (BreakpointsSet) { DoOutputDebugString("Base-on-API: Breakpoints set.\n"); } @@ -87,7 +88,8 @@ void base_on_api(hook_t *h) DoOutputDebugString("Base-on-API: No main_caller_retaddr to get caller base.\n"); PVOID ImageBase = GetHookCallerBase(); if (ImageBase) { - BreakpointsSet = SetInitialBreakpoints((PVOID)ImageBase); + if (!BreakpointsSet) + BreakpointsSet = SetInitialBreakpoints((PVOID)ImageBase); if (BreakpointsSet) { DoOutputDebugString("Base-on-API: GetHookCallerBase success 0x%p - Breakpoints set.\n", ImageBase); } From eece85f81406d3784b7bcceb8ee237019b6b64f8 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 2 May 2018 14:35:35 +0000 Subject: [PATCH 03/12] Further development and merging of fixes from main package. --- CAPE/CAPE.c | 79 ++++++++++++++--------------- CAPE/CAPE.h | 4 +- CAPE/Debugger.h | 2 + CAPE/Output.c | 2 + CAPE/ScyllaHarness.cpp | 36 ++++++++++++++ CAPE/Trace.c | 110 ++++++++++++++++++++++++++++++++++------- cuckoomon.c | 31 +++++++----- hook_file.c | 72 +++++++++++---------------- hook_misc.c | 35 +++++++++++-- hook_process.c | 20 +++++--- hook_special.c | 14 +++--- hook_thread.c | 58 +++++++++++++++------- hooking.c | 89 +++++++++++++++------------------ hooking.h | 3 ++ lookup.c | 51 +++++++++++++++++++ lookup.h | 4 ++ misc.c | 4 +- unhook.c | 12 ++++- 18 files changed, 417 insertions(+), 209 deletions(-) diff --git a/CAPE/CAPE.c b/CAPE/CAPE.c index 0257181..4612acd 100644 --- a/CAPE/CAPE.c +++ b/CAPE/CAPE.c @@ -101,11 +101,17 @@ typedef struct _hook_info_t { ULONG_PTR parent_caller_retaddr; } hook_info_t; -static unsigned int DumpCount; +#define CAPE_OUTPUT_FILE "CapeOutput.bin" extern uint32_t path_from_handle(HANDLE handle, wchar_t *path, uint32_t path_buffer_len); - -#define CAPE_OUTPUT_FILE "CapeOutput.bin" +extern int called_by_hook(void); +extern int operate_on_backtrace(ULONG_PTR _esp, ULONG_PTR _ebp, void *extra, int(*func)(void *, ULONG_PTR)); +extern unsigned int address_is_in_stack(PVOID Address); +extern hook_info_t *hook_info(); +extern ULONG_PTR base_of_dll_of_interest; +extern wchar_t *our_process_path; +extern ULONG_PTR g_our_dll_base; +extern DWORD g_our_dll_size; extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); extern void DoOutputErrorString(_In_ LPCTSTR lpOutputString, ...); @@ -118,24 +124,11 @@ extern int ScyllaDumpProcessFixImports(HANDLE hProcess, DWORD_PTR modBase, DWORD extern int ScyllaDumpPE(DWORD_PTR Buffer); extern BOOL CountDepth(LPVOID* ReturnAddress, LPVOID Address); extern SIZE_T GetPESize(PVOID Buffer); - -extern int operate_on_backtrace(ULONG_PTR _esp, ULONG_PTR _ebp, void *extra, int(*func)(void *, ULONG_PTR)); -extern unsigned int address_is_in_stack(PVOID Address); -extern hook_info_t *hook_info(); -extern ULONG_PTR base_of_dll_of_interest; -extern wchar_t *our_process_path; -extern ULONG_PTR base_of_dll_of_interest; -extern ULONG_PTR g_our_dll_base; -extern DWORD g_our_dll_size; - -extern unsigned int address_is_in_stack(PVOID Address); -static HMODULE s_hInst = NULL; -static WCHAR s_wzDllPath[MAX_PATH]; -CHAR s_szDllPath[MAX_PATH]; - -BOOL ProcessDumped; -extern PVOID CallingModule; extern LPVOID GetReturnAddress(hook_info_t *hookinfo); +extern PVOID CallingModule; + +BOOL ProcessDumped, FilesDumped; +static unsigned int DumpCount; static __inline ULONG_PTR get_stack_top(void) { @@ -185,11 +178,6 @@ LPVOID GetReturnAddress(hook_info_t *hookinfo) __try { -#ifdef _WIN64 - DoOutputDebugString("GetReturnAddress: operate_on_backtrace call with Rip 0x%p.\n", hookinfo->frame_pointer); -#else - DoOutputDebugString("GetReturnAddress: operate_on_backtrace call with Ebp 0x%x.\n", hookinfo->frame_pointer); -#endif operate_on_backtrace(hookinfo->stack_pointer, hookinfo->frame_pointer, &ReturnAddress, GetCurrentFrame); return ReturnAddress; } @@ -209,11 +197,14 @@ PVOID GetHookCallerBase() //************************************************************************************** { PVOID ReturnAddress, AllocationBase; + hook_info_t *hookinfo = hook_info(); - if (CallingModule) - return NULL; - - ReturnAddress = GetReturnAddress(hook_info()); + if (hookinfo->main_caller_retaddr) + ReturnAddress = (PVOID)hookinfo->main_caller_retaddr; + else if (hookinfo->parent_caller_retaddr) + ReturnAddress = (PVOID)hookinfo->parent_caller_retaddr; + //else + // ReturnAddress = GetReturnAddress(hookinfo); if (ReturnAddress) { @@ -226,6 +217,7 @@ PVOID GetHookCallerBase() { CallingModule = AllocationBase; return CallingModule; + // Base-dependent breakpoints can be activated now } } else @@ -1844,22 +1836,25 @@ int DumpPE(LPVOID Buffer) int RoutineProcessDump() //************************************************************************************** { + PVOID ImageBase, CallerBase = GetHookCallerBase(); + + if (base_of_dll_of_interest) + ImageBase = (PVOID)base_of_dll_of_interest; + else + ImageBase = GetModuleHandle(NULL); + if (g_config.procdump && ProcessDumped == FALSE) { ProcessDumped = TRUE; // this prevents a second call before the first is complete if (g_config.import_reconstruction) - { - if (base_of_dll_of_interest) - ProcessDumped = ScyllaDumpProcessFixImports(GetCurrentProcess(), base_of_dll_of_interest, 0); - else - ProcessDumped = ScyllaDumpCurrentProcessFixImports(0); - } + ProcessDumped = ScyllaDumpProcessFixImports(GetCurrentProcess(), (DWORD_PTR)ImageBase, 0); else + ProcessDumped = ScyllaDumpProcess(GetCurrentProcess(), (DWORD_PTR)ImageBase, 0); + + if (CallerBase && ImageBase != CallerBase && called_by_hook()) { - if (base_of_dll_of_interest) - ProcessDumped = ScyllaDumpProcess(GetCurrentProcess(), base_of_dll_of_interest, 0); - else - ProcessDumped = ScyllaDumpCurrentProcess(0); + DoOutputDebugString("RoutineProcessDump: Terminate caller base (0x%p) different to imagebase (0x%p) - dumping.\n", CallerBase, ImageBase); + ScyllaDumpProcess(GetCurrentProcess(), (DWORD_PTR)CallerBase, 0); } } @@ -1877,7 +1872,7 @@ void init_CAPE() WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, (LPCWSTR)our_process_path, (int)wcslen(our_process_path)+1, CapeMetaData->ProcessPath, MAX_PATH, NULL, NULL); // This is package (and technique) dependent: - CapeMetaData->DumpType = PROCDUMP; + CapeMetaData->DumpType = EXTRACTION_SHELLCODE; ProcessDumped = FALSE; DumpCount = 0; @@ -1900,9 +1895,9 @@ void init_CAPE() DoOutputDebugString("Failed to initialise debugger.\n"); #ifdef _WIN64 - DoOutputDebugString("CAPE initialised: 64-bit Trace package loaded at 0x%p, process image base 0x%p\n", g_our_dll_base, GetModuleHandle(NULL)); + DoOutputDebugString("CAPE initialised: 64-bit Trace package loaded at 0x%p, process image base 0x%p, stack from 0x%p-0x%p\n", g_our_dll_base, GetModuleHandle(NULL), get_stack_bottom(), get_stack_top()); #else - DoOutputDebugString("CAPE initialised: 32-bit Trace package loaded at 0x%p, process image base 0x%p\n", g_our_dll_base, GetModuleHandle(NULL)); + DoOutputDebugString("CAPE initialised: 32-bit Trace package loaded at 0x%x, process image base 0x%x, stack from 0x%x-0x%x\n", g_our_dll_base, GetModuleHandle(NULL), get_stack_bottom(), get_stack_top()); #endif return; diff --git a/CAPE/CAPE.h b/CAPE/CAPE.h index 633d0de..686b874 100644 --- a/CAPE/CAPE.h +++ b/CAPE/CAPE.h @@ -152,7 +152,9 @@ enum { URSNIF_PAYLOAD = 0x25, CERBER_CONFIG = 0x30, - CERBER_PAYLOAD = 0x31 + CERBER_PAYLOAD = 0x31, + + DATADUMP = 0x66 }; HANDLE EvilGrabRegHandle; diff --git a/CAPE/Debugger.h b/CAPE/Debugger.h index e34156f..57f295d 100644 --- a/CAPE/Debugger.h +++ b/CAPE/Debugger.h @@ -119,6 +119,7 @@ int launch_debugger(void); BOOL SetBreakpoint(int Register, int Size, LPVOID Address, DWORD Type, PVOID Callback); BOOL SetThreadBreakpoint(DWORD ThreadId, int Register, int Size, LPVOID Address, DWORD Type, PVOID Callback); BOOL ContextSetThreadBreakpoint(PCONTEXT Context, int Register, int Size, LPVOID Address, DWORD Type, PVOID Callback); +BOOL ContextSetDebugRegister(PCONTEXT Context, int Register, int Size, LPVOID Address, DWORD Type); BOOL SetThreadBreakpoints(PTHREADBREAKPOINTS ThreadBreakpoints); BOOL ContextSetBreakpoint(PTHREADBREAKPOINTS ThreadBreakpoints); BOOL ContextUpdateCurrentBreakpoint(PCONTEXT Context, int Size, LPVOID Address, DWORD Type, PVOID Callback); @@ -136,6 +137,7 @@ BOOL ContextSetNextAvailableBreakpoint(PCONTEXT Context, unsigned int* Register, int CheckDebugRegister(HANDLE hThread, int Register); BOOL CheckDebugRegisters(HANDLE hThread, PCONTEXT pContext); int ContextCheckDebugRegister(CONTEXT Context, int Register); +BOOL ContextCheckDebugRegisters(PCONTEXT pContext); HANDLE GetThreadHandle(DWORD ThreadId); // Clear diff --git a/CAPE/Output.c b/CAPE/Output.c index 915fcc7..f7f8e36 100644 --- a/CAPE/Output.c +++ b/CAPE/Output.c @@ -184,6 +184,8 @@ void CapeOutputFile(_In_ LPCTSTR lpOutputFile) Buffer = malloc(BufferSize); + if (!CapeMetaData->ProcessPath) + CapeMetaData->ProcessPath = "Unknown path"; CapeMetaData->ModulePath = CapeMetaData->ProcessPath; if (CapeMetaData->DumpType == EXTRACTION_PE || CapeMetaData->DumpType == EXTRACTION_SHELLCODE) diff --git a/CAPE/ScyllaHarness.cpp b/CAPE/ScyllaHarness.cpp index 4be66ae..262fcfc 100644 --- a/CAPE/ScyllaHarness.cpp +++ b/CAPE/ScyllaHarness.cpp @@ -831,3 +831,39 @@ extern "C" int ScyllaDumpProcessFixImports(HANDLE hProcess, DWORD_PTR ModuleBase return 1; } + +//************************************************************************************** +extern "C" BOOL ScyllaGetSectionByName(PVOID ImageBase, char* Name, PVOID* SectionData, SIZE_T* SectionSize) +//************************************************************************************** +{ + ScyllaInitCurrentProcess(); + + PeParser *peFile = new PeParser((DWORD_PTR)ImageBase, true); + + if (!peFile->isValidPeFile()) + { + DoOutputDebugString("ScyllaGetSectionByName: Invalid PE image.\n"); + return 0; + } + + if (!peFile->readPeSectionsFromProcess()) + { + DoOutputDebugString("ScyllaGetSectionByName: Failed to read PE sections from image.\n"); + return 0; + } + + unsigned int NumberOfSections = peFile->getNumberOfSections(); + + for (unsigned int i = 0; i < NumberOfSections; i++) + { + if (!strcmp((char*)peFile->listPeSection[i].sectionHeader.Name, Name)) + { + *SectionData = peFile->listPeSection[i].sectionHeader.VirtualAddress + (PUCHAR)ImageBase; + *SectionSize = peFile->listPeSection[i].sectionHeader.Misc.VirtualSize; + DoOutputDebugString("ScyllaGetSectionByName: %s section at 0x%p size 0x%x.\n", Name, *SectionData, *SectionSize); + return TRUE; + } + } + + return FALSE; +} \ No newline at end of file diff --git a/CAPE/Trace.c b/CAPE/Trace.c index f7cdfa6..5f41c9d 100644 --- a/CAPE/Trace.c +++ b/CAPE/Trace.c @@ -15,8 +15,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.If not, see . */ -#include "..\hooking.h" #include +#include "..\hooking.h" #include "Debugger.h" #include "CAPE.h" @@ -28,17 +28,31 @@ extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); extern void DoOutputErrorString(_In_ LPCTSTR lpOutputString, ...); extern int DumpModuleInCurrentProcess(LPVOID ModuleBase); extern int DumpMemory(LPVOID Buffer, SIZE_T Size); - +extern char *convert_address_to_dll_name_and_offset(ULONG_PTR addr, unsigned int *offset); extern DWORD_PTR FileOffsetToVA(DWORD_PTR modBase, DWORD_PTR dwOffset); -BOOL BreakpointSet; -unsigned int DumpCount, Correction, StepCount; +extern BOOL ScyllaGetSectionByName(PVOID ImageBase, char* Name, PVOID* SectionData, SIZE_T* SectionSize); + +BOOL BreakpointSet, DllPrinted; +unsigned int DumpCount, Correction, StepCount, DepthCount, DepthLimit; PVOID ModuleBase, DumpAddress; SIZE_T DumpSize; BOOL GetSystemTimeAsFileTimeImported, PayloadMarker, PayloadDumped; +int StepOverRegister; +BOOL Trace(struct _EXCEPTION_POINTERS* ExceptionInfo); +BOOL BreakpointCallback(PBREAKPOINTINFO pBreakpointInfo, struct _EXCEPTION_POINTERS* ExceptionInfo); + +BOOL DoSetSingleStepMode(int Register, PCONTEXT Context, PVOID Handler) +{ + StepOverRegister = Register; + return SetSingleStepMode(Context, Trace); +} BOOL Trace(struct _EXCEPTION_POINTERS* ExceptionInfo) { + PVOID ReturnAddress; + char* DllName; + unsigned int DllRVA; _DecodeResult Result; _OffsetType Offset = 0; @@ -55,22 +69,61 @@ BOOL Trace(struct _EXCEPTION_POINTERS* ExceptionInfo) } #ifdef _WIN64 + DllName = convert_address_to_dll_name_and_offset((ULONG_PTR)ExceptionInfo->ContextRecord->Rip, &DllRVA); _DecodeType DecodeType = Decode64Bits; Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Rip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); DoOutputDebugString("0x%p (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Rip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); #else + DllName = convert_address_to_dll_name_and_offset((ULONG_PTR)ExceptionInfo->ContextRecord->Eip, &DllRVA); _DecodeType DecodeType = Decode32Bits; Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Eip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); DoOutputDebugString("0x%x (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Eip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); #endif + if (!DllPrinted && DllName) + { + DoOutputDebugString("Trace: Tracing in %s (RVA 0x%x).\n", DllName, DllRVA); + DllPrinted = TRUE; + } + + if (!strcmp(DecodedInstruction.mnemonic.p, "CALL")) + { + if (DepthCount >= DepthLimit) + { +#ifdef _WIN64 + ReturnAddress = (PVOID)((PUCHAR)ExceptionInfo->ContextRecord->Rip + DecodedInstruction.size); +#else + ReturnAddress = (PVOID)((PUCHAR)ExceptionInfo->ContextRecord->Eip + DecodedInstruction.size); +#endif + if (!ContextSetThreadBreakpoint(ExceptionInfo->ContextRecord, StepOverRegister, 0, (BYTE*)ReturnAddress, BP_EXEC, BreakpointCallback)) + { + DoOutputDebugString("Trace: Failed to set breakpoint on return address 0x%p\n", ReturnAddress); + } + + ClearSingleStepMode(ExceptionInfo->ContextRecord); + + return TRUE; + } + else + DepthCount++; + } + else if (!strcmp(DecodedInstruction.mnemonic.p, "RET")) + { + DepthCount--; + } + SetSingleStepMode(ExceptionInfo->ContextRecord, Trace); return TRUE; } - + BOOL BreakpointCallback(PBREAKPOINTINFO pBreakpointInfo, struct _EXCEPTION_POINTERS* ExceptionInfo) { + _DecodeResult Result; + _OffsetType Offset = 0; + _DecodedInst DecodedInstruction; + unsigned int DecodedInstructionsCount = 0; + if (pBreakpointInfo == NULL) { DoOutputDebugString("BreakpointCallback executed with pBreakpointInfo NULL.\n"); @@ -83,15 +136,25 @@ BOOL BreakpointCallback(PBREAKPOINTINFO pBreakpointInfo, struct _EXCEPTION_POINT return FALSE; } - DoOutputDebugString("BreakpointCallback: Breakpoint %i Size=0x%x and Address=0x%p.\n", pBreakpointInfo->Register, pBreakpointInfo->Size, pBreakpointInfo->Address); - - StepCount = 0; - +#ifdef _WIN64 + _DecodeType DecodeType = Decode64Bits; + Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Rip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); + DoOutputDebugString("0x%p (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Rip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); +#else + _DecodeType DecodeType = Decode32Bits; + Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Eip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); + DoOutputDebugString("0x%x (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Eip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); +#endif + //ContextClearCurrentBreakpoint(ExceptionInfo->ContextRecord); StepOverExecutionBreakpoint(ExceptionInfo->ContextRecord, pBreakpointInfo); - SetSingleStepMode(ExceptionInfo->ContextRecord, Trace); + StepCount = 0; + DepthCount = 0; + DepthLimit = 3; + + DoSetSingleStepMode(pBreakpointInfo->Register, ExceptionInfo->ContextRecord, Trace); return TRUE; } @@ -107,15 +170,24 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) return FALSE; } + if (!ImageBase) + { + ImageBase = GetModuleHandle(NULL); + DoOutputDebugString("SetInitialBreakpoints: ImageBase not set by base-on-api parameter, defaulting to process image base 0x%p.\n", ImageBase); + return FALSE; + } + else + DoOutputDebugString("SetInitialBreakpoints: ImageBase set to 0x%p.\n", ImageBase); + if (bp0) { Register = 0; - if (!ImageBase) ImageBase = GetModuleHandle(NULL); + BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp0; if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) { - DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p (image base 0x%p, RVA 0x%x)\n", Register, BreakpointVA, ImageBase, bp0); + DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p (RVA 0x%x)\n", Register, BreakpointVA, bp0); BreakpointSet = TRUE; } else @@ -129,12 +201,12 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) if (bp1) { Register = 1; - if (!ImageBase) ImageBase = GetModuleHandle(NULL); + BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp1; if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) { - DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p\n", Register, BreakpointVA); + DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p (RVA 0x%x)\n", Register, BreakpointVA, bp1); BreakpointSet = TRUE; } else @@ -148,12 +220,12 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) if (bp2) { Register = 2; - if (!ImageBase) ImageBase = GetModuleHandle(NULL); + BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp2; if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) { - DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p\n", Register, BreakpointVA); + DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p (RVA 0x%x)\n", Register, BreakpointVA, bp2); BreakpointSet = TRUE; } else @@ -167,12 +239,12 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) if (bp3) { Register = 3; - if (!ImageBase) ImageBase = GetModuleHandle(NULL); + BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp3; if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) { - DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p\n", Register, BreakpointVA); + DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p (RVA 0x%x)\n", Register, BreakpointVA, bp3); BreakpointSet = TRUE; } else @@ -182,6 +254,6 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) return FALSE; } } - + return BreakpointSet; } diff --git a/cuckoomon.c b/cuckoomon.c index b0806e5..41634a4 100644 --- a/cuckoomon.c +++ b/cuckoomon.c @@ -36,6 +36,8 @@ volatile int dummy_val; extern void init_CAPE(); extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); extern LONG WINAPI CAPEExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo); +extern BOOL SetInitialBreakpoints(PVOID ImageBase); +extern ULONG_PTR base_of_dll_of_interest; void disable_tail_call_optimization(void) { @@ -657,16 +659,22 @@ VOID CALLBACK DllLoadNotification( } if (NotificationReason == 1) { - if (g_config.file_of_interest && !wcsicmp(library.Buffer, g_config.file_of_interest)) - set_dll_of_interest((ULONG_PTR)NotificationData->Loaded.DllBase); - - // unoptimized, but easy - add_all_dlls_to_dll_ranges(); + if (g_config.file_of_interest && !wcsicmp(library.Buffer, g_config.file_of_interest)) { + if (base_of_dll_of_interest) + DoOutputDebugString("Target DLL loaded at 0x%p: %ws (0x%x bytes).\n", NotificationData->Loaded.DllBase, library.Buffer, NotificationData->Loaded.SizeOfImage); + else + set_dll_of_interest((ULONG_PTR)NotificationData->Loaded.DllBase); + SetInitialBreakpoints((PVOID)base_of_dll_of_interest); + } + else { + // unoptimized, but easy + add_all_dlls_to_dll_ranges(); - dllname = get_dll_basename(&library); - set_hooks_dll(dllname); + dllname = get_dll_basename(&library); + set_hooks_dll(dllname); - DoOutputDebugString("DLL loaded at 0x%p: %ws (0x%x bytes).\n", NotificationData->Loaded.DllBase, library.Buffer, NotificationData->Loaded.SizeOfImage); + DoOutputDebugString("DLL loaded at 0x%p: %ws (0x%x bytes).\n", NotificationData->Loaded.DllBase, library.Buffer, NotificationData->Loaded.SizeOfImage); + } } else { // unload @@ -680,8 +688,6 @@ VOID CALLBACK DllLoadNotification( extern _LdrRegisterDllNotification pLdrRegisterDllNotification; -CRITICAL_SECTION g_tmp_hookinfo_lock; - void set_hooks() { // before modifying any DLLs, let's first freeze all other threads in our process @@ -698,14 +704,14 @@ void set_hooks() // the hooks contain executable code as well, so they have to be RWX DWORD old_protect; - InitializeCriticalSection(&g_tmp_hookinfo_lock); - VirtualProtect(g_hooks, sizeof(g_hooks), PAGE_EXECUTE_READWRITE, &old_protect); memset(&threadInfo, 0, sizeof(threadInfo)); threadInfo.dwSize = sizeof(threadInfo); + hook_init(); + hook_disable(); hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); @@ -790,7 +796,6 @@ LONG WINAPI cuckoomon_exception_handler(__in struct _EXCEPTION_POINTERS *Excepti return EXCEPTION_CONTINUE_SEARCH; if (ExceptionInfo->ExceptionRecord->ExceptionCode == DBG_PRINTEXCEPTION_C) - return EXCEPTION_CONTINUE_SEARCH; if (ExceptionInfo->ExceptionRecord->ExceptionCode == EXCEPTION_SINGLE_STEP) diff --git a/hook_file.c b/hook_file.c index 8e4b584..ac2bbb6 100644 --- a/hook_file.c +++ b/hook_file.c @@ -33,6 +33,8 @@ along with this program. If not, see . // length of a hardcoded unicode string #define UNILEN(x) (sizeof(x) / sizeof(wchar_t) - 1) +extern BOOL FilesDumped; + typedef struct _file_record_t { unsigned int attributes; size_t length; @@ -240,29 +242,48 @@ void file_close(HANDLE file_handle) get_lasterrors(&lasterror); r = lookup_get(&g_files, (ULONG_PTR)file_handle, NULL); - if(r != NULL) { + if (r != NULL) { UNICODE_STRING str; str.Length = (USHORT)r->length * sizeof(wchar_t); str.MaximumLength = ((USHORT)r->length + 1) * sizeof(wchar_t); str.Buffer = r->filename; - new_file(&str); - lookup_del(&g_files, (ULONG_PTR) file_handle); } set_lasterrors(&lasterror); } -void handle_terminate() +void file_handle_terminate() { - entry_t *p; + entry_t *p; + file_record_t *r; + lasterror_t lasterror; + + // ensure this only happens once as we can't lookup_del in the loop + if (FilesDumped) + return; + + FilesDumped = TRUE; + + get_lasterrors(&lasterror); for (p = (entry_t*)&(g_files.root); p != NULL; p = p->next) { - if (p->id) - file_close((HANDLE)p->id); + if (p->id) { + r = lookup_get(&g_files, (ULONG_PTR)p->id, NULL); + if (r != NULL) { + UNICODE_STRING str; + str.Length = (USHORT)r->length * sizeof(wchar_t); + str.MaximumLength = ((USHORT)r->length + 1) * sizeof(wchar_t); + str.Buffer = r->filename; + new_file(&str); + } + } } + + set_lasterrors(&lasterror); } + static BOOLEAN is_protected_objattr(POBJECT_ATTRIBUTES obj) { wchar_t path[MAX_PATH_PLUS_TOLERANCE]; @@ -826,7 +847,6 @@ HOOKDEF_ALT(BOOL, WINAPI, MoveFileWithProgressW, // we can do this here because it's not scheduled for deletion until reboot pipe("FILE_DEL:%Z", path); } - } free(path); @@ -885,7 +905,6 @@ HOOKDEF_ALT(BOOL, WINAPI, MoveFileWithProgressTransactedW, // we can do this here because it's not scheduled for deletion until reboot pipe("FILE_DEL:%Z", path); } - } free(path); @@ -1286,25 +1305,6 @@ HOOKDEF(BOOL, WINAPI, GetVolumeInformationA, { BOOL ret = Old_GetVolumeInformationA(lpRootPathName, lpVolumeNameBuffer, nVolumeNameSize, lpVolumeSerialNumber, lpMaximumComponentLength, lpFileSystemFlags, lpFileSystemNameBuffer, nFileSystemNameSize); LOQ_bool("filesystem", "s", "RootPathName", lpRootPathName); -#ifdef KEV - if (ret != 0 && lpVolumeSerialNumber != NULL) - { - char SystemDirectory[MAX_PATH]; - size_t DirectoryPathLength = GetSystemDirectoryA(SystemDirectory, MAX_PATH); - - if (DirectoryPathLength == 0) - return ret; - - if (!strncmp(lpRootPathName, SystemDirectory, 3)) - { - *lpVolumeSerialNumber = 0x46e70ca9; - debug_message("Changed Volume Serial Number."); - } - - - - } -#endif return ret; } @@ -1321,22 +1321,6 @@ HOOKDEF(BOOL, WINAPI, GetVolumeInformationW, { BOOL ret = Old_GetVolumeInformationW(lpRootPathName, lpVolumeNameBuffer, nVolumeNameSize, lpVolumeSerialNumber, lpMaximumComponentLength, lpFileSystemFlags, lpFileSystemNameBuffer, nFileSystemNameSize); LOQ_bool("filesystem", "u", "RootPathName", lpRootPathName); -#ifdef KEV - if (ret != 0 && lpVolumeSerialNumber != NULL) - { - WCHAR SystemDirectory[MAX_PATH]; - size_t DirectoryPathLength = GetSystemDirectoryW(SystemDirectory, MAX_PATH); - - if (DirectoryPathLength == 0) - return ret; - - if (!wcsncmp(lpRootPathName, SystemDirectory, 3)) - { - *lpVolumeSerialNumber = 0x46e70ca9; - debug_message("Changed Volume Serial Number."); - } - } -#endif return ret; } diff --git a/hook_misc.c b/hook_misc.c index f8d94fd..f9efada 100644 --- a/hook_misc.c +++ b/hook_misc.c @@ -26,9 +26,13 @@ along with this program. If not, see . #include "hook_sleep.h" #include "config.h" #include "ignore.h" +#include "CAPE\CAPE.h" +#include "CAPE\Debugger.h" #define STATUS_BAD_COMPRESSION_BUFFER ((NTSTATUS)0xC0000242L) +extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); + HOOKDEF(HHOOK, WINAPI, SetWindowsHookExA, __in int idHook, __in HOOKPROC lpfn, @@ -100,11 +104,34 @@ HOOKDEF(PVOID, WINAPI, RtlAddVectoredExceptionHandler, __out PVECTORED_EXCEPTION_HANDLER Handler ) { PVOID ret = 0; - - ret = Old_RtlAddVectoredExceptionHandler(First, Handler); - + + if (DEBUGGER_ENABLED && VECTORED_HANDLER && First) + { + if (!CAPEExceptionFilterHandle) + { + DoOutputDebugString("RtlAddVectoredExceptionHandler hook: Error - CAPE vectored handler not registered.\n"); + ret = Old_RtlAddVectoredExceptionHandler(First, Handler); + LOQ_nonnull("hooking", "ip", "First", First, "Handler", Handler); + return ret; + } + + // We register the handler at the bottom, this minimizes + // our interference and means the handle is valid + ret = Old_RtlAddVectoredExceptionHandler(0, Handler); + + if (ret == NULL) + return ret; + + // We record the handler address so that + // CAPEExceptionFilter can call it directly + DoOutputDebugString("RtlAddVectoredExceptionHandler hook: CAPE vectored handler protected as First.\n"); + SampleVectoredHandler = (SAMPLE_HANDLER)Handler; + } + else + ret = Old_RtlAddVectoredExceptionHandler(First, Handler); + LOQ_nonnull("hooking", "ip", "First", First, "Handler", Handler); - + return ret; } diff --git a/hook_process.c b/hook_process.c index a5af0b0..2c0759b 100644 --- a/hook_process.c +++ b/hook_process.c @@ -28,8 +28,10 @@ along with this program. If not, see . #include "unhook.h" #include "config.h" -extern void handle_terminate(); +extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); +extern void file_handle_terminate(); extern int RoutineProcessDump(); +extern BOOL ProcessDumped; HOOKDEF(HANDLE, WINAPI, CreateToolhelp32Snapshot, __in DWORD dwFlags, @@ -332,20 +334,26 @@ HOOKDEF(NTSTATUS, WINAPI, NtTerminateProcess, // we mark this here as this termination type will kill all threads but ours, including // the logging thread. By setting this, we'll switch into a direct logging mode // for the subsequent call to NtTerminateProcess against our own process handle - handle_terminate(); - if (g_config.procdump) + if (g_config.procdump && !ProcessDumped) + { + DoOutputDebugString("NtTerminateProcess hook: Attempting to dump process %d\n", GetCurrentProcessId()); RoutineProcessDump(); + } process_shutting_down = 1; LOQ_ntstatus("process", "ph", "ProcessHandle", ProcessHandle, "ExitCode", ExitStatus); + file_handle_terminate(); } else if (GetCurrentProcessId() == our_getprocessid(ProcessHandle)) { - handle_terminate(); - if (g_config.procdump) + if (g_config.procdump && !ProcessDumped) + { + DoOutputDebugString("NtTerminateProcess hook: Attempting to dump process %d\n", GetCurrentProcessId()); RoutineProcessDump(); + } process_shutting_down = 1; LOQ_ntstatus("process", "ph", "ProcessHandle", ProcessHandle, "ExitCode", ExitStatus); pipe("KILL:%d", GetCurrentProcessId()); log_free(); + file_handle_terminate(); } else { DWORD PID = pid_from_process_handle(ProcessHandle); @@ -817,7 +825,7 @@ HOOKDEF_NOTAIL(WINAPI, RtlDispatchException, if (tebtmp[0] != 0xffffffff) seh = ((DWORD *)tebtmp[0])[1]; if (seh < g_our_dll_base || seh >= (g_our_dll_base + g_our_dll_size)) { - _snprintf(buf, sizeof(buf), "Exception reported at offset 0x%x in cuckoomon itself while accessing 0x%x from hook %s", (DWORD)((ULONG_PTR)ExceptionRecord->ExceptionAddress - g_our_dll_base), ExceptionRecord->ExceptionInformation[1], hook_info()->current_hook ? hook_info()->current_hook->funcname : "unknown"); + _snprintf(buf, sizeof(buf), "Exception 0x%x reported at offset 0x%x in cuckoomon itself while accessing 0x%x from hook %s", ExceptionRecord->ExceptionCode, (DWORD)((ULONG_PTR)ExceptionRecord->ExceptionAddress - g_our_dll_base), ExceptionRecord->ExceptionInformation[1], hook_info()->current_hook ? hook_info()->current_hook->funcname : "unknown"); log_anomaly("cuckoocrash", buf); } } diff --git a/hook_special.c b/hook_special.c index cb67047..5c52bf8 100644 --- a/hook_special.c +++ b/hook_special.c @@ -29,6 +29,8 @@ extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); extern int RoutineProcessDump(); extern ULONG_PTR base_of_dll_of_interest; +PVOID LastDllUnload; + HOOKDEF_NOTAIL(WINAPI, LdrLoadDll, __in_opt PWCHAR PathToFile, __in_opt PULONG Flags, @@ -108,8 +110,6 @@ HOOKDEF_ALT(NTSTATUS, WINAPI, LdrLoadDll, ret = Old_LdrLoadDll(PathToFile, Flags, ModuleFileName, ModuleHandle); memcpy(hook_info(), &saved_hookinfo, sizeof(saved_hookinfo)); - //DoOutputDebugString("LdrLoadDll hook2: ModuleBase 0x%p: %ws.\n", *ModuleHandle, library.Buffer); - disable_tail_call_optimization(); return ret; } @@ -119,12 +119,14 @@ extern void revalidate_all_hooks(void); HOOKDEF_NOTAIL(WINAPI, LdrUnloadDll, PVOID DllImageBase ) { - if (DllImageBase && DllImageBase == (PVOID)base_of_dll_of_interest) { - //DoOutputDebugString("LdrUnloadDll hook: Dumping DLL-of-interest prior to unloading.\n"); + if (DllImageBase && DllImageBase == (PVOID)base_of_dll_of_interest) RoutineProcessDump(); - } - //DoOutputDebugString("DLL unloaded from 0x%p.\n", DllImageBase); + if (DllImageBase && DllImageBase != LastDllUnload) + { + DoOutputDebugString("DLL unloaded from 0x%p.\n", DllImageBase); + LastDllUnload = DllImageBase; + } return 0; } diff --git a/hook_thread.c b/hook_thread.c index 1a87089..10bb819 100644 --- a/hook_thread.c +++ b/hook_thread.c @@ -25,9 +25,15 @@ along with this program. If not, see . #include "hook_sleep.h" #include "unhook.h" #include "lookup.h" +#include "CAPE\CAPE.h" +#include "CAPE\Debugger.h" + +extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); static lookup_t g_ignored_threads; +DWORD LastInjected; + void ignored_threads_init(void) { lookup_init(&g_ignored_threads); @@ -66,7 +72,6 @@ void add_ignored_thread(DWORD tid) set_lasterrors(&lasterror); } - HOOKDEF(NTSTATUS, WINAPI, NtQueueApcThread, __in HANDLE ThreadHandle, __in PIO_APC_ROUTINE ApcRoutine, @@ -78,10 +83,9 @@ HOOKDEF(NTSTATUS, WINAPI, NtQueueApcThread, DWORD TID = tid_from_thread_handle(ThreadHandle); NTSTATUS ret; - pipe("PROCESS:%d:%d,%d", is_suspended(PID, TID), PID, TID); + pipe("PROCESS:%d:%d,%d", is_suspended(PID, TID), PID, TID); - ret = Old_NtQueueApcThread(ThreadHandle, ApcRoutine, - ApcRoutineContext, ApcStatusBlock, ApcReserved); + ret = Old_NtQueueApcThread(ThreadHandle, ApcRoutine, ApcRoutineContext, ApcStatusBlock, ApcReserved); LOQ_ntstatus("threading", "iip", "ProcessId", PID, "ThreadId", TID, "ThreadHandle", ThreadHandle); @@ -104,8 +108,7 @@ HOOKDEF(NTSTATUS, WINAPI, NtQueueApcThreadEx, pipe("PROCESS:%d:%d,%d", is_suspended(PID, TID), PID, TID); - ret = Old_NtQueueApcThreadEx(ThreadHandle, UserApcReserveHandle, ApcRoutine, - ApcRoutineContext, ApcStatusBlock, ApcReserved); + ret = Old_NtQueueApcThreadEx(ThreadHandle, UserApcReserveHandle, ApcRoutine, ApcRoutineContext, ApcStatusBlock, ApcReserved); LOQ_ntstatus("threading", "iip", "ProcessId", PID, "ThreadId", TID, "ThreadHandle", ThreadHandle); @@ -114,7 +117,6 @@ HOOKDEF(NTSTATUS, WINAPI, NtQueueApcThreadEx, return ret; } - HOOKDEF(NTSTATUS, WINAPI, NtCreateThread, __out PHANDLE ThreadHandle, __in ACCESS_MASK DesiredAccess, @@ -176,8 +178,10 @@ HOOKDEF(NTSTATUS, WINAPI, NtCreateThreadEx, //if (called_by_hook() && pid == GetCurrentProcessId()) // add_ignored_thread(tid); - pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); - if (!(CreateFlags & 1)) { + if (pid != GetCurrentProcessId()) + pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); + + if (!(CreateFlags & 1)) { lasterror_t lasterror; get_lasterrors(&lasterror); ResumeThread(*hThread); @@ -243,10 +247,13 @@ HOOKDEF(NTSTATUS, WINAPI, NtSetContextThread, NTSTATUS ret; DWORD pid = pid_from_thread_handle(ThreadHandle); DWORD tid = tid_from_thread_handle(ThreadHandle); - pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); - ret = Old_NtSetContextThread(ThreadHandle, Context); - if (Context->ContextFlags & CONTEXT_CONTROL) + if (pid != GetCurrentProcessId()) + pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); + + ret = Old_NtSetContextThread(ThreadHandle, Context); + + if (Context->ContextFlags & CONTEXT_CONTROL) #ifdef _WIN64 LOQ_ntstatus("threading", "pp", "ThreadHandle", ThreadHandle, "InstructionPointer", Context->Rcx); #else @@ -301,7 +308,6 @@ HOOKDEF(NTSTATUS, WINAPI, NtResumeThread, } extern DWORD tmphookinfo_threadid; -extern CRITICAL_SECTION g_tmp_hookinfo_lock; HOOKDEF(NTSTATUS, WINAPI, NtTerminateThread, __in HANDLE ThreadHandle, @@ -314,7 +320,6 @@ HOOKDEF(NTSTATUS, WINAPI, NtTerminateThread, if (tmphookinfo_threadid && tid == tmphookinfo_threadid) { tmphookinfo_threadid = 0; - LeaveCriticalSection(&g_tmp_hookinfo_lock); } //remove_ignored_thread(tid); @@ -347,7 +352,19 @@ HOOKDEF(HANDLE, WINAPI, CreateThread, ENSURE_DWORD(lpThreadId); ret = Old_CreateThread(lpThreadAttributes, dwStackSize, - lpStartAddress, lpParameter, dwCreationFlags, lpThreadId); + lpStartAddress, lpParameter, dwCreationFlags | CREATE_SUSPENDED, lpThreadId); + + if (DEBUGGER_ENABLED && !called_by_hook()) { + DoOutputDebugString("CreateThread: Initialising breakpoints for thread %d.\n", *lpThreadId); + InitNewThreadBreakpoints(*lpThreadId); + } + + if (!(dwCreationFlags && CREATE_SUSPENDED)) { + lasterror_t lasterror; + get_lasterrors(&lasterror); + ResumeThread(ret); + set_lasterrors(&lasterror); + } LOQ_nonnull("threading", "pphI", "StartRoutine", lpStartAddress, "Parameter", lpParameter, "CreationFlags", dwCreationFlags, "ThreadId", lpThreadId); if (ret != NULL) @@ -374,8 +391,10 @@ HOOKDEF(HANDLE, WINAPI, CreateRemoteThread, lpThreadId); if (ret != NULL) { - pipe("PROCESS:%d:%d,%d", is_suspended(pid, *lpThreadId), pid, *lpThreadId); - if (!(dwCreationFlags & CREATE_SUSPENDED)) { + if (pid != GetCurrentProcessId()) + pipe("PROCESS:%d:%d,%d", is_suspended(pid, *lpThreadId), pid, *lpThreadId); + + if (!(dwCreationFlags & CREATE_SUSPENDED)) { lasterror_t lasterror; get_lasterrors(&lasterror); ResumeThread(ret); @@ -409,7 +428,7 @@ HOOKDEF(NTSTATUS, WINAPI, RtlCreateUserThread, ENSURE_CLIENT_ID(ClientId); pid = pid_from_process_handle(ProcessHandle); - + ret = Old_RtlCreateUserThread(ProcessHandle, SecurityDescriptor, TRUE, StackZeroBits, StackReserved, StackCommit, StartAddress, StartParameter, ThreadHandle, ClientId); @@ -419,7 +438,8 @@ HOOKDEF(NTSTATUS, WINAPI, RtlCreateUserThread, "ThreadIdentifier", ClientId->UniqueThread); if (NT_SUCCESS(ret)) { - pipe("PROCESS:%d:%d,%d", is_suspended(pid, (DWORD)(ULONG_PTR)ClientId->UniqueThread), pid, (DWORD)(ULONG_PTR)ClientId->UniqueThread); + if (pid != GetCurrentProcessId()) + pipe("PROCESS:%d:%d,%d", is_suspended(pid, (DWORD)(ULONG_PTR)ClientId->UniqueThread), pid, (DWORD)(ULONG_PTR)ClientId->UniqueThread); if (CreateSuspended == FALSE) { lasterror_t lasterror; get_lasterrors(&lasterror); diff --git a/hooking.c b/hooking.c index 59fb7b7..b534d8f 100644 --- a/hooking.c +++ b/hooking.c @@ -29,8 +29,6 @@ along with this program. If not, see . extern DWORD g_tls_hook_index; extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); -extern PVOID GetAllocationBase(PVOID Address); -extern SIZE_T GetAllocationSize(PVOID Address); extern PVOID GetHookCallerBase(); extern BOOL SetInitialBreakpoints(PVOID ImageBase); BOOL BreakpointsSet; @@ -43,6 +41,13 @@ BOOL BreakpointsSet; #define TLS_LAST_NTSTATUS_ERROR 0xbf4 #endif +static lookup_t g_hook_info; + +void hook_init() +{ + lookup_init(&g_hook_info); +} + void emit_rel(unsigned char *buf, unsigned char *source, unsigned char *target) { *(DWORD *)buf = (DWORD)(target - (source + 4)); @@ -66,45 +71,6 @@ static int set_caller_info(void *unused, ULONG_PTR addr) return 0; } -void base_on_api(hook_t *h) -{ - unsigned int i; - hook_info_t *hookinfo = hook_info(); - - for (i = 0; i < ARRAYSIZE(g_config.base_on_apiname); i++) { - if (!g_config.base_on_apiname[i]) - break; - if (!BreakpointsSet && !called_by_hook() && !stricmp(h->funcname, g_config.base_on_apiname[i])) { - if (hookinfo->main_caller_retaddr) { - if (!BreakpointsSet) - BreakpointsSet = SetInitialBreakpoints(GetAllocationBase((PVOID)hookinfo->main_caller_retaddr)); - if (BreakpointsSet) { - DoOutputDebugString("Base-on-API: Breakpoints set.\n"); - } - else - DoOutputDebugString("Base-on-API: Failed to set breakpoints.\n"); - } - else - DoOutputDebugString("Base-on-API: No main_caller_retaddr to get caller base.\n"); - PVOID ImageBase = GetHookCallerBase(); - if (ImageBase) { - if (!BreakpointsSet) - BreakpointsSet = SetInitialBreakpoints((PVOID)ImageBase); - if (BreakpointsSet) { - DoOutputDebugString("Base-on-API: GetHookCallerBase success 0x%p - Breakpoints set.\n", ImageBase); - } - else - DoOutputDebugString("Base-on-API: Failed to set breakpoints on 0x%p.\n", ImageBase); - } - else - DoOutputDebugString("Base-on-API: GetHookCallerBase fail.\n"); - return; - } - } - - return; -} - int hook_is_excluded(hook_t *h) { unsigned int i; @@ -144,8 +110,33 @@ int called_by_hook(void) return __called_by_hook(hookinfo->stack_pointer, hookinfo->frame_pointer); } +void base_on_api(hook_t *h) +{ + unsigned int i; + hook_info_t *hookinfo = hook_info(); + + for (i = 0; i < ARRAYSIZE(g_config.base_on_apiname); i++) { + if (!g_config.base_on_apiname[i]) + break; + if (!BreakpointsSet && !called_by_hook() && !stricmp(h->funcname, g_config.base_on_apiname[i])) { + DoOutputDebugString("Base-on-API: %s call detected in thread %d.\n", g_config.base_on_apiname[i], GetCurrentThreadId()); + PVOID AllocationBase = GetHookCallerBase(); + if (AllocationBase) { + BreakpointsSet = SetInitialBreakpoints((PVOID)AllocationBase); + if (BreakpointsSet) + DoOutputDebugString("Base-on-API: GetHookCallerBase success 0x%p - Breakpoints set.\n", AllocationBase); + else + DoOutputDebugString("Base-on-API: Failed to set breakpoints on 0x%p.\n", AllocationBase); + } + else + DoOutputDebugString("Base-on-API: GetHookCallerBase fail.\n"); + } + } + + return; +} + extern BOOLEAN is_ignored_thread(DWORD tid); -extern CRITICAL_SECTION g_tmp_hookinfo_lock; static hook_info_t tmphookinfo; DWORD tmphookinfo_threadid; @@ -160,11 +151,10 @@ int WINAPI enter_hook(hook_t *h, ULONG_PTR sp, ULONG_PTR ebp_or_rip) if (h->fully_emulate) return 1; - if (g_tls_hook_index >= 0x40 && h->new_func == &New_NtAllocateVirtualMemory) { + if (h->new_func == &New_NtAllocateVirtualMemory) { lasterror_t lasterrors; get_lasterrors(&lasterrors); - if (TlsGetValue(g_tls_hook_index) == NULL && (!tmphookinfo_threadid || tmphookinfo_threadid != GetCurrentThreadId())) { - EnterCriticalSection(&g_tmp_hookinfo_lock); + if (lookup_get_no_cs(&g_hook_info, (ULONG_PTR)GetCurrentThreadId(), NULL) == NULL && (!tmphookinfo_threadid || tmphookinfo_threadid != GetCurrentThreadId())) { memset(&tmphookinfo, 0, sizeof(tmphookinfo)); tmphookinfo_threadid = GetCurrentThreadId(); } @@ -172,7 +162,6 @@ int WINAPI enter_hook(hook_t *h, ULONG_PTR sp, ULONG_PTR ebp_or_rip) } else if (tmphookinfo_threadid) { tmphookinfo_threadid = 0; - LeaveCriticalSection(&g_tmp_hookinfo_lock); } hookinfo = hook_info(); @@ -191,7 +180,7 @@ int WINAPI enter_hook(hook_t *h, ULONG_PTR sp, ULONG_PTR ebp_or_rip) operate_on_backtrace(sp, ebp_or_rip, NULL, set_caller_info); base_on_api(h); - + return 1; } @@ -209,10 +198,10 @@ hook_info_t *hook_info() get_lasterrors(&lasterror); - ptr = (hook_info_t *)TlsGetValue(g_tls_hook_index); + ptr = (hook_info_t *)lookup_get_no_cs(&g_hook_info, (ULONG_PTR)GetCurrentThreadId(), NULL); if (ptr == NULL) { - ptr = (hook_info_t *)calloc(1, sizeof(hook_info_t)); - TlsSetValue(g_tls_hook_index, ptr); + ptr = lookup_add_no_cs(&g_hook_info, (ULONG_PTR)GetCurrentThreadId(), sizeof(hook_info_t)); + memset(ptr, 0, sizeof(*ptr)); } set_lasterrors(&lasterror); diff --git a/hooking.h b/hooking.h index e4ae038..a2a7015 100644 --- a/hooking.h +++ b/hooking.h @@ -20,6 +20,7 @@ along with this program. If not, see . #define __HOOKING_H #include "ntapi.h" +#include "lookup.h" #include "config.h" #include @@ -288,4 +289,6 @@ static inline BOOLEAN disable_this_hook(hook_t *h) return TRUE; } +void hook_init(); + #endif \ No newline at end of file diff --git a/lookup.c b/lookup.c index 3b034a1..7a69c61 100644 --- a/lookup.c +++ b/lookup.c @@ -51,6 +51,17 @@ void *lookup_add(lookup_t *d, ULONG_PTR id, unsigned int size) return t->data; } +void *lookup_add_no_cs(lookup_t *d, ULONG_PTR id, unsigned int size) +{ + entry_t *t = (entry_t *) malloc(sizeof(entry_t) + size); + memset(t, 0, sizeof(*t)); + t->next = d->root; + t->id = id; + t->size = size; + d->root = t; + return t->data; +} + void *lookup_get(lookup_t *d, ULONG_PTR id, unsigned int *size) { entry_t *p; @@ -70,6 +81,23 @@ void *lookup_get(lookup_t *d, ULONG_PTR id, unsigned int *size) return NULL; } +void *lookup_get_no_cs(lookup_t *d, ULONG_PTR id, unsigned int *size) +{ + entry_t *p; + for (p = d->root; p != NULL; p = p->next) { + if(p->id == id) { + void *data; + if(size != NULL) { + *size = p->size; + } + data = p->data; + LEAVE(); + return data; + } + } + return NULL; +} + void lookup_del(lookup_t *d, ULONG_PTR id) { entry_t *p; @@ -94,3 +122,26 @@ void lookup_del(lookup_t *d, ULONG_PTR id) } LEAVE(); } + +void lookup_del_no_cs(lookup_t *d, ULONG_PTR id) +{ + entry_t *p; + entry_t *last; + + p = d->root; + // edge case; we want to delete the first entry + if(p != NULL && p->id == id) { + entry_t *t = p->next; + free(d->root); + d->root = t; + LEAVE(); + return; + } + for (last = NULL; p != NULL; last = p, p = p->next) { + if(p->id == id) { + last->next = p->next; + free(p); + break; + } + } +} diff --git a/lookup.h b/lookup.h index 235b714..15e58f3 100644 --- a/lookup.h +++ b/lookup.h @@ -35,3 +35,7 @@ void lookup_init(lookup_t *d); void *lookup_add(lookup_t *d, ULONG_PTR id, unsigned int size); void *lookup_get(lookup_t *d, ULONG_PTR id, unsigned int *size); void lookup_del(lookup_t *d, ULONG_PTR id); + +void *lookup_add_no_cs(lookup_t *d, ULONG_PTR id, unsigned int size); +void *lookup_get_no_cs(lookup_t *d, ULONG_PTR id, unsigned int *size); +void lookup_del_no_cs(lookup_t *d, ULONG_PTR id); diff --git a/misc.c b/misc.c index a473a35..25e5158 100644 --- a/misc.c +++ b/misc.c @@ -781,9 +781,7 @@ uint32_t path_from_object_attributes(const OBJECT_ATTRIBUTES *obj, return copylen; } - length = path_from_handle(obj->RootDirectory, - path, buffer_length); - + length = path_from_handle(obj->RootDirectory, path, buffer_length); path[length++] = L'\\'; if (length >= (buffer_length - 1)) diff --git a/unhook.c b/unhook.c index 6d2bc1b..3ef7aa9 100644 --- a/unhook.c +++ b/unhook.c @@ -28,7 +28,10 @@ along with this program. If not, see . #define UNHOOK_MAXCOUNT 2048 #define UNHOOK_BUFSIZE 32 -extern void handle_terminate(); +extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); +extern void file_handle_terminate(); +extern int RoutineProcessDump(); +extern BOOL ProcessDumped; static HANDLE g_unhook_thread_handle, g_watcher_thread_handle; @@ -253,7 +256,12 @@ static DWORD WINAPI _terminate_event_thread(LPVOID param) while (1) { WaitForSingleObject(g_terminate_event_handle, INFINITE); - handle_terminate(); + if (g_config.procdump && !ProcessDumped) + { + DoOutputDebugString("Terminate Event: Attempting to dump process %d\n", GetCurrentProcessId()); + RoutineProcessDump(); + } + file_handle_terminate(); log_flush(); } From e18708f69eab82e635f149b1409006a0bd2892f5 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 Jul 2018 13:52:57 +0100 Subject: [PATCH 04/12] Added default breakpoint initialisation to main process base on startup --- CAPE/CAPE.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CAPE/CAPE.c b/CAPE/CAPE.c index 4612acd..7849f96 100644 --- a/CAPE/CAPE.c +++ b/CAPE/CAPE.c @@ -122,6 +122,7 @@ extern int ScyllaDumpProcess(HANDLE hProcess, DWORD_PTR modBase, DWORD_PTR NewOE extern int ScyllaDumpCurrentProcessFixImports(DWORD_PTR NewOEP); extern int ScyllaDumpProcessFixImports(HANDLE hProcess, DWORD_PTR modBase, DWORD_PTR NewOEP); extern int ScyllaDumpPE(DWORD_PTR Buffer); +extern BOOL SetInitialBreakpoints(PVOID ImageBase); extern BOOL CountDepth(LPVOID* ReturnAddress, LPVOID Address); extern SIZE_T GetPESize(PVOID Buffer); extern LPVOID GetReturnAddress(hook_info_t *hookinfo); @@ -1899,6 +1900,8 @@ void init_CAPE() #else DoOutputDebugString("CAPE initialised: 32-bit Trace package loaded at 0x%x, process image base 0x%x, stack from 0x%x-0x%x\n", g_our_dll_base, GetModuleHandle(NULL), get_stack_bottom(), get_stack_top()); #endif - + + SetInitialBreakpoints(GetModuleHandle(NULL)); + return; } From 58dfb7698f22564436d72ff55d5e55637d815252 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Aug 2018 15:18:25 +0100 Subject: [PATCH 05/12] Add configurable depth (step-into) and count (instruction) parameters. --- CAPE/CAPE.c | 6 +- CAPE/CAPE.h | 2 +- CAPE/Debugger.c | 12 ++ CAPE/Debugger.h | 1 + CAPE/Scylla/IATReferenceScan.cpp | 6 - CAPE/Scylla/PeParser.cpp | 64 +++++---- CAPE/ScyllaHarness.cpp | 10 +- CAPE/Trace.c | 38 +++--- config.c | 10 ++ cuckoomon.c | 11 +- hook_file.c | 2 +- hook_misc.c | 66 ++++++++-- hook_process.c | 79 +++++++---- hook_sleep.c | 6 +- hook_special.c | 65 +++++----- hook_thread.c | 216 ++++++++++++++++++++++--------- hooking.c | 33 ----- hooks.h | 34 +++++ log.h | 3 + ntapi.h | 104 ++++++++++++++- pipe.c | 94 +++++++------- 21 files changed, 584 insertions(+), 278 deletions(-) diff --git a/CAPE/CAPE.c b/CAPE/CAPE.c index 7849f96..ebd7cab 100644 --- a/CAPE/CAPE.c +++ b/CAPE/CAPE.c @@ -100,8 +100,6 @@ typedef struct _hook_info_t { ULONG_PTR main_caller_retaddr; ULONG_PTR parent_caller_retaddr; } hook_info_t; - -#define CAPE_OUTPUT_FILE "CapeOutput.bin" extern uint32_t path_from_handle(HANDLE handle, wchar_t *path, uint32_t path_buffer_len); extern int called_by_hook(void); @@ -1896,9 +1894,9 @@ void init_CAPE() DoOutputDebugString("Failed to initialise debugger.\n"); #ifdef _WIN64 - DoOutputDebugString("CAPE initialised: 64-bit Trace package loaded at 0x%p, process image base 0x%p, stack from 0x%p-0x%p\n", g_our_dll_base, GetModuleHandle(NULL), get_stack_bottom(), get_stack_top()); + DoOutputDebugString("CAPE initialised: 64-bit Trace package loaded in process %d at 0x%p, image base 0x%p, stack from 0x%p-0x%p\n", GetCurrentProcessId(), g_our_dll_base, GetModuleHandle(NULL), get_stack_bottom(), get_stack_top()); #else - DoOutputDebugString("CAPE initialised: 32-bit Trace package loaded at 0x%x, process image base 0x%x, stack from 0x%x-0x%x\n", g_our_dll_base, GetModuleHandle(NULL), get_stack_bottom(), get_stack_top()); + DoOutputDebugString("CAPE initialised: 32-bit Trace package loaded in process %d at 0x%x, image base 0x%x, stack from 0x%x-0x%x\n", GetCurrentProcessId(), g_our_dll_base, GetModuleHandle(NULL), get_stack_bottom(), get_stack_top()); #endif SetInitialBreakpoints(GetModuleHandle(NULL)); diff --git a/CAPE/CAPE.h b/CAPE/CAPE.h index 686b874..44424eb 100644 --- a/CAPE/CAPE.h +++ b/CAPE/CAPE.h @@ -153,7 +153,7 @@ enum { CERBER_CONFIG = 0x30, CERBER_PAYLOAD = 0x31, - + DATADUMP = 0x66 }; diff --git a/CAPE/Debugger.c b/CAPE/Debugger.c index 948b93b..3778ca8 100644 --- a/CAPE/Debugger.c +++ b/CAPE/Debugger.c @@ -1784,6 +1784,18 @@ BOOL SetZeroFlag(PCONTEXT Context) return TRUE; } +//************************************************************************************** +BOOL ClearZeroFlag(PCONTEXT Context) +//************************************************************************************** +{ + if (Context == NULL) + return FALSE; + + Context->EFlags &= ~FL_ZF; + + return TRUE; +} + //************************************************************************************** BOOL SetSingleStepMode(PCONTEXT Context, PVOID Handler) //************************************************************************************** diff --git a/CAPE/Debugger.h b/CAPE/Debugger.h index 57f295d..fc38b5a 100644 --- a/CAPE/Debugger.h +++ b/CAPE/Debugger.h @@ -127,6 +127,7 @@ BOOL SetNextAvailableBreakpoint(DWORD ThreadId, unsigned int* Register, int Size BOOL SetSingleStepMode(PCONTEXT Context, PVOID Handler); BOOL SetResumeFlag(PCONTEXT Context); BOOL SetZeroFlag(PCONTEXT Context); +BOOL ClearZeroFlag(PCONTEXT Context); PTHREADBREAKPOINTS CreateThreadBreakpoints(DWORD ThreadId); // Get diff --git a/CAPE/Scylla/IATReferenceScan.cpp b/CAPE/Scylla/IATReferenceScan.cpp index 471a21d..7e1690e 100644 --- a/CAPE/Scylla/IATReferenceScan.cpp +++ b/CAPE/Scylla/IATReferenceScan.cpp @@ -67,8 +67,6 @@ void IATReferenceScan::startScan(DWORD_PTR imageBase, DWORD imageSize, DWORD_PTR iatDirectImportList.reserve(50); } - - DWORD_PTR section = imageBase; do @@ -410,7 +408,6 @@ void IATReferenceScan::patchNewIat(DWORD_PTR stdImagebase, DWORD_PTR newIatBaseA } } - void IATReferenceScan::printDirectImportLog() { DoOutputDebugString("------------------------------------------------------------"); @@ -455,7 +452,6 @@ void IATReferenceScan::printDirectImportLog() DoOutputDebugString("------------------------------------------------------------"); } - void IATReferenceScan::findDirectIatReferenceCallJmp( _DInst * instruction ) { IATReference ref; @@ -735,5 +731,3 @@ DWORD IATReferenceScan::addAdditionalApisToList() return newIatSize; } - - diff --git a/CAPE/Scylla/PeParser.cpp b/CAPE/Scylla/PeParser.cpp index 08b7ff2..4b4c564 100644 --- a/CAPE/Scylla/PeParser.cpp +++ b/CAPE/Scylla/PeParser.cpp @@ -359,11 +359,11 @@ bool PeParser::readPeSectionsFromProcess() #ifdef DEBUG_COMMENTS DoOutputDebugString("PeParser::readPeSectionsFromProcess: Correcting VirtualSize for last section (%d) from 0x%x to 0x%x.\n", i+1, listPeSection[i].sectionHeader.Misc.VirtualSize, alignValue(listPeSection[i].sectionHeader.SizeOfRawData, sectionAlignment)); #endif - listPeSection[i].sectionHeader.Misc.VirtualSize = alignValue(listPeSection[i].sectionHeader.SizeOfRawData, sectionAlignment); + listPeSection[i].normalSize = alignValue(listPeSection[i].sectionHeader.SizeOfRawData, sectionAlignment); } else { - listPeSection[i].sectionHeader.Misc.VirtualSize = alignValue(listPeSection[i].sectionHeader.Misc.VirtualSize, sectionAlignment); + listPeSection[i].normalSize = alignValue(listPeSection[i].sectionHeader.Misc.VirtualSize, sectionAlignment); #ifdef DEBUG_COMMENTS DoOutputDebugString("PeParser::readPeSectionsFromProcess: VirtualSize for last section (%d) ok: 0x%x.\n", i+1, listPeSection[i].sectionHeader.Misc.VirtualSize); #endif @@ -749,7 +749,7 @@ bool PeParser::readSectionFrom(const DWORD_PTR readOffset, PeFileSection & peFil currentOffset = readOffset + readSize - currentReadSize; #ifdef DEBUG_COMMENTS - DoOutputDebugString("PeParser: About to attempt to read section from 0x%x size 0x%x.\n", readOffset, readSize); + DoOutputDebugString("PeParser: About to reverse-scan section from 0x%p size 0x%x.\n", readOffset, readSize); #endif while(currentOffset >= readOffset) //start from the end @@ -768,10 +768,14 @@ bool PeParser::readSectionFrom(const DWORD_PTR readOffset, PeFileSection & peFil if (!retValue) { #ifdef DEBUG_COMMENTS - DoOutputDebugString("PeParser: readMemory failure reading 0x%x bytes from 0x%x.\n", currentOffset , currentReadSize); + DoOutputDebugString("PeParser: readMemory failure reading from 0x%p (currentReadSize 0x%x).\n", currentOffset, currentReadSize); #endif break; } +#ifdef DEBUG_COMMENTS + //else + // DoOutputDebugString("PeParser: Read memory chunk from 0x%p size 0x%x.\n", currentOffset, currentReadSize); +#endif valuesFound = isMemoryNotNull(data, currentReadSize); if (valuesFound) @@ -779,7 +783,7 @@ bool PeParser::readSectionFrom(const DWORD_PTR readOffset, PeFileSection & peFil //found some real code #ifdef DEBUG_COMMENTS - //DoOutputDebugString("PeParser: readMemory found data at 0x%x.\n", currentOffset); + DoOutputDebugString("PeParser: readMemory found data at 0x%p (currentReadSize 0x%x).\n", currentOffset, currentReadSize); #endif currentOffset += valuesFound; @@ -802,21 +806,17 @@ bool PeParser::readSectionFrom(const DWORD_PTR readOffset, PeFileSection & peFil } #ifdef DEBUG_COMMENTS //else - // DoOutputDebugString("PeParser: readMemory found nothing at 0x%x.\n", currentOffset); + // DoOutputDebugString("PeParser: readMemory found nothing at 0x%p (currentReadSize 0x%x).\n", currentOffset, currentReadSize); #endif currentReadSize = maxReadSize; currentOffset -= currentReadSize; } -#ifdef DEBUG_COMMENTS - DoOutputDebugString("PeParser: calls to readSectionFrom succeeded.\n"); -#endif - if (peFileSection.dataSize) { #ifdef DEBUG_COMMENTS - DoOutputDebugString("PeParser: readSectionFrom: About to read PE section from 0x%x.\n", readOffset); + DoOutputDebugString("PeParser: readSectionFrom: About to read full PE section from 0x%p size 0x%x.\n", readOffset, peFileSection.dataSize); #endif if (isProcess) { @@ -827,6 +827,10 @@ bool PeParser::readSectionFrom(const DWORD_PTR readOffset, PeFileSection & peFil retValue = readPeSectionFromFile((DWORD)readOffset, peFileSection); } } +#ifdef DEBUG_COMMENTS + else + DoOutputDebugString("PeParser: No data read from section at 0x%p.\n", readOffset); +#endif return retValue; } @@ -850,7 +854,7 @@ bool PeParser::savePeFileToDisk(const CHAR *newFile) char *CapeName; #ifdef DEBUG_COMMENTS - DoOutputDebugString("PeParser::savePeFileToDisk: Function entry.\n"); + //DoOutputDebugString("PeParser::savePeFileToDisk: Function entry.\n"); #endif DWORD dwFileOffset = 0, dwWriteSize = 0; @@ -919,7 +923,6 @@ bool PeParser::savePeFileToDisk(const CHAR *newFile) if (!listPeSection[i].sectionHeader.PointerToRawData) continue; - if (listPeSection[i].sectionHeader.PointerToRawData > dwFileOffset) { dwWriteSize = listPeSection[i].sectionHeader.PointerToRawData - dwFileOffset; //padding @@ -934,7 +937,7 @@ bool PeParser::savePeFileToDisk(const CHAR *newFile) dwWriteSize = listPeSection[i].dataSize; - if (dwWriteSize >= pNTHeader32->OptionalHeader.FileAlignment) + if (dwWriteSize) { #ifdef DEBUG_COMMENTS DoOutputDebugString("PeParser::savePeFileToDisk: Writing section %d of size 0x%x bytes.\n", i+1, dwWriteSize); @@ -960,7 +963,10 @@ bool PeParser::savePeFileToDisk(const CHAR *newFile) dwFileOffset += dwWriteSize; } } - +#ifdef DEBUG_COMMENTS + else + DoOutputDebugString("PeParser::savePeFileToDisk: Nothing to write for section %d.\n", i+1); +#endif } //add overlay? @@ -1319,15 +1325,15 @@ void PeParser::fixPeHeader() pNTHeader32->OptionalHeader.SizeOfImage = getSectionHeaderBasedSizeOfImage(); - //if (moduleBaseAddress) - //{ - // pNTHeader32->OptionalHeader.ImageBase = (DWORD)moduleBaseAddress; - //} - pNTHeader32->OptionalHeader.SizeOfHeaders = alignValue(dwSize + pNTHeader32->FileHeader.SizeOfOptionalHeader + (getNumberOfSections() * sizeof(IMAGE_SECTION_HEADER)), pNTHeader32->OptionalHeader.FileAlignment); + + if (moduleBaseAddress && moduleBaseAddress != pNTHeader32->OptionalHeader.ImageBase) + { + pNTHeader32->OptionalHeader.ImageBase = (DWORD)moduleBaseAddress; #ifdef DEBUG_COMMENTS - //DoOutputDebugString("fixPeHeader: imagebase 0x%x.\n", pNTHeader32->OptionalHeader.ImageBase); + DoOutputDebugString("fixPeHeader: ImageBase set to 0x%x.\n", pNTHeader32->OptionalHeader.ImageBase); #endif + } } else { @@ -1347,13 +1353,15 @@ void PeParser::fixPeHeader() pNTHeader64->OptionalHeader.SizeOfImage = getSectionHeaderBasedSizeOfImage(); - //if (moduleBaseAddress) - //{ - // pNTHeader64->OptionalHeader.ImageBase = moduleBaseAddress; - //} - pNTHeader64->OptionalHeader.SizeOfHeaders = alignValue(dwSize + pNTHeader64->FileHeader.SizeOfOptionalHeader + (getNumberOfSections() * sizeof(IMAGE_SECTION_HEADER)), pNTHeader64->OptionalHeader.FileAlignment); - //DoOutputDebugString("fixPeHeader: imagebase 0x%x.\n", pNTHeader64->OptionalHeader.ImageBase); + + if (moduleBaseAddress && moduleBaseAddress != pNTHeader64->OptionalHeader.ImageBase) + { + pNTHeader64->OptionalHeader.ImageBase = (DWORD)moduleBaseAddress; +#ifdef DEBUG_COMMENTS + DoOutputDebugString("fixPeHeader: ImageBase set to 0x%x.\n", pNTHeader64->OptionalHeader.ImageBase); +#endif + } } removeIatDirectory(); @@ -1541,9 +1549,11 @@ bool PeParser::dumpProcess(DWORD_PTR modBase, DWORD_PTR entryPoint, const CHAR * setEntryPointVa(entryPoint); alignAllSectionHeaders(); + fixPeHeader(); getFileOverlay(); + #ifdef DEBUG_COMMENTS DoOutputDebugString("dumpProcess DEBUG: Fixups complete, about to save to disk.\n"); #endif diff --git a/CAPE/ScyllaHarness.cpp b/CAPE/ScyllaHarness.cpp index 262fcfc..b6ff1de 100644 --- a/CAPE/ScyllaHarness.cpp +++ b/CAPE/ScyllaHarness.cpp @@ -180,7 +180,7 @@ extern "C" int ScyllaDumpProcess(HANDLE hProcess, DWORD_PTR ModuleBase, DWORD_PT else { DoOutputDebugString("DumpProcess: Module entry point VA is 0x%p.\n", entrypoint); - entrypoint = entrypoint + ModuleBase; + entrypoint = entrypoint + (DWORD_PTR)ModuleBase; } if (peFile->dumpProcess(ModuleBase, entrypoint, NULL)) @@ -828,7 +828,7 @@ extern "C" int ScyllaDumpProcessFixImports(HANDLE hProcess, DWORD_PTR ModuleBase } delete peFile; - + return 1; } @@ -839,13 +839,13 @@ extern "C" BOOL ScyllaGetSectionByName(PVOID ImageBase, char* Name, PVOID* Secti ScyllaInitCurrentProcess(); PeParser *peFile = new PeParser((DWORD_PTR)ImageBase, true); - + if (!peFile->isValidPeFile()) { DoOutputDebugString("ScyllaGetSectionByName: Invalid PE image.\n"); return 0; } - + if (!peFile->readPeSectionsFromProcess()) { DoOutputDebugString("ScyllaGetSectionByName: Failed to read PE sections from image.\n"); @@ -853,7 +853,7 @@ extern "C" BOOL ScyllaGetSectionByName(PVOID ImageBase, char* Name, PVOID* Secti } unsigned int NumberOfSections = peFile->getNumberOfSections(); - + for (unsigned int i = 0; i < NumberOfSections; i++) { if (!strcmp((char*)peFile->listPeSection[i].sectionHeader.Name, Name)) diff --git a/CAPE/Trace.c b/CAPE/Trace.c index 5f41c9d..c66b59b 100644 --- a/CAPE/Trace.c +++ b/CAPE/Trace.c @@ -21,7 +21,7 @@ along with this program.If not, see . #include "CAPE.h" #define MAX_INSTRUCTIONS 0x10 -#define SINGLE_STEP_LIMIT 0x80 +#define SINGLE_STEP_LIMIT 0x80 // default unless specified in web ui #define CHUNKSIZE 0x10 * MAX_INSTRUCTIONS extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); @@ -33,11 +33,11 @@ extern DWORD_PTR FileOffsetToVA(DWORD_PTR modBase, DWORD_PTR dwOffset); extern BOOL ScyllaGetSectionByName(PVOID ImageBase, char* Name, PVOID* SectionData, SIZE_T* SectionSize); BOOL BreakpointSet, DllPrinted; -unsigned int DumpCount, Correction, StepCount, DepthCount, DepthLimit; PVOID ModuleBase, DumpAddress; SIZE_T DumpSize; BOOL GetSystemTimeAsFileTimeImported, PayloadMarker, PayloadDumped; -int StepOverRegister; +unsigned int DumpCount, Correction, StepCount, StepLimit; +int StepOverRegister, TraceDepthCount, TraceDepthLimit; BOOL Trace(struct _EXCEPTION_POINTERS* ExceptionInfo); BOOL BreakpointCallback(PBREAKPOINTINFO pBreakpointInfo, struct _EXCEPTION_POINTERS* ExceptionInfo); @@ -61,10 +61,9 @@ BOOL Trace(struct _EXCEPTION_POINTERS* ExceptionInfo) StepCount++; - if (StepCount > SINGLE_STEP_LIMIT) + if (StepCount > StepLimit) { - DoOutputDebugString("Trace: single-step limit reached, releasing."); - + DoOutputDebugString("Trace: single-step limit reached (%d), releasing.", StepLimit); return TRUE; } @@ -88,7 +87,7 @@ BOOL Trace(struct _EXCEPTION_POINTERS* ExceptionInfo) if (!strcmp(DecodedInstruction.mnemonic.p, "CALL")) { - if (DepthCount >= DepthLimit) + if (TraceDepthCount >= TraceDepthLimit) { #ifdef _WIN64 ReturnAddress = (PVOID)((PUCHAR)ExceptionInfo->ContextRecord->Rip + DecodedInstruction.size); @@ -105,11 +104,20 @@ BOOL Trace(struct _EXCEPTION_POINTERS* ExceptionInfo) return TRUE; } else - DepthCount++; + TraceDepthCount++; } else if (!strcmp(DecodedInstruction.mnemonic.p, "RET")) { - DepthCount--; + if (TraceDepthCount < 0) + { + DoOutputDebugString("Trace: Stepping out of initial depth, releasing."); + + ClearSingleStepMode(ExceptionInfo->ContextRecord); + + return TRUE; + } + + TraceDepthCount--; } SetSingleStepMode(ExceptionInfo->ContextRecord, Trace); @@ -146,14 +154,8 @@ BOOL BreakpointCallback(PBREAKPOINTINFO pBreakpointInfo, struct _EXCEPTION_POINT DoOutputDebugString("0x%x (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Eip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); #endif - //ContextClearCurrentBreakpoint(ExceptionInfo->ContextRecord); - StepOverExecutionBreakpoint(ExceptionInfo->ContextRecord, pBreakpointInfo); - StepCount = 0; - DepthCount = 0; - DepthLimit = 3; - DoSetSingleStepMode(pBreakpointInfo->Register, ExceptionInfo->ContextRecord, Trace); return TRUE; @@ -164,6 +166,12 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) DWORD_PTR BreakpointVA; DWORD Register; + StepCount = 0; + TraceDepthCount = 0; + + if (!StepLimit) + StepLimit = SINGLE_STEP_LIMIT; + if (!bp0 && !bp1 && !bp2 && !bp3) { DoOutputDebugString("SetInitialBreakpoints: Error - No address specified for Trace breakpoints.\n"); diff --git a/config.c b/config.c index e82e07c..508fed0 100644 --- a/config.c +++ b/config.c @@ -25,6 +25,8 @@ along with this program. If not, see . extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); extern PVOID bp0, bp1, bp2, bp3; +extern unsigned int StepLimit; +extern int TraceDepthLimit; int read_config(void) { @@ -250,6 +252,14 @@ int read_config(void) bp3 = (PVOID)strtoul(value, NULL, 10); DoOutputDebugString("bp3 set to 0x%x", bp3); } + else if (!strcmp(key, "depth")) { + TraceDepthLimit = (int)strtoul(value, NULL, 10); + DoOutputDebugString("Trace depth set to 0x%x", TraceDepthLimit); + } + else if (!strcmp(key, "count")) { + StepLimit = (unsigned int)strtoul(value, NULL, 10); + DoOutputDebugString("Trace instruction count set to 0x%x", StepLimit); + } else if (!strcmp(key, "procdump")) { g_config.procdump = value[0] == '1'; if (g_config.procdump) diff --git a/cuckoomon.c b/cuckoomon.c index 41634a4..855f29a 100644 --- a/cuckoomon.c +++ b/cuckoomon.c @@ -87,6 +87,8 @@ static hook_t g_hooks[] = { //HOOK_SPECIAL(ntdll, NtCreateThread), //HOOK_SPECIAL(ntdll, NtCreateThreadEx), //HOOK_SPECIAL(ntdll, NtTerminateThread), + //HOOK_SPECIAL(kernel32, lstrcpynA), + //HOOK_SPECIAL(kernel32, lstrcmpiA), // has special handling @@ -357,6 +359,8 @@ static hook_t g_hooks[] = { HOOK(kernel32, CreateThread), HOOK(kernel32, CreateRemoteThread), HOOK(ntdll, RtlCreateUserThread), + HOOK(ntdll, NtSetInformationThread), + HOOK(ntdll, NtQueryInformationThread), // // Misc Hooks @@ -402,6 +406,7 @@ static hook_t g_hooks[] = { HOOK(user32, GetAsyncKeyState), HOOK(ntdll, NtLoadDriver), HOOK(ntdll, NtSetInformationProcess), + //HOOK(ntdll, NtQueryInformationProcess), HOOK(ntdll, RtlDecompressBuffer), HOOK(ntdll, RtlCompressBuffer), HOOK(kernel32, GetSystemInfo), @@ -644,7 +649,7 @@ void revalidate_all_hooks(void) PVOID g_dll_notify_cookie; -VOID CALLBACK DllLoadNotification( +VOID CALLBACK New_DllLoadNotification( _In_ ULONG NotificationReason, _In_ const PLDR_DLL_NOTIFICATION_DATA NotificationData, _In_opt_ PVOID Context) @@ -741,9 +746,9 @@ void set_hooks() free(suspended_threads); if (pLdrRegisterDllNotification) - pLdrRegisterDllNotification(0, &DllLoadNotification, NULL, &g_dll_notify_cookie); + pLdrRegisterDllNotification(0, &New_DllLoadNotification, NULL, &g_dll_notify_cookie); else - register_dll_notification_manually(&DllLoadNotification); + register_dll_notification_manually(&New_DllLoadNotification); hook_enable(); } diff --git a/hook_file.c b/hook_file.c index ac2bbb6..94e7749 100644 --- a/hook_file.c +++ b/hook_file.c @@ -438,7 +438,7 @@ HOOKDEF(NTSTATUS, WINAPI, NtReadFile, if (read_count < 50) LOQ_ntstatus("filesystem", "pFbl", "FileHandle", FileHandle, "HandleName", fname, "Buffer", InitialBufferLength, InitialBuffer, "Length", AccumulatedLength); - else if (read_count == 50) + else LOQ_ntstatus("filesystem", "pFbls", "FileHandle", FileHandle, "HandleName", fname, "Buffer", InitialBufferLength, InitialBuffer, "Length", AccumulatedLength, "Status", "Maximum logged reads reached for this file"); diff --git a/hook_misc.c b/hook_misc.c index f9efada..13d47bc 100644 --- a/hook_misc.c +++ b/hook_misc.c @@ -116,16 +116,16 @@ HOOKDEF(PVOID, WINAPI, RtlAddVectoredExceptionHandler, } // We register the handler at the bottom, this minimizes - // our interference and means the handle is valid + // our interference and means the handle is valid ret = Old_RtlAddVectoredExceptionHandler(0, Handler); if (ret == NULL) return ret; - // We record the handler address so that + // We record the handler address so that // CAPEExceptionFilter can call it directly DoOutputDebugString("RtlAddVectoredExceptionHandler hook: CAPE vectored handler protected as First.\n"); - SampleVectoredHandler = (SAMPLE_HANDLER)Handler; + SampleVectoredHandler = (SAMPLE_HANDLER)Handler; } else ret = Old_RtlAddVectoredExceptionHandler(First, Handler); @@ -486,10 +486,11 @@ static int lasty; HOOKDEF(BOOL, WINAPI, GetCursorPos, _Out_ LPPOINT lpPoint ) { + ENSURE_STRUCT(lpPoint, POINT); BOOL ret = Old_GetCursorPos(lpPoint); /* work around the fact that skipping sleeps prevents the human module from making the system look active */ - if (lpPoint && time_skipped.QuadPart != last_skipped.QuadPart) { + if (ret && time_skipped.QuadPart != last_skipped.QuadPart) { int xres, yres; xres = our_GetSystemMetrics(0); yres = our_GetSystemMetrics(1); @@ -512,9 +513,13 @@ HOOKDEF(BOOL, WINAPI, GetCursorPos, last_skipped.QuadPart = time_skipped.QuadPart; } - LOQ_bool("misc", "ii", "x", lpPoint != NULL ? lpPoint->x : 0, - "y", lpPoint != NULL ? lpPoint->y : 0); - + if (ret){ + LOQ_bool("misc", "ii", "x", lpPoint != NULL ? lpPoint->x : 0, + "y", lpPoint != NULL ? lpPoint->y : 0); + } + else{ + LOQ_bool("misc", "ii", "x", 0, "y", 0); + } return ret; } @@ -653,11 +658,25 @@ HOOKDEF(NTSTATUS, WINAPI, NtSetInformationProcess, __in ULONG ProcessInformationLength ) { NTSTATUS ret = Old_NtSetInformationProcess(ProcessHandle, ProcessInformationClass, ProcessInformation, ProcessInformationLength); - if (NT_SUCCESS(ret) && (ProcessInformationClass == ProcessInfoDEPPolicy || ProcessInformationClass == ProcessBreakOnTermination) && ProcessInformationLength == 4) - LOQ_ntstatus("misc", "ii", "ProcessInformationClass", ProcessInformationClass, "Value", *(int *)ProcessInformation); + if ((ProcessInformationClass == ProcessExecuteFlags || ProcessInformationClass == ProcessBreakOnTermination) && ProcessInformationLength == 4) + LOQ_ntstatus("process", "ii", "ProcessInformationClass", ProcessInformationClass, "ProcessInformation", *(int*)ProcessInformation); + else + LOQ_ntstatus("process", "ib", "ProcessInformationClass", ProcessInformationClass, "ProcessInformation", ProcessInformationLength, ProcessInformation); return ret; } +HOOKDEF(NTSTATUS, WINAPI, NtQueryInformationProcess, + IN HANDLE ProcessHandle, + IN PROCESSINFOCLASS ProcessInformationClass, + OUT PVOID ProcessInformation, + IN ULONG ProcessInformationLength, + OUT PULONG ReturnLength OPTIONAL +) { + NTSTATUS ret = Old_NtQueryInformationProcess(ProcessHandle, ProcessInformationClass, ProcessInformation, ProcessInformationLength, ReturnLength); + LOQ_ntstatus("process", "ib", "ProcessInformationClass", ProcessInformationClass, "ProcessInformation", ProcessInformationLength, ProcessInformation); + return ret; +} + HOOKDEF(NTSTATUS, WINAPI, NtQuerySystemInformation, _In_ ULONG SystemInformationClass, _Inout_ PVOID SystemInformation, @@ -1110,3 +1129,32 @@ HOOKDEF(void, WINAPIV, srand, LOQ_void("misc", "h", "seed", seed); } + +HOOKDEF(LPSTR, WINAPI, lstrcpynA, + _Out_ LPSTR lpString1, + _In_ LPSTR lpString2, + _In_ int iMaxLength +) +{ + LPSTR ret; + + ret = Old_lstrcpynA(lpString1, lpString2, iMaxLength); + + LOQ_nonzero("misc", "u", "String", lpString1); + + return ret; +} + +HOOKDEF(int, WINAPI, lstrcmpiA, + _In_ LPCSTR lpString1, + _In_ LPCSTR lpString2 +) +{ + int ret; + + ret = Old_lstrcmpiA(lpString1, lpString2); + + LOQ_nonzero("misc", "ss", "String1", lpString1, "String2", lpString2); + + return ret; +} diff --git a/hook_process.c b/hook_process.c index 2c0759b..b8b2174 100644 --- a/hook_process.c +++ b/hook_process.c @@ -214,21 +214,33 @@ HOOKDEF(BOOL, WINAPI, CreateProcessWithLogonW, ) { BOOL ret; LPWSTR origcommandline = NULL; - + ENSURE_STRUCT(lpProcessInfo, PROCESS_INFORMATION); + if (lpCommandLine) origcommandline = wcsdup(lpCommandLine); ret = Old_CreateProcessWithLogonW(lpUsername, lpDomain, lpPassword, dwLogonFlags, lpApplicationName, lpCommandLine, dwCreationFlags | CREATE_SUSPENDED, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInfo); - LOQ_bool("process", "uuuhuuhiipp", "Username", lpUsername, "Domain", lpDomain, "Password", lpPassword, "LogonFlags", dwLogonFlags, "ApplicationName", lpApplicationName, "CommandLine", origcommandline, "CreationFlags", dwCreationFlags, - "ProcessId", lpProcessInfo->dwProcessId, "ThreadId", lpProcessInfo->dwThreadId, "ProcessHandle", lpProcessInfo->hProcess, "ThreadHandle", lpProcessInfo->hThread); + LOQ_bool("process", "uuuhuuhiipp", + "Username", lpUsername, + "Domain", lpDomain, + "Password", lpPassword, + "LogonFlags", dwLogonFlags, + "ApplicationName", lpApplicationName, + "CommandLine", origcommandline, + "CreationFlags", dwCreationFlags, + "ProcessId", lpProcessInfo->dwProcessId, + "ThreadId", lpProcessInfo->dwThreadId, + "ProcessHandle", lpProcessInfo->hProcess, + "ThreadHandle", lpProcessInfo->hThread + ); if (origcommandline) free(origcommandline); if (ret) { pipe("PROCESS:%d:%d,%d", is_suspended(lpProcessInfo->dwProcessId, lpProcessInfo->dwThreadId), lpProcessInfo->dwProcessId, lpProcessInfo->dwThreadId); - if (!(dwCreationFlags & CREATE_SUSPENDED)) + if (!(dwCreationFlags & CREATE_SUSPENDED) && is_valid_address_range((ULONG_PTR)lpProcessInfo, (DWORD)sizeof(PROCESS_INFORMATION))) ResumeThread(lpProcessInfo->hThread); disable_sleep_skip(); } @@ -254,13 +266,35 @@ HOOKDEF(BOOL, WINAPI, CreateProcessWithTokenW, ret = Old_CreateProcessWithTokenW(hToken, dwLogonFlags, lpApplicationName, lpCommandLine, dwCreationFlags | CREATE_SUSPENDED, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInfo); - LOQ_bool("process", "huuhiipp", "LogonFlags", dwLogonFlags, "ApplicationName", lpApplicationName, "CommandLine", origcommandline, "CreationFlags", dwCreationFlags, - "ProcessId", lpProcessInfo->dwProcessId, "ThreadId", lpProcessInfo->dwThreadId, "ProcessHandle", lpProcessInfo->hProcess, "ThreadHandle", lpProcessInfo->hThread); + if (lpProcessInfo) { + LOQ_bool("process", "huuhiipp", + "LogonFlags", dwLogonFlags, + "ApplicationName", lpApplicationName, + "CommandLine", origcommandline, + "CreationFlags", dwCreationFlags, + "ProcessId", lpProcessInfo->dwProcessId, + "ThreadId", lpProcessInfo->dwThreadId, + "ProcessHandle", lpProcessInfo->hProcess, + "ThreadHandle", lpProcessInfo->hThread + ); + } + else { + LOQ_bool("process", "huuhiipp", + "LogonFlags", dwLogonFlags, + "ApplicationName", lpApplicationName, + "CommandLine", origcommandline, + "CreationFlags", dwCreationFlags, + "ProcessId", NULL, + "ThreadId", NULL, + "ProcessHandle", NULL, + "ThreadHandle", NULL + ); + } if (origcommandline) free(origcommandline); - if (ret) { + if (ret && lpProcessInfo) { pipe("PROCESS:%d:%d,%d", is_suspended(lpProcessInfo->dwProcessId, lpProcessInfo->dwThreadId), lpProcessInfo->dwProcessId, lpProcessInfo->dwThreadId); if (!(dwCreationFlags & CREATE_SUSPENDED)) ResumeThread(lpProcessInfo->hThread); @@ -439,7 +473,7 @@ HOOKDEF(NTSTATUS, WINAPI, NtUnmapViewOfSection, map_size = mbi.RegionSize; } ret = Old_NtUnmapViewOfSection(ProcessHandle, BaseAddress); - + LOQ_ntstatus("process", "ppp", "ProcessHandle", ProcessHandle, "BaseAddress", BaseAddress, "RegionSize", map_size); @@ -506,11 +540,9 @@ HOOKDEF(NTSTATUS, WINAPI, NtReadVirtualMemory, NTSTATUS ret; ENSURE_SIZET(NumberOfBytesRead); - ret = Old_NtReadVirtualMemory(ProcessHandle, BaseAddress, Buffer, - NumberOfBytesToRead, NumberOfBytesRead); + ret = Old_NtReadVirtualMemory(ProcessHandle, BaseAddress, Buffer, NumberOfBytesToRead, NumberOfBytesRead); - LOQ_ntstatus("process", "ppB", "ProcessHandle", ProcessHandle, "BaseAddress", BaseAddress, - "Buffer", NumberOfBytesRead, Buffer); + LOQ_ntstatus("process", "pphB", "ProcessHandle", ProcessHandle, "BaseAddress", BaseAddress, "Size", NumberOfBytesToRead, "Buffer", NumberOfBytesRead, Buffer); return ret; } @@ -525,11 +557,9 @@ HOOKDEF(BOOL, WINAPI, ReadProcessMemory, BOOL ret; ENSURE_SIZET(lpNumberOfBytesRead); - ret = Old_ReadProcessMemory(hProcess, lpBaseAddress, lpBuffer, - nSize, lpNumberOfBytesRead); + ret = Old_ReadProcessMemory(hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesRead); - LOQ_bool("process", "ppB", "ProcessHandle", hProcess, "BaseAddress", lpBaseAddress, - "Buffer", lpNumberOfBytesRead, lpBuffer); + LOQ_bool("process", "pphB", "ProcessHandle", hProcess, "BaseAddress", lpBaseAddress, "Size", nSize, "Buffer", lpNumberOfBytesRead, lpBuffer); return ret; } @@ -550,8 +580,12 @@ HOOKDEF(NTSTATUS, WINAPI, NtWriteVirtualMemory, pid = pid_from_process_handle(ProcessHandle); - LOQ_ntstatus("process", "ppBhs", "ProcessHandle", ProcessHandle, "BaseAddress", BaseAddress, - "Buffer", NumberOfBytesWritten, Buffer, "BufferLength", *NumberOfBytesWritten, "StackPivoted", is_stack_pivoted() ? "yes" : "no"); + LOQ_ntstatus("process", "ppBhs", + "ProcessHandle", ProcessHandle, + "BaseAddress", BaseAddress, + "Buffer", NumberOfBytesWritten, Buffer, + "BufferLength", is_valid_address_range((ULONG_PTR)NumberOfBytesWritten, 4) ? *NumberOfBytesWritten : 0, + "StackPivoted", is_stack_pivoted() ? "yes" : "no"); if (pid != GetCurrentProcessId()) { if (NT_SUCCESS(ret)) { @@ -560,7 +594,6 @@ HOOKDEF(NTSTATUS, WINAPI, NtWriteVirtualMemory, } } - return ret; } @@ -659,12 +692,12 @@ HOOKDEF(NTSTATUS, WINAPI, NtProtectVirtualMemory, if (NewAccessProtection == PAGE_EXECUTE_READ && BaseAddress && NumberOfBytesToProtect && GetCurrentProcessId() == our_getprocessid(ProcessHandle) && is_in_dll_range((ULONG_PTR)*BaseAddress)) restore_hooks_on_range((ULONG_PTR)*BaseAddress, (ULONG_PTR)*BaseAddress + *NumberOfBytesToProtect); - + ret = Old_NtProtectVirtualMemory(ProcessHandle, BaseAddress, NumberOfBytesToProtect, NewAccessProtection, OldAccessProtection); memset(&meminfo, 0, sizeof(meminfo)); - if (NT_SUCCESS(ret)) { + if (NT_SUCCESS(ret) && OldAccessProtection && *OldAccessProtection == NewAccessProtection) { lasterror_t lasterrors; get_lasterrors(&lasterrors); VirtualQueryEx(ProcessHandle, *BaseAddress, &meminfo, sizeof(meminfo)); @@ -707,7 +740,7 @@ HOOKDEF(BOOL, WINAPI, VirtualProtectEx, lpflOldProtect); memset(&meminfo, 0, sizeof(meminfo)); - if (ret) { + if (ret && lpflOldProtect && *lpflOldProtect == flNewProtect) { lasterror_t lasterrors; get_lasterrors(&lasterrors); VirtualQueryEx(hProcess, lpAddress, &meminfo, sizeof(meminfo)); @@ -825,7 +858,7 @@ HOOKDEF_NOTAIL(WINAPI, RtlDispatchException, if (tebtmp[0] != 0xffffffff) seh = ((DWORD *)tebtmp[0])[1]; if (seh < g_our_dll_base || seh >= (g_our_dll_base + g_our_dll_size)) { - _snprintf(buf, sizeof(buf), "Exception 0x%x reported at offset 0x%x in cuckoomon itself while accessing 0x%x from hook %s", ExceptionRecord->ExceptionCode, (DWORD)((ULONG_PTR)ExceptionRecord->ExceptionAddress - g_our_dll_base), ExceptionRecord->ExceptionInformation[1], hook_info()->current_hook ? hook_info()->current_hook->funcname : "unknown"); + _snprintf(buf, sizeof(buf), "Exception 0x%x reported at offset 0x%x in capemon itself while accessing 0x%x from hook %s", ExceptionRecord->ExceptionCode, (DWORD)((ULONG_PTR)ExceptionRecord->ExceptionAddress - g_our_dll_base), ExceptionRecord->ExceptionInformation[1], hook_info()->current_hook ? hook_info()->current_hook->funcname : "unknown"); log_anomaly("cuckoocrash", buf); } } diff --git a/hook_sleep.c b/hook_sleep.c index b7a4ad8..9f08c1e 100644 --- a/hook_sleep.c +++ b/hook_sleep.c @@ -119,7 +119,7 @@ HOOKDEF(NTSTATUS, WINAPI, NtWaitForSingleObject, LOQ_ntstatus("system", "s", "Status", "Small log limit reached"); num_wait_small++; } - else if (num_wait_small > 20) { + else { // likely using a bunch of tiny sleeps to delay execution, so let's suddenly mimic high load and give our // fake passage of time the impression of longer delays to return from sleep time_skipped.QuadPart += (randint(500, 1000) * 10000); @@ -213,7 +213,7 @@ HOOKDEF(NTSTATUS, WINAPI, NtDelayExecution, LOQ_ntstatus("system", "s", "Status", "Small log limit reached"); num_small++; } - else if (num_small > 20) { + else { // likely using a bunch of tiny sleeps to delay execution, so let's suddenly mimic high load and give our // fake passage of time the impression of longer delays to return from sleep time_skipped.QuadPart += (randint(500, 1000) * 10000); @@ -267,7 +267,7 @@ HOOKDEF(DWORD, WINAPI, MsgWaitForMultipleObjectsEx, LOQ_msgwait("system", "s", "Status", "Small log limit reached"); num_msg_small++; } - else if (num_msg_small > 20) { + else { // likely using a bunch of tiny sleeps to delay execution, so let's suddenly mimic high load and give our // fake passage of time the impression of longer delays to return from sleep time_skipped.QuadPart += (randint(500, 1000) * 10000); diff --git a/hook_special.c b/hook_special.c index 5c52bf8..f00a7d0 100644 --- a/hook_special.c +++ b/hook_special.c @@ -172,32 +172,30 @@ HOOKDEF(BOOL, WINAPI, CreateProcessInternalW, disable_sleep_skip(); } - if (!called_by_hook()) { - if (dwCreationFlags & EXTENDED_STARTUPINFO_PRESENT && lpStartupInfo->cb == sizeof(STARTUPINFOEXW)) { - HANDLE ParentHandle = (HANDLE)-1; - unsigned int i; - LPSTARTUPINFOEXW lpExtStartupInfo = (LPSTARTUPINFOEXW)lpStartupInfo; - if (lpExtStartupInfo->lpAttributeList) { - for (i = 0; i < lpExtStartupInfo->lpAttributeList->Count; i++) - if (lpExtStartupInfo->lpAttributeList->Entries[i].Attribute == PROC_THREAD_ATTRIBUTE_PARENT_PROCESS) - ParentHandle = *(HANDLE *)lpExtStartupInfo->lpAttributeList->Entries[i].lpValue; - } - LOQ_bool("process", "uuhiippps", "ApplicationName", lpApplicationName, - "CommandLine", lpCommandLine, "CreationFlags", dwCreationFlags, - "ProcessId", lpProcessInformation->dwProcessId, - "ThreadId", lpProcessInformation->dwThreadId, - "ParentHandle", ParentHandle, - "ProcessHandle", lpProcessInformation->hProcess, - "ThreadHandle", lpProcessInformation->hThread, "StackPivoted", is_stack_pivoted() ? "yes" : "no"); - } - else { - LOQ_bool("process", "uuhiipps", "ApplicationName", lpApplicationName, - "CommandLine", lpCommandLine, "CreationFlags", dwCreationFlags, - "ProcessId", lpProcessInformation->dwProcessId, - "ThreadId", lpProcessInformation->dwThreadId, - "ProcessHandle", lpProcessInformation->hProcess, - "ThreadHandle", lpProcessInformation->hThread, "StackPivoted", is_stack_pivoted() ? "yes" : "no"); - } + if (dwCreationFlags & EXTENDED_STARTUPINFO_PRESENT && lpStartupInfo->cb == sizeof(STARTUPINFOEXW)) { + HANDLE ParentHandle = (HANDLE)-1; + unsigned int i; + LPSTARTUPINFOEXW lpExtStartupInfo = (LPSTARTUPINFOEXW)lpStartupInfo; + if (lpExtStartupInfo->lpAttributeList) { + for (i = 0; i < lpExtStartupInfo->lpAttributeList->Count; i++) + if (lpExtStartupInfo->lpAttributeList->Entries[i].Attribute == PROC_THREAD_ATTRIBUTE_PARENT_PROCESS) + ParentHandle = *(HANDLE *)lpExtStartupInfo->lpAttributeList->Entries[i].lpValue; + } + LOQ_bool("process", "uuhiippps", "ApplicationName", lpApplicationName, + "CommandLine", lpCommandLine, "CreationFlags", dwCreationFlags, + "ProcessId", lpProcessInformation->dwProcessId, + "ThreadId", lpProcessInformation->dwThreadId, + "ParentHandle", ParentHandle, + "ProcessHandle", lpProcessInformation->hProcess, + "ThreadHandle", lpProcessInformation->hThread, "StackPivoted", is_stack_pivoted() ? "yes" : "no"); + } + else { + LOQ_bool("process", "uuhiipps", "ApplicationName", lpApplicationName, + "CommandLine", lpCommandLine, "CreationFlags", dwCreationFlags, + "ProcessId", lpProcessInformation->dwProcessId, + "ThreadId", lpProcessInformation->dwThreadId, + "ProcessHandle", lpProcessInformation->hProcess, + "ThreadHandle", lpProcessInformation->hThread, "StackPivoted", is_stack_pivoted() ? "yes" : "no"); } return ret; @@ -229,8 +227,10 @@ HOOKDEF(HRESULT, WINAPI, CoCreateInstance, if (!pProgIDFromCLSID) pProgIDFromCLSID = (_ProgIDFromCLSID)GetProcAddress(GetModuleHandleA("ole32"), "ProgIDFromCLSID"); - memcpy(&id1, rclsid, sizeof(id1)); - memcpy(&id2, riid, sizeof(id2)); + if (is_valid_address_range((ULONG_PTR)rclsid, 16)) + memcpy(&id1, rclsid, sizeof(id1)); + if (is_valid_address_range((ULONG_PTR)riid, 16)) + memcpy(&id2, riid, sizeof(id2)); sprintf(idbuf1, "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", id1.Data1, id1.Data2, id1.Data3, id1.Data4[0], id1.Data4[1], id1.Data4[2], id1.Data4[3], id1.Data4[4], id1.Data4[5], id1.Data4[6], id1.Data4[7]); sprintf(idbuf2, "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", id2.Data1, id2.Data2, id2.Data3, @@ -290,7 +290,8 @@ HOOKDEF(HRESULT, WINAPI, CoCreateInstanceEx, if (!pProgIDFromCLSID) pProgIDFromCLSID = (_ProgIDFromCLSID)GetProcAddress(GetModuleHandleA("ole32"), "ProgIDFromCLSID"); - memcpy(&id1, rclsid, sizeof(id1)); + if (is_valid_address_range((ULONG_PTR)rclsid, 16)) + memcpy(&id1, rclsid, sizeof(id1)); sprintf(idbuf1, "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", id1.Data1, id1.Data2, id1.Data3, id1.Data4[0], id1.Data4[1], id1.Data4[2], id1.Data4[3], id1.Data4[4], id1.Data4[5], id1.Data4[6], id1.Data4[7]); @@ -352,8 +353,10 @@ HOOKDEF(HRESULT, WINAPI, CoGetClassObject, if (!pProgIDFromCLSID) pProgIDFromCLSID = (_ProgIDFromCLSID)GetProcAddress(GetModuleHandleA("ole32"), "ProgIDFromCLSID"); - memcpy(&id1, rclsid, sizeof(id1)); - memcpy(&id2, riid, sizeof(id2)); + if (is_valid_address_range((ULONG_PTR)rclsid, 16)) + memcpy(&id1, rclsid, sizeof(id1)); + if (is_valid_address_range((ULONG_PTR)riid, 16)) + memcpy(&id2, riid, sizeof(id2)); sprintf(idbuf1, "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", id1.Data1, id1.Data2, id1.Data3, id1.Data4[0], id1.Data4[1], id1.Data4[2], id1.Data4[3], id1.Data4[4], id1.Data4[5], id1.Data4[6], id1.Data4[7]); sprintf(idbuf2, "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", id2.Data1, id2.Data2, id2.Data3, diff --git a/hook_thread.c b/hook_thread.c index 10bb819..d3f6fab 100644 --- a/hook_thread.c +++ b/hook_thread.c @@ -50,6 +50,7 @@ BOOLEAN is_ignored_thread(DWORD tid) if (ret) return TRUE; + return FALSE; } @@ -79,18 +80,19 @@ HOOKDEF(NTSTATUS, WINAPI, NtQueueApcThread, __in_opt PIO_STATUS_BLOCK ApcStatusBlock, __in_opt ULONG ApcReserved ) { - DWORD PID = pid_from_thread_handle(ThreadHandle); - DWORD TID = tid_from_thread_handle(ThreadHandle); + DWORD pid = pid_from_thread_handle(ThreadHandle); + DWORD tid = tid_from_thread_handle(ThreadHandle); NTSTATUS ret; - pipe("PROCESS:%d:%d,%d", is_suspended(PID, TID), PID, TID); + pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); ret = Old_NtQueueApcThread(ThreadHandle, ApcRoutine, ApcRoutineContext, ApcStatusBlock, ApcReserved); - LOQ_ntstatus("threading", "iip", "ProcessId", PID, "ThreadId", TID, "ThreadHandle", ThreadHandle); + LOQ_ntstatus("threading", "iip", "ProcessId", pid, "ThreadId", tid, "ThreadHandle", ThreadHandle); if (NT_SUCCESS(ret)) disable_sleep_skip(); + return ret; } @@ -102,18 +104,19 @@ HOOKDEF(NTSTATUS, WINAPI, NtQueueApcThreadEx, __in_opt PIO_STATUS_BLOCK ApcStatusBlock, __in_opt PVOID ApcReserved ) { - DWORD PID = pid_from_thread_handle(ThreadHandle); - DWORD TID = tid_from_thread_handle(ThreadHandle); + DWORD pid = pid_from_thread_handle(ThreadHandle); + DWORD tid = tid_from_thread_handle(ThreadHandle); NTSTATUS ret; - pipe("PROCESS:%d:%d,%d", is_suspended(PID, TID), PID, TID); + pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); ret = Old_NtQueueApcThreadEx(ThreadHandle, UserApcReserveHandle, ApcRoutine, ApcRoutineContext, ApcStatusBlock, ApcReserved); - LOQ_ntstatus("threading", "iip", "ProcessId", PID, "ThreadId", TID, "ThreadHandle", ThreadHandle); + LOQ_ntstatus("threading", "iip", "ProcessId", pid, "ThreadId", tid, "ThreadHandle", ThreadHandle); if (NT_SUCCESS(ret)) disable_sleep_skip(); + return ret; } @@ -128,28 +131,38 @@ HOOKDEF(NTSTATUS, WINAPI, NtCreateThread, __in BOOLEAN CreateSuspended ) { DWORD pid = pid_from_process_handle(ProcessHandle); - NTSTATUS ret = Old_NtCreateThread(ThreadHandle, DesiredAccess, ObjectAttributes, ProcessHandle, ClientId, ThreadContext, InitialTeb, TRUE); if (NT_SUCCESS(ret)) { + DWORD tid = tid_from_thread_handle(*ThreadHandle); //if (called_by_hook() && pid == GetCurrentProcessId()) - // add_ignored_thread((DWORD)ClientId->UniqueThread); - pipe("PROCESS:%d:%d,%d", is_suspended(pid, (DWORD)(ULONG_PTR)ClientId->UniqueThread), pid, (DWORD)(ULONG_PTR)ClientId->UniqueThread); - if (CreateSuspended == FALSE) { + // add_ignored_thread(tid); + + if (DEBUGGER_ENABLED && !called_by_hook()) { + DoOutputDebugString("NtCreateThread: Initialising breakpoints for thread %d.\n", tid); + InitNewThreadBreakpoints(tid); + } + + pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); + + if (CreateSuspended == FALSE) { lasterror_t lasterror; get_lasterrors(&lasterror); ResumeThread(*ThreadHandle); set_lasterrors(&lasterror); } - } - - LOQ_ntstatus("threading", "PpOi", "ThreadHandle", ThreadHandle, "ProcessHandle", ProcessHandle, - "ObjectAttributes", ObjectAttributes, "CreateSuspended", CreateSuspended); + + LOQ_ntstatus("threading", "PpOii", "ThreadHandle", ThreadHandle, "ProcessHandle", ProcessHandle, + "ObjectAttributes", ObjectAttributes, "CreateSuspended", CreateSuspended, "ThreadId", tid); - if (NT_SUCCESS(ret)) disable_sleep_skip(); + } + else + LOQ_ntstatus("threading", "PpOi", "ThreadHandle", ThreadHandle, "ProcessHandle", ProcessHandle, + "ObjectAttributes", ObjectAttributes, "CreateSuspended", CreateSuspended); + return ret; } @@ -179,6 +192,11 @@ HOOKDEF(NTSTATUS, WINAPI, NtCreateThreadEx, // add_ignored_thread(tid); if (pid != GetCurrentProcessId()) + if (DEBUGGER_ENABLED && !called_by_hook()) { + DoOutputDebugString("NtCreateThreadEx: Initialising breakpoints for thread %d.\n", tid); + InitNewThreadBreakpoints(tid); + } + pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); if (!(CreateFlags & 1)) { @@ -187,14 +205,17 @@ HOOKDEF(NTSTATUS, WINAPI, NtCreateThreadEx, ResumeThread(*hThread); set_lasterrors(&lasterror); } + + LOQ_ntstatus("threading", "Ppphi", "ThreadHandle", hThread, "ProcessHandle", ProcessHandle, + "StartAddress", lpStartAddress, "CreateFlags", CreateFlags, "ThreadId", tid); + + disable_sleep_skip(); } - LOQ_ntstatus("threading", "Ppph", "ThreadHandle", hThread, "ProcessHandle", ProcessHandle, - "StartAddress", lpStartAddress, "CreateFlags", CreateFlags); + else + LOQ_ntstatus("threading", "Ppph", "ThreadHandle", hThread, "ProcessHandle", ProcessHandle, + "StartAddress", lpStartAddress, "CreateFlags", CreateFlags); - if (NT_SUCCESS(ret)) - disable_sleep_skip(); - - return ret; + return ret; } HOOKDEF(NTSTATUS, WINAPI, NtOpenThread, @@ -205,17 +226,17 @@ HOOKDEF(NTSTATUS, WINAPI, NtOpenThread, ) { NTSTATUS ret = Old_NtOpenThread(ThreadHandle, DesiredAccess, ObjectAttributes, ClientId); - DWORD PID = 0; - DWORD TID = 0; + DWORD pid = 0; + DWORD tid = 0; if (NT_SUCCESS(ret) && ThreadHandle) { - PID = pid_from_thread_handle(*ThreadHandle); - TID = tid_from_thread_handle(*ThreadHandle); + pid = pid_from_thread_handle(*ThreadHandle); + tid = tid_from_thread_handle(*ThreadHandle); } if (ClientId) { LOQ_ntstatus("threading", "Phii", "ThreadHandle", ThreadHandle, "DesiredAccess", DesiredAccess, - "ProcessId", PID, "ThreadId", TID); + "ProcessId", pid, "ThreadId", tid); } else { LOQ_ntstatus("threading", "PhO", "ThreadHandle", ThreadHandle, "DesiredAccess", DesiredAccess, "ObjectAttributes", ObjectAttributes); @@ -228,15 +249,20 @@ HOOKDEF(NTSTATUS, WINAPI, NtGetContextThread, __in HANDLE ThreadHandle, __inout LPCONTEXT Context ) { + ENSURE_HANDLE(ThreadHandle); + ENSURE_STRUCT(Context, CONTEXT); + DWORD tid = tid_from_thread_handle(ThreadHandle); + NTSTATUS ret = Old_NtGetContextThread(ThreadHandle, Context); - if (Context->ContextFlags & CONTEXT_CONTROL) + + if (Context && Context->ContextFlags & CONTEXT_CONTROL) #ifdef _WIN64 - LOQ_ntstatus("threading", "pp", "ThreadHandle", ThreadHandle, "InstructionPointer", Context->Rcx); + LOQ_ntstatus("threading", "ppi", "ThreadHandle", ThreadHandle, "InstructionPointer", Context->Rcx, "ThreadId", tid); #else - LOQ_ntstatus("threading", "pp", "ThreadHandle", ThreadHandle, "InstructionPointer", Context->Eax); + LOQ_ntstatus("threading", "ppi", "ThreadHandle", ThreadHandle, "InstructionPointer", Context->Eax, "ThreadId", tid); #endif else - LOQ_ntstatus("threading", "p", "ThreadHandle", ThreadHandle); + LOQ_ntstatus("threading", "pi", "ThreadHandle", ThreadHandle, "ThreadId", tid); return ret; } @@ -245,6 +271,8 @@ HOOKDEF(NTSTATUS, WINAPI, NtSetContextThread, __in const CONTEXT *Context ) { NTSTATUS ret; + ENSURE_HANDLE(ThreadHandle); + ENSURE_STRUCT(Context, CONTEXT); DWORD pid = pid_from_thread_handle(ThreadHandle); DWORD tid = tid_from_thread_handle(ThreadHandle); @@ -253,14 +281,14 @@ HOOKDEF(NTSTATUS, WINAPI, NtSetContextThread, ret = Old_NtSetContextThread(ThreadHandle, Context); - if (Context->ContextFlags & CONTEXT_CONTROL) + if (Context && Context->ContextFlags & CONTEXT_CONTROL) #ifdef _WIN64 - LOQ_ntstatus("threading", "pp", "ThreadHandle", ThreadHandle, "InstructionPointer", Context->Rcx); + LOQ_ntstatus("threading", "ppi", "ThreadHandle", ThreadHandle, "InstructionPointer", Context->Rcx, "ThreadId", tid); #else - LOQ_ntstatus("threading", "pp", "ThreadHandle", ThreadHandle, "InstructionPointer", Context->Eax); + LOQ_ntstatus("threading", "ppi", "ThreadHandle", ThreadHandle, "InstructionPointer", Context->Eax, "ThreadId", tid); #endif else - LOQ_ntstatus("threading", "p", "ThreadHandle", ThreadHandle); + LOQ_ntstatus("threading", "pi", "ThreadHandle", ThreadHandle, "ThreadId", tid); return ret; } @@ -269,9 +297,9 @@ HOOKDEF(NTSTATUS, WINAPI, NtSuspendThread, __in HANDLE ThreadHandle, __out_opt ULONG *PreviousSuspendCount ) { + NTSTATUS ret; DWORD pid = pid_from_thread_handle(ThreadHandle); DWORD tid = tid_from_thread_handle(ThreadHandle); - NTSTATUS ret; ENSURE_ULONG(PreviousSuspendCount); if (pid == GetCurrentProcessId() && tid && (tid == g_unhook_detect_thread_id || tid == g_unhook_watcher_thread_id || @@ -284,11 +312,9 @@ HOOKDEF(NTSTATUS, WINAPI, NtSuspendThread, } else { pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); - ret = Old_NtSuspendThread(ThreadHandle, PreviousSuspendCount); - LOQ_ntstatus("threading", "pL", "ThreadHandle", ThreadHandle, - "SuspendCount", PreviousSuspendCount); - } + LOQ_ntstatus("threading", "pLi", "ThreadHandle", ThreadHandle, "SuspendCount", PreviousSuspendCount, "ThreadId", tid); + } return ret; } @@ -303,7 +329,7 @@ HOOKDEF(NTSTATUS, WINAPI, NtResumeThread, pipe("RESUME:%d,%d", pid, tid); ret = Old_NtResumeThread(ThreadHandle, SuspendCount); - LOQ_ntstatus("threading", "pI", "ThreadHandle", ThreadHandle, "SuspendCount", SuspendCount); + LOQ_ntstatus("threading", "pIi", "ThreadHandle", ThreadHandle, "SuspendCount", SuspendCount, "ThreadId", tid); return ret; } @@ -332,7 +358,8 @@ HOOKDEF(NTSTATUS, WINAPI, NtTerminateThread, return ret; } - LOQ_ntstatus("threading", "ph", "ThreadHandle", ThreadHandle, "ExitStatus", ExitStatus); + LOQ_ntstatus("threading", "phi", "ThreadHandle", ThreadHandle, "ExitStatus", ExitStatus, "ThreadId", tid); + ret = Old_NtTerminateThread(ThreadHandle, ExitStatus); disable_tail_call_optimization(); @@ -354,21 +381,28 @@ HOOKDEF(HANDLE, WINAPI, CreateThread, ret = Old_CreateThread(lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags | CREATE_SUSPENDED, lpThreadId); - if (DEBUGGER_ENABLED && !called_by_hook()) { - DoOutputDebugString("CreateThread: Initialising breakpoints for thread %d.\n", *lpThreadId); - InitNewThreadBreakpoints(*lpThreadId); - } + if (ret != NULL) { + if (DEBUGGER_ENABLED && !called_by_hook()) { + DoOutputDebugString("CreateThread: Initialising breakpoints for thread %d.\n", *lpThreadId); + InitNewThreadBreakpoints(*lpThreadId); + } + + if (!(dwCreationFlags && CREATE_SUSPENDED)) { + lasterror_t lasterror; + get_lasterrors(&lasterror); + ResumeThread(ret); + set_lasterrors(&lasterror); + } + + LOQ_nonnull("threading", "pphI", "StartRoutine", lpStartAddress, "Parameter", lpParameter, + "CreationFlags", dwCreationFlags, "ThreadId", lpThreadId); - if (!(dwCreationFlags && CREATE_SUSPENDED)) { - lasterror_t lasterror; - get_lasterrors(&lasterror); - ResumeThread(ret); - set_lasterrors(&lasterror); - } - LOQ_nonnull("threading", "pphI", "StartRoutine", lpStartAddress, "Parameter", lpParameter, - "CreationFlags", dwCreationFlags, "ThreadId", lpThreadId); - if (ret != NULL) disable_sleep_skip(); + } + else + LOQ_nonnull("threading", "pphI", "StartRoutine", lpStartAddress, "Parameter", lpParameter, + "CreationFlags", dwCreationFlags); + return ret; } @@ -393,6 +427,10 @@ HOOKDEF(HANDLE, WINAPI, CreateRemoteThread, if (ret != NULL) { if (pid != GetCurrentProcessId()) pipe("PROCESS:%d:%d,%d", is_suspended(pid, *lpThreadId), pid, *lpThreadId); + else if (DEBUGGER_ENABLED && !called_by_hook()) { + DoOutputDebugString("CreateRemoteThread: Initialising breakpoints for (local) thread %d.\n", *lpThreadId); + InitNewThreadBreakpoints(*lpThreadId); + } if (!(dwCreationFlags & CREATE_SUSPENDED)) { lasterror_t lasterror; @@ -400,14 +438,14 @@ HOOKDEF(HANDLE, WINAPI, CreateRemoteThread, ResumeThread(ret); set_lasterrors(&lasterror); } + + disable_sleep_skip(); } LOQ_nonnull("threading", "ppphI", "ProcessHandle", hProcess, "StartRoutine", lpStartAddress, "Parameter", lpParameter, "CreationFlags", dwCreationFlags, "ThreadId", lpThreadId); - if (ret != NULL) - disable_sleep_skip(); return ret; } @@ -425,6 +463,7 @@ HOOKDEF(NTSTATUS, WINAPI, RtlCreateUserThread, ) { DWORD pid; NTSTATUS ret; + ENSURE_HANDLE(ThreadHandle); ENSURE_CLIENT_ID(ClientId); pid = pid_from_process_handle(ProcessHandle); @@ -437,19 +476,68 @@ HOOKDEF(NTSTATUS, WINAPI, RtlCreateUserThread, "StartParameter", StartParameter, "ThreadHandle", ThreadHandle, "ThreadIdentifier", ClientId->UniqueThread); - if (NT_SUCCESS(ret)) { + if (NT_SUCCESS(ret) && ClientId && ThreadHandle) { + DWORD tid = tid_from_thread_handle(ThreadHandle); if (pid != GetCurrentProcessId()) - pipe("PROCESS:%d:%d,%d", is_suspended(pid, (DWORD)(ULONG_PTR)ClientId->UniqueThread), pid, (DWORD)(ULONG_PTR)ClientId->UniqueThread); - if (CreateSuspended == FALSE) { + pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); + else if (DEBUGGER_ENABLED && !called_by_hook()) { + DoOutputDebugString("RtlCreateUserThread: Initialising breakpoints for (local) thread %d.\n", tid); + InitNewThreadBreakpoints(tid); + } + if (CreateSuspended == FALSE && is_valid_address_range((ULONG_PTR)ThreadHandle, 4)) { lasterror_t lasterror; get_lasterrors(&lasterror); ResumeThread(*ThreadHandle); set_lasterrors(&lasterror); } + disable_sleep_skip(); } - if (NT_SUCCESS(ret)) - disable_sleep_skip(); + LOQ_ntstatus("threading", "pippPi", "ProcessHandle", ProcessHandle, + "CreateSuspended", CreateSuspended, "StartAddress", StartAddress, + "StartParameter", StartParameter, "ThreadHandle", ThreadHandle, + "ThreadId", ClientId->UniqueThread); - return ret; + return ret; +} + +HOOKDEF(NTSTATUS, WINAPI, NtSetInformationThread, + IN HANDLE ThreadHandle, + IN THREADINFOCLASS ThreadInformationClass, + IN PVOID ThreadInformation, + IN ULONG ThreadInformationLength +) { + NTSTATUS ret; + ENSURE_HANDLE(ThreadHandle); + DWORD tid = tid_from_thread_handle(ThreadHandle); + + ret = Old_NtSetInformationThread(ThreadHandle, ThreadInformationClass, ThreadInformation, ThreadInformationLength); + + if (ThreadInformationClass == ThreadHideFromDebugger) + LOQ_ntstatus("threading", "pib", "ThreadHandle", ThreadHandle, + "ThreadInformationClass", ThreadInformationClass, + "ThreadId", tid); + + return ret; +} + +HOOKDEF(NTSTATUS, WINAPI, NtQueryInformationThread, + IN HANDLE ThreadHandle, + IN THREADINFOCLASS ThreadInformationClass, + OUT PVOID ThreadInformation, + IN ULONG ThreadInformationLength, + OUT PULONG ReturnLength OPTIONAL +) { + NTSTATUS ret; + ENSURE_HANDLE(ThreadHandle); + DWORD tid = tid_from_thread_handle(ThreadHandle); + + ret = Old_NtQueryInformationThread(ThreadHandle, ThreadInformationClass, ThreadInformation, ThreadInformationLength, ReturnLength); + + LOQ_ntstatus("threading", "pibi", "ThreadHandle", ThreadHandle, + "ThreadInformationClass", ThreadInformationClass, + "ThreadInformation", ThreadInformationLength, ThreadInformation, + "ThreadId", tid); + + return ret; } diff --git a/hooking.c b/hooking.c index b534d8f..5720b14 100644 --- a/hooking.c +++ b/hooking.c @@ -28,11 +28,6 @@ along with this program. If not, see . extern DWORD g_tls_hook_index; -extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); -extern PVOID GetHookCallerBase(); -extern BOOL SetInitialBreakpoints(PVOID ImageBase); -BOOL BreakpointsSet; - #ifdef _WIN64 #define TLS_LAST_WIN32_ERROR 0x68 #define TLS_LAST_NTSTATUS_ERROR 0x1250 @@ -110,32 +105,6 @@ int called_by_hook(void) return __called_by_hook(hookinfo->stack_pointer, hookinfo->frame_pointer); } -void base_on_api(hook_t *h) -{ - unsigned int i; - hook_info_t *hookinfo = hook_info(); - - for (i = 0; i < ARRAYSIZE(g_config.base_on_apiname); i++) { - if (!g_config.base_on_apiname[i]) - break; - if (!BreakpointsSet && !called_by_hook() && !stricmp(h->funcname, g_config.base_on_apiname[i])) { - DoOutputDebugString("Base-on-API: %s call detected in thread %d.\n", g_config.base_on_apiname[i], GetCurrentThreadId()); - PVOID AllocationBase = GetHookCallerBase(); - if (AllocationBase) { - BreakpointsSet = SetInitialBreakpoints((PVOID)AllocationBase); - if (BreakpointsSet) - DoOutputDebugString("Base-on-API: GetHookCallerBase success 0x%p - Breakpoints set.\n", AllocationBase); - else - DoOutputDebugString("Base-on-API: Failed to set breakpoints on 0x%p.\n", AllocationBase); - } - else - DoOutputDebugString("Base-on-API: GetHookCallerBase fail.\n"); - } - } - - return; -} - extern BOOLEAN is_ignored_thread(DWORD tid); static hook_info_t tmphookinfo; @@ -179,8 +148,6 @@ int WINAPI enter_hook(hook_t *h, ULONG_PTR sp, ULONG_PTR ebp_or_rip) operate_on_backtrace(sp, ebp_or_rip, NULL, set_caller_info); - base_on_api(h); - return 1; } diff --git a/hooks.h b/hooks.h index 6ad37c9..278abf7 100644 --- a/hooks.h +++ b/hooks.h @@ -1142,6 +1142,14 @@ extern HOOKDEF(NTSTATUS, WINAPI, NtSetInformationProcess, __in ULONG ProcessInformationLength ); +extern HOOKDEF(NTSTATUS, WINAPI, NtQueryInformationProcess, + IN HANDLE ProcessHandle, + IN PROCESSINFOCLASS ProcessInformationClass, + OUT PVOID ProcessInformation, + IN ULONG ProcessInformationLength, + OUT PULONG ReturnLength OPTIONAL +); + extern HOOKDEF(NTSTATUS, WINAPI, NtAllocateVirtualMemory, __in HANDLE ProcessHandle, __inout PVOID *BaseAddress, @@ -2864,3 +2872,29 @@ extern HOOKDEF(unsigned int, WINAPIV, SizeofResource, extern HOOKDEF(void, WINAPIV, srand, unsigned int seed ); + +extern HOOKDEF(NTSTATUS, WINAPI, NtSetInformationThread, + IN HANDLE ThreadHandle, + IN THREADINFOCLASS ThreadInformationClass, + IN PVOID ThreadInformation, + IN ULONG ThreadInformationLength +); + +extern HOOKDEF(NTSTATUS, WINAPI, NtQueryInformationThread, + IN HANDLE ThreadHandle, + IN THREADINFOCLASS ThreadInformationClass, + OUT PVOID ThreadInformation, + IN ULONG ThreadInformationLength, + OUT PULONG ReturnLength OPTIONAL +); + +extern HOOKDEF(LPSTR, WINAPI, lstrcpynA, + _Out_ LPSTR lpString1, + _In_ LPSTR lpString2, + _In_ int iMaxLength +); + +extern HOOKDEF(int, WINAPI, lstrcmpiA, + _In_ LPCSTR lpString1, + _In_ LPCSTR lpString2 +); diff --git a/log.h b/log.h index a211632..31ca007 100644 --- a/log.h +++ b/log.h @@ -145,6 +145,9 @@ do { \ #define ENSURE_CLIENT_ID(param) \ CLIENT_ID _##param; memset(&_##param, 0, sizeof(_##param)); if (param == NULL) param = &_##param +#define ENSURE_HANDLE(param) \ + HANDLE _##param; memset(&_##param, 0, sizeof(_##param)); if (param == NULL) param = &_##param + #define ENSURE_STRUCT(param, type) \ type _##param; memset(&_##param, 0, sizeof(_##param)); if(param == NULL) param = &_##param diff --git a/ntapi.h b/ntapi.h index cf573ca..54750a4 100644 --- a/ntapi.h +++ b/ntapi.h @@ -768,14 +768,106 @@ typedef enum { FileFsSectorSizeInformation = 11 } FS_INFORMATION_CLASS; -typedef enum { - ProcessBreakOnTermination = 29, - ProcessInfoDEPPolicy = 34 +typedef enum _PROCESSINFOCLASS { + ProcessBasicInformation, + ProcessQuotaLimits, + ProcessIoCounters, + ProcessVmCounters, + ProcessTimes, + ProcessBasePriority, + ProcessRaisePriority, + ProcessDebugPort, + ProcessExceptionPort, + ProcessAccessToken, + ProcessLdtInformation, + ProcessLdtSize, + ProcessDefaultHardErrorMode, + ProcessIoPortHandlers, // Note: this is kernel mode only + ProcessPooledUsageAndLimits, + ProcessWorkingSetWatch, + ProcessUserModeIOPL, + ProcessEnableAlignmentFaultFixup, + ProcessPriorityClass, + ProcessWx86Information, + ProcessHandleCount, + ProcessAffinityMask, + ProcessPriorityBoost, + ProcessDeviceMap, + ProcessSessionInformation, + ProcessForegroundInformation, + ProcessWow64Information, + ProcessImageFileName, + ProcessLUIDDeviceMapsEnabled, + ProcessBreakOnTermination, + ProcessDebugObjectHandle, + ProcessDebugFlags, + ProcessHandleTracing, + ProcessIoPriority, + ProcessExecuteFlags, + ProcessTlsInformation, + ProcessCookie, + ProcessImageInformation, + ProcessCycleTime, + ProcessPagePriority, + ProcessInstrumentationCallback, + ProcessThreadStackAllocation, + ProcessWorkingSetWatchEx, + ProcessImageFileNameWin32, + ProcessImageFileMapping, + ProcessAffinityUpdateMode, + ProcessMemoryAllocationMode, + ProcessGroupInformation, + ProcessTokenVirtualizationEnabled, + ProcessConsoleHostProcess, + ProcessWindowInformation, + ProcessHandleInformation, + ProcessMitigationPolicy, + ProcessDynamicFunctionTableInformation, + ProcessHandleCheckingMode, + ProcessKeepAliveCount, + ProcessRevokeFileHandles, + ProcessWorkingSetControl, + MaxProcessInfoClass // MaxProcessInfoClass should always be the last enum } PROCESSINFOCLASS; -typedef enum { - ThreadBasicInformation = 0, -} THREAD_INFORMATION_CLASS; +typedef enum _THREADINFOCLASS { + ThreadBasicInformation, + ThreadTimes, + ThreadPriority, + ThreadBasePriority, + ThreadAffinityMask, + ThreadImpersonationToken, + ThreadDescriptorTableEntry, + ThreadEnableAlignmentFaultFixup, + ThreadEventPair_Reusable, + ThreadQuerySetWin32StartAddress, + ThreadZeroTlsCell, + ThreadPerformanceCount, + ThreadAmILastThread, + ThreadIdealProcessor, + ThreadPriorityBoost, + ThreadSetTlsArrayAddress, // Obsolete + ThreadIsIoPending, + ThreadHideFromDebugger, + ThreadBreakOnTermination, + ThreadSwitchLegacyState, + ThreadIsTerminated, + ThreadLastSystemCall, + ThreadIoPriority, + ThreadCycleTime, + ThreadPagePriority, + ThreadActualBasePriority, + ThreadTebInformation, + ThreadCSwitchMon, // Obsolete + ThreadCSwitchPmu, + ThreadWow64Context, + ThreadGroupInformation, + ThreadUmsInformation, // UMS + ThreadCounterProfiling, + ThreadIdealProcessorEx, + ThreadCpuAccountingInformation, + MaxThreadInfoClass +} THREADINFOCLASS; typedef struct _FILE_FS_VOLUME_INFORMATION { LARGE_INTEGER VolumeCreationTime; diff --git a/pipe.c b/pipe.c index f131124..5c81e4c 100644 --- a/pipe.c +++ b/pipe.c @@ -68,42 +68,42 @@ static int _pipe_sprintf(char *out, const char *fmt, va_list args) ret += _pipe_ascii(&out, s, (int)strlen(s)); } - else if (*fmt == 'c') { - char buf[2]; - buf[0] = va_arg(args, char); - buf[1] = '\0'; - ret += _pipe_ascii(&out, buf, 1); - } + else if (*fmt == 'c') { + char buf[2]; + buf[0] = va_arg(args, char); + buf[1] = '\0'; + ret += _pipe_ascii(&out, buf, 1); + } else if(*fmt == 'Z') { const wchar_t *s = va_arg(args, const wchar_t *); if(s == NULL) return -1; ret += _pipe_unicode(&out, s, lstrlenW(s)); } - else if (*fmt == 'F') { - const wchar_t *s = va_arg(args, const wchar_t *); - wchar_t *absolutepath = malloc(32768 * sizeof(wchar_t)); - if (s == NULL) return -1; - if (absolutepath) { - ensure_absolute_unicode_path(absolutepath, s); - ret += _pipe_unicode(&out, absolutepath, lstrlenW(absolutepath)); - free(absolutepath); - } - else { - return -1; - } - } - else if (*fmt == 's') { + else if (*fmt == 'F') { + const wchar_t *s = va_arg(args, const wchar_t *); + wchar_t *absolutepath = malloc(32768 * sizeof(wchar_t)); + if (s == NULL) return -1; + if (absolutepath) { + ensure_absolute_unicode_path(absolutepath, s); + ret += _pipe_unicode(&out, absolutepath, lstrlenW(absolutepath)); + free(absolutepath); + } + else { + return -1; + } + } + else if (*fmt == 's') { int len = va_arg(args, int); const char *s = va_arg(args, const char *); - if(s == NULL) return -1; + if(s == NULL || !is_valid_address_range((ULONG_PTR)s, len)) return -1; - ret += _pipe_ascii(&out, s, len < 0 ? (int)strlen(s) : len); + ret += _pipe_ascii(&out, s, len < 0 ? (int)strlen(s) : len); } else if(*fmt == 'S') { int len = va_arg(args, int); const wchar_t *s = va_arg(args, const wchar_t *); - if(s == NULL) return -1; + if(s == NULL || !is_valid_address_range((ULONG_PTR)s, len)) return -1; ret += _pipe_unicode(&out, s, len < 0 ? lstrlenW(s) : len); } @@ -116,43 +116,43 @@ static int _pipe_sprintf(char *out, const char *fmt, va_list args) } else if(*fmt == 'O') { OBJECT_ATTRIBUTES *obj = va_arg(args, OBJECT_ATTRIBUTES *); - wchar_t path[MAX_PATH_PLUS_TOLERANCE]; - wchar_t *absolutepath; + wchar_t path[MAX_PATH_PLUS_TOLERANCE]; + wchar_t *absolutepath; if(obj == NULL || obj->ObjectName == NULL) return -1; - absolutepath = malloc(32768 * sizeof(wchar_t)); - if (absolutepath) { - path_from_object_attributes(obj, path, (unsigned int)MAX_PATH_PLUS_TOLERANCE); + absolutepath = malloc(32768 * sizeof(wchar_t)); + if (absolutepath) { + path_from_object_attributes(obj, path, (unsigned int)MAX_PATH_PLUS_TOLERANCE); - ensure_absolute_unicode_path(absolutepath, path); + ensure_absolute_unicode_path(absolutepath, path); - ret += _pipe_unicode(&out, absolutepath, lstrlenW(absolutepath)); - free(absolutepath); - } - else { - ret += _pipe_unicode(&out, L"", 0); - } + ret += _pipe_unicode(&out, absolutepath, lstrlenW(absolutepath)); + free(absolutepath); + } + else { + ret += _pipe_unicode(&out, L"", 0); + } } else if(*fmt == 'd') { char s[32]; - num_to_string(s, sizeof(s), va_arg(args, int)); - ret += _pipe_ascii(&out, s, (int)strlen(s)); + num_to_string(s, sizeof(s), va_arg(args, int)); + ret += _pipe_ascii(&out, s, (int)strlen(s)); } else if(*fmt == 'x') { char s[16]; sprintf(s, "%x", va_arg(args, int)); - ret += _pipe_ascii(&out, s, (int)strlen(s)); + ret += _pipe_ascii(&out, s, (int)strlen(s)); + } + else if (*fmt == 'p') { + char s[18]; + sprintf(s, "%p", va_arg(args, void *)); + ret += _pipe_ascii(&out, s, (int)strlen(s)); + } + else { + const char *msg = "-- UNKNOWN FORMAT STRING -- "; + ret += _pipe_ascii(&out, msg, (int)strlen(msg)); } - else if (*fmt == 'p') { - char s[18]; - sprintf(s, "%p", va_arg(args, void *)); - ret += _pipe_ascii(&out, s, (int)strlen(s)); - } - else { - const char *msg = "-- UNKNOWN FORMAT STRING -- "; - ret += _pipe_ascii(&out, msg, (int)strlen(msg)); - } fmt++; } return ret; From 3fb6073e064b8764bdf745721bfb8cde6adac4e4 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Aug 2018 12:04:31 +0100 Subject: [PATCH 06/12] Small bugfix with dll load notifications for target dll --- cuckoomon.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cuckoomon.c b/cuckoomon.c index 855f29a..b9a4acb 100644 --- a/cuckoomon.c +++ b/cuckoomon.c @@ -665,10 +665,9 @@ VOID CALLBACK New_DllLoadNotification( if (NotificationReason == 1) { if (g_config.file_of_interest && !wcsicmp(library.Buffer, g_config.file_of_interest)) { - if (base_of_dll_of_interest) - DoOutputDebugString("Target DLL loaded at 0x%p: %ws (0x%x bytes).\n", NotificationData->Loaded.DllBase, library.Buffer, NotificationData->Loaded.SizeOfImage); - else + if (!base_of_dll_of_interest) set_dll_of_interest((ULONG_PTR)NotificationData->Loaded.DllBase); + DoOutputDebugString("Target DLL loaded at 0x%p: %ws (0x%x bytes).\n", NotificationData->Loaded.DllBase, library.Buffer, NotificationData->Loaded.SizeOfImage); SetInitialBreakpoints((PVOID)base_of_dll_of_interest); } else { From 77e2ba16d4c7d6688a259a311e9c3e1c61ab7cf2 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 10 Aug 2018 11:13:17 +0100 Subject: [PATCH 07/12] Add hooks for (PE) resource functions (FindResource, LoadResource, etc) --- cuckoomon.c | 6 ++++- hook_misc.c | 73 ++++++++++++++++++++++++++++++++++++++++++++--------- hooks.h | 31 +++++++++++++++++++---- 3 files changed, 92 insertions(+), 18 deletions(-) diff --git a/cuckoomon.c b/cuckoomon.c index b9a4acb..80cdcdd 100644 --- a/cuckoomon.c +++ b/cuckoomon.c @@ -369,7 +369,6 @@ static hook_t g_hooks[] = { HOOK(ntdll, memcpy), #endif HOOK(msvcrt, memcpy), - //HOOK(kernel32, SizeofResource), HOOK(msvcrt, srand), // for debugging only @@ -431,6 +430,11 @@ static hook_t g_hooks[] = { HOOK(user32, SystemParametersInfoW), HOOK(pstorec, PStoreCreateInstance), HOOK(advapi32, SaferIdentifyLevel), + HOOK(kernel32, FindResourceA), + HOOK(kernel32, FindResourceW), + HOOK(kernel32, LoadResource), + HOOK(kernel32, LockResource), + HOOK(kernel32, SizeofResource), // // Network Hooks diff --git a/hook_misc.c b/hook_misc.c index 13d47bc..e9980d3 100644 --- a/hook_misc.c +++ b/hook_misc.c @@ -1107,18 +1107,6 @@ HOOKDEF(void, WINAPIV, memcpy, return; } -HOOKDEF(unsigned int, WINAPIV, SizeofResource, - _In_opt_ HMODULE hModule, - _In_ HRSRC hResInfo -) -{ - unsigned int ret = Old_SizeofResource(hModule, hResInfo); - - LOQ_nonzero("misc", "ppi", "ModuleHandle", hModule, "ResourceInfo", hResInfo, "Size", ret); - - return ret; -} - HOOKDEF(void, WINAPIV, srand, unsigned int seed ) @@ -1158,3 +1146,64 @@ HOOKDEF(int, WINAPI, lstrcmpiA, return ret; } + +HOOKDEF(HRSRC, WINAPI, FindResourceA, + HMODULE hModule, + LPCSTR lpName, + LPCSTR lpType +) +{ + HRSRC ret = Old_FindResourceA(hModule, lpName, lpType); + + LOQ_handle("misc", "ps", "Module", hModule, "Name", lpName); + + return ret; +} + + HOOKDEF(HRSRC, WINAPI, FindResourceW, + HMODULE hModule, + LPCWSTR lpName, + LPCWSTR lpType +) +{ + HRSRC ret = Old_FindResourceW(hModule, lpName, lpType); + + LOQ_handle("misc", "pu", "Module", hModule, "Name", lpName); + + return ret; +} + + HOOKDEF(HGLOBAL, WINAPI, LoadResource, + _In_opt_ HMODULE hModule, + _In_ HRSRC hResInfo +) +{ + HGLOBAL ret = Old_LoadResource(hModule, hResInfo); + + LOQ_handle("misc", "pp", "Module", hModule, "ResourceInfo", hResInfo); + + return ret; +} + +HOOKDEF(LPVOID, WINAPI, LockResource, + _In_ HGLOBAL hResData +) +{ + LPVOID ret = Old_LockResource(hResData); + + LOQ_nonnull("misc", "p", "ResourceData", hResData); + + return ret; +} + +HOOKDEF(DWORD, WINAPI, SizeofResource, + _In_opt_ HMODULE hModule, + _In_ HRSRC hResInfo +) +{ + DWORD ret = Old_SizeofResource(hModule, hResInfo); + + LOQ_nonzero("misc", "pp", "ModuleHandle", hModule, "ResourceInfo", hResInfo); + + return ret; +} diff --git a/hooks.h b/hooks.h index 278abf7..200820d 100644 --- a/hooks.h +++ b/hooks.h @@ -2864,11 +2864,6 @@ extern HOOKDEF(NTSTATUS, WINAPI, NtQuerySystemInformation, _Out_opt_ PULONG ReturnLength ); -extern HOOKDEF(unsigned int, WINAPIV, SizeofResource, - _In_opt_ HMODULE hModule, - _In_ HRSRC hResInfo -); - extern HOOKDEF(void, WINAPIV, srand, unsigned int seed ); @@ -2898,3 +2893,29 @@ extern HOOKDEF(int, WINAPI, lstrcmpiA, _In_ LPCSTR lpString1, _In_ LPCSTR lpString2 ); + +extern HOOKDEF(HRSRC, WINAPI, FindResourceA, + HMODULE hModule, + LPCSTR lpName, + LPCSTR lpType +); + +extern HOOKDEF(HRSRC, WINAPI, FindResourceW, + HMODULE hModule, + LPCWSTR lpName, + LPCWSTR lpType +); + +extern HOOKDEF(HGLOBAL, WINAPI, LoadResource, + _In_opt_ HMODULE hModule, + _In_ HRSRC hResInfo +); + +extern HOOKDEF(LPVOID, WINAPI, LockResource, + _In_ HGLOBAL hResData +); + +extern HOOKDEF(DWORD, WINAPI, SizeofResource, + _In_opt_ HMODULE hModule, + _In_ HRSRC hResInfo +); From f08fbb3ba4e72d50a6d69f00a031498081de1fa1 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 13 Aug 2018 09:04:32 +0100 Subject: [PATCH 08/12] First working build of QakBot monitor. --- CAPE/CAPE.c | 10 +- CAPE/CAPE.h | 3 + CAPE/QakBot.c | 495 ++++++++++++++++++++++++++++++++++++++ CAPE/Trace.c | 267 -------------------- cuckoomon.c | 2 +- cuckoomon.vcxproj | 4 +- cuckoomon.vcxproj.filters | 2 +- hook_process.c | 7 +- hooking.c | 46 ++++ 9 files changed, 557 insertions(+), 279 deletions(-) create mode 100644 CAPE/QakBot.c delete mode 100644 CAPE/Trace.c diff --git a/CAPE/CAPE.c b/CAPE/CAPE.c index ebd7cab..9a9c94e 100644 --- a/CAPE/CAPE.c +++ b/CAPE/CAPE.c @@ -126,7 +126,7 @@ extern SIZE_T GetPESize(PVOID Buffer); extern LPVOID GetReturnAddress(hook_info_t *hookinfo); extern PVOID CallingModule; -BOOL ProcessDumped, FilesDumped; +BOOL ProcessDumped, FilesDumped, ModuleDumped; static unsigned int DumpCount; static __inline ULONG_PTR get_stack_top(void) @@ -1720,7 +1720,7 @@ int DumpModuleInCurrentProcess(LPVOID ModuleBase) ModuleBase = PEImage; } - SetCapeMetaData(EXTRACTION_PE, 0, NULL, (PVOID)ModuleBase); + SetCapeMetaData(QAKBOT_PAYLOAD, 0, NULL, (PVOID)ModuleBase); if (DumpCount < DUMP_MAX && ScyllaDumpProcess(GetCurrentProcess(), (DWORD_PTR)ModuleBase, 0)) { @@ -1894,12 +1894,10 @@ void init_CAPE() DoOutputDebugString("Failed to initialise debugger.\n"); #ifdef _WIN64 - DoOutputDebugString("CAPE initialised: 64-bit Trace package loaded in process %d at 0x%p, image base 0x%p, stack from 0x%p-0x%p\n", GetCurrentProcessId(), g_our_dll_base, GetModuleHandle(NULL), get_stack_bottom(), get_stack_top()); + DoOutputDebugString("CAPE initialised: 64-bit QakBot package loaded in process %d at 0x%p, image base 0x%p, stack from 0x%p-0x%p\n", GetCurrentProcessId(), g_our_dll_base, GetModuleHandle(NULL), get_stack_bottom(), get_stack_top()); #else - DoOutputDebugString("CAPE initialised: 32-bit Trace package loaded in process %d at 0x%x, image base 0x%x, stack from 0x%x-0x%x\n", GetCurrentProcessId(), g_our_dll_base, GetModuleHandle(NULL), get_stack_bottom(), get_stack_top()); + DoOutputDebugString("CAPE initialised: 32-bit QakBot package loaded in process %d at 0x%x, image base 0x%x, stack from 0x%x-0x%x\n", GetCurrentProcessId(), g_our_dll_base, GetModuleHandle(NULL), get_stack_bottom(), get_stack_top()); #endif - SetInitialBreakpoints(GetModuleHandle(NULL)); - return; } diff --git a/CAPE/CAPE.h b/CAPE/CAPE.h index 44424eb..53daee1 100644 --- a/CAPE/CAPE.h +++ b/CAPE/CAPE.h @@ -154,6 +154,9 @@ enum { CERBER_CONFIG = 0x30, CERBER_PAYLOAD = 0x31, + QAKBOT_CONFIG = 0x38, + QAKBOT_PAYLOAD = 0x39, + DATADUMP = 0x66 }; diff --git a/CAPE/QakBot.c b/CAPE/QakBot.c new file mode 100644 index 0000000..497d90c --- /dev/null +++ b/CAPE/QakBot.c @@ -0,0 +1,495 @@ +/* +CAPE - Config And Payload Extraction +Copyright(C) 2015 - 2018 Context Information Security. (kevin.oreilly@contextis.com) + +This program is free software : you can redistribute it and / or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program.If not, see . +*/ +#include +#include "..\hooking.h" +#include "Debugger.h" +#include "CAPE.h" + +#define MAX_INSTRUCTIONS 0x10 +#define SINGLE_STEP_LIMIT 0x80 // default unless specified in web ui +#define CHUNKSIZE 0x10 * MAX_INSTRUCTIONS + +extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); +extern void DoOutputErrorString(_In_ LPCTSTR lpOutputString, ...); +extern int DumpModuleInCurrentProcess(LPVOID ModuleBase); +extern int DumpMemory(LPVOID Buffer, SIZE_T Size); +extern char *convert_address_to_dll_name_and_offset(ULONG_PTR addr, unsigned int *offset); +extern DWORD_PTR FileOffsetToVA(DWORD_PTR modBase, DWORD_PTR dwOffset); +extern BOOL ScyllaGetSectionByName(PVOID ImageBase, char* Name, PVOID* SectionData, SIZE_T* SectionSize); + +BOOL BreakpointSet, DllPrinted; +PVOID ModuleBase, DumpAddress; +SIZE_T DumpSize; +BOOL GetSystemTimeAsFileTimeImported, PayloadMarker, PayloadDumped; +unsigned int DumpCount, Correction, StepCount, StepLimit; +int StepOverRegister, TraceDepthCount, TraceDepthLimit; + +BOOL Trace(struct _EXCEPTION_POINTERS* ExceptionInfo); +BOOL Trace2(struct _EXCEPTION_POINTERS* ExceptionInfo); +BOOL BreakpointCallback1(PBREAKPOINTINFO pBreakpointInfo, struct _EXCEPTION_POINTERS* ExceptionInfo); +BOOL BreakpointCallback2(PBREAKPOINTINFO pBreakpointInfo, struct _EXCEPTION_POINTERS* ExceptionInfo); +BOOL BreakpointCallback3(PBREAKPOINTINFO pBreakpointInfo, struct _EXCEPTION_POINTERS* ExceptionInfo); + +BOOL DoSetSingleStepMode(int Register, PCONTEXT Context, PVOID Handler) +{ + StepOverRegister = Register; + return SetSingleStepMode(Context, Trace); +} + +BOOL Trace(struct _EXCEPTION_POINTERS* ExceptionInfo) +{ + PVOID ReturnAddress; + char* DllName; + unsigned int DllRVA; + + _DecodeResult Result; + _OffsetType Offset = 0; + _DecodedInst DecodedInstruction; + unsigned int DecodedInstructionsCount = 0; + + StepCount++; + + if (StepCount > StepLimit) + { + DoOutputDebugString("Trace: single-step limit reached (%d), releasing.", StepLimit); + return TRUE; + } + +#ifdef _WIN64 + DllName = convert_address_to_dll_name_and_offset((ULONG_PTR)ExceptionInfo->ContextRecord->Rip, &DllRVA); + _DecodeType DecodeType = Decode64Bits; + Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Rip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); + DoOutputDebugString("0x%p (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Rip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); +#else + DllName = convert_address_to_dll_name_and_offset((ULONG_PTR)ExceptionInfo->ContextRecord->Eip, &DllRVA); + _DecodeType DecodeType = Decode32Bits; + Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Eip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); + DoOutputDebugString("0x%x (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Eip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); +#endif + + if (!DllPrinted && DllName) + { + DoOutputDebugString("Trace: Tracing in %s (RVA 0x%x).\n", DllName, DllRVA); + DllPrinted = TRUE; + } + + if (!strcmp(DecodedInstruction.mnemonic.p, "CALL")) + { + if (TraceDepthCount >= TraceDepthLimit) + { +#ifdef _WIN64 + ReturnAddress = (PVOID)((PUCHAR)ExceptionInfo->ContextRecord->Rip + DecodedInstruction.size); +#else + ReturnAddress = (PVOID)((PUCHAR)ExceptionInfo->ContextRecord->Eip + DecodedInstruction.size); +#endif + if (!ContextSetThreadBreakpoint(ExceptionInfo->ContextRecord, StepOverRegister, 0, (BYTE*)ReturnAddress, BP_EXEC, BreakpointCallback1)) + { + DoOutputDebugString("Trace: Failed to set breakpoint on return address 0x%p\n", ReturnAddress); + } + + ClearSingleStepMode(ExceptionInfo->ContextRecord); + + return TRUE; + } + else + TraceDepthCount++; + } + else if (!strcmp(DecodedInstruction.mnemonic.p, "RET")) + { + if (TraceDepthCount < 0) + { + DoOutputDebugString("Trace: Stepping out of initial depth, releasing."); + + ClearSingleStepMode(ExceptionInfo->ContextRecord); + + return TRUE; + } + + TraceDepthCount--; + } + else if (!strcmp(DecodedInstruction.mnemonic.p, "JLE")) + { + DoOutputDebugString("Trace: JLE detected, clearing zero flag.\n"); + ClearZeroFlag(ExceptionInfo->ContextRecord); + } + + SetSingleStepMode(ExceptionInfo->ContextRecord, Trace); + + return TRUE; +} + +BOOL Trace2(struct _EXCEPTION_POINTERS* ExceptionInfo) +{ + PVOID ReturnAddress; + char* DllName; + unsigned int DllRVA; + + _DecodeResult Result; + _OffsetType Offset = 0; + _DecodedInst DecodedInstruction; + unsigned int DecodedInstructionsCount = 0; + + StepCount++; + + if (StepCount > StepLimit) + { + DoOutputDebugString("Trace2: single-step limit reached (%d), releasing.", StepLimit); + return TRUE; + } + +#ifdef _WIN64 + DllName = convert_address_to_dll_name_and_offset((ULONG_PTR)ExceptionInfo->ContextRecord->Rip, &DllRVA); + _DecodeType DecodeType = Decode64Bits; + Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Rip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); + DoOutputDebugString("0x%p (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Rip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); +#else + DllName = convert_address_to_dll_name_and_offset((ULONG_PTR)ExceptionInfo->ContextRecord->Eip, &DllRVA); + _DecodeType DecodeType = Decode32Bits; + Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Eip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); + DoOutputDebugString("0x%x (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Eip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); +#endif + + if (!DllPrinted && DllName) + { + DoOutputDebugString("Trace2: Tracing in %s (RVA 0x%x).\n", DllName, DllRVA); + DllPrinted = TRUE; + } + + if (!strcmp(DecodedInstruction.mnemonic.p, "CALL")) + { + if (TraceDepthCount >= TraceDepthLimit) + { +#ifdef _WIN64 + ReturnAddress = (PVOID)((PUCHAR)ExceptionInfo->ContextRecord->Rip + DecodedInstruction.size); +#else + ReturnAddress = (PVOID)((PUCHAR)ExceptionInfo->ContextRecord->Eip + DecodedInstruction.size); +#endif + if (!ContextSetThreadBreakpoint(ExceptionInfo->ContextRecord, StepOverRegister, 0, (BYTE*)ReturnAddress, BP_EXEC, BreakpointCallback2)) + { + DoOutputDebugString("Trace2: Failed to set breakpoint on return address 0x%p\n", ReturnAddress); + } + + ClearSingleStepMode(ExceptionInfo->ContextRecord); + + return TRUE; + } + else + TraceDepthCount++; + } + else if (!strcmp(DecodedInstruction.mnemonic.p, "RET")) + { + if (TraceDepthCount < 0) + { + DoOutputDebugString("Trace2: Stepping out of initial depth, releasing."); + + ClearSingleStepMode(ExceptionInfo->ContextRecord); + + return TRUE; + } + + TraceDepthCount--; + } + + SetSingleStepMode(ExceptionInfo->ContextRecord, Trace); + + return TRUE; +} + +BOOL BreakpointCallback1(PBREAKPOINTINFO pBreakpointInfo, struct _EXCEPTION_POINTERS* ExceptionInfo) +{ + _DecodeResult Result; + _OffsetType Offset = 0; + _DecodedInst DecodedInstruction; + unsigned int DecodedInstructionsCount = 0; + + if (pBreakpointInfo == NULL) + { + DoOutputDebugString("BreakpointCallback1 executed with pBreakpointInfo NULL.\n"); + return FALSE; + } + + if (pBreakpointInfo->ThreadHandle == NULL) + { + DoOutputDebugString("BreakpointCallback1 executed with NULL thread handle.\n"); + return FALSE; + } + +#ifdef _WIN64 + _DecodeType DecodeType = Decode64Bits; + Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Rip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); + DoOutputDebugString("0x%p (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Rip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); +#else + _DecodeType DecodeType = Decode32Bits; + Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Eip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); + DoOutputDebugString("0x%x (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Eip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); +#endif + + if (!strcmp(DecodedInstruction.mnemonic.p, "JLE")) + { + DoOutputDebugString("Trace: JLE detected, clearing zero flag to bypass anti-sandbox.\n"); + ClearZeroFlag(ExceptionInfo->ContextRecord); + } + + StepOverExecutionBreakpoint(ExceptionInfo->ContextRecord, pBreakpointInfo); + + DoSetSingleStepMode(pBreakpointInfo->Register, ExceptionInfo->ContextRecord, Trace); + + return TRUE; +} + +BOOL BreakpointCallback2(PBREAKPOINTINFO pBreakpointInfo, struct _EXCEPTION_POINTERS* ExceptionInfo) +{ + _DecodeResult Result; + _OffsetType Offset = 0; + _DecodedInst DecodedInstruction; + unsigned int DecodedInstructionsCount = 0; + + if (pBreakpointInfo == NULL) + { + DoOutputDebugString("BreakpointCallback2 executed with pBreakpointInfo NULL.\n"); + return FALSE; + } + + if (pBreakpointInfo->ThreadHandle == NULL) + { + DoOutputDebugString("BreakpointCallback2 executed with NULL thread handle.\n"); + return FALSE; + } + +#ifdef _WIN64 + _DecodeType DecodeType = Decode64Bits; + Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Rip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); + DoOutputDebugString("0x%p (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Rip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); +#else + _DecodeType DecodeType = Decode32Bits; + Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Eip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); + DoOutputDebugString("0x%x (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Eip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); +#endif + + if (!strcmp(DecodedInstruction.mnemonic.p, "CALL")) + { + DumpSize = (SIZE_T)*(DWORD*)((BYTE*)ExceptionInfo->ContextRecord->Esp+4*3); + DumpAddress = (PVOID)*(DWORD*)((BYTE*)ExceptionInfo->ContextRecord->Esp+4*4); + + DoOutputDebugString("Trace: CALL detected, grabbing size 0x%x and buffer 0x%x from stack.\n", DumpSize, DumpAddress); + + if (DumpSize > 0x400) + DoOutputDebugString("Trace: Size too big, not the config.\n"); + else if (!ContextSetThreadBreakpoint(ExceptionInfo->ContextRecord, 2, 0, ((BYTE*)ExceptionInfo->ContextRecord->Eip)+5, BP_EXEC, BreakpointCallback3)) + DoOutputDebugString("Trace: failed to set breakpoint on call return at 0x%x", ((BYTE*)ExceptionInfo->ContextRecord->Eip)+5); + } + + StepOverExecutionBreakpoint(ExceptionInfo->ContextRecord, pBreakpointInfo); + + return TRUE; +} + +BOOL BreakpointCallback3(PBREAKPOINTINFO pBreakpointInfo, struct _EXCEPTION_POINTERS* ExceptionInfo) +{ + _DecodeResult Result; + _OffsetType Offset = 0; + _DecodedInst DecodedInstruction; + unsigned int DecodedInstructionsCount = 0; + + if (pBreakpointInfo == NULL) + { + DoOutputDebugString("BreakpointCallback3 executed with pBreakpointInfo NULL.\n"); + return FALSE; + } + + if (pBreakpointInfo->ThreadHandle == NULL) + { + DoOutputDebugString("BreakpointCallback3 executed with NULL thread handle.\n"); + return FALSE; + } + +#ifdef _WIN64 + _DecodeType DecodeType = Decode64Bits; + Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Rip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); + DoOutputDebugString("0x%p (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Rip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); +#else + _DecodeType DecodeType = Decode32Bits; + Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Eip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); + DoOutputDebugString("0x%x (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Eip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); +#endif + + if (DumpSize && DumpAddress && DumpCount < 1) + { + CapeMetaData->DumpType = QAKBOT_CONFIG; + if (DumpMemory(DumpAddress, DumpSize)) + { + DoOutputDebugString("Trace: dumped QakBot config from 0x%x.\n", DumpAddress); + DumpCount+=1; + } + else + DoOutputDebugString("Trace: Error - failed to dump config from: 0x%x.\n", DumpAddress); + } + else + DoOutputDebugString("Trace: Error - dump size or dump address not set: 0x%x, 0x%x.\n", DumpAddress, DumpSize); + + ContextClearCurrentBreakpoint(ExceptionInfo->ContextRecord); + + StepOverExecutionBreakpoint(ExceptionInfo->ContextRecord, pBreakpointInfo); + + return TRUE; +} + +BOOL SetInitialBreakpoints(PVOID ImageBase) +{ + _DecodeResult Result; + _OffsetType Offset = 0; + _DecodedInst DecodedInstructions[MAX_INSTRUCTIONS]; + unsigned int DecodedInstructionsCount = 0, ChunkSize, Delta = 0; + + DWORD_PTR BreakpointVA; + DWORD Register = 0, ThreadId = GetCurrentThreadId(); + + DumpCount = 0; + StepCount = 0; + TraceDepthCount = 0; + + if (!StepLimit) + StepLimit = SINGLE_STEP_LIMIT; + + if (!bp0 && !bp1)// && !bp2 && !bp3) + { + DoOutputDebugString("SetInitialBreakpoints: Error - No address specified for QakBot breakpoints.\n"); + return FALSE; + } + + if (!ImageBase) + { + ImageBase = GetModuleHandle(NULL); + DoOutputDebugString("SetInitialBreakpoints: ImageBase not set by base-on-api parameter, defaulting to process image base 0x%p.\n", ImageBase); + return FALSE; + } + else + DoOutputDebugString("SetInitialBreakpoints: ImageBase set to 0x%p.\n", ImageBase); + + BreakpointSet = FALSE; + + if (bp0) + { + Delta = 0; + Register = 0; + BreakpointVA = FileOffsetToVA((DWORD_PTR)ImageBase, (DWORD_PTR)bp0); + + ChunkSize = 0x80; // Size of code to disassemble + memset(&DecodedInstructions, 0, sizeof(DecodedInstructions)); + + _DecodeType DecodeType = Decode32Bits; + Result = distorm_decode(Offset, (const unsigned char*)BreakpointVA, ChunkSize, DecodeType, DecodedInstructions, 1, &DecodedInstructionsCount); + + for (unsigned int i = 0; i < DecodedInstructionsCount; i++) + { + DoOutputDebugString("0x%x (%02d) %-24s %s%s%s\n", BreakpointVA + Delta, DecodedInstructions[i].size, (char*)DecodedInstructions[i].instructionHex.p, (char*)DecodedInstructions[i].mnemonic.p, DecodedInstructions[i].operands.length != 0 ? " " : "", (char*)DecodedInstructions[i].operands.p); + + if (!strcmp(DecodedInstructions[i].mnemonic.p, "JLE")) + { + if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA + Delta, BP_EXEC, BreakpointCallback1)) + { + DoOutputDebugString("SetInitialBreakpoint: Breakpoint %d set on jle instruction at 0x%x.\n", Register, (BYTE*)BreakpointVA + Delta); + BreakpointSet = TRUE; + break; + } + else + { + DoOutputDebugString("SetInitialBreakpoint: SetBreakpoint failed #1.\n"); + return FALSE; + } + } + + Delta += DecodedInstructions[i].size; + } + } + + if (bp1) + { + Delta = 0; + Register = 1; + BreakpointVA = FileOffsetToVA((DWORD_PTR)ImageBase, (DWORD_PTR)bp1); + + ChunkSize = 0x80; // Size of code to disassemble + memset(&DecodedInstructions, 0, sizeof(DecodedInstructions)); + + _DecodeType DecodeType = Decode32Bits; + Result = distorm_decode(Offset, (const unsigned char*)BreakpointVA, ChunkSize, DecodeType, DecodedInstructions, 1, &DecodedInstructionsCount); + + for (unsigned int i = 0; i < DecodedInstructionsCount; i++) + { + DoOutputDebugString("0x%x (%02d) %-24s %s%s%s\n", BreakpointVA + Delta, DecodedInstructions[i].size, (char*)DecodedInstructions[i].instructionHex.p, (char*)DecodedInstructions[i].mnemonic.p, DecodedInstructions[i].operands.length != 0 ? " " : "", (char*)DecodedInstructions[i].operands.p); + + if (!strcmp(DecodedInstructions[i].mnemonic.p, "CALL")) + { + if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA + Delta, BP_EXEC, BreakpointCallback2)) + { + DoOutputDebugString("SetInitialBreakpoint: Breakpoint %d set on call instruction at 0x%x.\n", Register, (BYTE*)BreakpointVA + Delta); + BreakpointSet = TRUE; + break; + } + else + { + DoOutputDebugString("SetInitialBreakpoint: SetBreakpoint failed #2.\n"); + return FALSE; + } + } + + Delta += DecodedInstructions[i].size; + } + } +/* + if (bp2) + { + Register = 2; + + BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp2; + + if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) + { + DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p (RVA 0x%x)\n", Register, BreakpointVA, bp2); + BreakpointSet = TRUE; + } + else + { + DoOutputDebugString("SetInitialBreakpoints: SetBreakpoint failed.\n"); + BreakpointSet = FALSE; + return FALSE; + } + } + + if (bp3) + { + Register = 3; + + BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp3; + + if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) + { + DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p (RVA 0x%x)\n", Register, BreakpointVA, bp3); + BreakpointSet = TRUE; + } + else + { + DoOutputDebugString("SetInitialBreakpoints: SetBreakpoint failed.\n"); + BreakpointSet = FALSE; + return FALSE; + } + } +*/ + return BreakpointSet; +} diff --git a/CAPE/Trace.c b/CAPE/Trace.c deleted file mode 100644 index c66b59b..0000000 --- a/CAPE/Trace.c +++ /dev/null @@ -1,267 +0,0 @@ -/* -CAPE - Config And Payload Extraction -Copyright(C) 2015 - 2018 Context Information Security. (kevin.oreilly@contextis.com) - -This program is free software : you can redistribute it and / or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program.If not, see . -*/ -#include -#include "..\hooking.h" -#include "Debugger.h" -#include "CAPE.h" - -#define MAX_INSTRUCTIONS 0x10 -#define SINGLE_STEP_LIMIT 0x80 // default unless specified in web ui -#define CHUNKSIZE 0x10 * MAX_INSTRUCTIONS - -extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); -extern void DoOutputErrorString(_In_ LPCTSTR lpOutputString, ...); -extern int DumpModuleInCurrentProcess(LPVOID ModuleBase); -extern int DumpMemory(LPVOID Buffer, SIZE_T Size); -extern char *convert_address_to_dll_name_and_offset(ULONG_PTR addr, unsigned int *offset); -extern DWORD_PTR FileOffsetToVA(DWORD_PTR modBase, DWORD_PTR dwOffset); -extern BOOL ScyllaGetSectionByName(PVOID ImageBase, char* Name, PVOID* SectionData, SIZE_T* SectionSize); - -BOOL BreakpointSet, DllPrinted; -PVOID ModuleBase, DumpAddress; -SIZE_T DumpSize; -BOOL GetSystemTimeAsFileTimeImported, PayloadMarker, PayloadDumped; -unsigned int DumpCount, Correction, StepCount, StepLimit; -int StepOverRegister, TraceDepthCount, TraceDepthLimit; - -BOOL Trace(struct _EXCEPTION_POINTERS* ExceptionInfo); -BOOL BreakpointCallback(PBREAKPOINTINFO pBreakpointInfo, struct _EXCEPTION_POINTERS* ExceptionInfo); - -BOOL DoSetSingleStepMode(int Register, PCONTEXT Context, PVOID Handler) -{ - StepOverRegister = Register; - return SetSingleStepMode(Context, Trace); -} - -BOOL Trace(struct _EXCEPTION_POINTERS* ExceptionInfo) -{ - PVOID ReturnAddress; - char* DllName; - unsigned int DllRVA; - - _DecodeResult Result; - _OffsetType Offset = 0; - _DecodedInst DecodedInstruction; - unsigned int DecodedInstructionsCount = 0; - - StepCount++; - - if (StepCount > StepLimit) - { - DoOutputDebugString("Trace: single-step limit reached (%d), releasing.", StepLimit); - return TRUE; - } - -#ifdef _WIN64 - DllName = convert_address_to_dll_name_and_offset((ULONG_PTR)ExceptionInfo->ContextRecord->Rip, &DllRVA); - _DecodeType DecodeType = Decode64Bits; - Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Rip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); - DoOutputDebugString("0x%p (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Rip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); -#else - DllName = convert_address_to_dll_name_and_offset((ULONG_PTR)ExceptionInfo->ContextRecord->Eip, &DllRVA); - _DecodeType DecodeType = Decode32Bits; - Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Eip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); - DoOutputDebugString("0x%x (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Eip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); -#endif - - if (!DllPrinted && DllName) - { - DoOutputDebugString("Trace: Tracing in %s (RVA 0x%x).\n", DllName, DllRVA); - DllPrinted = TRUE; - } - - if (!strcmp(DecodedInstruction.mnemonic.p, "CALL")) - { - if (TraceDepthCount >= TraceDepthLimit) - { -#ifdef _WIN64 - ReturnAddress = (PVOID)((PUCHAR)ExceptionInfo->ContextRecord->Rip + DecodedInstruction.size); -#else - ReturnAddress = (PVOID)((PUCHAR)ExceptionInfo->ContextRecord->Eip + DecodedInstruction.size); -#endif - if (!ContextSetThreadBreakpoint(ExceptionInfo->ContextRecord, StepOverRegister, 0, (BYTE*)ReturnAddress, BP_EXEC, BreakpointCallback)) - { - DoOutputDebugString("Trace: Failed to set breakpoint on return address 0x%p\n", ReturnAddress); - } - - ClearSingleStepMode(ExceptionInfo->ContextRecord); - - return TRUE; - } - else - TraceDepthCount++; - } - else if (!strcmp(DecodedInstruction.mnemonic.p, "RET")) - { - if (TraceDepthCount < 0) - { - DoOutputDebugString("Trace: Stepping out of initial depth, releasing."); - - ClearSingleStepMode(ExceptionInfo->ContextRecord); - - return TRUE; - } - - TraceDepthCount--; - } - - SetSingleStepMode(ExceptionInfo->ContextRecord, Trace); - - return TRUE; -} - -BOOL BreakpointCallback(PBREAKPOINTINFO pBreakpointInfo, struct _EXCEPTION_POINTERS* ExceptionInfo) -{ - _DecodeResult Result; - _OffsetType Offset = 0; - _DecodedInst DecodedInstruction; - unsigned int DecodedInstructionsCount = 0; - - if (pBreakpointInfo == NULL) - { - DoOutputDebugString("BreakpointCallback executed with pBreakpointInfo NULL.\n"); - return FALSE; - } - - if (pBreakpointInfo->ThreadHandle == NULL) - { - DoOutputDebugString("BreakpointCallback executed with NULL thread handle.\n"); - return FALSE; - } - -#ifdef _WIN64 - _DecodeType DecodeType = Decode64Bits; - Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Rip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); - DoOutputDebugString("0x%p (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Rip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); -#else - _DecodeType DecodeType = Decode32Bits; - Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Eip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); - DoOutputDebugString("0x%x (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Eip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); -#endif - - StepOverExecutionBreakpoint(ExceptionInfo->ContextRecord, pBreakpointInfo); - - DoSetSingleStepMode(pBreakpointInfo->Register, ExceptionInfo->ContextRecord, Trace); - - return TRUE; -} - -BOOL SetInitialBreakpoints(PVOID ImageBase) -{ - DWORD_PTR BreakpointVA; - DWORD Register; - - StepCount = 0; - TraceDepthCount = 0; - - if (!StepLimit) - StepLimit = SINGLE_STEP_LIMIT; - - if (!bp0 && !bp1 && !bp2 && !bp3) - { - DoOutputDebugString("SetInitialBreakpoints: Error - No address specified for Trace breakpoints.\n"); - return FALSE; - } - - if (!ImageBase) - { - ImageBase = GetModuleHandle(NULL); - DoOutputDebugString("SetInitialBreakpoints: ImageBase not set by base-on-api parameter, defaulting to process image base 0x%p.\n", ImageBase); - return FALSE; - } - else - DoOutputDebugString("SetInitialBreakpoints: ImageBase set to 0x%p.\n", ImageBase); - - if (bp0) - { - Register = 0; - - BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp0; - - if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) - { - DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p (RVA 0x%x)\n", Register, BreakpointVA, bp0); - BreakpointSet = TRUE; - } - else - { - DoOutputDebugString("SetInitialBreakpoints: SetBreakpoint failed.\n"); - BreakpointSet = FALSE; - return FALSE; - } - } - - if (bp1) - { - Register = 1; - - BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp1; - - if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) - { - DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p (RVA 0x%x)\n", Register, BreakpointVA, bp1); - BreakpointSet = TRUE; - } - else - { - DoOutputDebugString("SetInitialBreakpoints: SetBreakpoint failed.\n"); - BreakpointSet = FALSE; - return FALSE; - } - } - - if (bp2) - { - Register = 2; - - BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp2; - - if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) - { - DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p (RVA 0x%x)\n", Register, BreakpointVA, bp2); - BreakpointSet = TRUE; - } - else - { - DoOutputDebugString("SetInitialBreakpoints: SetBreakpoint failed.\n"); - BreakpointSet = FALSE; - return FALSE; - } - } - - if (bp3) - { - Register = 3; - - BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp3; - - if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) - { - DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p (RVA 0x%x)\n", Register, BreakpointVA, bp3); - BreakpointSet = TRUE; - } - else - { - DoOutputDebugString("SetInitialBreakpoints: SetBreakpoint failed.\n"); - BreakpointSet = FALSE; - return FALSE; - } - } - - return BreakpointSet; -} diff --git a/cuckoomon.c b/cuckoomon.c index 80cdcdd..dff3db2 100644 --- a/cuckoomon.c +++ b/cuckoomon.c @@ -88,7 +88,7 @@ static hook_t g_hooks[] = { //HOOK_SPECIAL(ntdll, NtCreateThreadEx), //HOOK_SPECIAL(ntdll, NtTerminateThread), //HOOK_SPECIAL(kernel32, lstrcpynA), - //HOOK_SPECIAL(kernel32, lstrcmpiA), + HOOK_SPECIAL(kernel32, lstrcmpiA), // has special handling diff --git a/cuckoomon.vcxproj b/cuckoomon.vcxproj index acbaa72..07e5bb2 100644 --- a/cuckoomon.vcxproj +++ b/cuckoomon.vcxproj @@ -78,7 +78,7 @@ true AllRules.ruleset false - Trace + QakBot $(VC_IncludePath);$(WindowsSdk_71A_IncludePath);C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\WTL91\Include; @@ -201,6 +201,7 @@ + @@ -213,7 +214,6 @@ - diff --git a/cuckoomon.vcxproj.filters b/cuckoomon.vcxproj.filters index 6478be1..fae9c55 100644 --- a/cuckoomon.vcxproj.filters +++ b/cuckoomon.vcxproj.filters @@ -276,7 +276,7 @@ Source Files\CAPE - + Source Files\CAPE diff --git a/hook_process.c b/hook_process.c index b8b2174..991b01a 100644 --- a/hook_process.c +++ b/hook_process.c @@ -31,7 +31,7 @@ along with this program. If not, see . extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); extern void file_handle_terminate(); extern int RoutineProcessDump(); -extern BOOL ProcessDumped; +extern BOOL ProcessDumped, ModuleDumped; HOOKDEF(HANDLE, WINAPI, CreateToolhelp32Snapshot, __in DWORD dwFlags, @@ -403,7 +403,10 @@ HOOKDEF(NTSTATUS, WINAPI, NtTerminateProcess, } set_lasterrors(&lasterror); - ret = Old_NtTerminateProcess(ProcessHandle, ExitStatus); + if (ModuleDumped && ExitStatus == 1) + ExitStatus = 0; + + ret = Old_NtTerminateProcess(ProcessHandle, ExitStatus); return ret; } diff --git a/hooking.c b/hooking.c index 5720b14..b6eaabe 100644 --- a/hooking.c +++ b/hooking.c @@ -28,6 +28,15 @@ along with this program. If not, see . extern DWORD g_tls_hook_index; +extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); +extern PVOID GetHookCallerBase(); +extern int DumpModuleInCurrentProcess(LPVOID ModuleBase); +extern PVOID GetAllocationBase(PVOID Address); +extern SIZE_T GetAllocationSize(PVOID Address); +extern BOOL ModuleDumped; +extern BOOL SetInitialBreakpoints(PVOID ImageBase); +BOOL BreakpointsSet; + #ifdef _WIN64 #define TLS_LAST_WIN32_ERROR 0x68 #define TLS_LAST_NTSTATUS_ERROR 0x1250 @@ -105,6 +114,41 @@ int called_by_hook(void) return __called_by_hook(hookinfo->stack_pointer, hookinfo->frame_pointer); } +void base_on_api(hook_t *h) +{ + unsigned int i; + + for (i = 0; i < ARRAYSIZE(g_config.base_on_apiname); i++) { + PVOID AllocationBase; + if (!g_config.base_on_apiname[i]) + break; + if (!BreakpointsSet && !called_by_hook() && !stricmp(h->funcname, g_config.base_on_apiname[i])) { + DoOutputDebugString("Base-on-API: %s call detected in thread %d.\n", g_config.base_on_apiname[i], GetCurrentThreadId()); + AllocationBase = GetHookCallerBase(); + if (AllocationBase) { + BreakpointsSet = SetInitialBreakpoints((PVOID)AllocationBase); + if (BreakpointsSet) + { + DoOutputDebugString("Base-on-API: GetHookCallerBase success 0x%p - Breakpoints set.\n", AllocationBase); + if (!ModuleDumped && DumpModuleInCurrentProcess(AllocationBase)) { + ModuleDumped = TRUE; + DoOutputDebugString("Dump-on-API: Dumped module at 0x%p due to %s call.\n", AllocationBase, h->funcname); + } + else { + DoOutputDebugString("Dump-on-API: Failed to dump module at 0x%p due to %s call.\n", AllocationBase, h->funcname); + } + } + else + DoOutputDebugString("Base-on-API: Failed to set breakpoints on 0x%p.\n", AllocationBase); + } + else + DoOutputDebugString("Base-on-API: GetHookCallerBase fail.\n"); + } + } + + return; +} + extern BOOLEAN is_ignored_thread(DWORD tid); static hook_info_t tmphookinfo; @@ -148,6 +192,8 @@ int WINAPI enter_hook(hook_t *h, ULONG_PTR sp, ULONG_PTR ebp_or_rip) operate_on_backtrace(sp, ebp_or_rip, NULL, set_caller_info); + base_on_api(h); + return 1; } From 784de1cffc86d821ebc46f9eb8daa5aa5e2628c6 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 13 Aug 2018 15:33:43 +0100 Subject: [PATCH 09/12] Improve TerminateProcess hook code --- cuckoomon.c | 2 +- hook_process.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cuckoomon.c b/cuckoomon.c index dff3db2..80cdcdd 100644 --- a/cuckoomon.c +++ b/cuckoomon.c @@ -88,7 +88,7 @@ static hook_t g_hooks[] = { //HOOK_SPECIAL(ntdll, NtCreateThreadEx), //HOOK_SPECIAL(ntdll, NtTerminateThread), //HOOK_SPECIAL(kernel32, lstrcpynA), - HOOK_SPECIAL(kernel32, lstrcmpiA), + //HOOK_SPECIAL(kernel32, lstrcmpiA), // has special handling diff --git a/hook_process.c b/hook_process.c index 991b01a..fe2ae87 100644 --- a/hook_process.c +++ b/hook_process.c @@ -363,6 +363,12 @@ HOOKDEF(NTSTATUS, WINAPI, NtTerminateProcess, NTSTATUS ret = 0; lasterror_t lasterror; + if (ModuleDumped && ExitStatus == 1) + { + DoOutputDebugString("NtTerminateProcess hook: Fixing return value to bypass QakBot anti-sandbox.\n"); + ExitStatus = 0; + } + get_lasterrors(&lasterror); if (ProcessHandle == NULL) { // we mark this here as this termination type will kill all threads but ours, including @@ -403,9 +409,6 @@ HOOKDEF(NTSTATUS, WINAPI, NtTerminateProcess, } set_lasterrors(&lasterror); - if (ModuleDumped && ExitStatus == 1) - ExitStatus = 0; - ret = Old_NtTerminateProcess(ProcessHandle, ExitStatus); return ret; } From 559d6c9df7598c0617cd9ac75b7c0b0dd2bb3a53 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 16 Dec 2018 10:46:14 +0000 Subject: [PATCH 10/12] Upgrade to 2017, add debug output for missing breakpoints. --- .gitignore | 3 +- CAPE/QakBot.c | 4 + CAPE/Scylla/ApiReader.h | 2 +- CAPE/Scylla/ImportsHandling.cpp | 461 - CAPE/Scylla/ImportsHandling.h | 69 +- CAPE/Scylla/PeParser.cpp | 238 +- CAPE/Scylla/PeParser.h | 3 + CAPE/Scylla/Thunks.h | 10 +- bson/bson.vcxproj | 11 +- cuckoomon.vcxproj | 75 +- cuckoomon.vcxproj.filters | 143 +- distorm/COPYING | 26 + .../include/distorm.h | 94 +- distorm/include/mnemonics.h | 301 + {distorm3.2-package => distorm}/src/config.h | 18 +- {distorm3.2-package => distorm}/src/decoder.c | 134 +- {distorm3.2-package => distorm}/src/decoder.h | 0 {distorm3.2-package => distorm}/src/distorm.c | 71 +- .../src/instructions.c | 71 +- .../src/instructions.h | 105 +- distorm/src/insts.c | 7939 +++++++++++++++++ distorm/src/insts.h | 64 + .../src/mnemonics.c | 166 +- .../src/operands.c | 39 +- distorm/src/operands.h | 28 + {distorm3.2-package => distorm}/src/prefix.c | 16 +- {distorm3.2-package => distorm}/src/prefix.h | 16 +- .../src/textdefs.c | 16 +- .../src/textdefs.h | 18 +- {distorm3.2-package => distorm}/src/wstring.c | 16 +- {distorm3.2-package => distorm}/src/wstring.h | 16 +- {distorm3.2-package => distorm}/src/x86defs.h | 49 +- distorm3.2-package/COPYING | 674 -- distorm3.2-package/include/mnemonics.h | 312 - distorm3.2-package/src/insts.c | 7343 --------------- distorm3.2-package/src/insts.h | 47 - distorm3.2-package/src/operands.h | 40 - distorm3.2-package/src/x86defs.c | 50 - loader/loader/Loader.c | 228 +- loader/loader/Loader.h | 2 +- loader/loader/loader.vcxproj | 14 +- 41 files changed, 9331 insertions(+), 9601 deletions(-) create mode 100644 distorm/COPYING rename {distorm3.2-package => distorm}/include/distorm.h (89%) create mode 100644 distorm/include/mnemonics.h rename {distorm3.2-package => distorm}/src/config.h (85%) rename {distorm3.2-package => distorm}/src/decoder.c (84%) rename {distorm3.2-package => distorm}/src/decoder.h (100%) rename {distorm3.2-package => distorm}/src/distorm.c (88%) rename {distorm3.2-package => distorm}/src/instructions.c (91%) rename {distorm3.2-package => distorm}/src/instructions.h (88%) create mode 100644 distorm/src/insts.c create mode 100644 distorm/src/insts.h rename {distorm3.2-package => distorm}/src/mnemonics.c (68%) rename {distorm3.2-package => distorm}/src/operands.c (97%) create mode 100644 distorm/src/operands.h rename {distorm3.2-package => distorm}/src/prefix.c (94%) rename {distorm3.2-package => distorm}/src/prefix.h (77%) rename {distorm3.2-package => distorm}/src/textdefs.c (90%) rename {distorm3.2-package => distorm}/src/textdefs.h (64%) rename {distorm3.2-package => distorm}/src/wstring.c (54%) rename {distorm3.2-package => distorm}/src/wstring.h (58%) rename {distorm3.2-package => distorm}/src/x86defs.h (54%) delete mode 100644 distorm3.2-package/COPYING delete mode 100644 distorm3.2-package/include/mnemonics.h delete mode 100644 distorm3.2-package/src/insts.c delete mode 100644 distorm3.2-package/src/insts.h delete mode 100644 distorm3.2-package/src/operands.h delete mode 100644 distorm3.2-package/src/x86defs.c diff --git a/.gitignore b/.gitignore index ffc88da..418e99b 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,5 @@ Release tests/logging-test.* *.suo *.opendb -*.VC.db \ No newline at end of file +*.VC.db +.vs/* diff --git a/CAPE/QakBot.c b/CAPE/QakBot.c index 497d90c..9ca1135 100644 --- a/CAPE/QakBot.c +++ b/CAPE/QakBot.c @@ -417,6 +417,8 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) Delta += DecodedInstructions[i].size; } } + else + DoOutputDebugString("SetInitialBreakpoint: No breakpoint supplied for QakBot anti-sandbox bypass.\n"); if (bp1) { @@ -452,6 +454,8 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) Delta += DecodedInstructions[i].size; } } + else + DoOutputDebugString("SetInitialBreakpoint: No breakpoint supplied for QakBot config dump.\n"); /* if (bp2) { diff --git a/CAPE/Scylla/ApiReader.h b/CAPE/Scylla/ApiReader.h index 45e67ef..54d1431 100644 --- a/CAPE/Scylla/ApiReader.h +++ b/CAPE/Scylla/ApiReader.h @@ -29,6 +29,7 @@ class ApiReader : public ProcessAccessHelp void addFoundApiToModuleList(DWORD_PTR iatAddress, ApiInfo * apiFound, bool isNewModule, bool isSuspect); void clearAll(); bool isInvalidMemoryForIat( DWORD_PTR address ); + void parseModuleWithOwnProcess( ModuleInfo * module ); private: bool readExportTableAlwaysFromDisk; void parseIAT(DWORD_PTR addressIAT, BYTE * iatBuffer, SIZE_T size); @@ -49,7 +50,6 @@ class ApiReader : public ProcessAccessHelp void findApiByModule(ModuleInfo * module, char * searchFunctionName, WORD ordinal, DWORD_PTR * vaApi, DWORD_PTR * rvaApi); bool isModuleLoadedInOwnProcess( ModuleInfo * module ); - void parseModuleWithOwnProcess( ModuleInfo * module ); bool isPeAndExportTableValid(PIMAGE_NT_HEADERS pNtHeader); void findApiInProcess( ModuleInfo * module, char * searchFunctionName, WORD ordinal, DWORD_PTR * vaApi, DWORD_PTR * rvaApi ); bool findApiInExportTable(ModuleInfo *module, PIMAGE_EXPORT_DIRECTORY pExportDir, DWORD_PTR deltaAddress, char * searchFunctionName, WORD ordinal, DWORD_PTR * vaApi, DWORD_PTR * rvaApi); diff --git a/CAPE/Scylla/ImportsHandling.cpp b/CAPE/Scylla/ImportsHandling.cpp index 17c9cda..4724f15 100644 --- a/CAPE/Scylla/ImportsHandling.cpp +++ b/CAPE/Scylla/ImportsHandling.cpp @@ -3,12 +3,6 @@ #include "Thunks.h" #include "Architecture.h" -#include -#include -//#include "multitree.h" // CMultiSelectTreeViewCtrl - -//#include "resource.h" - //#define DEBUG_COMMENTS extern "C" void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); @@ -59,59 +53,6 @@ ImportsHandling::ImportsHandling() ImportsHandling::~ImportsHandling() { - //TreeIcons.Destroy(); -} - -bool ImportsHandling::isModule(CTreeItem item) -{ - return (0 != getModuleThunk(item)); -} - -bool ImportsHandling::isImport(CTreeItem item) -{ - return (0 != getImportThunk(item)); -} - -ImportModuleThunk * ImportsHandling::getModuleThunk(CTreeItem item) -{ - stdext::hash_map::const_iterator it; - it = itemData.find(item); - if(it != itemData.end()) - { - const TreeItemData * data = &it->second; - if(data->isModule) - { - return data->module; - } - } - return NULL; -} - -ImportThunk * ImportsHandling::getImportThunk(CTreeItem item) -{ - stdext::hash_map::const_iterator it; - TreeItemData * data = getItemData(item); - if(data && !data->isModule) - { - return data->import; - } - return NULL; -} - -void ImportsHandling::setItemData(CTreeItem item, const TreeItemData * data) -{ - itemData[item] = *data; -} - -ImportsHandling::TreeItemData * ImportsHandling::getItemData(CTreeItem item) -{ - stdext::hash_map::iterator it; - it = itemData.find(item); - if(it != itemData.end()) - { - return &it->second; - } - return NULL; } void ImportsHandling::updateCounts() @@ -144,160 +85,17 @@ void ImportsHandling::updateCounts() } } -/*bool ImportsHandling::addImport(const CHAR * moduleName, const CHAR * name, DWORD_PTR va, DWORD_PTR rva, WORD ordinal, bool valid, bool suspect) -{ - ImportThunk import; - ImportModuleThunk * module = 0; - std::map::iterator iterator1; - - if (moduleList.size() > 1) - { - iterator1 = moduleList.begin(); - while (iterator1 != moduleList.end()) - { - if (rva >= iterator1->second.firstThunk) - { - iterator1++; - if (iterator1 == moduleList.end()) - { - iterator1--; - module = &(iterator1->second); - break; - } - else if (rva < iterator1->second.firstThunk) - { - iterator1--; - module = &(iterator1->second); - break; - } - } - } - } - else - { - iterator1 = moduleList.begin(); - module = &(iterator1->second); - } - - if (!module) - { - DoOutputDebugString("ImportsHandling::addFunction module not found rva " PRINTF_DWORD_PTR_FULL, rva); - return false; - } - - //TODO - import.suspect = true; - import.valid = false; - import.va = va; - import.rva = rva; - import.ordinal = ordinal; - - strcpy_s(import.moduleName, MAX_PATH, moduleName); - strcpy_s(import.name, MAX_PATH, name); - - module->thunkList.insert(std::pair(import.rva, import)); - - return true; -} -*/ - -/* -bool ImportsHandling::addModule(const CHAR * moduleName, DWORD_PTR firstThunk) -{ - ImportModuleThunk module; - - module.firstThunk = firstThunk; - strcpy_s(module.moduleName, MAX_PATH, moduleName); - - moduleList.insert(std::pair(firstThunk,module)); - - return true; -} - -void ImportsHandling::displayAllImports() -{ - std::map::iterator it_module; - std::map::iterator it_import; - - //TreeImports.DeleteAllItems(); - itemData.clear(); - //TreeImports.SetImageList(TreeIcons); - - it_module = moduleList.begin(); - while (it_module != moduleList.end()) - { - ImportModuleThunk &moduleThunk = it_module->second; - - moduleThunk.key = moduleThunk.firstThunk; // This belongs elsewhere... - //moduleThunk.hTreeItem = addDllToTreeView(TreeImports, &moduleThunk); - - it_import = moduleThunk.thunkList.begin(); - while (it_import != moduleThunk.thunkList.end()) - { - ImportThunk &importThunk = it_import->second; - - importThunk.key = importThunk.rva; // This belongs elsewhere... - importThunk.hTreeItem = addApiToTreeView(TreeImports, moduleThunk.hTreeItem, &importThunk); - - it_import++; - } - - it_module++; - } - - updateCounts(); -} -*/ - void ImportsHandling::clearAllImports() { - //TreeImports.DeleteAllItems(); - itemData.clear(); moduleList.clear(); updateCounts(); } -/* -CTreeItem ImportsHandling::addDllToTreeView(CMultiSelectTreeViewCtrl& idTreeView, ImportModuleThunk * moduleThunk) -{ - CTreeItem item = idTreeView.InsertItem("", NULL, TVI_ROOT); - - item.SetData(itemData.size()); - - TreeItemData data; - data.isModule = true; - data.module = moduleThunk; - - setItemData(item, &data); - - updateModuleInTreeView(moduleThunk, item); - return item; -} - -CTreeItem ImportsHandling::addApiToTreeView(CMultiSelectTreeViewCtrl& idTreeView, CTreeItem parentDll, ImportThunk * importThunk) -{ - CTreeItem item = idTreeView.InsertItem("", parentDll, TVI_LAST); - - item.SetData(itemData.size()); - - TreeItemData data; - data.isModule = false; - data.import = importThunk; - - setItemData(item, &data); - - updateImportInTreeView(importThunk, item); - return item; -} -*/ - void ImportsHandling::selectImports(bool invalid, bool suspect) { std::map::iterator it_module; std::map::iterator it_import; - //TreeImports.SelectAllItems(FALSE); //remove selection - it_module = moduleList.begin(); while (it_module != moduleList.end()) { @@ -307,13 +105,6 @@ void ImportsHandling::selectImports(bool invalid, bool suspect) while (it_import != moduleThunk.thunkList.end()) { ImportThunk &importThunk = it_import->second; - - if ((invalid && !importThunk.valid) || (suspect && importThunk.suspect)) - { - //TreeImports.SelectItem(importThunk.hTreeItem, TRUE); - importThunk.hTreeItem.EnsureVisible(); - } - it_import++; } @@ -321,232 +112,6 @@ void ImportsHandling::selectImports(bool invalid, bool suspect) } } -bool ImportsHandling::invalidateImport(CTreeItem item) -{ - ImportThunk * import = getImportThunk(item); - if(import) - { - CTreeItem parent = item.GetParent(); - if(!parent.IsNull()) - { - const ImportModuleThunk * module = getModuleThunk(parent); - if(module) - { - import->invalidate(); - - updateImportInTreeView(import, import->hTreeItem); - updateModuleInTreeView(module, module->hTreeItem); - - updateCounts(); - return true; - } - } - } - return false; -} - -bool ImportsHandling::invalidateModule(CTreeItem item) -{ - ImportModuleThunk * module = getModuleThunk(item); - if(module) - { - std::map::iterator it_import; - - it_import = module->thunkList.begin(); - while(it_import != module->thunkList.end()) - { - ImportThunk * import = &it_import->second; - import->invalidate(); - updateImportInTreeView(import, import->hTreeItem); - it_import++; - } - - updateModuleInTreeView(module, module->hTreeItem); - - updateCounts(); - return true; - } - return false; -} - -bool ImportsHandling::setImport(CTreeItem item, const CHAR * moduleName, const CHAR * apiName, WORD ordinal, WORD hint, bool valid, bool suspect) -{ - ImportThunk * import = getImportThunk(item); - if(import) - { - CTreeItem parent = item.GetParent(); - if(!parent.IsNull()) - { - ImportModuleThunk * module = getModuleThunk(parent); - if(module) - { - - strcpy_s(import->moduleName, moduleName); - strcpy_s(import->name, apiName); - import->ordinal = ordinal; - //import->apiAddressVA = api->va; //?? - import->hint = hint; - import->valid = valid; - import->suspect = suspect; - - if (module->isValid()) - { - scanAndFixModuleList(); - //displayAllImports(); - } - else - { - updateImportInTreeView(import, item); - updateCounts(); - } - return true; - } - } - } - return false; -} - -void ImportsHandling::updateImportInTreeView(const ImportThunk * importThunk, CTreeItem item) -{ - if (importThunk->valid) - { - CHAR tempString[300]; - - if (importThunk->name[0] != 0x00) - { - sprintf_s(tempString, "ord: %04X name: %s", importThunk->ordinal, importThunk->name); - } - else - { - sprintf_s(tempString, "ord: %04X", importThunk->ordinal); - } - - sprintf_s(stringBuffer, " rva: " PRINTF_DWORD_PTR_HALF " mod: %s %s", importThunk->rva, importThunk->moduleName, tempString); - } - else - { - sprintf_s(stringBuffer, " rva: " PRINTF_DWORD_PTR_HALF " ptr: " PRINTF_DWORD_PTR_FULL, importThunk->rva, importThunk->apiAddressVA); - } - -// item.SetText(stringBuffer); -// Icon icon = getAppropiateIcon(importThunk); -// item.SetImage(icon, icon); -} - -void ImportsHandling::updateModuleInTreeView(const ImportModuleThunk * importThunk, CTreeItem item) -{ - sprintf_s(stringBuffer, "%s (%d) FThunk: " PRINTF_DWORD_PTR_HALF, importThunk->moduleName,importThunk->thunkList.size(), importThunk->firstThunk); - - item.SetText(stringBuffer); - Icon icon = getAppropiateIcon(importThunk->isValid()); - item.SetImage(icon, icon); -} - -ImportsHandling::Icon ImportsHandling::getAppropiateIcon(const ImportThunk * importThunk) -{ - if(importThunk->valid) - { - if(importThunk->suspect) - { - return iconWarning; - } - else - { - return iconCheck; - } - } - else - { - return iconError; - } -} - -ImportsHandling::Icon ImportsHandling::getAppropiateIcon(bool valid) -{ - if(valid) - { - return iconCheck; - } - else - { - return iconError; - } -} - -bool ImportsHandling::cutImport(CTreeItem item) -{ - ImportThunk * import = getImportThunk(item); - if(import) - { - CTreeItem parent = item.GetParent(); - if(!parent.IsNull()) - { - ImportModuleThunk * module = getModuleThunk(parent); - if(module) - { - itemData.erase(item); - import->hTreeItem.Delete(); - module->thunkList.erase(import->key); - import = 0; - - if (module->thunkList.empty()) - { - itemData.erase(parent); - module->hTreeItem.Delete(); - moduleList.erase(module->key); - module = 0; - } - else - { - if (module->isValid() && module->moduleName[0] == L'?') - { - //update module name - strcpy_s(module->moduleName, module->thunkList.begin()->second.moduleName); - } - - module->firstThunk = module->thunkList.begin()->second.rva; - updateModuleInTreeView(module, module->hTreeItem); - } - - updateCounts(); - return true; - } - } - } - return false; -} - -bool ImportsHandling::cutModule(CTreeItem item) -{ - ImportModuleThunk * module = getModuleThunk(item); - if(module) - { - CTreeItem child = item.GetChild(); - while(!child.IsNull()) - { - itemData.erase(child); - child = child.GetNextSibling(); - } - itemData.erase(item); - module->hTreeItem.Delete(); - moduleList.erase(module->key); - module = 0; - updateCounts(); - return true; - } - return false; -} - -DWORD_PTR ImportsHandling::getApiAddressByNode(CTreeItem item) -{ - const ImportThunk * import = getImportThunk(item); - if(import) - { - return import->apiAddressVA; - } - return 0; -} - void ImportsHandling::scanAndFixModuleList() { CHAR prevModuleName[MAX_PATH] = {0}; @@ -787,29 +352,3 @@ bool ImportsHandling::addFunctionToModuleList(const ImportThunk * apiFound) module->thunkList[import.key] = import; return true; } - -void ImportsHandling::expandAllTreeNodes() -{ - changeExpandStateOfTreeNodes(TVE_EXPAND); -} - -void ImportsHandling::collapseAllTreeNodes() -{ - changeExpandStateOfTreeNodes(TVE_COLLAPSE); -} - -void ImportsHandling::changeExpandStateOfTreeNodes(UINT flag) -{ - std::map::iterator it_module; - - it_module = moduleList.begin(); - while (it_module != moduleList.end()) - { - ImportModuleThunk &moduleThunk = it_module->second; - - moduleThunk.hTreeItem.Expand(flag); - - it_module++; - } -} - diff --git a/CAPE/Scylla/ImportsHandling.h b/CAPE/Scylla/ImportsHandling.h index 8a7fcb4..3c1ee9b 100644 --- a/CAPE/Scylla/ImportsHandling.h +++ b/CAPE/Scylla/ImportsHandling.h @@ -1,15 +1,9 @@ #pragma once +#include #include #include -// WTL -#include -#include -#include // CTreeItem - -class CMultiSelectTreeViewCtrl; - class ImportThunk; class ImportModuleThunk; @@ -26,28 +20,10 @@ class ImportsHandling unsigned int invalidThunkCount() const { return m_invalidThunkCount; } unsigned int suspectThunkCount() const { return m_suspectThunkCount; } - bool isModule(CTreeItem item); - bool isImport(CTreeItem item); - - ImportModuleThunk * getModuleThunk(CTreeItem item); - ImportThunk * getImportThunk(CTreeItem item); - - //void displayAllImports(); void clearAllImports(); void selectImports(bool invalid, bool suspect); - bool invalidateImport(CTreeItem item); - bool invalidateModule(CTreeItem item); - bool setImport(CTreeItem item, const CHAR * moduleName, const CHAR * apiName, WORD ordinal = 0, WORD hint = 0, bool valid = true, bool suspect = false); - bool cutImport(CTreeItem item); - bool cutModule(CTreeItem item); - //bool addImport(const CHAR * moduleName, const CHAR * name, DWORD_PTR va, DWORD_PTR rva, WORD ordinal = 0, bool valid = true, bool suspect = false); - //bool addModule(const CHAR * moduleName, DWORD_PTR firstThunk); - - DWORD_PTR getApiAddressByNode(CTreeItem selectedTreeNode); void scanAndFixModuleList(); - void expandAllTreeNodes(); - void collapseAllTreeNodes(); private: DWORD numberOfFunctions; @@ -56,58 +32,15 @@ class ImportsHandling unsigned int m_invalidThunkCount; unsigned int m_suspectThunkCount; - struct TreeItemData - { - bool isModule; - union - { - ImportModuleThunk * module; - ImportThunk * import; - }; - }; - - stdext::hash_map itemData; - - void setItemData(CTreeItem item, const TreeItemData * data); - TreeItemData * getItemData(CTreeItem item); - CHAR stringBuffer[600]; - //CMultiSelectTreeViewCtrl& TreeImports; - //CImageList TreeIcons; - //CIcon hIconCheck; - //CIcon hIconWarning; - //CIcon hIconError; - - // They have to be added to the image list in that order! - enum Icon { - iconCheck = 0, - iconWarning, - iconError - }; - void updateCounts(); - CTreeItem addDllToTreeView(CMultiSelectTreeViewCtrl& idTreeView, ImportModuleThunk * moduleThunk); - CTreeItem addApiToTreeView(CMultiSelectTreeViewCtrl& idTreeView, CTreeItem parentDll, ImportThunk * importThunk); - - void updateImportInTreeView(const ImportThunk * importThunk, CTreeItem item); - void updateModuleInTreeView(const ImportModuleThunk * importThunk, CTreeItem item); - - //bool isItemSelected(CTreeItem hItem); - //void unselectItem(CTreeItem htItem); - //bool selectItem(CTreeItem hItem, bool select = true); bool findNewModules(std::map & thunkList); - Icon getAppropiateIcon(const ImportThunk * importThunk); - Icon getAppropiateIcon(bool valid); - bool addModuleToModuleList(const CHAR * moduleName, DWORD_PTR firstThunk); void addUnknownModuleToModuleList(DWORD_PTR firstThunk); bool addNotFoundApiToModuleList(const ImportThunk * apiNotFound); bool addFunctionToModuleList(const ImportThunk * apiFound); bool isNewModule(const CHAR * moduleName); - - void changeExpandStateOfTreeNodes(UINT flag); - }; diff --git a/CAPE/Scylla/PeParser.cpp b/CAPE/Scylla/PeParser.cpp index 4b4c564..87727f5 100644 --- a/CAPE/Scylla/PeParser.cpp +++ b/CAPE/Scylla/PeParser.cpp @@ -666,7 +666,7 @@ bool PeParser::openFileHandle() return (hFile != INVALID_HANDLE_VALUE); } -bool PeParser::openWriteFileHandle( const CHAR * newFile ) +bool PeParser::openWriteFileHandle(const CHAR *newFile) { if (newFile) { @@ -1061,7 +1061,147 @@ bool PeParser::savePeFileToDisk(const CHAR *newFile) return retValue; } -bool PeParser::saveCompletePeToDisk( const CHAR * newFile ) +bool PeParser::savePeFileToHandle(HANDLE FileHandle) +{ + bool retValue = true, SectionDataWritten = false; + +#ifdef DEBUG_COMMENTS + //DoOutputDebugString("PeParser::savePeFileToDisk: Function entry.\n"); +#endif + + DWORD dwFileOffset = 0, dwWriteSize = 0; + + if (getNumberOfSections() != listPeSection.size()) + { +#ifdef DEBUG_COMMENTS + DoOutputDebugString("PeParser::savePeFileToDisk: Number of sections mismatch error.\n"); +#endif + return false; + } + + //Dos header + dwWriteSize = sizeof(IMAGE_DOS_HEADER); + if (!ProcessAccessHelp::writeMemoryToFile(FileHandle, dwFileOffset, dwWriteSize, pDosHeader)) + { + retValue = false; + } + dwFileOffset += dwWriteSize; + + + if (dosStubSize && pDosStub) + { + //Dos Stub + dwWriteSize = dosStubSize; + if (!ProcessAccessHelp::writeMemoryToFile(FileHandle, dwFileOffset, dwWriteSize, pDosStub)) + { + retValue = false; + } + dwFileOffset += dwWriteSize; + } + + //Pe Header + if (isPE32()) + { + dwWriteSize = sizeof(IMAGE_NT_HEADERS32); + } + else + { + dwWriteSize = sizeof(IMAGE_NT_HEADERS64); + } + + if (!ProcessAccessHelp::writeMemoryToFile(FileHandle, dwFileOffset, dwWriteSize, pNTHeader32)) + { + retValue = false; + } + dwFileOffset += dwWriteSize; + + //section headers + dwWriteSize = sizeof(IMAGE_SECTION_HEADER); + + for (WORD i = 0; i < getNumberOfSections(); i++) + { + if (!ProcessAccessHelp::writeMemoryToFile(FileHandle, dwFileOffset, dwWriteSize, &listPeSection[i].sectionHeader)) + { + retValue = false; + break; + } + dwFileOffset += dwWriteSize; + } + + for (WORD i = 0; i < getNumberOfSections(); i++) + { + if (!listPeSection[i].sectionHeader.PointerToRawData) + continue; + + if (listPeSection[i].sectionHeader.PointerToRawData > dwFileOffset) + { + dwWriteSize = listPeSection[i].sectionHeader.PointerToRawData - dwFileOffset; //padding + + if (!writeZeroMemoryToFile(FileHandle, dwFileOffset, dwWriteSize)) + { + retValue = false; + break; + } + dwFileOffset += dwWriteSize; + } + + dwWriteSize = listPeSection[i].dataSize; + + if (dwWriteSize) + { +#ifdef DEBUG_COMMENTS + DoOutputDebugString("PeParser::savePeFileToDisk: Writing section %d of size 0x%x bytes.\n", i+1, dwWriteSize); +#endif + if (!ProcessAccessHelp::writeMemoryToFile(FileHandle, listPeSection[i].sectionHeader.PointerToRawData, dwWriteSize, listPeSection[i].data)) + { + retValue = false; + break; + } + dwFileOffset += dwWriteSize; + + SectionDataWritten = true; + + if (listPeSection[i].dataSize < listPeSection[i].sectionHeader.SizeOfRawData) //padding + { + dwWriteSize = listPeSection[i].sectionHeader.SizeOfRawData - listPeSection[i].dataSize; + + if (!writeZeroMemoryToFile(FileHandle, dwFileOffset, dwWriteSize)) + { + retValue = false; + break; + } + dwFileOffset += dwWriteSize; + } + } +#ifdef DEBUG_COMMENTS + else + DoOutputDebugString("PeParser::savePeFileToDisk: Nothing to write for section %d.\n", i+1); +#endif + } + + //add overlay? + if (overlaySize && overlayData) + { + dwWriteSize = overlaySize; + if (!ProcessAccessHelp::writeMemoryToFile(FileHandle, dwFileOffset, dwWriteSize, overlayData)) + { + retValue = false; + } + dwFileOffset += dwWriteSize; + } + + //SetEndOfFile(FileHandle); + dumpSize = dwFileOffset; + + // If only headers are written, fail + // (this will allow a subsequent 'raw' memory dump) + if (!SectionDataWritten) + return false; + + return retValue; +} + +bool PeParser::saveCompletePeToDisk(const CHAR *newFile) { bool retValue = true; DWORD dwWriteSize = 0; @@ -1139,6 +1279,41 @@ bool PeParser::saveCompletePeToDisk( const CHAR * newFile ) return retValue; } +bool PeParser::saveCompletePeToHandle(HANDLE FileHandle) +{ + DWORD dwWriteSize = 0; + + if (getNumberOfSections() != listPeSection.size()) + { + return false; + } + + if (listPeSection[getNumberOfSections()-1].sectionHeader.PointerToRawData < pNTHeader32->OptionalHeader.FileAlignment + || listPeSection[getNumberOfSections()-1].sectionHeader.SizeOfRawData < pNTHeader32->OptionalHeader.FileAlignment) + { + DoOutputDebugString("PE Parser: Error - image seems incomplete: (%d sections, PointerToRawData: 0x%x, SizeOfRawData: 0x%x) - dump failed.\n", getNumberOfSections(), listPeSection[getNumberOfSections()-1].sectionHeader.PointerToRawData, listPeSection[getNumberOfSections()-1].sectionHeader.SizeOfRawData); + return false; + } + +#ifdef DEBUG_COMMENTS + DoOutputDebugString("Number of sections: %d, PointerToRawData: 0x%x, SizeOfRawData: 0x%x\n", getNumberOfSections(), listPeSection[getNumberOfSections() - 1].sectionHeader.PointerToRawData, listPeSection[getNumberOfSections() - 1].sectionHeader.SizeOfRawData); +#endif + + dwWriteSize = listPeSection[getNumberOfSections()-1].sectionHeader.PointerToRawData + + listPeSection[getNumberOfSections()-1].sectionHeader.SizeOfRawData; + + if (!ProcessAccessHelp::writeMemoryToFile(FileHandle, 0, dwWriteSize, (LPCVOID)moduleBaseAddress)) + { + DoOutputDebugString("saveCompletePeToHandle: writeMemoryToFile failed.\n"); + return false; + } + + //SetEndOfFile(FileHandle); + dumpSize = dwWriteSize; + + return true; +} + bool PeParser::writeZeroMemoryToFile(HANDLE hFile, DWORD fileOffset, DWORD size) { bool retValue = false; @@ -1327,13 +1502,13 @@ void PeParser::fixPeHeader() pNTHeader32->OptionalHeader.SizeOfHeaders = alignValue(dwSize + pNTHeader32->FileHeader.SizeOfOptionalHeader + (getNumberOfSections() * sizeof(IMAGE_SECTION_HEADER)), pNTHeader32->OptionalHeader.FileAlignment); - if (moduleBaseAddress && moduleBaseAddress != pNTHeader32->OptionalHeader.ImageBase) - { - pNTHeader32->OptionalHeader.ImageBase = (DWORD)moduleBaseAddress; -#ifdef DEBUG_COMMENTS - DoOutputDebugString("fixPeHeader: ImageBase set to 0x%x.\n", pNTHeader32->OptionalHeader.ImageBase); -#endif - } +// if (moduleBaseAddress && moduleBaseAddress != pNTHeader32->OptionalHeader.ImageBase) +// { +// pNTHeader32->OptionalHeader.ImageBase = (DWORD)moduleBaseAddress; +//#ifdef DEBUG_COMMENTS +// DoOutputDebugString("fixPeHeader: ImageBase set to 0x%x.\n", pNTHeader32->OptionalHeader.ImageBase); +//#endif +// } } else { @@ -1355,13 +1530,13 @@ void PeParser::fixPeHeader() pNTHeader64->OptionalHeader.SizeOfHeaders = alignValue(dwSize + pNTHeader64->FileHeader.SizeOfOptionalHeader + (getNumberOfSections() * sizeof(IMAGE_SECTION_HEADER)), pNTHeader64->OptionalHeader.FileAlignment); - if (moduleBaseAddress && moduleBaseAddress != pNTHeader64->OptionalHeader.ImageBase) - { - pNTHeader64->OptionalHeader.ImageBase = (DWORD)moduleBaseAddress; -#ifdef DEBUG_COMMENTS - DoOutputDebugString("fixPeHeader: ImageBase set to 0x%x.\n", pNTHeader64->OptionalHeader.ImageBase); -#endif - } +// if (moduleBaseAddress && moduleBaseAddress != pNTHeader64->OptionalHeader.ImageBase) +// { +// pNTHeader64->OptionalHeader.ImageBase = (DWORD)moduleBaseAddress; +//#ifdef DEBUG_COMMENTS +// DoOutputDebugString("fixPeHeader: ImageBase set to 0x%x.\n", pNTHeader64->OptionalHeader.ImageBase); +//#endif +// } } removeIatDirectory(); @@ -1583,6 +1758,37 @@ bool PeParser::dumpProcess(DWORD_PTR modBase, DWORD_PTR entryPoint, const CHAR * return dumpProcess(modBase, entryPoint, dumpFilePath); } +bool PeParser::dumpProcessToHandle(DWORD_PTR modBase, DWORD_PTR entryPoint, HANDLE FileHandle) +{ + moduleBaseAddress = modBase; + +#ifdef DEBUG_COMMENTS + DoOutputDebugString("DumpProcess: called with modBase = 0x%x.\n", modBase); +#endif + + if (!readPeSectionsFromProcess()) + DoOutputDebugString("DumpProcess: There was a problem reading one or more sections, the dump may be incomplete.\n"); +#ifdef DEBUG_COMMENTS + else + DoOutputDebugString("DumpProcess: Successfully read all sections.\n"); +#endif + setDefaultFileAlignment(); + + if (entryPoint) + setEntryPointVa(entryPoint); + + alignAllSectionHeaders(); + + fixPeHeader(); + + getFileOverlay(); + +#ifdef DEBUG_COMMENTS + DoOutputDebugString("dumpProcess DEBUG: Fixups complete, about to save to disk.\n"); +#endif + return savePeFileToHandle(FileHandle); +} + void PeParser::setEntryPointVa(DWORD_PTR entryPoint) { DWORD entryPointRva = (DWORD)(entryPoint - moduleBaseAddress); diff --git a/CAPE/Scylla/PeParser.h b/CAPE/Scylla/PeParser.h index 3bb2063..dcf31f3 100644 --- a/CAPE/Scylla/PeParser.h +++ b/CAPE/Scylla/PeParser.h @@ -70,13 +70,16 @@ class PeParser bool readPeSectionsFromProcess(); bool readPeSectionsFromFile(); bool savePeFileToDisk(const CHAR * newFile); + bool savePeFileToHandle(HANDLE FileHandle); bool saveCompletePeToDisk(const CHAR * newFile); + bool saveCompletePeToHandle(HANDLE FileHandle); void removeDosStub(); void alignAllSectionHeaders(); void fixPeHeader(); void setDefaultFileAlignment(); bool dumpProcess(DWORD_PTR modBase, DWORD_PTR entryPoint, const CHAR * dumpFilePath); bool dumpProcess(DWORD_PTR modBase, DWORD_PTR entryPoint, const CHAR * dumpFilePath, std::vector & sectionList); + bool dumpProcessToHandle(DWORD_PTR modBase, DWORD_PTR entryPoint, HANDLE FileHandle); void setEntryPointVa(DWORD_PTR entryPoint); void setEntryPointRva(DWORD entryPoint); diff --git a/CAPE/Scylla/Thunks.h b/CAPE/Scylla/Thunks.h index 3be2a74..27918bb 100644 --- a/CAPE/Scylla/Thunks.h +++ b/CAPE/Scylla/Thunks.h @@ -4,9 +4,9 @@ #include // WTL -#include -#include -#include // CTreeItem +//#include +//#include +//#include // CTreeItem class ImportThunk { @@ -21,7 +21,7 @@ class ImportThunk bool valid; bool suspect; - CTreeItem hTreeItem; +// CTreeItem hTreeItem; DWORD_PTR key; void invalidate(); @@ -35,7 +35,7 @@ class ImportModuleThunk DWORD_PTR firstThunk; - CTreeItem hTreeItem; +// CTreeItem hTreeItem; DWORD_PTR key; DWORD_PTR getFirstThunk() const; diff --git a/bson/bson.vcxproj b/bson/bson.vcxproj index cae92ba..dd0c78e 100644 --- a/bson/bson.vcxproj +++ b/bson/bson.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -21,31 +21,32 @@ {0DA99545-93E9-4C1B-861B-C4DAB5360AA8} Win32Proj + 10.0.17134.0 StaticLibrary true - v140 + v141 MultiByte StaticLibrary true - v140 + v141_xp MultiByte StaticLibrary false - v140_xp + v141_xp MultiByte true StaticLibrary false - v140_xp + v141_xp MultiByte true diff --git a/cuckoomon.vcxproj b/cuckoomon.vcxproj index 07e5bb2..921c0ac 100644 --- a/cuckoomon.vcxproj +++ b/cuckoomon.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -21,34 +21,38 @@ {15C69A24-71D1-4A1A-B39B-0466181ACD7E} Win32Proj - 8.1 + 7.0 DynamicLibrary true - v140 + v141 MultiByte + false DynamicLibrary true - v140 + v141 MultiByte + false DynamicLibrary false - v140_xp + v141_xp MultiByte true + false DynamicLibrary false - v140_xp + v141_xp NotSet true + false @@ -85,18 +89,18 @@ true AllRules.ruleset false - Trace_x64 + QakBot_x64 .dll $(VC_IncludePath);$(WindowsSdk_71A_IncludePath);C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\WTL91\Include; - CUCKOODBG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS_DEBUG;_WINDOWS;_USRDLL;MONGO_HAVE_STDINT;MONGO_STATIC_BUILD;CUCKOOMON_EXPORTS;%(PreprocessorDefinitions) + CUCKOODBG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS_DEBUG;_WINDOWS;_USRDLL;MONGO_HAVE_STDINT;MONGO_STATIC_BUILD;CUCKOOMON_EXPORTS;%(PreprocessorDefinitions);_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS MultiThreadedDebug Level3 ProgramDatabase Disabled - .\bson;.\distorm3.2-package\include;%(AdditionalIncludeDirectories) + .\bson;.\distorm\include;%(AdditionalIncludeDirectories) Default @@ -115,12 +119,12 @@ - CUCKOODBG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS_DEBUG;_WINDOWS;_USRDLL;MONGO_HAVE_STDINT;MONGO_STATIC_BUILD;CUCKOOMON_EXPORTS;%(PreprocessorDefinitions) + CUCKOODBG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS_DEBUG;_WINDOWS;_USRDLL;MONGO_HAVE_STDINT;MONGO_STATIC_BUILD;CUCKOOMON_EXPORTS;%(PreprocessorDefinitions);_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS MultiThreadedDebug Level3 ProgramDatabase Disabled - .\bson;.\distorm3.2-package\include;%(AdditionalIncludeDirectories) + .\bson;.\distorm\include;%(AdditionalIncludeDirectories) Default @@ -138,11 +142,11 @@ - WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGSNDEBUG;_WINDOWS;_USRDLL;MONGO_HAVE_STDINT;MONGO_STATIC_BUILD;CUCKOOMON_EXPORTS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) + WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGSNDEBUG;_WINDOWS;_USRDLL;MONGO_HAVE_STDINT;MONGO_STATIC_BUILD;CUCKOOMON_EXPORTS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions);_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS MultiThreaded Level3 ProgramDatabase - .\bson;.\distorm3.2-package\include;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\WTL81\Include;%(AdditionalIncludeDirectories) + .\bson;.\distorm\include;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\WTL81\Include;%(AdditionalIncludeDirectories) true false NoExtensions @@ -169,11 +173,11 @@ - WIN32;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGSNDEBUG;_WINDOWS;_USRDLL;MONGO_HAVE_STDINT;MONGO_STATIC_BUILD;CUCKOOMON_EXPORTS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) + WIN32;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGSNDEBUG;_WINDOWS;_USRDLL;MONGO_HAVE_STDINT;MONGO_STATIC_BUILD;CUCKOOMON_EXPORTS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions);_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS MultiThreaded Level3 ProgramDatabase - .\bson;.\distorm3.2-package\include;%(AdditionalIncludeDirectories) + .\bson;.\distorm\include;%(AdditionalIncludeDirectories) true false @@ -199,9 +203,9 @@ + - @@ -218,16 +222,15 @@ - - - - - - - - - - + + + + + + + + + @@ -427,16 +430,16 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/cuckoomon.vcxproj.filters b/cuckoomon.vcxproj.filters index fae9c55..8dd49aa 100644 --- a/cuckoomon.vcxproj.filters +++ b/cuckoomon.vcxproj.filters @@ -28,11 +28,11 @@ {dde7b0e5-0c75-442b-bbf4-24703756bd05} - - {2870ff64-a1ae-437b-b93d-b815724102e4} + + {a39cf6bf-3af9-42f9-971d-fcfbc3e0596d} - - {cf36b66e-1611-4be7-abe4-482a5fbacbe2} + + {df6779d0-6bb8-40c0-ab5a-c233ea8726e9} @@ -192,36 +192,6 @@ Source Files - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - Source Files\CAPE @@ -271,10 +241,37 @@ Source Files\CAPE\Scylla - Source Files\CAPE\w64wow64 + Source Files - Source Files\CAPE + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files Source Files\CAPE @@ -326,36 +323,6 @@ Header Files - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - Header Files\CAPE @@ -392,9 +359,6 @@ Header Files\CAPE\Scylla - - Header Files\CAPE\Scylla - Header Files\CAPE\Scylla @@ -404,17 +368,50 @@ Header Files\CAPE\Scylla + + Header Files + - Header Files\CAPE\w64wow64 + Header Files - Header Files\CAPE\w64wow64 + Header Files - Header Files\CAPE\w64wow64 + Header Files - Header Files\CAPE\w64wow64 + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files \ No newline at end of file diff --git a/distorm/COPYING b/distorm/COPYING new file mode 100644 index 0000000..4f365dd --- /dev/null +++ b/distorm/COPYING @@ -0,0 +1,26 @@ +:[diStorm3}: +The ultimate disassembler library. +Copyright (c) 2003-2016, Gil Dabah +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Gil Dabah nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL GIL DABAH BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/distorm3.2-package/include/distorm.h b/distorm/include/distorm.h similarity index 89% rename from distorm3.2-package/include/distorm.h rename to distorm/include/distorm.h index 09db9d2..cce3314 100644 --- a/distorm3.2-package/include/distorm.h +++ b/distorm/include/distorm.h @@ -1,4 +1,4 @@ -/* diStorm3 3.2 */ +/* diStorm 3.3.3 */ /* distorm.h @@ -6,20 +6,8 @@ distorm.h diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. */ @@ -91,10 +79,10 @@ typedef unsigned __int8 uint8_t; /* * Operand Size or Adderss size are stored inside the flags: - * 0 - 16 bits - * 1 - 32 bits - * 2 - 64 bits - * 3 - reserved + * 00 - 16 bits + * 01 - 32 bits + * 10 - 64 bits + * 11 - reserved * * If you call these set-macros more than once, you will have to clean the bits before doing so. */ @@ -104,6 +92,8 @@ typedef unsigned __int8 uint8_t; #define FLAG_GET_ADDRSIZE(flags) (((flags) >> 10) & 3) /* To get the LOCK/REPNZ/REP prefixes. */ #define FLAG_GET_PREFIX(flags) ((flags) & 7) +/* Indicates whether the instruction is privileged. */ +#define FLAG_GET_PRIVILEGED(flags) (((flags) & FLAG_PRIVILEGED_INSTRUCTION) != 0) /* * Macros to extract segment registers from 'segment': @@ -179,7 +169,7 @@ typedef struct { */ uint8_t index; - /* Size of: + /* Size in bits of: O_REG: register O_IMM: instruction.imm O_IMM1: instruction.imm.ex.i1 @@ -206,29 +196,33 @@ typedef struct { #define FLAG_HINT_TAKEN (1 << 3) /* Indicates there is a hint non-taken for Jcc instructions only. */ #define FLAG_HINT_NOT_TAKEN (1 << 4) -/* The Imm value is signed extended. */ +/* The Imm value is signed extended (E.G in 64 bit decoding mode, a 32 bit imm is usually sign extended into 64 bit imm). */ #define FLAG_IMM_SIGNED (1 << 5) /* The destination operand is writable. */ #define FLAG_DST_WR (1 << 6) /* The instruction uses RIP-relative indirection. */ #define FLAG_RIP_RELATIVE (1 << 7) +/* See flag FLAG_GET_XXX macros above. */ + +/* The instruction is privileged and can only be used from Ring0. */ +#define FLAG_PRIVILEGED_INSTRUCTION (1 << 15) + /* No register was defined. */ #define R_NONE ((uint8_t)-1) -#define REGS64_BASE (0) -#define REGS32_BASE (16) -#define REGS16_BASE (32) -#define REGS8_BASE (48) -#define REGS8_REX_BASE (64) -#define SREGS_BASE (68) -/* #define RIP 74 */ -#define FPUREGS_BASE (75) -#define MMXREGS_BASE (83) -#define SSEREGS_BASE (91) -#define AVXREGS_BASE (107) -#define CREGS_BASE (123) -#define DREGS_BASE (132) +#define REGS64_BASE 0 +#define REGS32_BASE 16 +#define REGS16_BASE 32 +#define REGS8_BASE 48 +#define REGS8_REX_BASE 64 +#define SREGS_BASE 68 +#define FPUREGS_BASE 75 +#define MMXREGS_BASE 83 +#define SSEREGS_BASE 91 +#define AVXREGS_BASE 107 +#define CREGS_BASE 123 +#define DREGS_BASE 132 #define OPERANDS_NO (4) @@ -244,12 +238,12 @@ typedef struct { /* Unused prefixes mask, for each bit that is set that prefix is not used (LSB is byte [addr + 0]). */ uint16_t unusedPrefixesMask; /* Mask of registers that were used in the operands, only used for quick look up, in order to know *some* operand uses that register class. */ - uint16_t usedRegistersMask; + uint32_t usedRegistersMask; /* ID of opcode in the global opcode table. Use for mnemonic look up. */ uint16_t opcode; /* Up to four operands per instruction, ignored if ops[n].type == O_NONE. */ _Operand ops[OPERANDS_NO]; - /* Size of the whole instruction. */ + /* Size of the whole instruction in bytes. */ uint8_t size; /* Segment information of memory indirection, default segment, or overriden one, can be -1. Use SEGMENT macros. */ uint8_t segment; @@ -258,6 +252,8 @@ typedef struct { uint8_t dispSize; /* Meta defines the instruction set class, and the flow control flags. Use META macros. */ uint8_t meta; + /* The CPU flags that the instruction operates upon. */ + uint16_t modifiedFlagsMask, testedFlagsMask, undefinedFlagsMask; uint8_t imm_encoded_size; } _DInst; @@ -280,7 +276,7 @@ typedef struct { _WString mnemonic; /* Mnemonic of decoded instruction, prefixed if required by REP, LOCK etc. */ _WString operands; /* Operands of the decoded instruction, up to 3 operands, comma-seperated. */ _WString instructionHex; /* Hex dump - little endian, including prefixes. */ - unsigned int size; /* Size of decoded instruction. */ + unsigned int size; /* Size of decoded instruction in bytes. */ _OffsetType offset; /* Start offset of the decoded instruction. */ } _DecodedInst; @@ -301,11 +297,30 @@ typedef struct { #define RM_AVX 0x800 /* YMM0 - YMM15 */ #define RM_CR 0x1000 /* CR0, CR2, CR3, CR4, CR8 */ #define RM_DR 0x2000 /* DR0, DR1, DR2, DR3, DR6, DR7 */ +#define RM_R8 0x4000 /* R8B, R8W, R8D, R8 */ +#define RM_R9 0x8000 /* R9B, R9W, R9D, R9 */ +#define RM_R10 0x10000 /* R10B, R10W, R10D, R10 */ +#define RM_R11 0x20000 /* R11B, R11W, R11D, R11 */ +#define RM_R12 0x40000 /* R12B, R12W, R12D, R12 */ +#define RM_R13 0x80000 /* R13B, R13W, R13D, R13 */ +#define RM_R14 0x100000 /* R14B, R14W, R14D, R14 */ +#define RM_R15 0x200000 /* R15B, R15W, R15D, R15 */ + /* RIP should be checked using the 'flags' field and FLAG_RIP_RELATIVE. * Segments should be checked using the segment macros. * For now R8 - R15 are not supported and non general purpose registers map into same RM. */ +/* CPU flags that instructions modify, test or undefine (are EFLAGS compatible!). */ +#define D_CF 1 /* Carry */ +#define D_PF 4 /* Parity */ +#define D_AF 0x10 /* Auxiliary */ +#define D_ZF 0x40 /* Zero */ +#define D_SF 0x80 /* Sign */ +#define D_IF 0x200 /* Interrupt */ +#define D_DF 0x400 /* Direction */ +#define D_OF 0x800 /* Overflow */ + /* * Instructions Set classes: * if you want a better understanding of the available classes, look at disOps project, file: x86sets.py. @@ -418,6 +433,11 @@ typedef enum { DECRES_NONE, DECRES_SUCCESS, DECRES_MEMORYERR, DECRES_INPUTERR, D * Notes: 1)The minimal size of maxInstructions is 15. * 2)You will have to synchronize the offset,code and length by yourself if you pass code fragments and not a complete code block! */ + +/* distorm_decompose + * See more documentation online at the GitHub project's wiki. + * + */ #ifdef SUPPORT_64BIT_OFFSET _DecodeResult distorm_decompose64(_CodeInfo* ci, _DInst result[], unsigned int maxInstructions, unsigned int* usedInstructionsCount); diff --git a/distorm/include/mnemonics.h b/distorm/include/mnemonics.h new file mode 100644 index 0000000..ef9889c --- /dev/null +++ b/distorm/include/mnemonics.h @@ -0,0 +1,301 @@ +/* +mnemonics.h + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#ifndef MNEMONICS_H +#define MNEMONICS_H + +#ifdef __cplusplus + extern "C" { +#endif + +#ifndef DISTORM_LIGHT + +typedef struct WMnemonic { + unsigned char length; + unsigned char p[1]; /* p is a null terminated string, which contains 'length' characters. */ +} _WMnemonic; + +typedef struct WRegister { + unsigned int length; + unsigned char p[6]; /* p is a null terminated string. */ +} _WRegister; + +extern const unsigned char _MNEMONICS[]; +extern const _WRegister _REGISTERS[]; + +#endif /* DISTORM_LIGHT */ + +#ifdef __cplusplus +} /* End Of Extern */ +#endif + +#define GET_REGISTER_NAME(r) (unsigned char*)_REGISTERS[(r)].p +#define GET_MNEMONIC_NAME(m) ((_WMnemonic*)&_MNEMONICS[(m)])->p + + typedef enum { + I_UNDEFINED = 0, I_AAA = 66, I_AAD = 389, I_AAM = 384, I_AAS = 76, I_ADC = 31, I_ADD = 11, I_ADDPD = 3132, + I_ADDPS = 3125, I_ADDSD = 3146, I_ADDSS = 3139, I_ADDSUBPD = 6416, I_ADDSUBPS = 6426, + I_AESDEC = 9231, I_AESDECLAST = 9248, I_AESENC = 9189, I_AESENCLAST = 9206, + I_AESIMC = 9172, I_AESKEYGENASSIST = 9817, I_AND = 41, I_ANDNPD = 3043, I_ANDNPS = 3035, + I_ANDPD = 3012, I_ANDPS = 3005, I_ARPL = 111, I_BLENDPD = 9394, I_BLENDPS = 9375, + I_BLENDVPD = 7641, I_BLENDVPS = 7631, I_BOUND = 104, I_BSF = 4368, I_BSR = 4380, + I_BSWAP = 960, I_BT = 872, I_BTC = 934, I_BTR = 912, I_BTS = 887, I_CALL = 456, + I_CALL_FAR = 260, I_CBW = 228, I_CDQ = 250, I_CDQE = 239, I_CLC = 492, I_CLD = 512, + I_CLFLUSH = 4351, I_CLGI = 1855, I_CLI = 502, I_CLTS = 541, I_CMC = 487, I_CMOVA = 694, + I_CMOVAE = 663, I_CMOVB = 656, I_CMOVBE = 686, I_CMOVG = 754, I_CMOVGE = 738, + I_CMOVL = 731, I_CMOVLE = 746, I_CMOVNO = 648, I_CMOVNP = 723, I_CMOVNS = 708, + I_CMOVNZ = 678, I_CMOVO = 641, I_CMOVP = 716, I_CMOVS = 701, I_CMOVZ = 671, + I_CMP = 71, I_CMPEQPD = 4471, I_CMPEQPS = 4392, I_CMPEQSD = 4629, I_CMPEQSS = 4550, + I_CMPLEPD = 4489, I_CMPLEPS = 4410, I_CMPLESD = 4647, I_CMPLESS = 4568, I_CMPLTPD = 4480, + I_CMPLTPS = 4401, I_CMPLTSD = 4638, I_CMPLTSS = 4559, I_CMPNEQPD = 4510, I_CMPNEQPS = 4431, + I_CMPNEQSD = 4668, I_CMPNEQSS = 4589, I_CMPNLEPD = 4530, I_CMPNLEPS = 4451, + I_CMPNLESD = 4688, I_CMPNLESS = 4609, I_CMPNLTPD = 4520, I_CMPNLTPS = 4441, + I_CMPNLTSD = 4678, I_CMPNLTSS = 4599, I_CMPORDPD = 4540, I_CMPORDPS = 4461, + I_CMPORDSD = 4698, I_CMPORDSS = 4619, I_CMPS = 301, I_CMPUNORDPD = 4498, I_CMPUNORDPS = 4419, + I_CMPUNORDSD = 4656, I_CMPUNORDSS = 4577, I_CMPXCHG = 898, I_CMPXCHG16B = 6395, + I_CMPXCHG8B = 6384, I_COMISD = 2801, I_COMISS = 2793, I_CPUID = 865, I_CQO = 255, + I_CRC32 = 9280, I_CVTDQ2PD = 6809, I_CVTDQ2PS = 3329, I_CVTPD2DQ = 6819, I_CVTPD2PI = 2703, + I_CVTPD2PS = 3255, I_CVTPH2PS = 4183, I_CVTPI2PD = 2517, I_CVTPI2PS = 2507, + I_CVTPS2DQ = 3339, I_CVTPS2PD = 3245, I_CVTPS2PH = 4193, I_CVTPS2PI = 2693, + I_CVTSD2SI = 2723, I_CVTSD2SS = 3275, I_CVTSI2SD = 2537, I_CVTSI2SS = 2527, + I_CVTSS2SD = 3265, I_CVTSS2SI = 2713, I_CVTTPD2DQ = 6798, I_CVTTPD2PI = 2636, + I_CVTTPS2DQ = 3349, I_CVTTPS2PI = 2625, I_CVTTSD2SI = 2658, I_CVTTSS2SI = 2647, + I_CWD = 245, I_CWDE = 233, I_DAA = 46, I_DAS = 56, I_DEC = 86, I_DIV = 1646, + I_DIVPD = 3521, I_DIVPS = 3514, I_DIVSD = 3535, I_DIVSS = 3528, I_DPPD = 9637, + I_DPPS = 9624, I_EMMS = 4122, I_ENTER = 340, I_EXTRACTPS = 9502, I_EXTRQ = 4158, + I_F2XM1 = 1192, I_FABS = 1123, I_FADD = 1023, I_FADDP = 1549, I_FBLD = 1601, + I_FBSTP = 1607, I_FCHS = 1117, I_FCLEX = 7311, I_FCMOVB = 1376, I_FCMOVBE = 1392, + I_FCMOVE = 1384, I_FCMOVNB = 1445, I_FCMOVNBE = 1463, I_FCMOVNE = 1454, I_FCMOVNU = 1473, + I_FCMOVU = 1401, I_FCOM = 1035, I_FCOMI = 1512, I_FCOMIP = 1623, I_FCOMP = 1041, + I_FCOMPP = 1563, I_FCOS = 1311, I_FDECSTP = 1238, I_FDIV = 1061, I_FDIVP = 1594, + I_FDIVR = 1067, I_FDIVRP = 1586, I_FEDISI = 1488, I_FEMMS = 574, I_FENI = 1482, + I_FFREE = 1527, I_FIADD = 1317, I_FICOM = 1331, I_FICOMP = 1338, I_FIDIV = 1361, + I_FIDIVR = 1368, I_FILD = 1418, I_FIMUL = 1324, I_FINCSTP = 1247, I_FINIT = 7326, + I_FIST = 1432, I_FISTP = 1438, I_FISTTP = 1424, I_FISUB = 1346, I_FISUBR = 1353, + I_FLD = 1074, I_FLD1 = 1141, I_FLDCW = 1098, I_FLDENV = 1090, I_FLDL2E = 1155, + I_FLDL2T = 1147, I_FLDLG2 = 1170, I_FLDLN2 = 1178, I_FLDPI = 1163, I_FLDZ = 1186, + I_FMUL = 1029, I_FMULP = 1556, I_FNCLEX = 7303, I_FNINIT = 7318, I_FNOP = 1111, + I_FNSAVE = 7333, I_FNSTCW = 7288, I_FNSTENV = 7271, I_FNSTSW = 7348, I_FPATAN = 1213, + I_FPREM = 1256, I_FPREM1 = 1230, I_FPTAN = 1206, I_FRNDINT = 1288, I_FRSTOR = 1519, + I_FSAVE = 7341, I_FSCALE = 1297, I_FSETPM = 1496, I_FSIN = 1305, I_FSINCOS = 1279, + I_FSQRT = 1272, I_FST = 1079, I_FSTCW = 7296, I_FSTENV = 7280, I_FSTP = 1084, + I_FSTSW = 7356, I_FSUB = 1048, I_FSUBP = 1579, I_FSUBR = 1054, I_FSUBRP = 1571, + I_FTST = 1129, I_FUCOM = 1534, I_FUCOMI = 1504, I_FUCOMIP = 1614, I_FUCOMP = 1541, + I_FUCOMPP = 1409, I_FXAM = 1135, I_FXCH = 1105, I_FXRSTOR = 9914, I_FXRSTOR64 = 9923, + I_FXSAVE = 9886, I_FXSAVE64 = 9894, I_FXTRACT = 1221, I_FYL2X = 1199, I_FYL2XP1 = 1263, + I_GETSEC = 633, I_HADDPD = 4203, I_HADDPS = 4211, I_HLT = 482, I_HSUBPD = 4237, + I_HSUBPS = 4245, I_IDIV = 1651, I_IMUL = 117, I_IN = 447, I_INC = 81, I_INS = 123, + I_INSERTPS = 9569, I_INSERTQ = 4165, I_INT = 367, I_INT_3 = 360, I_INT1 = 476, + I_INTO = 372, I_INVD = 555, I_INVEPT = 8306, I_INVLPG = 1727, I_INVLPGA = 1869, + I_INVPCID = 8323, I_INVVPID = 8314, I_IRET = 378, I_JA = 166, I_JAE = 147, + I_JB = 143, I_JBE = 161, I_JCXZ = 427, I_JECXZ = 433, I_JG = 202, I_JGE = 192, + I_JL = 188, I_JLE = 197, I_JMP = 462, I_JMP_FAR = 467, I_JNO = 138, I_JNP = 183, + I_JNS = 174, I_JNZ = 156, I_JO = 134, I_JP = 179, I_JRCXZ = 440, I_JS = 170, + I_JZ = 152, I_LAHF = 289, I_LAR = 522, I_LDDQU = 7016, I_LDMXCSR = 9944, I_LDS = 335, + I_LEA = 223, I_LEAVE = 347, I_LES = 330, I_LFENCE = 4287, I_LFS = 917, I_LGDT = 1703, + I_LGS = 922, I_LIDT = 1709, I_LLDT = 1668, I_LMSW = 1721, I_LODS = 313, I_LOOP = 421, + I_LOOPNZ = 406, I_LOOPZ = 414, I_LSL = 527, I_LSS = 907, I_LTR = 1674, I_LZCNT = 4385, + I_MASKMOVDQU = 7141, I_MASKMOVQ = 7131, I_MAXPD = 3581, I_MAXPS = 3574, I_MAXSD = 3595, + I_MAXSS = 3588, I_MFENCE = 4313, I_MINPD = 3461, I_MINPS = 3454, I_MINSD = 3475, + I_MINSS = 3468, I_MONITOR = 1771, I_MOV = 218, I_MOVAPD = 2481, I_MOVAPS = 2473, + I_MOVBE = 9273, I_MOVD = 3942, I_MOVDDUP = 2208, I_MOVDQ2Q = 6544, I_MOVDQA = 3968, + I_MOVDQU = 3976, I_MOVHLPS = 2173, I_MOVHPD = 2367, I_MOVHPS = 2359, I_MOVLHPS = 2350, + I_MOVLPD = 2190, I_MOVLPS = 2182, I_MOVMSKPD = 2837, I_MOVMSKPS = 2827, I_MOVNTDQ = 6871, + I_MOVNTDQA = 7917, I_MOVNTI = 952, I_MOVNTPD = 2578, I_MOVNTPS = 2569, I_MOVNTQ = 6863, + I_MOVNTSD = 2596, I_MOVNTSS = 2587, I_MOVQ = 3948, I_MOVQ2DQ = 6535, I_MOVS = 295, + I_MOVSD = 2132, I_MOVSHDUP = 2375, I_MOVSLDUP = 2198, I_MOVSS = 2125, I_MOVSX = 939, + I_MOVSXD = 10027, I_MOVUPD = 2117, I_MOVUPS = 2109, I_MOVZX = 927, I_MPSADBW = 9650, + I_MUL = 1641, I_MULPD = 3192, I_MULPS = 3185, I_MULSD = 3206, I_MULSS = 3199, + I_MWAIT = 1780, I_NEG = 1636, I_NOP = 581, I_NOT = 1631, I_OR = 27, I_ORPD = 3075, + I_ORPS = 3069, I_OUT = 451, I_OUTS = 128, I_PABSB = 7710, I_PABSD = 7740, I_PABSW = 7725, + I_PACKSSDW = 3871, I_PACKSSWB = 3703, I_PACKUSDW = 7938, I_PACKUSWB = 3781, + I_PADDB = 7226, I_PADDD = 7256, I_PADDQ = 6503, I_PADDSB = 6952, I_PADDSW = 6969, + I_PADDUSB = 6642, I_PADDUSW = 6661, I_PADDW = 7241, I_PALIGNR = 9432, I_PAND = 6629, + I_PANDN = 6687, I_PAUSE = 10035, I_PAVGB = 6702, I_PAVGUSB = 2100, I_PAVGW = 6747, + I_PBLENDVB = 7621, I_PBLENDW = 9413, I_PCLMULQDQ = 9669, I_PCMPEQB = 4065, + I_PCMPEQD = 4103, I_PCMPEQQ = 7898, I_PCMPEQW = 4084, I_PCMPESTRI = 9748, + I_PCMPESTRM = 9725, I_PCMPGTB = 3724, I_PCMPGTD = 3762, I_PCMPGTQ = 8109, + I_PCMPGTW = 3743, I_PCMPISTRI = 9794, I_PCMPISTRM = 9771, I_PEXTRB = 9451, + I_PEXTRD = 9468, I_PEXTRQ = 9476, I_PEXTRW = 6333, I_PF2ID = 1936, I_PF2IW = 1929, + I_PFACC = 2050, I_PFADD = 1999, I_PFCMPEQ = 2057, I_PFCMPGE = 1960, I_PFCMPGT = 2006, + I_PFMAX = 2015, I_PFMIN = 1969, I_PFMUL = 2066, I_PFNACC = 1943, I_PFPNACC = 1951, + I_PFRCP = 1976, I_PFRCPIT1 = 2022, I_PFRCPIT2 = 2073, I_PFRSQIT1 = 2032, I_PFRSQRT = 1983, + I_PFSUB = 1992, I_PFSUBR = 2042, I_PHADDD = 7397, I_PHADDSW = 7414, I_PHADDW = 7380, + I_PHMINPOSUW = 8281, I_PHSUBD = 7473, I_PHSUBSW = 7490, I_PHSUBW = 7456, I_PI2FD = 1922, + I_PI2FW = 1915, I_PINSRB = 9552, I_PINSRD = 9590, I_PINSRQ = 9598, I_PINSRW = 6316, + I_PMADDUBSW = 7433, I_PMADDWD = 7095, I_PMAXSB = 8196, I_PMAXSD = 8213, I_PMAXSW = 6986, + I_PMAXUB = 6670, I_PMAXUD = 8247, I_PMAXUW = 8230, I_PMINSB = 8128, I_PMINSD = 8145, + I_PMINSW = 6924, I_PMINUB = 6612, I_PMINUD = 8179, I_PMINUW = 8162, I_PMOVMSKB = 6553, + I_PMOVSXBD = 7776, I_PMOVSXBQ = 7797, I_PMOVSXBW = 7755, I_PMOVSXDQ = 7860, + I_PMOVSXWD = 7818, I_PMOVSXWQ = 7839, I_PMOVZXBD = 8004, I_PMOVZXBQ = 8025, + I_PMOVZXBW = 7983, I_PMOVZXDQ = 8088, I_PMOVZXWD = 8046, I_PMOVZXWQ = 8067, + I_PMULDQ = 7881, I_PMULHRSW = 7560, I_PMULHRW = 2083, I_PMULHUW = 6762, I_PMULHW = 6781, + I_PMULLD = 8264, I_PMULLW = 6518, I_PMULUDQ = 7076, I_POP = 22, I_POPA = 98, + I_POPCNT = 4360, I_POPF = 277, I_POR = 6941, I_PREFETCH = 1894, I_PREFETCHNTA = 2424, + I_PREFETCHT0 = 2437, I_PREFETCHT1 = 2449, I_PREFETCHT2 = 2461, I_PREFETCHW = 1904, + I_PSADBW = 7114, I_PSHUFB = 7363, I_PSHUFD = 4010, I_PSHUFHW = 4018, I_PSHUFLW = 4027, + I_PSHUFW = 4002, I_PSIGNB = 7509, I_PSIGND = 7543, I_PSIGNW = 7526, I_PSLLD = 7046, + I_PSLLDQ = 9869, I_PSLLQ = 7061, I_PSLLW = 7031, I_PSRAD = 6732, I_PSRAW = 6717, + I_PSRLD = 6473, I_PSRLDQ = 9852, I_PSRLQ = 6488, I_PSRLW = 6458, I_PSUBB = 7166, + I_PSUBD = 7196, I_PSUBQ = 7211, I_PSUBSB = 6890, I_PSUBSW = 6907, I_PSUBUSB = 6574, + I_PSUBUSW = 6593, I_PSUBW = 7181, I_PSWAPD = 2092, I_PTEST = 7651, I_PUNPCKHBW = 3802, + I_PUNPCKHDQ = 3848, I_PUNPCKHQDQ = 3917, I_PUNPCKHWD = 3825, I_PUNPCKLBW = 3634, + I_PUNPCKLDQ = 3680, I_PUNPCKLQDQ = 3892, I_PUNPCKLWD = 3657, I_PUSH = 16, + I_PUSHA = 91, I_PUSHF = 270, I_PXOR = 7003, I_RCL = 977, I_RCPPS = 2975, I_RCPSS = 2982, + I_RCR = 982, I_RDFSBASE = 9904, I_RDGSBASE = 9934, I_RDMSR = 600, I_RDPMC = 607, + I_RDRAND = 10048, I_RDTSC = 593, I_RDTSCP = 1886, I_RET = 325, I_RETF = 354, + I_ROL = 967, I_ROR = 972, I_ROUNDPD = 9318, I_ROUNDPS = 9299, I_ROUNDSD = 9356, + I_ROUNDSS = 9337, I_RSM = 882, I_RSQRTPS = 2937, I_RSQRTSS = 2946, I_SAHF = 283, + I_SAL = 997, I_SALC = 394, I_SAR = 1002, I_SBB = 36, I_SCAS = 319, I_SETA = 807, + I_SETAE = 780, I_SETB = 774, I_SETBE = 800, I_SETG = 859, I_SETGE = 845, I_SETL = 839, + I_SETLE = 852, I_SETNO = 767, I_SETNP = 832, I_SETNS = 819, I_SETNZ = 793, + I_SETO = 761, I_SETP = 826, I_SETS = 813, I_SETZ = 787, I_SFENCE = 4343, I_SGDT = 1691, + I_SHL = 987, I_SHLD = 876, I_SHR = 992, I_SHRD = 892, I_SHUFPD = 6358, I_SHUFPS = 6350, + I_SIDT = 1697, I_SKINIT = 1861, I_SLDT = 1657, I_SMSW = 1715, I_SQRTPD = 2877, + I_SQRTPS = 2869, I_SQRTSD = 2893, I_SQRTSS = 2885, I_STC = 497, I_STD = 517, + I_STGI = 1849, I_STI = 507, I_STMXCSR = 9973, I_STOS = 307, I_STR = 1663, I_SUB = 51, + I_SUBPD = 3401, I_SUBPS = 3394, I_SUBSD = 3415, I_SUBSS = 3408, I_SWAPGS = 1878, + I_SYSCALL = 532, I_SYSENTER = 614, I_SYSEXIT = 624, I_SYSRET = 547, I_TEST = 206, + I_TZCNT = 4373, I_UCOMISD = 2764, I_UCOMISS = 2755, I_UD2 = 569, I_UNPCKHPD = 2318, + I_UNPCKHPS = 2308, I_UNPCKLPD = 2276, I_UNPCKLPS = 2266, I_VADDPD = 3161, + I_VADDPS = 3153, I_VADDSD = 3177, I_VADDSS = 3169, I_VADDSUBPD = 6436, I_VADDSUBPS = 6447, + I_VAESDEC = 9239, I_VAESDECLAST = 9260, I_VAESENC = 9197, I_VAESENCLAST = 9218, + I_VAESIMC = 9180, I_VAESKEYGENASSIST = 9834, I_VANDNPD = 3060, I_VANDNPS = 3051, + I_VANDPD = 3027, I_VANDPS = 3019, I_VBLENDPD = 9403, I_VBLENDPS = 9384, I_VBLENDVPD = 9703, + I_VBLENDVPS = 9692, I_VBROADCASTF128 = 7694, I_VBROADCASTSD = 7680, I_VBROADCASTSS = 7666, + I_VCMPEQPD = 5110, I_VCMPEQPS = 4708, I_VCMPEQSD = 5914, I_VCMPEQSS = 5512, + I_VCMPEQ_OSPD = 5291, I_VCMPEQ_OSPS = 4889, I_VCMPEQ_OSSD = 6095, I_VCMPEQ_OSSS = 5693, + I_VCMPEQ_UQPD = 5197, I_VCMPEQ_UQPS = 4795, I_VCMPEQ_UQSD = 6001, I_VCMPEQ_UQSS = 5599, + I_VCMPEQ_USPD = 5400, I_VCMPEQ_USPS = 4998, I_VCMPEQ_USSD = 6204, I_VCMPEQ_USSS = 5802, + I_VCMPFALSEPD = 5232, I_VCMPFALSEPS = 4830, I_VCMPFALSESD = 6036, I_VCMPFALSESS = 5634, + I_VCMPFALSE_OSPD = 5441, I_VCMPFALSE_OSPS = 5039, I_VCMPFALSE_OSSD = 6245, + I_VCMPFALSE_OSSS = 5843, I_VCMPGEPD = 5259, I_VCMPGEPS = 4857, I_VCMPGESD = 6063, + I_VCMPGESS = 5661, I_VCMPGE_OQPD = 5471, I_VCMPGE_OQPS = 5069, I_VCMPGE_OQSD = 6275, + I_VCMPGE_OQSS = 5873, I_VCMPGTPD = 5269, I_VCMPGTPS = 4867, I_VCMPGTSD = 6073, + I_VCMPGTSS = 5671, I_VCMPGT_OQPD = 5484, I_VCMPGT_OQPS = 5082, I_VCMPGT_OQSD = 6288, + I_VCMPGT_OQSS = 5886, I_VCMPLEPD = 5130, I_VCMPLEPS = 4728, I_VCMPLESD = 5934, + I_VCMPLESS = 5532, I_VCMPLE_OQPD = 5317, I_VCMPLE_OQPS = 4915, I_VCMPLE_OQSD = 6121, + I_VCMPLE_OQSS = 5719, I_VCMPLTPD = 5120, I_VCMPLTPS = 4718, I_VCMPLTSD = 5924, + I_VCMPLTSS = 5522, I_VCMPLT_OQPD = 5304, I_VCMPLT_OQPS = 4902, I_VCMPLT_OQSD = 6108, + I_VCMPLT_OQSS = 5706, I_VCMPNEQPD = 5153, I_VCMPNEQPS = 4751, I_VCMPNEQSD = 5957, + I_VCMPNEQSS = 5555, I_VCMPNEQ_OQPD = 5245, I_VCMPNEQ_OQPS = 4843, I_VCMPNEQ_OQSD = 6049, + I_VCMPNEQ_OQSS = 5647, I_VCMPNEQ_OSPD = 5457, I_VCMPNEQ_OSPS = 5055, I_VCMPNEQ_OSSD = 6261, + I_VCMPNEQ_OSSS = 5859, I_VCMPNEQ_USPD = 5345, I_VCMPNEQ_USPS = 4943, I_VCMPNEQ_USSD = 6149, + I_VCMPNEQ_USSS = 5747, I_VCMPNGEPD = 5210, I_VCMPNGEPS = 4808, I_VCMPNGESD = 6014, + I_VCMPNGESS = 5612, I_VCMPNGE_UQPD = 5413, I_VCMPNGE_UQPS = 5011, I_VCMPNGE_UQSD = 6217, + I_VCMPNGE_UQSS = 5815, I_VCMPNGTPD = 5221, I_VCMPNGTPS = 4819, I_VCMPNGTSD = 6025, + I_VCMPNGTSS = 5623, I_VCMPNGT_UQPD = 5427, I_VCMPNGT_UQPS = 5025, I_VCMPNGT_UQSD = 6231, + I_VCMPNGT_UQSS = 5829, I_VCMPNLEPD = 5175, I_VCMPNLEPS = 4773, I_VCMPNLESD = 5979, + I_VCMPNLESS = 5577, I_VCMPNLE_UQPD = 5373, I_VCMPNLE_UQPS = 4971, I_VCMPNLE_UQSD = 6177, + I_VCMPNLE_UQSS = 5775, I_VCMPNLTPD = 5164, I_VCMPNLTPS = 4762, I_VCMPNLTSD = 5968, + I_VCMPNLTSS = 5566, I_VCMPNLT_UQPD = 5359, I_VCMPNLT_UQPS = 4957, I_VCMPNLT_UQSD = 6163, + I_VCMPNLT_UQSS = 5761, I_VCMPORDPD = 5186, I_VCMPORDPS = 4784, I_VCMPORDSD = 5990, + I_VCMPORDSS = 5588, I_VCMPORD_SPD = 5387, I_VCMPORD_SPS = 4985, I_VCMPORD_SSD = 6191, + I_VCMPORD_SSS = 5789, I_VCMPTRUEPD = 5279, I_VCMPTRUEPS = 4877, I_VCMPTRUESD = 6083, + I_VCMPTRUESS = 5681, I_VCMPTRUE_USPD = 5497, I_VCMPTRUE_USPS = 5095, I_VCMPTRUE_USSD = 6301, + I_VCMPTRUE_USSS = 5899, I_VCMPUNORDPD = 5140, I_VCMPUNORDPS = 4738, I_VCMPUNORDSD = 5944, + I_VCMPUNORDSS = 5542, I_VCMPUNORD_SPD = 5330, I_VCMPUNORD_SPS = 4928, I_VCMPUNORD_SSD = 6134, + I_VCMPUNORD_SSS = 5732, I_VCOMISD = 2818, I_VCOMISS = 2809, I_VCVTDQ2PD = 6841, + I_VCVTDQ2PS = 3360, I_VCVTPD2DQ = 6852, I_VCVTPD2PS = 3296, I_VCVTPS2DQ = 3371, + I_VCVTPS2PD = 3285, I_VCVTSD2SI = 2744, I_VCVTSD2SS = 3318, I_VCVTSI2SD = 2558, + I_VCVTSI2SS = 2547, I_VCVTSS2SD = 3307, I_VCVTSS2SI = 2733, I_VCVTTPD2DQ = 6829, + I_VCVTTPS2DQ = 3382, I_VCVTTSD2SI = 2681, I_VCVTTSS2SI = 2669, I_VDIVPD = 3550, + I_VDIVPS = 3542, I_VDIVSD = 3566, I_VDIVSS = 3558, I_VDPPD = 9643, I_VDPPS = 9630, + I_VERR = 1679, I_VERW = 1685, I_VEXTRACTF128 = 9538, I_VEXTRACTPS = 9513, + I_VFMADD132PD = 8409, I_VFMADD132PS = 8396, I_VFMADD132SD = 8435, I_VFMADD132SS = 8422, + I_VFMADD213PD = 8689, I_VFMADD213PS = 8676, I_VFMADD213SD = 8715, I_VFMADD213SS = 8702, + I_VFMADD231PD = 8969, I_VFMADD231PS = 8956, I_VFMADD231SD = 8995, I_VFMADD231SS = 8982, + I_VFMADDSUB132PD = 8348, I_VFMADDSUB132PS = 8332, I_VFMADDSUB213PD = 8628, + I_VFMADDSUB213PS = 8612, I_VFMADDSUB231PD = 8908, I_VFMADDSUB231PS = 8892, + I_VFMSUB132PD = 8461, I_VFMSUB132PS = 8448, I_VFMSUB132SD = 8487, I_VFMSUB132SS = 8474, + I_VFMSUB213PD = 8741, I_VFMSUB213PS = 8728, I_VFMSUB213SD = 8767, I_VFMSUB213SS = 8754, + I_VFMSUB231PD = 9021, I_VFMSUB231PS = 9008, I_VFMSUB231SD = 9047, I_VFMSUB231SS = 9034, + I_VFMSUBADD132PD = 8380, I_VFMSUBADD132PS = 8364, I_VFMSUBADD213PD = 8660, + I_VFMSUBADD213PS = 8644, I_VFMSUBADD231PD = 8940, I_VFMSUBADD231PS = 8924, + I_VFNMADD132PD = 8514, I_VFNMADD132PS = 8500, I_VFNMADD132SD = 8542, I_VFNMADD132SS = 8528, + I_VFNMADD213PD = 8794, I_VFNMADD213PS = 8780, I_VFNMADD213SD = 8822, I_VFNMADD213SS = 8808, + I_VFNMADD231PD = 9074, I_VFNMADD231PS = 9060, I_VFNMADD231SD = 9102, I_VFNMADD231SS = 9088, + I_VFNMSUB132PD = 8570, I_VFNMSUB132PS = 8556, I_VFNMSUB132SD = 8598, I_VFNMSUB132SS = 8584, + I_VFNMSUB213PD = 8850, I_VFNMSUB213PS = 8836, I_VFNMSUB213SD = 8878, I_VFNMSUB213SS = 8864, + I_VFNMSUB231PD = 9130, I_VFNMSUB231PS = 9116, I_VFNMSUB231SD = 9158, I_VFNMSUB231SS = 9144, + I_VHADDPD = 4219, I_VHADDPS = 4228, I_VHSUBPD = 4253, I_VHSUBPS = 4262, I_VINSERTF128 = 9525, + I_VINSERTPS = 9579, I_VLDDQU = 7023, I_VLDMXCSR = 9963, I_VMASKMOVDQU = 7153, + I_VMASKMOVPD = 7971, I_VMASKMOVPS = 7959, I_VMAXPD = 3610, I_VMAXPS = 3602, + I_VMAXSD = 3626, I_VMAXSS = 3618, I_VMCALL = 1735, I_VMCLEAR = 10011, I_VMFUNC = 1803, + I_VMINPD = 3490, I_VMINPS = 3482, I_VMINSD = 3506, I_VMINSS = 3498, I_VMLAUNCH = 1743, + I_VMLOAD = 1833, I_VMMCALL = 1824, I_VMOVAPD = 2498, I_VMOVAPS = 2489, I_VMOVD = 3954, + I_VMOVDDUP = 2256, I_VMOVDQA = 3984, I_VMOVDQU = 3993, I_VMOVHLPS = 2217, + I_VMOVHPD = 2404, I_VMOVHPS = 2395, I_VMOVLHPS = 2385, I_VMOVLPD = 2236, I_VMOVLPS = 2227, + I_VMOVMSKPD = 2858, I_VMOVMSKPS = 2847, I_VMOVNTDQ = 6880, I_VMOVNTDQA = 7927, + I_VMOVNTPD = 2615, I_VMOVNTPS = 2605, I_VMOVQ = 3961, I_VMOVSD = 2165, I_VMOVSHDUP = 2413, + I_VMOVSLDUP = 2245, I_VMOVSS = 2157, I_VMOVUPD = 2148, I_VMOVUPS = 2139, I_VMPSADBW = 9659, + I_VMPTRLD = 10002, I_VMPTRST = 6407, I_VMREAD = 4150, I_VMRESUME = 1753, I_VMRUN = 1817, + I_VMSAVE = 1841, I_VMULPD = 3221, I_VMULPS = 3213, I_VMULSD = 3237, I_VMULSS = 3229, + I_VMWRITE = 4174, I_VMXOFF = 1763, I_VMXON = 10020, I_VORPD = 3088, I_VORPS = 3081, + I_VPABSB = 7717, I_VPABSD = 7747, I_VPABSW = 7732, I_VPACKSSDW = 3881, I_VPACKSSWB = 3713, + I_VPACKUSDW = 7948, I_VPACKUSWB = 3791, I_VPADDB = 7233, I_VPADDD = 7263, + I_VPADDQ = 6510, I_VPADDSB = 6960, I_VPADDSW = 6977, I_VPADDUSW = 6651, I_VPADDW = 7248, + I_VPALIGNR = 9441, I_VPAND = 6635, I_VPANDN = 6694, I_VPAVGB = 6709, I_VPAVGW = 6754, + I_VPBLENDVB = 9714, I_VPBLENDW = 9422, I_VPCLMULQDQ = 9680, I_VPCMPEQB = 4074, + I_VPCMPEQD = 4112, I_VPCMPEQQ = 7907, I_VPCMPEQW = 4093, I_VPCMPESTRI = 9759, + I_VPCMPESTRM = 9736, I_VPCMPGTB = 3733, I_VPCMPGTD = 3771, I_VPCMPGTQ = 8118, + I_VPCMPGTW = 3752, I_VPCMPISTRI = 9805, I_VPCMPISTRM = 9782, I_VPERM2F128 = 9287, + I_VPERMILPD = 7592, I_VPERMILPS = 7581, I_VPEXTRB = 9459, I_VPEXTRD = 9484, + I_VPEXTRQ = 9493, I_VPEXTRW = 6341, I_VPHADDD = 7405, I_VPHADDSW = 7423, I_VPHADDW = 7388, + I_VPHMINPOSUW = 8293, I_VPHSUBD = 7481, I_VPHSUBSW = 7499, I_VPHSUBW = 7464, + I_VPINSRB = 9560, I_VPINSRD = 9606, I_VPINSRQ = 9615, I_VPINSRW = 6324, I_VPMADDUBSW = 7444, + I_VPMADDWD = 7104, I_VPMAXSB = 8204, I_VPMAXSD = 8221, I_VPMAXSW = 6994, I_VPMAXUB = 6678, + I_VPMAXUD = 8255, I_VPMAXUW = 8238, I_VPMINSB = 8136, I_VPMINSD = 8153, I_VPMINSW = 6932, + I_VPMINUB = 6620, I_VPMINUD = 8187, I_VPMINUW = 8170, I_VPMOVMSKB = 6563, + I_VPMOVSXBD = 7786, I_VPMOVSXBQ = 7807, I_VPMOVSXBW = 7765, I_VPMOVSXDQ = 7870, + I_VPMOVSXWD = 7828, I_VPMOVSXWQ = 7849, I_VPMOVZXBD = 8014, I_VPMOVZXBQ = 8035, + I_VPMOVZXBW = 7993, I_VPMOVZXDQ = 8098, I_VPMOVZXWD = 8056, I_VPMOVZXWQ = 8077, + I_VPMULDQ = 7889, I_VPMULHRSW = 7570, I_VPMULHUW = 6771, I_VPMULHW = 6789, + I_VPMULLD = 8272, I_VPMULLW = 6526, I_VPMULUDQ = 7085, I_VPOR = 6946, I_VPSADBW = 7122, + I_VPSHUFB = 7371, I_VPSHUFD = 4036, I_VPSHUFHW = 4045, I_VPSHUFLW = 4055, + I_VPSIGNB = 7517, I_VPSIGND = 7551, I_VPSIGNW = 7534, I_VPSLLD = 7053, I_VPSLLDQ = 9877, + I_VPSLLQ = 7068, I_VPSLLW = 7038, I_VPSRAD = 6739, I_VPSRAW = 6724, I_VPSRLD = 6480, + I_VPSRLDQ = 9860, I_VPSRLQ = 6495, I_VPSRLW = 6465, I_VPSUBB = 7173, I_VPSUBD = 7203, + I_VPSUBQ = 7218, I_VPSUBSB = 6898, I_VPSUBSW = 6915, I_VPSUBUSB = 6583, I_VPSUBUSW = 6602, + I_VPSUBW = 7188, I_VPTEST = 7658, I_VPUNPCKHBW = 3813, I_VPUNPCKHDQ = 3859, + I_VPUNPCKHQDQ = 3929, I_VPUNPCKHWD = 3836, I_VPUNPCKLBW = 3645, I_VPUNPCKLDQ = 3691, + I_VPUNPCKLQDQ = 3904, I_VPUNPCKLWD = 3668, I_VPXOR = 7009, I_VRCPPS = 2989, + I_VRCPSS = 2997, I_VROUNDPD = 9327, I_VROUNDPS = 9308, I_VROUNDSD = 9365, + I_VROUNDSS = 9346, I_VRSQRTPS = 2955, I_VRSQRTSS = 2965, I_VSHUFPD = 6375, + I_VSHUFPS = 6366, I_VSQRTPD = 2910, I_VSQRTPS = 2901, I_VSQRTSD = 2928, I_VSQRTSS = 2919, + I_VSTMXCSR = 9992, I_VSUBPD = 3430, I_VSUBPS = 3422, I_VSUBSD = 3446, I_VSUBSS = 3438, + I_VTESTPD = 7612, I_VTESTPS = 7603, I_VUCOMISD = 2783, I_VUCOMISS = 2773, + I_VUNPCKHPD = 2339, I_VUNPCKHPS = 2328, I_VUNPCKLPD = 2297, I_VUNPCKLPS = 2286, + I_VXORPD = 3117, I_VXORPS = 3109, I_VZEROALL = 4140, I_VZEROUPPER = 4128, + I_WAIT = 10042, I_WBINVD = 561, I_WRFSBASE = 9953, I_WRGSBASE = 9982, I_WRMSR = 586, + I_XABORT = 1007, I_XADD = 946, I_XBEGIN = 1015, I_XCHG = 212, I_XEND = 1811, + I_XGETBV = 1787, I_XLAT = 400, I_XOR = 61, I_XORPD = 3102, I_XORPS = 3095, + I_XRSTOR = 4295, I_XRSTOR64 = 4303, I_XSAVE = 4271, I_XSAVE64 = 4278, I_XSAVEOPT = 4321, + I_XSAVEOPT64 = 4331, I_XSETBV = 1795, I__3DNOW = 10056 + } _InstructionType; + +typedef enum { + R_RAX, R_RCX, R_RDX, R_RBX, R_RSP, R_RBP, R_RSI, R_RDI, R_R8, R_R9, R_R10, R_R11, R_R12, R_R13, R_R14, R_R15, + R_EAX, R_ECX, R_EDX, R_EBX, R_ESP, R_EBP, R_ESI, R_EDI, R_R8D, R_R9D, R_R10D, R_R11D, R_R12D, R_R13D, R_R14D, R_R15D, + R_AX, R_CX, R_DX, R_BX, R_SP, R_BP, R_SI, R_DI, R_R8W, R_R9W, R_R10W, R_R11W, R_R12W, R_R13W, R_R14W, R_R15W, + R_AL, R_CL, R_DL, R_BL, R_AH, R_CH, R_DH, R_BH, R_R8B, R_R9B, R_R10B, R_R11B, R_R12B, R_R13B, R_R14B, R_R15B, + R_SPL, R_BPL, R_SIL, R_DIL, + R_ES, R_CS, R_SS, R_DS, R_FS, R_GS, + R_RIP, + R_ST0, R_ST1, R_ST2, R_ST3, R_ST4, R_ST5, R_ST6, R_ST7, + R_MM0, R_MM1, R_MM2, R_MM3, R_MM4, R_MM5, R_MM6, R_MM7, + R_XMM0, R_XMM1, R_XMM2, R_XMM3, R_XMM4, R_XMM5, R_XMM6, R_XMM7, R_XMM8, R_XMM9, R_XMM10, R_XMM11, R_XMM12, R_XMM13, R_XMM14, R_XMM15, + R_YMM0, R_YMM1, R_YMM2, R_YMM3, R_YMM4, R_YMM5, R_YMM6, R_YMM7, R_YMM8, R_YMM9, R_YMM10, R_YMM11, R_YMM12, R_YMM13, R_YMM14, R_YMM15, + R_CR0, R_UNUSED0, R_CR2, R_CR3, R_CR4, R_UNUSED1, R_UNUSED2, R_UNUSED3, R_CR8, + R_DR0, R_DR1, R_DR2, R_DR3, R_UNUSED4, R_UNUSED5, R_DR6, R_DR7 +} _RegisterType; + +#endif /* MNEMONICS_H */ diff --git a/distorm3.2-package/src/config.h b/distorm/src/config.h similarity index 85% rename from distorm3.2-package/src/config.h rename to distorm/src/config.h index 30f7d39..164536f 100644 --- a/distorm3.2-package/src/config.h +++ b/distorm/src/config.h @@ -4,20 +4,8 @@ config.h diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. */ @@ -25,7 +13,7 @@ along with this program. If not, see #define CONFIG_H /* diStorm version number. */ -#define __DISTORMV__ 0x030200 +#define __DISTORMV__ 0x030304 #include /* memset, memcpy - can be easily self implemented for libc independency. */ diff --git a/distorm3.2-package/src/decoder.c b/distorm/src/decoder.c similarity index 84% rename from distorm3.2-package/src/decoder.c rename to distorm/src/decoder.c index 8123753..b76f710 100644 --- a/distorm3.2-package/src/decoder.c +++ b/distorm/src/decoder.c @@ -4,20 +4,8 @@ decoder.c diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. */ @@ -27,6 +15,7 @@ along with this program. If not, see #include "prefix.h" #include "x86defs.h" #include "operands.h" +#include "insts.h" #include "../include/mnemonics.h" @@ -77,8 +66,17 @@ static _DecodeType decode_get_effective_op_size(_DecodeType dt, _iflags decodedP return dt; } +/* A helper macro to convert from diStorm's CPU flags to EFLAGS. */ +#define CONVERT_FLAGS_TO_EFLAGS(dst, src, field) dst->field = ((src->field & D_COMPACT_SAME_FLAGS) | \ + ((src->field & D_COMPACT_IF) ? D_IF : 0) | \ + ((src->field & D_COMPACT_DF) ? D_DF : 0) | \ + ((src->field & D_COMPACT_OF) ? D_OF : 0)); + static _DecodeResult decode_inst(_CodeInfo* ci, _PrefixState* ps, _DInst* di) { + /* Remember whether the instruction is privileged. */ + uint16_t privilegedFlag = 0; + /* The ModR/M byte of the current instruction. */ unsigned int modrm = 0; @@ -93,6 +91,8 @@ static _DecodeResult decode_inst(_CodeInfo* ci, _PrefixState* ps, _DInst* di) /* Holds the info about the current found instruction. */ _InstInfo* ii = NULL; + _InstInfo iip; /* Privileged instruction cache. */ + _InstSharedInfo* isi = NULL; /* Used only for special CMP instructions which have pseudo opcodes suffix. */ unsigned char cmpType = 0; @@ -104,13 +104,26 @@ static _DecodeResult decode_inst(_CodeInfo* ci, _PrefixState* ps, _DInst* di) */ int lockable = FALSE; - /* Calcualte (and cache) effective-operand-size and effective-address-size only once. */ + /* Calculate (and cache) effective-operand-size and effective-address-size only once. */ _DecodeType effOpSz, effAdrSz; _iflags instFlags; ii = inst_lookup(ci, ps); if (ii == NULL) goto _Undecodable; - instFlags = INST_INFO_FLAGS(ii); + isi = &InstSharedInfoTable[ii->sharedIndex]; + instFlags = FlagsTable[isi->flagsIndex]; + privilegedFlag = ii->opcodeId & OPCODE_ID_PRIVILEGED; + + if (privilegedFlag) { + /* + * Copy the privileged instruction info so we can remove the privileged bit + * from the opcodeId field. This makes sure we're not modifying the tables + * in case we lookup this privileged instruction later. + */ + iip = *ii; + iip.opcodeId &= ~OPCODE_ID_PRIVILEGED; + ii = &iip; + } /* * If both REX and OpSize are available we will have to disable the OpSize, because REX has precedence. @@ -132,8 +145,8 @@ static _DecodeResult decode_inst(_CodeInfo* ci, _PrefixState* ps, _DInst* di) * Which practically means, don't allow 32 bits instructions in 16 bits decoding mode, but do allow * 16 bits instructions in 32 bits decoding mode, of course... - * NOTE: Make sure the instruction set for 32 bits has explicitly this specfic flag set. - * NOTE2: Make sure the instruction set for 64 bits has explicitly this specfic flag set. + * NOTE: Make sure the instruction set for 32 bits has explicitly this specific flag set. + * NOTE2: Make sure the instruction set for 64 bits has explicitly this specific flag set. * If this is the case, drop what we've got and restart all over after DB'ing that byte. @@ -179,22 +192,22 @@ static _DecodeResult decode_inst(_CodeInfo* ci, _PrefixState* ps, _DInst* di) * Note: do-while with a constant 0 makes the compiler warning about it. */ for (;;) { - if (ii->d != OT_NONE) { - if (!operands_extract(ci, di, ii, (_OpType)ii->d, ONT_1, modrm, ps, effOpSz, effAdrSz, &lockable)) goto _Undecodable; + if (isi->d != OT_NONE) { + if (!operands_extract(ci, di, ii, instFlags, (_OpType)isi->d, ONT_1, modrm, ps, effOpSz, effAdrSz, &lockable)) goto _Undecodable; } else break; - if (ii->s != OT_NONE) { - if (!operands_extract(ci, di, ii, (_OpType)ii->s, ONT_2, modrm, ps, effOpSz, effAdrSz, NULL)) goto _Undecodable; + if (isi->s != OT_NONE) { + if (!operands_extract(ci, di, ii, instFlags, (_OpType)isi->s, ONT_2, modrm, ps, effOpSz, effAdrSz, NULL)) goto _Undecodable; } else break; /* Use third operand, only if the flags says this InstInfo requires it. */ if (instFlags & INST_USE_OP3) { - if (!operands_extract(ci, di, ii, (_OpType)((_InstInfoEx*)ii)->op3, ONT_3, modrm, ps, effOpSz, effAdrSz, NULL)) goto _Undecodable; + if (!operands_extract(ci, di, ii, instFlags, (_OpType)((_InstInfoEx*)ii)->op3, ONT_3, modrm, ps, effOpSz, effAdrSz, NULL)) goto _Undecodable; } else break; /* Support for a fourth operand is added for (i.e:) INSERTQ instruction. */ if (instFlags & INST_USE_OP4) { - if (!operands_extract(ci, di, ii, (_OpType)((_InstInfoEx*)ii)->op4, ONT_4, modrm, ps, effOpSz, effAdrSz, NULL)) goto _Undecodable; + if (!operands_extract(ci, di, ii, instFlags, (_OpType)((_InstInfoEx*)ii)->op4, ONT_4, modrm, ps, effOpSz, effAdrSz, NULL)) goto _Undecodable; } break; } /* Continue here after all operands were extracted. */ @@ -203,7 +216,8 @@ static _DecodeResult decode_inst(_CodeInfo* ci, _PrefixState* ps, _DInst* di) if (instFlags & INST_3DNOW_FETCH) { ii = inst_lookup_3dnow(ci); if (ii == NULL) goto _Undecodable; - instFlags = INST_INFO_FLAGS(ii); + isi = &InstSharedInfoTable[ii->sharedIndex]; + instFlags = FlagsTable[isi->flagsIndex]; } /* Check whether pseudo opcode is needed, only for CMP instructions: */ @@ -259,7 +273,7 @@ static _DecodeResult decode_inst(_CodeInfo* ci, _PrefixState* ps, _DInst* di) else if ((instFlags & (INST_PRE_ADDR_SIZE | INST_NATIVE)) == (INST_PRE_ADDR_SIZE | INST_NATIVE)) { di->opcode = ii->opcodeId; - /* If LOOPxx gets here from 64bits, it must be Decode32Bits because Address Size perfix is set. */ + /* If LOOPxx gets here from 64bits, it must be Decode32Bits because Address Size prefix is set. */ ps->usedPrefixes |= INST_PRE_ADDR_SIZE; } /* @@ -332,14 +346,14 @@ static _DecodeResult decode_inst(_CodeInfo* ci, _PrefixState* ps, _DInst* di) * Therefore, we use another table to fix the offset. */ if (instFlags & INST_PRE_VEX) { - /* Use the AVX pesudo compare mnemonics table. */ + /* Use the AVX pseudo compare mnemonics table. */ di->opcode = ii->opcodeId + VCmpMnemonicOffsets[cmpType]; } else { - /* Use the SSE psuedo compare mnemonics table. */ + /* Use the SSE pseudo compare mnemonics table. */ di->opcode = ii->opcodeId + CmpMnemonicOffsets[cmpType]; } } - + /* * Store the address size inside the flags. * This is necessary for the caller to know the size of rSP when using PUSHA for example. @@ -352,13 +366,21 @@ static _DecodeResult decode_inst(_CodeInfo* ci, _PrefixState* ps, _DInst* di) /* Set the unused prefixes mask. */ di->unusedPrefixesMask = prefixes_set_unused_mask(ps); + /* Fix privileged. Assumes the privilegedFlag is 0x8000 only. */ + di->flags |= privilegedFlag; + /* Copy instruction meta. */ - di->meta = ii->meta; + di->meta = isi->meta; if (di->segment == 0) di->segment = R_NONE; /* Take into account the O_MEM base register for the mask. */ if (di->base != R_NONE) di->usedRegistersMask |= _REGISTERTORCLASS[di->base]; + /* Copy CPU affected flags. */ + CONVERT_FLAGS_TO_EFLAGS(di, isi, modifiedFlagsMask); + CONVERT_FLAGS_TO_EFLAGS(di, isi, testedFlagsMask); + CONVERT_FLAGS_TO_EFLAGS(di, isi, undefinedFlagsMask); + /* Calculate the size of the instruction we've just decoded. */ di->size = (uint8_t)((ci->code - startCode) & 0xff); return DECRES_SUCCESS; @@ -395,6 +417,8 @@ _DecodeResult decode_internal(_CodeInfo* _ci, int supportOldIntr, _DInst result[ _PrefixState ps; unsigned int prefixSize; _CodeInfo ci; + unsigned int features; + unsigned int mfc; _OffsetType codeOffset = _ci->codeOffset; const uint8_t* code = _ci->code; @@ -419,10 +443,15 @@ _DecodeResult decode_internal(_CodeInfo* _ci, int supportOldIntr, _DInst result[ #ifdef DISTORM_LIGHT supportOldIntr; /* Unreferenced. */ -#endif + /* + * Only truncate address if we are using the decompose interface. + * Otherwise, we use the textual interface which needs full addresses for formatting bytes output. + * So distorm_format will truncate later. + */ if (_ci->features & DF_MAXIMUM_ADDR32) addrMask = 0xffffffff; else if (_ci->features & DF_MAXIMUM_ADDR16) addrMask = 0xffff; +#endif /* No entries are used yet. */ *usedInstructionsCount = 0; @@ -548,13 +577,26 @@ _DecodeResult decode_internal(_CodeInfo* _ci, int supportOldIntr, _DInst result[ pdi->addr = startInstOffset & addrMask; /* pdi->disp &= addrMask; */ - /* Advance to next instruction. */ - codeLen -= pdi->size; - codeOffset += pdi->size; - code += pdi->size; + if ((decodeResult == DECRES_INPUTERR) && (ps.decodedPrefixes & INST_PRE_VEX)) { + if (ps.prefixExtType == PET_VEX3BYTES) { + prefixSize -= 2; + codeLen += 2; + } else if (ps.prefixExtType == PET_VEX2BYTES) { + prefixSize -= 1; + codeLen += 1; + } + ps.last = ps.start + prefixSize - 1; + code = ps.last + 1; + codeOffset = startInstOffset + prefixSize; + } else { + /* Advance to next instruction. */ + codeLen -= pdi->size; + codeOffset += pdi->size; + code += pdi->size; - /* Instruction's size should include prefixes. */ - pdi->size += (uint8_t)prefixSize; + /* Instruction's size should include prefixes. */ + pdi->size += (uint8_t)prefixSize; + } /* Drop all prefixes and the instruction itself, because the instruction wasn't successfully decoded. */ if ((decodeResult == DECRES_INPUTERR) && (~_ci->features & DF_RETURN_FC_ONLY)) { @@ -590,14 +632,16 @@ _DecodeResult decode_internal(_CodeInfo* _ci, int supportOldIntr, _DInst result[ _ci->nextOffset = codeOffset; /* Check whether we need to stop on any flow control instruction. */ - if ((decodeResult == DECRES_SUCCESS) && (_ci->features & DF_STOP_ON_FLOW_CONTROL)) { - if (((_ci->features & DF_STOP_ON_CALL) && (META_GET_FC(pdi->meta) == FC_CALL)) || - ((_ci->features & DF_STOP_ON_RET) && (META_GET_FC(pdi->meta) == FC_RET)) || - ((_ci->features & DF_STOP_ON_SYS) && (META_GET_FC(pdi->meta) == FC_SYS)) || - ((_ci->features & DF_STOP_ON_UNC_BRANCH) && (META_GET_FC(pdi->meta) == FC_UNC_BRANCH)) || - ((_ci->features & DF_STOP_ON_CND_BRANCH) && (META_GET_FC(pdi->meta) == FC_CND_BRANCH)) || - ((_ci->features & DF_STOP_ON_INT) && (META_GET_FC(pdi->meta) == FC_INT)) || - ((_ci->features & DF_STOP_ON_CMOV) && (META_GET_FC(pdi->meta) == FC_CMOV))) + features = _ci->features; + mfc = META_GET_FC(pdi->meta); + if ((decodeResult == DECRES_SUCCESS) && (features & DF_STOP_ON_FLOW_CONTROL)) { + if (((features & DF_STOP_ON_CALL) && (mfc == FC_CALL)) || + ((features & DF_STOP_ON_RET) && (mfc == FC_RET)) || + ((features & DF_STOP_ON_SYS) && (mfc == FC_SYS)) || + ((features & DF_STOP_ON_UNC_BRANCH) && (mfc == FC_UNC_BRANCH)) || + ((features & DF_STOP_ON_CND_BRANCH) && (mfc == FC_CND_BRANCH)) || + ((features & DF_STOP_ON_INT) && (mfc == FC_INT)) || + ((features & DF_STOP_ON_CMOV) && (mfc == FC_CMOV))) return DECRES_SUCCESS; } } diff --git a/distorm3.2-package/src/decoder.h b/distorm/src/decoder.h similarity index 100% rename from distorm3.2-package/src/decoder.h rename to distorm/src/decoder.h diff --git a/distorm3.2-package/src/distorm.c b/distorm/src/distorm.c similarity index 88% rename from distorm3.2-package/src/distorm.c rename to distorm/src/distorm.c index 2b865a6..f4bc9d8 100644 --- a/distorm3.2-package/src/distorm.c +++ b/distorm/src/distorm.c @@ -5,20 +5,8 @@ diStorm3 C Library Interface diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. */ @@ -64,9 +52,10 @@ along with this program. If not, see #ifndef DISTORM_LIGHT -/* Helper function to concat an explicit size when it's unknown from the operands. */ +/* Helper function to concatenate an explicit size when it's unknown from the operands. */ static void distorm_format_size(_WString* str, const _DInst* di, int opNum) { + int isSizingRequired = 0; /* * We only have to output the size explicitly if it's not clear from the operands. * For example: @@ -75,9 +64,42 @@ static void distorm_format_size(_WString* str, const _DInst* di, int opNum) * * If given operand number is higher than 2, then output the size anyways. */ - if (((opNum >= 2) || ((di->ops[0].type != O_REG) && (di->ops[1].type != O_REG))) || - /* INS/OUTS are exception, because DX is a port specifier and not a real src/dst register. */ - ((di->opcode == I_INS) || (di->opcode == I_OUTS))) { + isSizingRequired = ((opNum >= 2) || ((di->ops[0].type != O_REG) && (di->ops[1].type != O_REG))); + + /* Still not sure? Try some special instructions. */ + if (!isSizingRequired) { + /* + * INS/OUTS are exception, because DX is a port specifier and not a real src/dst register. + * A few exceptions that always requires sizing: + * MOVZX, MOVSX, MOVSXD. + * ROL, ROR, RCL, RCR, SHL, SHR, SAL, SAR. + * SHLD, SHRD. + */ + switch (di->opcode) + { + case I_INS: + case I_OUTS: + case I_MOVZX: + case I_MOVSX: + case I_MOVSXD: + case I_ROL: + case I_ROR: + case I_RCL: + case I_RCR: + case I_SHL: + case I_SHR: + case I_SAL: + case I_SAR: + case I_SHLD: + case I_SHRD: + isSizingRequired = 1; + break; + default: /* Instruction doesn't require sizing. */ break; + } + } + + if (isSizingRequired) + { switch (di->ops[opNum].size) { case 0: break; /* OT_MEM's unknown size. */ @@ -125,10 +147,11 @@ static void distorm_format_signed_disp(_WString* str, const _DInst* di, uint64_t /* Copy other fields. */ result->size = di->size; - result->offset = di->addr & addrMask; + result->offset = di->addr; if (di->flags == FLAG_NOT_DECODABLE) { str = &result->mnemonic; + result->offset &= addrMask; strclear_WS(&result->operands); strcpy_WSN(str, "DB "); str_code_hb(str, di->imm.byte); @@ -139,9 +162,13 @@ static void distorm_format_signed_disp(_WString* str, const _DInst* di, uint64_t str = &result->instructionHex; strclear_WS(str); + /* Gotta have full address for (di->addr - ci->codeOffset) to work in all modes. */ for (i = 0; i < di->size; i++) str_hex_b(str, ci->code[(unsigned int)(di->addr - ci->codeOffset + i)]); + /* Truncate address now. */ + result->offset &= addrMask; + str = &result->mnemonic; switch (FLAG_GET_PREFIX(di->flags)) { @@ -149,7 +176,9 @@ static void distorm_format_signed_disp(_WString* str, const _DInst* di, uint64_t strcpy_WSN(str, "LOCK "); break; case FLAG_REP: - strcpy_WSN(str, "REP "); + /* REP prefix for CMPS and SCAS is really a REPZ. */ + if ((di->opcode == I_CMPS) || (di->opcode == I_SCAS)) strcpy_WSN(str, "REPZ "); + else strcpy_WSN(str, "REP "); break; case FLAG_REPNZ: strcpy_WSN(str, "REPNZ "); @@ -203,7 +232,7 @@ static void distorm_format_signed_disp(_WString* str, const _DInst* di, uint64_t break; case O_IMM: /* If the instruction is 'push', show explicit size (except byte imm). */ - if (di->opcode == I_PUSH && di->ops[i].size != 8) distorm_format_size(str, di, i); + if ((di->opcode == I_PUSH) && (di->ops[i].size != 8)) distorm_format_size(str, di, i); /* Special fix for negative sign extended immediates. */ if ((di->flags & FLAG_IMM_SIGNED) && (di->ops[i].size == 8)) { if (di->imm.sbyte < 0) { diff --git a/distorm3.2-package/src/instructions.c b/distorm/src/instructions.c similarity index 91% rename from distorm3.2-package/src/instructions.c rename to distorm/src/instructions.c index df122b9..0f120de 100644 --- a/distorm3.2-package/src/instructions.c +++ b/distorm/src/instructions.c @@ -4,20 +4,8 @@ instructions.c diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. */ @@ -33,13 +21,16 @@ along with this program. If not, see #define INST_NODE_INDEX(n) ((n) & 0x1fff) #define INST_NODE_TYPE(n) ((n) >> 13) +/* Helper macro to read the actual flags that are associated with an inst-info. */ +#define INST_INFO_FLAGS(ii) (FlagsTable[InstSharedInfoTable[(ii)->sharedIndex].flagsIndex]) + /* I use the trie data structure as I found it most fitting to a disassembler mechanism. When you read a byte and have to decide if it's enough or you should read more bytes, 'till you get to the instruction information. It's really fast because you POP the instruction info in top 3 iterates on the DB, because an instruction can be formed from two bytes + 3 bits reg from the ModR/M byte. For a simple explanation, check this out: http://www.csse.monash.edu.au/~lloyd/tildeAlgDS/Tree/Trie/ -Futher reading: http://en.wikipedia.org/wiki/Trie +Further reading: http://en.wikipedia.org/wiki/Trie The first GATE (array you read off a trie data structure), as I call them, is statically allocated by the compiler. The second and third gates if used are being allocated dynamically by the instructions-insertion functionality. @@ -83,9 +74,9 @@ But if you read 1, you know that you go to an instruction (in this case, a RET). That's why there's an Instruction-Node structure, it tells you whether you got to an instruction or another list so you should keep on reading byte). -In Intel, you could go through 4 gates at top, because there're instructions which are built from 2 bytes and another smaller list +In Intel, you could go through 4 gates at top, because there are instructions which are built from 2 bytes and another smaller list for the REG part, or newest SSE4 instructions which use 4 bytes for opcode. -Therefore, Intel's first gate is 256 long, and other gates are 256 (/72) or 8 long, yes, it costs pretty much alot of memory +Therefore, Intel's first gate is 256 long, and other gates are 256 (/72) or 8 long, yes, it costs pretty much a lot of memory for non-used defined instructions, but I think that it still rocks. */ @@ -136,7 +127,7 @@ static _InstInfo* inst_get_info(_InstNode in, int index) * Now, it's a mandatory prefix and NOT an operand size one. * 66480f2dc0 db 0x48; CVTPD2PI XMM0, XMM0 * Although this instruction doesn't require a REX.W, it just shows, that even if it did - it doesn't matter. - * REX.W is dropped because it's not requried, but the decode function disabled the operand size even so. + * REX.W is dropped because it's not required, but the decode function disabled the operand size even so. */ static _InstInfo* inst_lookup_prefixed(_InstNode in, _PrefixState* ps) { @@ -225,7 +216,7 @@ static _InstInfo* inst_vex_mod_lookup(_CodeInfo* ci, _InstNode in, _InstInfo* ii /* Make a second lookup for this special instruction. */ return inst_get_info(in, index); } - /* Return the original one, in case we didn't find a stuited instruction. */ + /* Return the original one, in case we didn't find a suited instruction. */ return ii; } @@ -383,14 +374,17 @@ _InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps) * And since the DB can't be patched dynamically, because the DB has to be multi-threaded compliant, * I have no choice but to check for ARPL/MOVSXD right here - "right about now, the funk soul brother, check it out now, the funk soul brother...", fatboy slim */ - return ci->dt == Decode64Bits ? &II_movsxd : &II_arpl; + if (ci->dt == Decode64Bits) { + return &II_MOVSXD; + } /* else ARPL will be returned because its defined in the DB already. */ + break; case INST_NOP_INDEX: /* Nopnopnop */ /* Check for Pause, since it's prefixed with 0xf3, which is not a real mandatory prefix. */ if (ps->decodedPrefixes & INST_PRE_REP) { /* Flag this prefix as used. */ ps->usedPrefixes |= INST_PRE_REP; - return &II_pause; + return &II_PAUSE; } /* @@ -402,7 +396,7 @@ _InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps) * Note that if the REX.B is used, then the register is not RAX anymore but R8, which means it's not a NOP. */ if (rex & PREFIX_EX_W) ps->usedPrefixes |= INST_PRE_REX; - if ((ci->dt != Decode64Bits) || (~rex & PREFIX_EX_B)) return &II_nop; + if ((ci->dt != Decode64Bits) || (~rex & PREFIX_EX_B)) return &II_NOP; break; case INST_LEA_INDEX: @@ -417,7 +411,7 @@ _InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps) return instType == INT_INFO ? &InstInfos[INST_NODE_INDEX(in)] : (_InstInfo*)&InstInfosEx[INST_NODE_INDEX(in)]; } - /* Read second byte, still doens't mean all of its bits are used (I.E: ModRM). */ + /* Read second byte, still doesn't mean all of its bits are used (I.E: ModRM). */ ci->code += 1; ci->codeLen -= 1; if (ci->codeLen < 0) return NULL; @@ -428,7 +422,23 @@ _InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps) /* Try single byte instruction + reg byte OR one whole byte (OCST_1dBYTES). */ if (instType == INT_LIST_DIVIDED) { - /* OCST_1dBYTES is relatively simple to OCST_2dBYTES, since it's really divided at 0xc0. */ + + /* Checking for inst by REG bits is higher priority if it's found not to be divided instruction. */ + { + _InstNode in2 = InstructionsTree[INST_NODE_INDEX(in) + ((tmpIndex1 >> 3) & 7)]; + /* + * Do NOT check for NULL here, since we do a bit of a guess work, + * hence we don't override 'in', cause we might still need it. + */ + instType = INST_NODE_TYPE(in2); + + if (instType == INT_INFO) ii = &InstInfos[INST_NODE_INDEX(in2)]; + else if (instType == INT_INFOEX) ii = (_InstInfo*)&InstInfosEx[INST_NODE_INDEX(in2)]; + if ((ii != NULL) && (INST_INFO_FLAGS(ii) & INST_NOT_DIVIDED)) return ii; + /* ii is reset below. */ + } + + /* Continue normally because of wait prefix. */ if (tmpIndex1 < INST_DIVIDED_MODRM) { /* An instruction which requires a ModR/M byte. Thus it's 1.3 bytes long instruction. */ tmpIndex1 = (tmpIndex1 >> 3) & 7; /* Isolate the 3 REG/OPCODE bits. */ @@ -437,7 +447,7 @@ _InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps) * Divided instructions can't be in the range of 0x8-0xc0. * That's because 0-8 are used for 3 bits group. * And 0xc0-0xff are used for not-divided instruction. - * So the inbetween range is omitted, thus saving some more place in the tables. + * So the in between range is omitted, thus saving some more place in the tables. */ tmpIndex1 -= INST_DIVIDED_MODRM - 8; } @@ -471,21 +481,21 @@ _InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps) instType = INST_NODE_TYPE(in); /* This is where we check if we just read two escape bytes in a row, which means it is a 3DNow! instruction. */ - if ((tmpIndex0 == _3DNOW_ESCAPE_BYTE) && (tmpIndex1 == _3DNOW_ESCAPE_BYTE)) return &II_3dnow; + if ((tmpIndex0 == _3DNOW_ESCAPE_BYTE) && (tmpIndex1 == _3DNOW_ESCAPE_BYTE)) return &II_3DNOW; /* 2 bytes instruction (OCST_2BYTES). */ if (instType < INT_INFOS) return instType == INT_INFO ? &InstInfos[INST_NODE_INDEX(in)] : (_InstInfo*)&InstInfosEx[INST_NODE_INDEX(in)]; /* - * 2 bytes + mandatory perfix. + * 2 bytes + mandatory prefix. * Mandatory prefixes can be anywhere in the prefixes. * There cannot be more than one mandatory prefix, unless it's a normal operand size prefix. */ if (instType == INT_LIST_PREFIXED) return inst_lookup_prefixed(in, ps); } - /* Read third byte, still doens't mean all of its bits are used (I.E: ModRM). */ + /* Read third byte, still doesn't mean all of its bits are used (I.E: ModRM). */ ci->code += 1; ci->codeLen -= 1; if (ci->codeLen < 0) return NULL; @@ -501,7 +511,10 @@ _InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps) return instType == INT_INFO ? &InstInfos[INST_NODE_INDEX(in)] : (_InstInfo*)&InstInfosEx[INST_NODE_INDEX(in)]; /* It has to be a prefixed table then. */ - return inst_lookup_prefixed(in, ps); + ii = inst_lookup_prefixed(in, ps); + /* RDRAND and VMPTRLD share same 2.3 bytes opcode, and alternate on the MOD bits. See insts.h for more info. */ + if ((ii != NULL) && (ii->opcodeId == I_VMPTRLD) && (tmpIndex1 >= INST_DIVIDED_MODRM)) return &II_RDRAND; + return ii; } /* Try 2 bytes + divided range (OCST_2dBYTES). */ diff --git a/distorm3.2-package/src/instructions.h b/distorm/src/instructions.h similarity index 88% rename from distorm3.2-package/src/instructions.h rename to distorm/src/instructions.h index 43be7d9..b8d8a64 100644 --- a/distorm3.2-package/src/instructions.h +++ b/distorm/src/instructions.h @@ -4,20 +4,8 @@ instructions.h diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. */ @@ -58,9 +46,9 @@ typedef enum OpType { /* 16 bits immediate using the first imm-slot */ OT_IMM16_1, /* 8 bits immediate using the first imm-slot */ - OT_IMM8_1, + OT_IMM8_1, /* 8 bits immediate using the second imm-slot */ - OT_IMM8_2, + OT_IMM8_2, /* Use a 8bit register */ OT_REG8, @@ -240,39 +228,39 @@ typedef enum OpType { /* ModR/M for 32 bits. */ OT_RM32, /* Reg32/Reg64 (prefix width) or Mem8. */ - OT_REG32_64_M8, + OT_REG32_64_M8, /* Reg32/Reg64 (prefix width) or Mem16. */ - OT_REG32_64_M16, + OT_REG32_64_M16, /* Reg32/Reg 64 depends on prefix width only. */ - OT_WREG32_64, + OT_WREG32_64, /* RM32/RM64 depends on prefix width only. */ - OT_WRM32_64, + OT_WRM32_64, /* XMM or Mem32/Mem64 depends on perfix width only. */ - OT_WXMM32_64, + OT_WXMM32_64, /* XMM is encoded in VEX.VVVV. */ - OT_VXMM, + OT_VXMM, /* XMM is encoded in the high nibble of an immediate byte. */ - OT_XMM_IMM, + OT_XMM_IMM, /* YMM/XMM is dependent on VEX.L. */ - OT_YXMM, + OT_YXMM, /* YMM/XMM (depends on prefix length) is encoded in the high nibble of an immediate byte. */ - OT_YXMM_IMM, + OT_YXMM_IMM, /* YMM is encoded in reg. */ - OT_YMM, + OT_YMM, /* YMM or Mem256. */ - OT_YMM256, + OT_YMM256, /* YMM is encoded in VEX.VVVV. */ - OT_VYMM, + OT_VYMM, /* YMM/XMM is dependent on VEX.L, and encoded in VEX.VVVV. */ - OT_VYXMM, + OT_VYXMM, /* YMM/XMM or Mem64/Mem256 is dependent on VEX.L. */ - OT_YXMM64_256, + OT_YXMM64_256, /* YMM/XMM or Mem128/Mem256 is dependent on VEX.L. */ - OT_YXMM128_256, + OT_YXMM128_256, /* XMM or Mem64/Mem256 is dependent on VEX.L. */ - OT_LXMM64_128, + OT_LXMM64_128, /* Mem128/Mem256 is dependent on VEX.L. */ - OT_LMEM128_256 + OT_LMEM128_256 } _OpType; /* Flags for instruction: */ @@ -376,6 +364,9 @@ typedef enum OpType { /* Indicates that the instruction doesn't use the VVVV field of the VEX prefix, if it does then it's undecodable. */ #define INST_VEX_V_UNUSED (1 << 6) +/* Indication that the instruction is privileged (Ring 0), this should be checked on the opcodeId field. */ +#define OPCODE_ID_PRIVILEGED ((uint16_t)0x8000) + /* * Indicates which operand is being decoded. * Destination (1st), Source (2nd), op3 (3rd), op4 (4th). @@ -383,17 +374,49 @@ typedef enum OpType { */ typedef enum {ONT_NONE = -1, ONT_1 = 0, ONT_2 = 1, ONT_3 = 2, ONT_4 = 3} _OperandNumberType; +/* CPU Flags that instructions modify, test or undefine, in compacted form (CF,PF,AF,ZF,SF are 1:1 map to EFLAGS). */ +#define D_COMPACT_CF 1 /* Carry */ +#define D_COMPACT_PF 4 /* Parity */ +#define D_COMPACT_AF 0x10 /* Auxiliary */ +#define D_COMPACT_ZF 0x40 /* Zero */ +#define D_COMPACT_SF 0x80 /* Sign */ +/* The following flags have to be translated to EFLAGS. */ +#define D_COMPACT_IF 2 /* Interrupt */ +#define D_COMPACT_DF 8 /* Direction */ +#define D_COMPACT_OF 0x20 /* Overflow */ + +/* The mask of flags that are already compatible with EFLAGS. */ +#define D_COMPACT_SAME_FLAGS (D_COMPACT_CF | D_COMPACT_PF | D_COMPACT_AF | D_COMPACT_ZF | D_COMPACT_SF) + /* - * Info about the instruction, source/dest types, its name in text and flags. - * This structure is used for the instructions DB and NOT for the disassembled result code! - * This is the BASE structure, there are extentions to this structure below. + * In order to save more space for storing the DB statically, + * I came up with another level of shared info. + * Because I saw that most of the information that instructions use repeats itself. + * + * Info about the instruction, source/dest types, meta and flags. + * _InstInfo points to a table of _InstSharedInfo. */ - typedef struct { - uint8_t flagsIndex; /* An index into FlagsTables. */ + uint8_t flagsIndex; /* An index into FlagsTables */ uint8_t s, d; /* OpType. */ uint8_t meta; /* Hi 5 bits = Instruction set class | Lo 3 bits = flow control flags. */ - uint16_t opcodeId; /* The opcodeId is really a byte-offset into the mnemonics table. */ + /* + * The following are CPU flag masks that the instruction changes. + * The flags are compacted so 8 bits representation is enough. + * They will be expanded in runtime to be compatible to EFLAGS. + */ + uint8_t modifiedFlagsMask; + uint8_t testedFlagsMask; + uint8_t undefinedFlagsMask; +} _InstSharedInfo; + +/* + * This structure is used for the instructions DB and NOT for the disassembled result code! + * This is the BASE structure, there are extensions to this structure below. + */ +typedef struct { + uint16_t sharedIndex; /* An index into the SharedInfoTable. */ + uint16_t opcodeId; /* The opcodeId is really a byte-offset into the mnemonics table. MSB is a privileged indication. */ } _InstInfo; /* @@ -406,7 +429,6 @@ typedef struct { * therefore, I decided to make the extended structure contain all extra info in the same structure. * There are a few instructions (SHLD/SHRD/IMUL and SSE too) which use third operand (or a fourth). * A flag will indicate it uses a third/fourth operand. - * */ typedef struct { /* Base structure (doesn't get accessed directly from code). */ @@ -435,9 +457,6 @@ typedef enum { /* Instruction node is treated as { int index:13; int type:3; } */ typedef uint16_t _InstNode; -/* Helper macro to read the actual flags that are associated with an inst-info. */ -#define INST_INFO_FLAGS(ii) (FlagsTable[(ii)->flagsIndex]) - _InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps); _InstInfo* inst_lookup_3dnow(_CodeInfo* ci); diff --git a/distorm/src/insts.c b/distorm/src/insts.c new file mode 100644 index 0000000..a081a2d --- /dev/null +++ b/distorm/src/insts.c @@ -0,0 +1,7939 @@ +/* +insts.c + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#include "config.h" +#include "insts.h" +#include "instructions.h" + + +/* +* GENERATED BY disOps at Sun Jul 09 21:22:14 2017 +*/ + +_InstInfo II_MOVSXD = /*II*/{ 0x1d3, 10027 }; +_InstInfo II_NOP = /*II*/{ 0x53, 581 }; +_InstInfo II_PAUSE = /*II*/{ 0x88, 10035 }; +_InstInfo II_WAIT = /*II*/{ 0x53, 10042 }; +_InstInfo II_RDRAND = /*II*/{ 0x1d4, 10048 }; +_InstInfo II_3DNOW = /*II*/{ 0x1d5, 10056 }; + +_iflags FlagsTable[101] = { + 0x80000011, + 0x80000000, + 0x800400, + 0x80800400, + 0x800080, + 0x800100, + 0x80800100, + 0x800200, + 0x80800200, + 0x800000, + 0x1, + 0x0, + 0x80800000, + 0x1000000, + 0x81000000, + 0x808000, + 0x800001, + 0x80020001, + 0x1002000, + 0x60, + 0x64, + 0x80000001, + 0x4010000, + 0x1008000, + 0x80000060, + 0x83000064, + 0x3000064, + 0x83000000, + 0x3008000, + 0x200, + 0xc000, + 0x4014000, + 0x8, + 0x81000009, + 0x9, + 0x80000009, + 0x1000808, + 0x81000808, + 0x80020009, + 0x1001008, + 0x81001008, + 0x80000019, + 0x3000009, + 0x83000009, + 0x83000008, + 0xc0000011, + 0x40000001, + 0xc0800011, + 0x40800001, + 0xc0000019, + 0xc1000001, + 0xc0000001, + 0xc0000003, + 0x41000000, + 0x40000000, + 0x40000008, + 0x40000009, + 0x41000001, + 0x43000001, + 0x40000003, + 0x48000000, + 0x200009, + 0x20000009, + 0x60020009, + 0x60000009, + 0x80090009, + 0x200b0009, + 0x20020009, + 0x80100009, + 0x21100009, + 0x87000009, + 0x20009, + 0x20000008, + 0x1000009, + 0x10020009, + 0x160009, + 0x100009, + 0x47000009, + 0x47090009, + 0x40090009, + 0x80002009, + 0xc0000009, + 0x2001, + 0x80002001, + 0x410009, + 0x20420009, + 0x20060009, + 0x120009, + 0x21020009, + 0xc7000019, + 0x20100009, + 0xc0002009, + 0x40002008, + 0xc0000000, + 0xc0002008, + 0x4020009, + 0x40100009, + 0x60120009, + 0x41000009, + 0x83000001, + 0x200001 +}; + +_InstNode Table_0F = 256; +_InstNode Table_0F_0F = 1440; +_InstNode Table_0F_38 = 1896; +_InstNode Table_0F_3A = 2152; + +_InstInfo InstInfos[1246] = { + /*II_00*/{ 0x0, 11 }, + /*II_01*/{ 0x1, 11 }, + /*II_02*/{ 0x2, 11 }, + /*II_03*/{ 0x3, 11 }, + /*II_04*/{ 0x4, 11 }, + /*II_05*/{ 0x5, 11 }, + /*II_06*/{ 0x6, 16 }, + /*II_07*/{ 0x7, 22 }, + /*II_08*/{ 0x8, 27 }, + /*II_09*/{ 0x9, 27 }, + /*II_0A*/{ 0xa, 27 }, + /*II_0B*/{ 0xb, 27 }, + /*II_0C*/{ 0xc, 27 }, + /*II_0D*/{ 0xd, 27 }, + /*II_0E*/{ 0xe, 16 }, + /*II_10*/{ 0xf, 31 }, + /*II_11*/{ 0x10, 31 }, + /*II_12*/{ 0x11, 31 }, + /*II_13*/{ 0x12, 31 }, + /*II_14*/{ 0x13, 31 }, + /*II_15*/{ 0x14, 31 }, + /*II_16*/{ 0x15, 16 }, + /*II_17*/{ 0x16, 22 }, + /*II_18*/{ 0xf, 36 }, + /*II_19*/{ 0x10, 36 }, + /*II_1A*/{ 0x11, 36 }, + /*II_1B*/{ 0x12, 36 }, + /*II_1C*/{ 0x13, 36 }, + /*II_1D*/{ 0x14, 36 }, + /*II_1E*/{ 0x17, 16 }, + /*II_1F*/{ 0x18, 22 }, + /*II_20*/{ 0x19, 41 }, + /*II_21*/{ 0x1a, 41 }, + /*II_22*/{ 0x1b, 41 }, + /*II_23*/{ 0x1c, 41 }, + /*II_24*/{ 0x1d, 41 }, + /*II_25*/{ 0x1e, 41 }, + /*II_27*/{ 0x1f, 46 }, + /*II_28*/{ 0x0, 51 }, + /*II_29*/{ 0x1, 51 }, + /*II_2A*/{ 0x2, 51 }, + /*II_2B*/{ 0x3, 51 }, + /*II_2C*/{ 0x4, 51 }, + /*II_2D*/{ 0x5, 51 }, + /*II_2F*/{ 0x1f, 56 }, + /*II_30*/{ 0x20, 61 }, + /*II_31*/{ 0x21, 61 }, + /*II_32*/{ 0x22, 61 }, + /*II_33*/{ 0x23, 61 }, + /*II_34*/{ 0x24, 61 }, + /*II_35*/{ 0x25, 61 }, + /*II_37*/{ 0x26, 66 }, + /*II_38*/{ 0x27, 71 }, + /*II_39*/{ 0x28, 71 }, + /*II_3A*/{ 0x29, 71 }, + /*II_3B*/{ 0x2a, 71 }, + /*II_3C*/{ 0x2b, 71 }, + /*II_3D*/{ 0x2c, 71 }, + /*II_3F*/{ 0x26, 76 }, + /*II_40*/{ 0x2d, 81 }, + /*II_40*/{ 0x2d, 81 }, + /*II_40*/{ 0x2d, 81 }, + /*II_40*/{ 0x2d, 81 }, + /*II_40*/{ 0x2d, 81 }, + /*II_40*/{ 0x2d, 81 }, + /*II_40*/{ 0x2d, 81 }, + /*II_40*/{ 0x2d, 81 }, + /*II_48*/{ 0x2d, 86 }, + /*II_48*/{ 0x2d, 86 }, + /*II_48*/{ 0x2d, 86 }, + /*II_48*/{ 0x2d, 86 }, + /*II_48*/{ 0x2d, 86 }, + /*II_48*/{ 0x2d, 86 }, + /*II_48*/{ 0x2d, 86 }, + /*II_48*/{ 0x2d, 86 }, + /*II_50*/{ 0x2e, 16 }, + /*II_50*/{ 0x2e, 16 }, + /*II_50*/{ 0x2e, 16 }, + /*II_50*/{ 0x2e, 16 }, + /*II_50*/{ 0x2e, 16 }, + /*II_50*/{ 0x2e, 16 }, + /*II_50*/{ 0x2e, 16 }, + /*II_50*/{ 0x2e, 16 }, + /*II_58*/{ 0x2f, 22 }, + /*II_58*/{ 0x2f, 22 }, + /*II_58*/{ 0x2f, 22 }, + /*II_58*/{ 0x2f, 22 }, + /*II_58*/{ 0x2f, 22 }, + /*II_58*/{ 0x2f, 22 }, + /*II_58*/{ 0x2f, 22 }, + /*II_58*/{ 0x2f, 22 }, + /*II_60*/{ 0x30, 91 }, + /*II_61*/{ 0x30, 98 }, + /*II_62*/{ 0x31, 104 }, + /*II_63*/{ 0x32, 111 }, + /*II_68*/{ 0x33, 16 }, + /*II_6A*/{ 0x35, 16 }, + /*II_6C*/{ 0x36, 32891 }, + /*II_6D*/{ 0x37, 32891 }, + /*II_6E*/{ 0x38, 32896 }, + /*II_6F*/{ 0x39, 32896 }, + /*II_70*/{ 0x3a, 134 }, + /*II_71*/{ 0x3a, 138 }, + /*II_72*/{ 0x3b, 143 }, + /*II_73*/{ 0x3b, 147 }, + /*II_74*/{ 0x3c, 152 }, + /*II_75*/{ 0x3c, 156 }, + /*II_76*/{ 0x3d, 161 }, + /*II_77*/{ 0x3d, 166 }, + /*II_78*/{ 0x3e, 170 }, + /*II_79*/{ 0x3e, 174 }, + /*II_7A*/{ 0x3f, 179 }, + /*II_7B*/{ 0x3f, 183 }, + /*II_7C*/{ 0x40, 188 }, + /*II_7D*/{ 0x40, 192 }, + /*II_7E*/{ 0x41, 197 }, + /*II_7F*/{ 0x41, 202 }, + /*II_84*/{ 0x42, 206 }, + /*II_85*/{ 0x43, 206 }, + /*II_86*/{ 0x44, 212 }, + /*II_87*/{ 0x45, 212 }, + /*II_88*/{ 0x46, 218 }, + /*II_89*/{ 0x47, 218 }, + /*II_8A*/{ 0x48, 218 }, + /*II_8B*/{ 0x49, 218 }, + /*II_8C*/{ 0x4a, 218 }, + /*II_8D*/{ 0x4b, 223 }, + /*II_8E*/{ 0x4c, 218 }, + /*II_90*/{ 0x4d, 212 }, + /*II_91*/{ 0x4d, 212 }, + /*II_92*/{ 0x4d, 212 }, + /*II_93*/{ 0x4d, 212 }, + /*II_94*/{ 0x4d, 212 }, + /*II_95*/{ 0x4d, 212 }, + /*II_96*/{ 0x4d, 212 }, + /*II_97*/{ 0x4d, 212 }, + /*II_9A*/{ 0x4f, 260 }, + /*II_9C*/{ 0x50, 270 }, + /*II_9D*/{ 0x51, 277 }, + /*II_9E*/{ 0x52, 283 }, + /*II_9F*/{ 0x53, 289 }, + /*II_A0*/{ 0x54, 218 }, + /*II_A1*/{ 0x55, 218 }, + /*II_A2*/{ 0x56, 218 }, + /*II_A3*/{ 0x57, 218 }, + /*II_A4*/{ 0x58, 295 }, + /*II_A5*/{ 0x59, 295 }, + /*II_A6*/{ 0x5a, 301 }, + /*II_A7*/{ 0x5b, 301 }, + /*II_A8*/{ 0x5c, 206 }, + /*II_A9*/{ 0x5d, 206 }, + /*II_AA*/{ 0x5e, 307 }, + /*II_AB*/{ 0x5f, 307 }, + /*II_AC*/{ 0x60, 313 }, + /*II_AD*/{ 0x61, 313 }, + /*II_AE*/{ 0x62, 319 }, + /*II_AF*/{ 0x63, 319 }, + /*II_B0*/{ 0x64, 218 }, + /*II_B0*/{ 0x64, 218 }, + /*II_B0*/{ 0x64, 218 }, + /*II_B0*/{ 0x64, 218 }, + /*II_B0*/{ 0x64, 218 }, + /*II_B0*/{ 0x64, 218 }, + /*II_B0*/{ 0x64, 218 }, + /*II_B0*/{ 0x64, 218 }, + /*II_B8*/{ 0x65, 218 }, + /*II_B8*/{ 0x65, 218 }, + /*II_B8*/{ 0x65, 218 }, + /*II_B8*/{ 0x65, 218 }, + /*II_B8*/{ 0x65, 218 }, + /*II_B8*/{ 0x65, 218 }, + /*II_B8*/{ 0x65, 218 }, + /*II_B8*/{ 0x65, 218 }, + /*II_C2*/{ 0x66, 325 }, + /*II_C3*/{ 0x67, 325 }, + /*II_C4*/{ 0x68, 330 }, + /*II_C5*/{ 0x68, 335 }, + /*II_C8*/{ 0x69, 340 }, + /*II_C9*/{ 0x6a, 347 }, + /*II_CA*/{ 0x6b, 354 }, + /*II_CB*/{ 0x6c, 354 }, + /*II_CC*/{ 0x6d, 360 }, + /*II_CD*/{ 0x6e, 367 }, + /*II_CE*/{ 0x6f, 372 }, + /*II_CF*/{ 0x70, 33146 }, + /*II_D4*/{ 0x71, 384 }, + /*II_D5*/{ 0x71, 389 }, + /*II_D6*/{ 0x72, 394 }, + /*II_D7*/{ 0x73, 400 }, + /*II_E0*/{ 0x74, 406 }, + /*II_E1*/{ 0x74, 414 }, + /*II_E2*/{ 0x75, 421 }, + /*II_E4*/{ 0x77, 33215 }, + /*II_E5*/{ 0x78, 33215 }, + /*II_E6*/{ 0x79, 33219 }, + /*II_E7*/{ 0x7a, 33219 }, + /*II_E8*/{ 0x7b, 456 }, + /*II_E9*/{ 0x7c, 462 }, + /*II_EA*/{ 0x7d, 467 }, + /*II_EB*/{ 0x7e, 462 }, + /*II_EC*/{ 0x7f, 33215 }, + /*II_ED*/{ 0x80, 33215 }, + /*II_EE*/{ 0x81, 33219 }, + /*II_EF*/{ 0x82, 33219 }, + /*II_F1*/{ 0x6d, 476 }, + /*II_F4*/{ 0x53, 33250 }, + /*II_F5*/{ 0x83, 487 }, + /*II_F8*/{ 0x83, 492 }, + /*II_F9*/{ 0x83, 497 }, + /*II_FA*/{ 0x84, 33270 }, + /*II_FB*/{ 0x84, 33275 }, + /*II_FC*/{ 0x85, 512 }, + /*II_FD*/{ 0x85, 517 }, + /*II_0F_02*/{ 0x86, 522 }, + /*II_0F_03*/{ 0x86, 527 }, + /*II_0F_05*/{ 0x87, 532 }, + /*II_0F_06*/{ 0x88, 33309 }, + /*II_0F_07*/{ 0x87, 547 }, + /*II_0F_08*/{ 0x88, 33323 }, + /*II_0F_09*/{ 0x88, 33329 }, + /*II_0F_0B*/{ 0x89, 569 }, + /*II_0F_0E*/{ 0x8a, 574 }, + /*II_0F_1F*/{ 0x8b, 581 }, + /*II_0F_20*/{ 0x8c, 32986 }, + /*II_0F_21*/{ 0x8d, 32986 }, + /*II_0F_22*/{ 0x8e, 32986 }, + /*II_0F_23*/{ 0x8f, 32986 }, + /*II_0F_30*/{ 0x88, 33354 }, + /*II_0F_31*/{ 0x88, 33361 }, + /*II_0F_32*/{ 0x88, 33368 }, + /*II_0F_33*/{ 0x88, 33375 }, + /*II_0F_34*/{ 0x87, 614 }, + /*II_0F_35*/{ 0x87, 624 }, + /*II_0F_37*/{ 0x90, 633 }, + /*II_0F_40*/{ 0x91, 641 }, + /*II_0F_41*/{ 0x91, 648 }, + /*II_0F_42*/{ 0x92, 656 }, + /*II_0F_43*/{ 0x92, 663 }, + /*II_0F_44*/{ 0x93, 671 }, + /*II_0F_45*/{ 0x93, 678 }, + /*II_0F_46*/{ 0x94, 686 }, + /*II_0F_47*/{ 0x94, 694 }, + /*II_0F_48*/{ 0x95, 701 }, + /*II_0F_49*/{ 0x95, 708 }, + /*II_0F_4A*/{ 0x96, 716 }, + /*II_0F_4B*/{ 0x96, 723 }, + /*II_0F_4C*/{ 0x97, 731 }, + /*II_0F_4D*/{ 0x97, 738 }, + /*II_0F_4E*/{ 0x98, 746 }, + /*II_0F_4F*/{ 0x98, 754 }, + /*II_0F_80*/{ 0x99, 134 }, + /*II_0F_81*/{ 0x99, 138 }, + /*II_0F_82*/{ 0x9a, 143 }, + /*II_0F_83*/{ 0x9a, 147 }, + /*II_0F_84*/{ 0x9b, 152 }, + /*II_0F_85*/{ 0x9b, 156 }, + /*II_0F_86*/{ 0x9c, 161 }, + /*II_0F_87*/{ 0x9c, 166 }, + /*II_0F_88*/{ 0x9d, 170 }, + /*II_0F_89*/{ 0x9d, 174 }, + /*II_0F_8A*/{ 0x9e, 179 }, + /*II_0F_8B*/{ 0x9e, 183 }, + /*II_0F_8C*/{ 0x9f, 188 }, + /*II_0F_8D*/{ 0x9f, 192 }, + /*II_0F_8E*/{ 0xa0, 197 }, + /*II_0F_8F*/{ 0xa0, 202 }, + /*II_0F_90*/{ 0xa1, 761 }, + /*II_0F_91*/{ 0xa1, 767 }, + /*II_0F_92*/{ 0xa2, 774 }, + /*II_0F_93*/{ 0xa2, 780 }, + /*II_0F_94*/{ 0xa3, 787 }, + /*II_0F_95*/{ 0xa3, 793 }, + /*II_0F_96*/{ 0xa4, 800 }, + /*II_0F_97*/{ 0xa4, 807 }, + /*II_0F_98*/{ 0xa5, 813 }, + /*II_0F_99*/{ 0xa5, 819 }, + /*II_0F_9A*/{ 0xa6, 826 }, + /*II_0F_9B*/{ 0xa6, 832 }, + /*II_0F_9C*/{ 0xa7, 839 }, + /*II_0F_9D*/{ 0xa7, 845 }, + /*II_0F_9E*/{ 0xa8, 852 }, + /*II_0F_9F*/{ 0xa8, 859 }, + /*II_0F_A0*/{ 0xa9, 16 }, + /*II_0F_A1*/{ 0xaa, 22 }, + /*II_0F_A2*/{ 0x88, 865 }, + /*II_0F_A3*/{ 0xab, 872 }, + /*II_0F_A8*/{ 0xad, 16 }, + /*II_0F_A9*/{ 0xae, 22 }, + /*II_0F_AA*/{ 0xaf, 882 }, + /*II_0F_AB*/{ 0xb0, 887 }, + /*II_0F_AF*/{ 0xb1, 117 }, + /*II_0F_B0*/{ 0xb2, 898 }, + /*II_0F_B1*/{ 0xb3, 898 }, + /*II_0F_B2*/{ 0xb4, 907 }, + /*II_0F_B3*/{ 0xb0, 912 }, + /*II_0F_B4*/{ 0xb4, 917 }, + /*II_0F_B5*/{ 0xb4, 922 }, + /*II_0F_B6*/{ 0xb5, 927 }, + /*II_0F_B7*/{ 0xb6, 927 }, + /*II_0F_B9*/{ 0x89, 569 }, + /*II_0F_BB*/{ 0xb0, 934 }, + /*II_0F_BE*/{ 0xb5, 939 }, + /*II_0F_BF*/{ 0xb6, 939 }, + /*II_0F_C0*/{ 0xb2, 946 }, + /*II_0F_C1*/{ 0xb3, 946 }, + /*II_0F_C3*/{ 0xb7, 952 }, + /*II_0F_C8*/{ 0xb8, 960 }, + /*II_0F_C8*/{ 0xb8, 960 }, + /*II_0F_C8*/{ 0xb8, 960 }, + /*II_0F_C8*/{ 0xb8, 960 }, + /*II_0F_C8*/{ 0xb8, 960 }, + /*II_0F_C8*/{ 0xb8, 960 }, + /*II_0F_C8*/{ 0xb8, 960 }, + /*II_0F_C8*/{ 0xb8, 960 }, + /*II_80_00*/{ 0xb9, 11 }, + /*II_80_01*/{ 0xba, 27 }, + /*II_80_02*/{ 0xbb, 31 }, + /*II_80_03*/{ 0xbb, 36 }, + /*II_80_04*/{ 0xbc, 41 }, + /*II_80_05*/{ 0xb9, 51 }, + /*II_80_06*/{ 0xbd, 61 }, + /*II_80_07*/{ 0xbe, 71 }, + /*II_81_00*/{ 0xbf, 11 }, + /*II_81_01*/{ 0xc0, 27 }, + /*II_81_02*/{ 0xc1, 31 }, + /*II_81_03*/{ 0xc1, 36 }, + /*II_81_04*/{ 0xc2, 41 }, + /*II_81_05*/{ 0xbf, 51 }, + /*II_81_06*/{ 0xc3, 61 }, + /*II_81_07*/{ 0xc4, 71 }, + /*II_82_00*/{ 0xc5, 11 }, + /*II_82_01*/{ 0xc6, 27 }, + /*II_82_02*/{ 0xc7, 31 }, + /*II_82_03*/{ 0xc7, 36 }, + /*II_82_04*/{ 0xc8, 41 }, + /*II_82_05*/{ 0xc5, 51 }, + /*II_82_06*/{ 0xc9, 61 }, + /*II_82_07*/{ 0xca, 71 }, + /*II_83_00*/{ 0xcb, 11 }, + /*II_83_01*/{ 0xcc, 27 }, + /*II_83_02*/{ 0xcd, 31 }, + /*II_83_03*/{ 0xcd, 36 }, + /*II_83_04*/{ 0xce, 41 }, + /*II_83_05*/{ 0xcb, 51 }, + /*II_83_06*/{ 0xcf, 61 }, + /*II_83_07*/{ 0xd0, 71 }, + /*II_8F_00*/{ 0xd1, 22 }, + /*II_C0_00*/{ 0xd2, 967 }, + /*II_C0_01*/{ 0xd2, 972 }, + /*II_C0_02*/{ 0xd3, 977 }, + /*II_C0_03*/{ 0xd3, 982 }, + /*II_C0_04*/{ 0xd4, 987 }, + /*II_C0_05*/{ 0xd4, 992 }, + /*II_C0_06*/{ 0xd4, 997 }, + /*II_C0_07*/{ 0xd4, 1002 }, + /*II_C1_00*/{ 0xd5, 967 }, + /*II_C1_01*/{ 0xd5, 972 }, + /*II_C1_02*/{ 0xd6, 977 }, + /*II_C1_03*/{ 0xd6, 982 }, + /*II_C1_04*/{ 0xd7, 987 }, + /*II_C1_05*/{ 0xd7, 992 }, + /*II_C1_06*/{ 0xd7, 997 }, + /*II_C1_07*/{ 0xd7, 1002 }, + /*II_C6_00*/{ 0xd8, 218 }, + /*II_C6_F8*/{ 0xd9, 1007 }, + /*II_C7_00*/{ 0xda, 218 }, + /*II_C7_F8*/{ 0xdb, 1015 }, + /*II_D0_00*/{ 0xdc, 967 }, + /*II_D0_01*/{ 0xdc, 972 }, + /*II_D0_02*/{ 0xdd, 977 }, + /*II_D0_03*/{ 0xdd, 982 }, + /*II_D0_04*/{ 0xde, 987 }, + /*II_D0_05*/{ 0xde, 992 }, + /*II_D0_06*/{ 0xde, 997 }, + /*II_D0_07*/{ 0xde, 1002 }, + /*II_D1_00*/{ 0xdf, 967 }, + /*II_D1_01*/{ 0xdf, 972 }, + /*II_D1_02*/{ 0xe0, 977 }, + /*II_D1_03*/{ 0xe0, 982 }, + /*II_D1_04*/{ 0xe1, 987 }, + /*II_D1_05*/{ 0xe1, 992 }, + /*II_D1_06*/{ 0xe1, 997 }, + /*II_D1_07*/{ 0xe1, 1002 }, + /*II_D2_00*/{ 0xe2, 967 }, + /*II_D2_01*/{ 0xe2, 972 }, + /*II_D2_02*/{ 0xe3, 977 }, + /*II_D2_03*/{ 0xe3, 982 }, + /*II_D2_04*/{ 0xe4, 987 }, + /*II_D2_05*/{ 0xe4, 992 }, + /*II_D2_06*/{ 0xe4, 997 }, + /*II_D2_07*/{ 0xe4, 1002 }, + /*II_D3_00*/{ 0xe5, 967 }, + /*II_D3_01*/{ 0xe5, 972 }, + /*II_D3_02*/{ 0xe6, 977 }, + /*II_D3_03*/{ 0xe6, 982 }, + /*II_D3_04*/{ 0xe7, 987 }, + /*II_D3_05*/{ 0xe7, 992 }, + /*II_D3_06*/{ 0xe7, 997 }, + /*II_D3_07*/{ 0xe7, 1002 }, + /*II_D8_00*/{ 0xe8, 1023 }, + /*II_D8_01*/{ 0xe8, 1029 }, + /*II_D8_02*/{ 0xe8, 1035 }, + /*II_D8_03*/{ 0xe8, 1041 }, + /*II_D8_04*/{ 0xe8, 1048 }, + /*II_D8_05*/{ 0xe8, 1054 }, + /*II_D8_06*/{ 0xe8, 1061 }, + /*II_D8_07*/{ 0xe8, 1067 }, + /*II_D8_C0*/{ 0xe9, 1023 }, + /*II_D8_C0*/{ 0xe9, 1023 }, + /*II_D8_C0*/{ 0xe9, 1023 }, + /*II_D8_C0*/{ 0xe9, 1023 }, + /*II_D8_C0*/{ 0xe9, 1023 }, + /*II_D8_C0*/{ 0xe9, 1023 }, + /*II_D8_C0*/{ 0xe9, 1023 }, + /*II_D8_C0*/{ 0xe9, 1023 }, + /*II_D8_C8*/{ 0xe9, 1029 }, + /*II_D8_C8*/{ 0xe9, 1029 }, + /*II_D8_C8*/{ 0xe9, 1029 }, + /*II_D8_C8*/{ 0xe9, 1029 }, + /*II_D8_C8*/{ 0xe9, 1029 }, + /*II_D8_C8*/{ 0xe9, 1029 }, + /*II_D8_C8*/{ 0xe9, 1029 }, + /*II_D8_C8*/{ 0xe9, 1029 }, + /*II_D8_D0*/{ 0xea, 1035 }, + /*II_D8_D0*/{ 0xea, 1035 }, + /*II_D8_D0*/{ 0xea, 1035 }, + /*II_D8_D0*/{ 0xea, 1035 }, + /*II_D8_D0*/{ 0xea, 1035 }, + /*II_D8_D0*/{ 0xea, 1035 }, + /*II_D8_D0*/{ 0xea, 1035 }, + /*II_D8_D0*/{ 0xea, 1035 }, + /*II_D8_D8*/{ 0xea, 1041 }, + /*II_D8_D9*/{ 0xeb, 1041 }, + /*II_D8_D8*/{ 0xea, 1041 }, + /*II_D8_D8*/{ 0xea, 1041 }, + /*II_D8_D8*/{ 0xea, 1041 }, + /*II_D8_D8*/{ 0xea, 1041 }, + /*II_D8_D8*/{ 0xea, 1041 }, + /*II_D8_D8*/{ 0xea, 1041 }, + /*II_D8_E0*/{ 0xe9, 1048 }, + /*II_D8_E0*/{ 0xe9, 1048 }, + /*II_D8_E0*/{ 0xe9, 1048 }, + /*II_D8_E0*/{ 0xe9, 1048 }, + /*II_D8_E0*/{ 0xe9, 1048 }, + /*II_D8_E0*/{ 0xe9, 1048 }, + /*II_D8_E0*/{ 0xe9, 1048 }, + /*II_D8_E0*/{ 0xe9, 1048 }, + /*II_D8_E8*/{ 0xe9, 1054 }, + /*II_D8_E8*/{ 0xe9, 1054 }, + /*II_D8_E8*/{ 0xe9, 1054 }, + /*II_D8_E8*/{ 0xe9, 1054 }, + /*II_D8_E8*/{ 0xe9, 1054 }, + /*II_D8_E8*/{ 0xe9, 1054 }, + /*II_D8_E8*/{ 0xe9, 1054 }, + /*II_D8_E8*/{ 0xe9, 1054 }, + /*II_D8_F0*/{ 0xe9, 1061 }, + /*II_D8_F0*/{ 0xe9, 1061 }, + /*II_D8_F0*/{ 0xe9, 1061 }, + /*II_D8_F0*/{ 0xe9, 1061 }, + /*II_D8_F0*/{ 0xe9, 1061 }, + /*II_D8_F0*/{ 0xe9, 1061 }, + /*II_D8_F0*/{ 0xe9, 1061 }, + /*II_D8_F0*/{ 0xe9, 1061 }, + /*II_D8_F8*/{ 0xe9, 1067 }, + /*II_D8_F8*/{ 0xe9, 1067 }, + /*II_D8_F8*/{ 0xe9, 1067 }, + /*II_D8_F8*/{ 0xe9, 1067 }, + /*II_D8_F8*/{ 0xe9, 1067 }, + /*II_D8_F8*/{ 0xe9, 1067 }, + /*II_D8_F8*/{ 0xe9, 1067 }, + /*II_D8_F8*/{ 0xe9, 1067 }, + /*II_D9_00*/{ 0xe8, 1074 }, + /*II_D9_02*/{ 0xec, 1079 }, + /*II_D9_03*/{ 0xec, 1084 }, + /*II_D9_04*/{ 0xed, 1090 }, + /*II_D9_05*/{ 0xee, 1098 }, + /*II_D9_C0*/{ 0xea, 1074 }, + /*II_D9_C0*/{ 0xea, 1074 }, + /*II_D9_C0*/{ 0xea, 1074 }, + /*II_D9_C0*/{ 0xea, 1074 }, + /*II_D9_C0*/{ 0xea, 1074 }, + /*II_D9_C0*/{ 0xea, 1074 }, + /*II_D9_C0*/{ 0xea, 1074 }, + /*II_D9_C0*/{ 0xea, 1074 }, + /*II_D9_C8*/{ 0xea, 1105 }, + /*II_D9_C9*/{ 0xeb, 1105 }, + /*II_D9_C8*/{ 0xea, 1105 }, + /*II_D9_C8*/{ 0xea, 1105 }, + /*II_D9_C8*/{ 0xea, 1105 }, + /*II_D9_C8*/{ 0xea, 1105 }, + /*II_D9_C8*/{ 0xea, 1105 }, + /*II_D9_C8*/{ 0xea, 1105 }, + /*II_D9_D0*/{ 0xeb, 1111 }, + /*II_D9_E0*/{ 0xeb, 1117 }, + /*II_D9_E1*/{ 0xeb, 1123 }, + /*II_D9_E4*/{ 0xeb, 1129 }, + /*II_D9_E5*/{ 0xeb, 1135 }, + /*II_D9_E8*/{ 0xeb, 1141 }, + /*II_D9_E9*/{ 0xeb, 1147 }, + /*II_D9_EA*/{ 0xeb, 1155 }, + /*II_D9_EB*/{ 0xeb, 1163 }, + /*II_D9_EC*/{ 0xeb, 1170 }, + /*II_D9_ED*/{ 0xeb, 1178 }, + /*II_D9_EE*/{ 0xeb, 1186 }, + /*II_D9_F0*/{ 0xeb, 1192 }, + /*II_D9_F1*/{ 0xeb, 1199 }, + /*II_D9_F2*/{ 0xeb, 1206 }, + /*II_D9_F3*/{ 0xeb, 1213 }, + /*II_D9_F4*/{ 0xeb, 1221 }, + /*II_D9_F5*/{ 0xeb, 1230 }, + /*II_D9_F6*/{ 0xeb, 1238 }, + /*II_D9_F7*/{ 0xeb, 1247 }, + /*II_D9_F8*/{ 0xeb, 1256 }, + /*II_D9_F9*/{ 0xeb, 1263 }, + /*II_D9_FA*/{ 0xeb, 1272 }, + /*II_D9_FB*/{ 0xeb, 1279 }, + /*II_D9_FC*/{ 0xeb, 1288 }, + /*II_D9_FD*/{ 0xeb, 1297 }, + /*II_D9_FE*/{ 0xeb, 1305 }, + /*II_D9_FF*/{ 0xeb, 1311 }, + /*II_DA_00*/{ 0xe8, 1317 }, + /*II_DA_01*/{ 0xe8, 1324 }, + /*II_DA_02*/{ 0xe8, 1331 }, + /*II_DA_03*/{ 0xe8, 1338 }, + /*II_DA_04*/{ 0xe8, 1346 }, + /*II_DA_05*/{ 0xe8, 1353 }, + /*II_DA_06*/{ 0xe8, 1361 }, + /*II_DA_07*/{ 0xe8, 1368 }, + /*II_DA_C0*/{ 0xef, 1376 }, + /*II_DA_C0*/{ 0xef, 1376 }, + /*II_DA_C0*/{ 0xef, 1376 }, + /*II_DA_C0*/{ 0xef, 1376 }, + /*II_DA_C0*/{ 0xef, 1376 }, + /*II_DA_C0*/{ 0xef, 1376 }, + /*II_DA_C0*/{ 0xef, 1376 }, + /*II_DA_C0*/{ 0xef, 1376 }, + /*II_DA_C8*/{ 0xf0, 1384 }, + /*II_DA_C8*/{ 0xf0, 1384 }, + /*II_DA_C8*/{ 0xf0, 1384 }, + /*II_DA_C8*/{ 0xf0, 1384 }, + /*II_DA_C8*/{ 0xf0, 1384 }, + /*II_DA_C8*/{ 0xf0, 1384 }, + /*II_DA_C8*/{ 0xf0, 1384 }, + /*II_DA_C8*/{ 0xf0, 1384 }, + /*II_DA_D0*/{ 0xf1, 1392 }, + /*II_DA_D0*/{ 0xf1, 1392 }, + /*II_DA_D0*/{ 0xf1, 1392 }, + /*II_DA_D0*/{ 0xf1, 1392 }, + /*II_DA_D0*/{ 0xf1, 1392 }, + /*II_DA_D0*/{ 0xf1, 1392 }, + /*II_DA_D0*/{ 0xf1, 1392 }, + /*II_DA_D0*/{ 0xf1, 1392 }, + /*II_DA_D8*/{ 0xf2, 1401 }, + /*II_DA_D8*/{ 0xf2, 1401 }, + /*II_DA_D8*/{ 0xf2, 1401 }, + /*II_DA_D8*/{ 0xf2, 1401 }, + /*II_DA_D8*/{ 0xf2, 1401 }, + /*II_DA_D8*/{ 0xf2, 1401 }, + /*II_DA_D8*/{ 0xf2, 1401 }, + /*II_DA_D8*/{ 0xf2, 1401 }, + /*II_DA_E9*/{ 0xeb, 1409 }, + /*II_DB_00*/{ 0xe8, 1418 }, + /*II_DB_01*/{ 0xf3, 1424 }, + /*II_DB_02*/{ 0xec, 1432 }, + /*II_DB_03*/{ 0xec, 1438 }, + /*II_DB_05*/{ 0xf4, 1074 }, + /*II_DB_07*/{ 0xf5, 1084 }, + /*II_DB_C0*/{ 0xef, 1445 }, + /*II_DB_C0*/{ 0xef, 1445 }, + /*II_DB_C0*/{ 0xef, 1445 }, + /*II_DB_C0*/{ 0xef, 1445 }, + /*II_DB_C0*/{ 0xef, 1445 }, + /*II_DB_C0*/{ 0xef, 1445 }, + /*II_DB_C0*/{ 0xef, 1445 }, + /*II_DB_C0*/{ 0xef, 1445 }, + /*II_DB_C8*/{ 0xf0, 1454 }, + /*II_DB_C8*/{ 0xf0, 1454 }, + /*II_DB_C8*/{ 0xf0, 1454 }, + /*II_DB_C8*/{ 0xf0, 1454 }, + /*II_DB_C8*/{ 0xf0, 1454 }, + /*II_DB_C8*/{ 0xf0, 1454 }, + /*II_DB_C8*/{ 0xf0, 1454 }, + /*II_DB_C8*/{ 0xf0, 1454 }, + /*II_DB_D0*/{ 0xf1, 1463 }, + /*II_DB_D0*/{ 0xf1, 1463 }, + /*II_DB_D0*/{ 0xf1, 1463 }, + /*II_DB_D0*/{ 0xf1, 1463 }, + /*II_DB_D0*/{ 0xf1, 1463 }, + /*II_DB_D0*/{ 0xf1, 1463 }, + /*II_DB_D0*/{ 0xf1, 1463 }, + /*II_DB_D0*/{ 0xf1, 1463 }, + /*II_DB_D8*/{ 0xf2, 1473 }, + /*II_DB_D8*/{ 0xf2, 1473 }, + /*II_DB_D8*/{ 0xf2, 1473 }, + /*II_DB_D8*/{ 0xf2, 1473 }, + /*II_DB_D8*/{ 0xf2, 1473 }, + /*II_DB_D8*/{ 0xf2, 1473 }, + /*II_DB_D8*/{ 0xf2, 1473 }, + /*II_DB_D8*/{ 0xf2, 1473 }, + /*II_DB_E0*/{ 0xeb, 1482 }, + /*II_DB_E1*/{ 0xeb, 1488 }, + /*II_DB_E4*/{ 0xeb, 1496 }, + /*II_DB_E8*/{ 0xf6, 1504 }, + /*II_DB_E8*/{ 0xf6, 1504 }, + /*II_DB_E8*/{ 0xf6, 1504 }, + /*II_DB_E8*/{ 0xf6, 1504 }, + /*II_DB_E8*/{ 0xf6, 1504 }, + /*II_DB_E8*/{ 0xf6, 1504 }, + /*II_DB_E8*/{ 0xf6, 1504 }, + /*II_DB_E8*/{ 0xf6, 1504 }, + /*II_DB_F0*/{ 0xf7, 1512 }, + /*II_DB_F0*/{ 0xf7, 1512 }, + /*II_DB_F0*/{ 0xf7, 1512 }, + /*II_DB_F0*/{ 0xf7, 1512 }, + /*II_DB_F0*/{ 0xf7, 1512 }, + /*II_DB_F0*/{ 0xf7, 1512 }, + /*II_DB_F0*/{ 0xf7, 1512 }, + /*II_DB_F0*/{ 0xf7, 1512 }, + /*II_DC_00*/{ 0xf8, 1023 }, + /*II_DC_01*/{ 0xf8, 1029 }, + /*II_DC_02*/{ 0xf8, 1035 }, + /*II_DC_03*/{ 0xf8, 1041 }, + /*II_DC_04*/{ 0xf8, 1048 }, + /*II_DC_05*/{ 0xf8, 1054 }, + /*II_DC_06*/{ 0xf8, 1061 }, + /*II_DC_07*/{ 0xf8, 1067 }, + /*II_DC_C0*/{ 0xf9, 1023 }, + /*II_DC_C0*/{ 0xf9, 1023 }, + /*II_DC_C0*/{ 0xf9, 1023 }, + /*II_DC_C0*/{ 0xf9, 1023 }, + /*II_DC_C0*/{ 0xf9, 1023 }, + /*II_DC_C0*/{ 0xf9, 1023 }, + /*II_DC_C0*/{ 0xf9, 1023 }, + /*II_DC_C0*/{ 0xf9, 1023 }, + /*II_DC_C8*/{ 0xf9, 1029 }, + /*II_DC_C8*/{ 0xf9, 1029 }, + /*II_DC_C8*/{ 0xf9, 1029 }, + /*II_DC_C8*/{ 0xf9, 1029 }, + /*II_DC_C8*/{ 0xf9, 1029 }, + /*II_DC_C8*/{ 0xf9, 1029 }, + /*II_DC_C8*/{ 0xf9, 1029 }, + /*II_DC_C8*/{ 0xf9, 1029 }, + /*II_DC_E0*/{ 0xf9, 1054 }, + /*II_DC_E0*/{ 0xf9, 1054 }, + /*II_DC_E0*/{ 0xf9, 1054 }, + /*II_DC_E0*/{ 0xf9, 1054 }, + /*II_DC_E0*/{ 0xf9, 1054 }, + /*II_DC_E0*/{ 0xf9, 1054 }, + /*II_DC_E0*/{ 0xf9, 1054 }, + /*II_DC_E0*/{ 0xf9, 1054 }, + /*II_DC_E8*/{ 0xf9, 1048 }, + /*II_DC_E8*/{ 0xf9, 1048 }, + /*II_DC_E8*/{ 0xf9, 1048 }, + /*II_DC_E8*/{ 0xf9, 1048 }, + /*II_DC_E8*/{ 0xf9, 1048 }, + /*II_DC_E8*/{ 0xf9, 1048 }, + /*II_DC_E8*/{ 0xf9, 1048 }, + /*II_DC_E8*/{ 0xf9, 1048 }, + /*II_DC_F0*/{ 0xf9, 1067 }, + /*II_DC_F0*/{ 0xf9, 1067 }, + /*II_DC_F0*/{ 0xf9, 1067 }, + /*II_DC_F0*/{ 0xf9, 1067 }, + /*II_DC_F0*/{ 0xf9, 1067 }, + /*II_DC_F0*/{ 0xf9, 1067 }, + /*II_DC_F0*/{ 0xf9, 1067 }, + /*II_DC_F0*/{ 0xf9, 1067 }, + /*II_DC_F8*/{ 0xf9, 1061 }, + /*II_DC_F8*/{ 0xf9, 1061 }, + /*II_DC_F8*/{ 0xf9, 1061 }, + /*II_DC_F8*/{ 0xf9, 1061 }, + /*II_DC_F8*/{ 0xf9, 1061 }, + /*II_DC_F8*/{ 0xf9, 1061 }, + /*II_DC_F8*/{ 0xf9, 1061 }, + /*II_DC_F8*/{ 0xf9, 1061 }, + /*II_DD_00*/{ 0xf8, 1074 }, + /*II_DD_01*/{ 0xfa, 1424 }, + /*II_DD_02*/{ 0xfb, 1079 }, + /*II_DD_03*/{ 0xfb, 1084 }, + /*II_DD_04*/{ 0xed, 1519 }, + /*II_DD_C0*/{ 0xea, 1527 }, + /*II_DD_C0*/{ 0xea, 1527 }, + /*II_DD_C0*/{ 0xea, 1527 }, + /*II_DD_C0*/{ 0xea, 1527 }, + /*II_DD_C0*/{ 0xea, 1527 }, + /*II_DD_C0*/{ 0xea, 1527 }, + /*II_DD_C0*/{ 0xea, 1527 }, + /*II_DD_C0*/{ 0xea, 1527 }, + /*II_DD_D0*/{ 0xea, 1079 }, + /*II_DD_D0*/{ 0xea, 1079 }, + /*II_DD_D0*/{ 0xea, 1079 }, + /*II_DD_D0*/{ 0xea, 1079 }, + /*II_DD_D0*/{ 0xea, 1079 }, + /*II_DD_D0*/{ 0xea, 1079 }, + /*II_DD_D0*/{ 0xea, 1079 }, + /*II_DD_D0*/{ 0xea, 1079 }, + /*II_DD_D8*/{ 0xea, 1084 }, + /*II_DD_D8*/{ 0xea, 1084 }, + /*II_DD_D8*/{ 0xea, 1084 }, + /*II_DD_D8*/{ 0xea, 1084 }, + /*II_DD_D8*/{ 0xea, 1084 }, + /*II_DD_D8*/{ 0xea, 1084 }, + /*II_DD_D8*/{ 0xea, 1084 }, + /*II_DD_D8*/{ 0xea, 1084 }, + /*II_DD_E0*/{ 0xf9, 1534 }, + /*II_DD_E1*/{ 0xeb, 1534 }, + /*II_DD_E0*/{ 0xf9, 1534 }, + /*II_DD_E0*/{ 0xf9, 1534 }, + /*II_DD_E0*/{ 0xf9, 1534 }, + /*II_DD_E0*/{ 0xf9, 1534 }, + /*II_DD_E0*/{ 0xf9, 1534 }, + /*II_DD_E0*/{ 0xf9, 1534 }, + /*II_DD_E8*/{ 0xea, 1541 }, + /*II_DD_E9*/{ 0xeb, 1541 }, + /*II_DD_E8*/{ 0xea, 1541 }, + /*II_DD_E8*/{ 0xea, 1541 }, + /*II_DD_E8*/{ 0xea, 1541 }, + /*II_DD_E8*/{ 0xea, 1541 }, + /*II_DD_E8*/{ 0xea, 1541 }, + /*II_DD_E8*/{ 0xea, 1541 }, + /*II_DE_00*/{ 0xee, 1317 }, + /*II_DE_01*/{ 0xee, 1324 }, + /*II_DE_02*/{ 0xee, 1331 }, + /*II_DE_03*/{ 0xee, 1338 }, + /*II_DE_04*/{ 0xee, 1346 }, + /*II_DE_05*/{ 0xee, 1353 }, + /*II_DE_06*/{ 0xee, 1361 }, + /*II_DE_07*/{ 0xee, 1368 }, + /*II_DE_C0*/{ 0xf9, 1549 }, + /*II_DE_C1*/{ 0xeb, 1549 }, + /*II_DE_C0*/{ 0xf9, 1549 }, + /*II_DE_C0*/{ 0xf9, 1549 }, + /*II_DE_C0*/{ 0xf9, 1549 }, + /*II_DE_C0*/{ 0xf9, 1549 }, + /*II_DE_C0*/{ 0xf9, 1549 }, + /*II_DE_C0*/{ 0xf9, 1549 }, + /*II_DE_C8*/{ 0xf9, 1556 }, + /*II_DE_C9*/{ 0xeb, 1556 }, + /*II_DE_C8*/{ 0xf9, 1556 }, + /*II_DE_C8*/{ 0xf9, 1556 }, + /*II_DE_C8*/{ 0xf9, 1556 }, + /*II_DE_C8*/{ 0xf9, 1556 }, + /*II_DE_C8*/{ 0xf9, 1556 }, + /*II_DE_C8*/{ 0xf9, 1556 }, + /*II_DE_D9*/{ 0xeb, 1563 }, + /*II_DE_E0*/{ 0xf9, 1571 }, + /*II_DE_E1*/{ 0xeb, 1571 }, + /*II_DE_E0*/{ 0xf9, 1571 }, + /*II_DE_E0*/{ 0xf9, 1571 }, + /*II_DE_E0*/{ 0xf9, 1571 }, + /*II_DE_E0*/{ 0xf9, 1571 }, + /*II_DE_E0*/{ 0xf9, 1571 }, + /*II_DE_E0*/{ 0xf9, 1571 }, + /*II_DE_E8*/{ 0xf9, 1579 }, + /*II_DE_E9*/{ 0xeb, 1579 }, + /*II_DE_E8*/{ 0xf9, 1579 }, + /*II_DE_E8*/{ 0xf9, 1579 }, + /*II_DE_E8*/{ 0xf9, 1579 }, + /*II_DE_E8*/{ 0xf9, 1579 }, + /*II_DE_E8*/{ 0xf9, 1579 }, + /*II_DE_E8*/{ 0xf9, 1579 }, + /*II_DE_F0*/{ 0xf9, 1586 }, + /*II_DE_F1*/{ 0xeb, 1586 }, + /*II_DE_F0*/{ 0xf9, 1586 }, + /*II_DE_F0*/{ 0xf9, 1586 }, + /*II_DE_F0*/{ 0xf9, 1586 }, + /*II_DE_F0*/{ 0xf9, 1586 }, + /*II_DE_F0*/{ 0xf9, 1586 }, + /*II_DE_F0*/{ 0xf9, 1586 }, + /*II_DE_F8*/{ 0xf9, 1594 }, + /*II_DE_F9*/{ 0xeb, 1594 }, + /*II_DE_F8*/{ 0xf9, 1594 }, + /*II_DE_F8*/{ 0xf9, 1594 }, + /*II_DE_F8*/{ 0xf9, 1594 }, + /*II_DE_F8*/{ 0xf9, 1594 }, + /*II_DE_F8*/{ 0xf9, 1594 }, + /*II_DE_F8*/{ 0xf9, 1594 }, + /*II_DF_00*/{ 0xee, 1418 }, + /*II_DF_01*/{ 0xfc, 1424 }, + /*II_DF_02*/{ 0xfd, 1432 }, + /*II_DF_03*/{ 0xfd, 1438 }, + /*II_DF_04*/{ 0xf4, 1601 }, + /*II_DF_05*/{ 0xf8, 1418 }, + /*II_DF_06*/{ 0xf5, 1607 }, + /*II_DF_07*/{ 0xfb, 1438 }, + /*II_DF_E8*/{ 0xf6, 1614 }, + /*II_DF_E8*/{ 0xf6, 1614 }, + /*II_DF_E8*/{ 0xf6, 1614 }, + /*II_DF_E8*/{ 0xf6, 1614 }, + /*II_DF_E8*/{ 0xf6, 1614 }, + /*II_DF_E8*/{ 0xf6, 1614 }, + /*II_DF_E8*/{ 0xf6, 1614 }, + /*II_DF_E8*/{ 0xf6, 1614 }, + /*II_DF_F0*/{ 0xf6, 1623 }, + /*II_DF_F0*/{ 0xf6, 1623 }, + /*II_DF_F0*/{ 0xf6, 1623 }, + /*II_DF_F0*/{ 0xf6, 1623 }, + /*II_DF_F0*/{ 0xf6, 1623 }, + /*II_DF_F0*/{ 0xf6, 1623 }, + /*II_DF_F0*/{ 0xf6, 1623 }, + /*II_DF_F0*/{ 0xf6, 1623 }, + /*II_F6_00*/{ 0xfe, 206 }, + /*II_F6_02*/{ 0xff, 1631 }, + /*II_F6_03*/{ 0x100, 1636 }, + /*II_F6_04*/{ 0x101, 1641 }, + /*II_F6_05*/{ 0x101, 117 }, + /*II_F6_06*/{ 0x102, 1646 }, + /*II_F6_07*/{ 0x102, 1651 }, + /*II_F7_00*/{ 0x103, 206 }, + /*II_F7_02*/{ 0x104, 1631 }, + /*II_F7_03*/{ 0x105, 1636 }, + /*II_F7_04*/{ 0x106, 1641 }, + /*II_F7_05*/{ 0x106, 117 }, + /*II_F7_06*/{ 0x107, 1646 }, + /*II_F7_07*/{ 0x107, 1651 }, + /*II_FE_00*/{ 0x108, 81 }, + /*II_FE_01*/{ 0x108, 86 }, + /*II_FF_00*/{ 0x109, 81 }, + /*II_FF_01*/{ 0x109, 86 }, + /*II_FF_02*/{ 0x10a, 456 }, + /*II_FF_03*/{ 0x10b, 260 }, + /*II_FF_04*/{ 0x10c, 462 }, + /*II_FF_05*/{ 0x10d, 467 }, + /*II_FF_06*/{ 0x10e, 16 }, + /*II_0F_00_00*/{ 0x10f, 1657 }, + /*II_0F_00_01*/{ 0x110, 1663 }, + /*II_0F_00_02*/{ 0x110, 34436 }, + /*II_0F_00_03*/{ 0x111, 34442 }, + /*II_0F_00_04*/{ 0x112, 1679 }, + /*II_0F_00_05*/{ 0x112, 1685 }, + /*II_0F_01_00*/{ 0x113, 1691 }, + /*II_0F_01_01*/{ 0x113, 1697 }, + /*II_0F_01_02*/{ 0x113, 34471 }, + /*II_0F_01_03*/{ 0x113, 34477 }, + /*II_0F_01_04*/{ 0x114, 1715 }, + /*II_0F_01_06*/{ 0x115, 34489 }, + /*II_0F_01_07*/{ 0x116, 34495 }, + /*II_0F_01_C1*/{ 0x117, 1735 }, + /*II_0F_01_C2*/{ 0x117, 1743 }, + /*II_0F_01_C3*/{ 0x117, 1753 }, + /*II_0F_01_C4*/{ 0x117, 1763 }, + /*II_0F_01_C8*/{ 0x118, 1771 }, + /*II_0F_01_C9*/{ 0x118, 1780 }, + /*II_0F_01_D0*/{ 0x88, 1787 }, + /*II_0F_01_D1*/{ 0x88, 1795 }, + /*II_0F_01_D4*/{ 0x117, 1803 }, + /*II_0F_01_D5*/{ 0x119, 1811 }, + /*II_0F_01_D8*/{ 0x11a, 1817 }, + /*II_0F_01_D9*/{ 0x11b, 1824 }, + /*II_0F_01_DA*/{ 0x11c, 1833 }, + /*II_0F_01_DB*/{ 0x11c, 1841 }, + /*II_0F_01_DC*/{ 0x11b, 1849 }, + /*II_0F_01_DD*/{ 0x11b, 1855 }, + /*II_0F_01_DE*/{ 0x11c, 1861 }, + /*II_0F_01_DF*/{ 0x11d, 1869 }, + /*II_0F_01_F8*/{ 0x11e, 1878 }, + /*II_0F_01_F9*/{ 0x11e, 1886 }, + /*II_0F_0D_00*/{ 0x11f, 1894 }, + /*II_0F_0D_01*/{ 0x11f, 1904 }, + /*II_0F_0F_0C*/{ 0x120, 1915 }, + /*II_0F_0F_0D*/{ 0x121, 1922 }, + /*II_0F_0F_1C*/{ 0x120, 1929 }, + /*II_0F_0F_1D*/{ 0x121, 1936 }, + /*II_0F_0F_8A*/{ 0x120, 1943 }, + /*II_0F_0F_8E*/{ 0x120, 1951 }, + /*II_0F_0F_90*/{ 0x121, 1960 }, + /*II_0F_0F_94*/{ 0x121, 1969 }, + /*II_0F_0F_96*/{ 0x121, 1976 }, + /*II_0F_0F_97*/{ 0x121, 1983 }, + /*II_0F_0F_9A*/{ 0x121, 1992 }, + /*II_0F_0F_9E*/{ 0x121, 1999 }, + /*II_0F_0F_A0*/{ 0x121, 2006 }, + /*II_0F_0F_A4*/{ 0x121, 2015 }, + /*II_0F_0F_A6*/{ 0x121, 2022 }, + /*II_0F_0F_A7*/{ 0x121, 2032 }, + /*II_0F_0F_AA*/{ 0x121, 2042 }, + /*II_0F_0F_AE*/{ 0x121, 2050 }, + /*II_0F_0F_B0*/{ 0x121, 2057 }, + /*II_0F_0F_B4*/{ 0x121, 2066 }, + /*II_0F_0F_B6*/{ 0x121, 2073 }, + /*II_0F_0F_B7*/{ 0x121, 2083 }, + /*II_0F_0F_BB*/{ 0x120, 2092 }, + /*II_0F_0F_BF*/{ 0x121, 2100 }, + /*II_0F_10*/{ 0x122, 2109 }, + /*II_66_0F_10*/{ 0x123, 2117 }, + /*II_F3_0F_10*/{ 0x124, 2125 }, + /*II_F2_0F_10*/{ 0x125, 2132 }, + /*II_0F_11*/{ 0x12a, 2109 }, + /*II_66_0F_11*/{ 0x12b, 2117 }, + /*II_F3_0F_11*/{ 0x12c, 2125 }, + /*II_F2_0F_11*/{ 0x12d, 2132 }, + /*II_66_0F_12*/{ 0x132, 2190 }, + /*II_F3_0F_12*/{ 0x133, 2198 }, + /*II_F2_0F_12*/{ 0x133, 2208 }, + /*II_0F_13*/{ 0x137, 2182 }, + /*II_66_0F_13*/{ 0x138, 2190 }, + /*II_0F_14*/{ 0x13a, 2266 }, + /*II_66_0F_14*/{ 0x13b, 2276 }, + /*II_0F_15*/{ 0x13a, 2308 }, + /*II_66_0F_15*/{ 0x13b, 2318 }, + /*II_66_0F_16*/{ 0x132, 2367 }, + /*II_F3_0F_16*/{ 0x13d, 2375 }, + /*II_0F_17*/{ 0x137, 2359 }, + /*II_66_0F_17*/{ 0x138, 2367 }, + /*II_0F_18_00*/{ 0x13e, 2424 }, + /*II_0F_18_01*/{ 0x13e, 2437 }, + /*II_0F_18_02*/{ 0x13e, 2449 }, + /*II_0F_18_03*/{ 0x13e, 2461 }, + /*II_0F_28*/{ 0x122, 2473 }, + /*II_66_0F_28*/{ 0x123, 2481 }, + /*II_0F_29*/{ 0x12a, 2473 }, + /*II_66_0F_29*/{ 0x12b, 2481 }, + /*II_0F_2A*/{ 0x13f, 2507 }, + /*II_66_0F_2A*/{ 0x140, 2517 }, + /*II_F3_0F_2A*/{ 0x141, 2527 }, + /*II_F2_0F_2A*/{ 0x142, 2537 }, + /*II_0F_2B*/{ 0x143, 2569 }, + /*II_66_0F_2B*/{ 0x144, 2578 }, + /*II_F3_0F_2B*/{ 0x145, 2587 }, + /*II_F2_0F_2B*/{ 0x146, 2596 }, + /*II_0F_2C*/{ 0x148, 2625 }, + /*II_66_0F_2C*/{ 0x149, 2636 }, + /*II_F3_0F_2C*/{ 0x14a, 2647 }, + /*II_F2_0F_2C*/{ 0x14b, 2658 }, + /*II_0F_2D*/{ 0x148, 2693 }, + /*II_66_0F_2D*/{ 0x13b, 2703 }, + /*II_F3_0F_2D*/{ 0x14a, 2713 }, + /*II_F2_0F_2D*/{ 0x14b, 2723 }, + /*II_0F_2E*/{ 0x14d, 2755 }, + /*II_66_0F_2E*/{ 0x14e, 2764 }, + /*II_0F_2F*/{ 0x14d, 2793 }, + /*II_66_0F_2F*/{ 0x14e, 2801 }, + /*II_0F_50*/{ 0x151, 2827 }, + /*II_66_0F_50*/{ 0x152, 2837 }, + /*II_0F_51*/{ 0x13a, 2869 }, + /*II_66_0F_51*/{ 0x13b, 2877 }, + /*II_F3_0F_51*/{ 0x154, 2885 }, + /*II_F2_0F_51*/{ 0x14e, 2893 }, + /*II_0F_52*/{ 0x13a, 2937 }, + /*II_F3_0F_52*/{ 0x154, 2946 }, + /*II_0F_53*/{ 0x13a, 2975 }, + /*II_F3_0F_53*/{ 0x154, 2982 }, + /*II_0F_54*/{ 0x13a, 3005 }, + /*II_66_0F_54*/{ 0x13b, 3012 }, + /*II_0F_55*/{ 0x13a, 3035 }, + /*II_66_0F_55*/{ 0x13b, 3043 }, + /*II_0F_56*/{ 0x13a, 3069 }, + /*II_66_0F_56*/{ 0x13b, 3075 }, + /*II_0F_57*/{ 0x13a, 3095 }, + /*II_66_0F_57*/{ 0x13b, 3102 }, + /*II_0F_58*/{ 0x13a, 3125 }, + /*II_66_0F_58*/{ 0x13b, 3132 }, + /*II_F3_0F_58*/{ 0x154, 3139 }, + /*II_F2_0F_58*/{ 0x14e, 3146 }, + /*II_0F_59*/{ 0x13a, 3185 }, + /*II_66_0F_59*/{ 0x13b, 3192 }, + /*II_F3_0F_59*/{ 0x154, 3199 }, + /*II_F2_0F_59*/{ 0x14e, 3206 }, + /*II_0F_5A*/{ 0x14e, 3245 }, + /*II_66_0F_5A*/{ 0x13b, 3255 }, + /*II_F3_0F_5A*/{ 0x155, 3265 }, + /*II_F2_0F_5A*/{ 0x14e, 3275 }, + /*II_0F_5B*/{ 0x13b, 3329 }, + /*II_66_0F_5B*/{ 0x13b, 3339 }, + /*II_F3_0F_5B*/{ 0x13b, 3349 }, + /*II_0F_5C*/{ 0x13a, 3394 }, + /*II_66_0F_5C*/{ 0x13b, 3401 }, + /*II_F3_0F_5C*/{ 0x154, 3408 }, + /*II_F2_0F_5C*/{ 0x14e, 3415 }, + /*II_0F_5D*/{ 0x13a, 3454 }, + /*II_66_0F_5D*/{ 0x13b, 3461 }, + /*II_F3_0F_5D*/{ 0x154, 3468 }, + /*II_F2_0F_5D*/{ 0x14e, 3475 }, + /*II_0F_5E*/{ 0x13a, 3514 }, + /*II_66_0F_5E*/{ 0x13b, 3521 }, + /*II_F3_0F_5E*/{ 0x154, 3528 }, + /*II_F2_0F_5E*/{ 0x14e, 3535 }, + /*II_0F_5F*/{ 0x13a, 3574 }, + /*II_66_0F_5F*/{ 0x13b, 3581 }, + /*II_F3_0F_5F*/{ 0x154, 3588 }, + /*II_F2_0F_5F*/{ 0x14e, 3595 }, + /*II_0F_60*/{ 0x158, 3634 }, + /*II_66_0F_60*/{ 0x13b, 3634 }, + /*II_0F_61*/{ 0x158, 3657 }, + /*II_66_0F_61*/{ 0x13b, 3657 }, + /*II_0F_62*/{ 0x158, 3680 }, + /*II_66_0F_62*/{ 0x13b, 3680 }, + /*II_0F_63*/{ 0x159, 3703 }, + /*II_66_0F_63*/{ 0x13b, 3703 }, + /*II_0F_64*/{ 0x159, 3724 }, + /*II_66_0F_64*/{ 0x13b, 3724 }, + /*II_0F_65*/{ 0x159, 3743 }, + /*II_66_0F_65*/{ 0x13b, 3743 }, + /*II_0F_66*/{ 0x159, 3762 }, + /*II_66_0F_66*/{ 0x13b, 3762 }, + /*II_0F_67*/{ 0x159, 3781 }, + /*II_66_0F_67*/{ 0x13b, 3781 }, + /*II_0F_68*/{ 0x159, 3802 }, + /*II_66_0F_68*/{ 0x13b, 3802 }, + /*II_0F_69*/{ 0x159, 3825 }, + /*II_66_0F_69*/{ 0x13b, 3825 }, + /*II_0F_6A*/{ 0x159, 3848 }, + /*II_66_0F_6A*/{ 0x13b, 3848 }, + /*II_0F_6B*/{ 0x159, 3871 }, + /*II_66_0F_6B*/{ 0x13b, 3871 }, + /*II_66_0F_6C*/{ 0x13b, 3892 }, + /*II_66_0F_6D*/{ 0x13b, 3917 }, + /*II_0F_6F*/{ 0x15d, 3948 }, + /*II_66_0F_6F*/{ 0x123, 3968 }, + /*II_F3_0F_6F*/{ 0x123, 3976 }, + /*II_0F_74*/{ 0x159, 4065 }, + /*II_66_0F_74*/{ 0x13b, 4065 }, + /*II_0F_75*/{ 0x159, 4084 }, + /*II_66_0F_75*/{ 0x13b, 4084 }, + /*II_0F_76*/{ 0x159, 4103 }, + /*II_66_0F_76*/{ 0x13b, 4103 }, + /*II_0F_77*/{ 0x161, 4122 }, + /*II_0F_78*/{ 0x163, 4150 }, + /*II_0F_79*/{ 0x166, 4174 }, + /*II_66_0F_79*/{ 0x167, 4158 }, + /*II_F2_0F_79*/{ 0x168, 4165 }, + /*II_0F_7A_30*/{ 0x169, 4183 }, + /*II_0F_7A_31*/{ 0x16a, 4193 }, + /*II_66_0F_7C*/{ 0x16b, 4203 }, + /*II_F2_0F_7C*/{ 0x16b, 4211 }, + /*II_66_0F_7D*/{ 0x16b, 4237 }, + /*II_F2_0F_7D*/{ 0x16b, 4245 }, + /*II_F3_0F_7E*/{ 0x125, 3948 }, + /*II_0F_7F*/{ 0x16f, 3948 }, + /*II_66_0F_7F*/{ 0x12b, 3968 }, + /*II_F3_0F_7F*/{ 0x12b, 3976 }, + /*II_F3_0F_B8*/{ 0x173, 4360 }, + /*II_0F_BA_04*/{ 0x174, 872 }, + /*II_0F_BA_05*/{ 0x175, 887 }, + /*II_0F_BA_06*/{ 0x175, 912 }, + /*II_0F_BA_07*/{ 0x175, 934 }, + /*II_0F_BC*/{ 0x176, 4368 }, + /*II_F3_0F_BC*/{ 0x177, 4373 }, + /*II_0F_BD*/{ 0x176, 4380 }, + /*II_F3_0F_BD*/{ 0x178, 4385 }, + /*II_0F_C7_07*/{ 0x188, 6407 }, + /*II_66_0F_D0*/{ 0x16b, 6416 }, + /*II_F2_0F_D0*/{ 0x16b, 6426 }, + /*II_0F_D1*/{ 0x159, 6458 }, + /*II_66_0F_D1*/{ 0x13b, 6458 }, + /*II_0F_D2*/{ 0x159, 6473 }, + /*II_66_0F_D2*/{ 0x13b, 6473 }, + /*II_0F_D3*/{ 0x159, 6488 }, + /*II_66_0F_D3*/{ 0x13b, 6488 }, + /*II_0F_D4*/{ 0x14e, 6503 }, + /*II_66_0F_D4*/{ 0x13b, 6503 }, + /*II_0F_D5*/{ 0x159, 6518 }, + /*II_66_0F_D5*/{ 0x13b, 6518 }, + /*II_66_0F_D6*/{ 0x12d, 3948 }, + /*II_F3_0F_D6*/{ 0x189, 6535 }, + /*II_F2_0F_D6*/{ 0x18a, 6544 }, + /*II_0F_D7*/{ 0x18c, 6553 }, + /*II_66_0F_D7*/{ 0x18d, 6553 }, + /*II_0F_D8*/{ 0x159, 6574 }, + /*II_66_0F_D8*/{ 0x13b, 6574 }, + /*II_0F_D9*/{ 0x159, 6593 }, + /*II_66_0F_D9*/{ 0x13b, 6593 }, + /*II_0F_DA*/{ 0x18f, 6612 }, + /*II_66_0F_DA*/{ 0x13b, 6612 }, + /*II_0F_DB*/{ 0x159, 6629 }, + /*II_66_0F_DB*/{ 0x13b, 6629 }, + /*II_0F_DC*/{ 0x159, 6642 }, + /*II_66_0F_DC*/{ 0x13b, 6642 }, + /*II_0F_DD*/{ 0x159, 6661 }, + /*II_66_0F_DD*/{ 0x13b, 6661 }, + /*II_0F_DE*/{ 0x18f, 6670 }, + /*II_66_0F_DE*/{ 0x13b, 6670 }, + /*II_0F_DF*/{ 0x159, 6687 }, + /*II_66_0F_DF*/{ 0x13b, 6687 }, + /*II_0F_E0*/{ 0x18f, 6702 }, + /*II_66_0F_E0*/{ 0x13b, 6702 }, + /*II_0F_E1*/{ 0x159, 6717 }, + /*II_66_0F_E1*/{ 0x13b, 6717 }, + /*II_0F_E2*/{ 0x159, 6732 }, + /*II_66_0F_E2*/{ 0x13b, 6732 }, + /*II_0F_E3*/{ 0x18f, 6747 }, + /*II_66_0F_E3*/{ 0x13b, 6747 }, + /*II_0F_E4*/{ 0x18f, 6762 }, + /*II_66_0F_E4*/{ 0x13b, 6762 }, + /*II_0F_E5*/{ 0x159, 6781 }, + /*II_66_0F_E5*/{ 0x13b, 6781 }, + /*II_66_0F_E6*/{ 0x13b, 6798 }, + /*II_F3_0F_E6*/{ 0x14e, 6809 }, + /*II_F2_0F_E6*/{ 0x13b, 6819 }, + /*II_0F_E7*/{ 0x190, 6863 }, + /*II_66_0F_E7*/{ 0x144, 6871 }, + /*II_0F_E8*/{ 0x159, 6890 }, + /*II_66_0F_E8*/{ 0x13b, 6890 }, + /*II_0F_E9*/{ 0x159, 6907 }, + /*II_66_0F_E9*/{ 0x13b, 6907 }, + /*II_0F_EA*/{ 0x18f, 6924 }, + /*II_66_0F_EA*/{ 0x13b, 6924 }, + /*II_0F_EB*/{ 0x159, 6941 }, + /*II_66_0F_EB*/{ 0x13b, 6941 }, + /*II_0F_EC*/{ 0x159, 6952 }, + /*II_66_0F_EC*/{ 0x13b, 6952 }, + /*II_0F_ED*/{ 0x159, 6969 }, + /*II_66_0F_ED*/{ 0x13b, 6969 }, + /*II_0F_EE*/{ 0x18f, 6986 }, + /*II_66_0F_EE*/{ 0x13b, 6986 }, + /*II_0F_EF*/{ 0x159, 7003 }, + /*II_66_0F_EF*/{ 0x13b, 7003 }, + /*II_F2_0F_F0*/{ 0x191, 7016 }, + /*II_0F_F1*/{ 0x159, 7031 }, + /*II_66_0F_F1*/{ 0x13b, 7031 }, + /*II_0F_F2*/{ 0x159, 7046 }, + /*II_66_0F_F2*/{ 0x13b, 7046 }, + /*II_0F_F3*/{ 0x159, 7061 }, + /*II_66_0F_F3*/{ 0x13b, 7061 }, + /*II_0F_F4*/{ 0x193, 7076 }, + /*II_66_0F_F4*/{ 0x13b, 7076 }, + /*II_0F_F5*/{ 0x159, 7095 }, + /*II_66_0F_F5*/{ 0x13b, 7095 }, + /*II_0F_F6*/{ 0x18f, 7114 }, + /*II_66_0F_F6*/{ 0x13b, 7114 }, + /*II_0F_F7*/{ 0x194, 7131 }, + /*II_66_0F_F7*/{ 0x195, 7141 }, + /*II_0F_F8*/{ 0x159, 7166 }, + /*II_66_0F_F8*/{ 0x13b, 7166 }, + /*II_0F_F9*/{ 0x159, 7181 }, + /*II_66_0F_F9*/{ 0x13b, 7181 }, + /*II_0F_FA*/{ 0x159, 7196 }, + /*II_66_0F_FA*/{ 0x13b, 7196 }, + /*II_0F_FB*/{ 0x193, 7211 }, + /*II_66_0F_FB*/{ 0x13b, 7211 }, + /*II_0F_FC*/{ 0x159, 7226 }, + /*II_66_0F_FC*/{ 0x13b, 7226 }, + /*II_0F_FD*/{ 0x159, 7241 }, + /*II_66_0F_FD*/{ 0x13b, 7241 }, + /*II_0F_FE*/{ 0x159, 7256 }, + /*II_66_0F_FE*/{ 0x13b, 7256 }, + /*II_D9_06*/{ 0x197, 7271 }, + /*II_9B_D9_06*/{ 0x198, 7280 }, + /*II_D9_07*/{ 0xfd, 7288 }, + /*II_9B_D9_07*/{ 0x199, 7296 }, + /*II_DB_E2*/{ 0xeb, 7303 }, + /*II_9B_DB_E2*/{ 0x19a, 7311 }, + /*II_DB_E3*/{ 0xeb, 7318 }, + /*II_9B_DB_E3*/{ 0x19a, 7326 }, + /*II_DD_06*/{ 0x197, 7333 }, + /*II_9B_DD_06*/{ 0x198, 7341 }, + /*II_DD_07*/{ 0xfd, 7348 }, + /*II_9B_DD_07*/{ 0x199, 7356 }, + /*II_DF_E0*/{ 0x19b, 7348 }, + /*II_9B_DF_E0*/{ 0x19c, 7356 }, + /*II_0F_38_00*/{ 0x19d, 7363 }, + /*II_66_0F_38_00*/{ 0x19e, 7363 }, + /*II_0F_38_01*/{ 0x19d, 7380 }, + /*II_66_0F_38_01*/{ 0x19e, 7380 }, + /*II_0F_38_02*/{ 0x19d, 7397 }, + /*II_66_0F_38_02*/{ 0x19e, 7397 }, + /*II_0F_38_03*/{ 0x19d, 7414 }, + /*II_66_0F_38_03*/{ 0x19e, 7414 }, + /*II_0F_38_04*/{ 0x19d, 7433 }, + /*II_66_0F_38_04*/{ 0x19e, 7433 }, + /*II_0F_38_05*/{ 0x19d, 7456 }, + /*II_66_0F_38_05*/{ 0x19e, 7456 }, + /*II_0F_38_06*/{ 0x19d, 7473 }, + /*II_66_0F_38_06*/{ 0x19e, 7473 }, + /*II_0F_38_07*/{ 0x19d, 7490 }, + /*II_66_0F_38_07*/{ 0x19e, 7490 }, + /*II_0F_38_08*/{ 0x19d, 7509 }, + /*II_66_0F_38_08*/{ 0x19e, 7509 }, + /*II_0F_38_09*/{ 0x19d, 7526 }, + /*II_66_0F_38_09*/{ 0x19e, 7526 }, + /*II_0F_38_0A*/{ 0x19d, 7543 }, + /*II_66_0F_38_0A*/{ 0x19e, 7543 }, + /*II_0F_38_0B*/{ 0x19d, 7560 }, + /*II_66_0F_38_0B*/{ 0x19e, 7560 }, + /*II_66_0F_38_17*/{ 0x1a0, 7651 }, + /*II_0F_38_1C*/{ 0x19d, 7710 }, + /*II_66_0F_38_1C*/{ 0x19e, 7710 }, + /*II_0F_38_1D*/{ 0x19d, 7725 }, + /*II_66_0F_38_1D*/{ 0x19e, 7725 }, + /*II_0F_38_1E*/{ 0x19d, 7740 }, + /*II_66_0F_38_1E*/{ 0x19e, 7740 }, + /*II_66_0F_38_20*/{ 0x1a5, 7755 }, + /*II_66_0F_38_21*/{ 0x1a6, 7776 }, + /*II_66_0F_38_22*/{ 0x1a7, 7797 }, + /*II_66_0F_38_23*/{ 0x1a5, 7818 }, + /*II_66_0F_38_24*/{ 0x1a6, 7839 }, + /*II_66_0F_38_25*/{ 0x1a5, 7860 }, + /*II_66_0F_38_28*/{ 0x1a9, 7881 }, + /*II_66_0F_38_29*/{ 0x1a9, 7898 }, + /*II_66_0F_38_2A*/{ 0x1aa, 7917 }, + /*II_66_0F_38_2B*/{ 0x1a9, 7938 }, + /*II_66_0F_38_30*/{ 0x1a5, 7983 }, + /*II_66_0F_38_31*/{ 0x1a6, 8004 }, + /*II_66_0F_38_32*/{ 0x1a7, 8025 }, + /*II_66_0F_38_33*/{ 0x1a5, 8046 }, + /*II_66_0F_38_34*/{ 0x1a6, 8067 }, + /*II_66_0F_38_35*/{ 0x1a5, 8088 }, + /*II_66_0F_38_37*/{ 0x1a0, 8109 }, + /*II_66_0F_38_38*/{ 0x1a9, 8128 }, + /*II_66_0F_38_39*/{ 0x1a9, 8145 }, + /*II_66_0F_38_3A*/{ 0x1a9, 8162 }, + /*II_66_0F_38_3B*/{ 0x1a9, 8179 }, + /*II_66_0F_38_3C*/{ 0x1a9, 8196 }, + /*II_66_0F_38_3D*/{ 0x1a9, 8213 }, + /*II_66_0F_38_3E*/{ 0x1a9, 8230 }, + /*II_66_0F_38_3F*/{ 0x1a9, 8247 }, + /*II_66_0F_38_40*/{ 0x1a9, 8264 }, + /*II_66_0F_38_41*/{ 0x1a9, 8281 }, + /*II_66_0F_38_80*/{ 0x1ad, 8306 }, + /*II_66_0F_38_81*/{ 0x1ad, 8314 }, + /*II_66_0F_38_82*/{ 0x1ad, 8323 }, + /*II_66_0F_38_DB*/{ 0x1b0, 9172 }, + /*II_66_0F_38_DC*/{ 0x1b0, 9189 }, + /*II_66_0F_38_DD*/{ 0x1b0, 9206 }, + /*II_66_0F_38_DE*/{ 0x1b0, 9231 }, + /*II_66_0F_38_DF*/{ 0x1b0, 9248 }, + /*II_0F_38_F0*/{ 0x1b3, 9273 }, + /*II_F2_0F_38_F0*/{ 0x1b4, 9280 }, + /*II_0F_38_F1*/{ 0x1b5, 9273 }, + /*II_F2_0F_38_F1*/{ 0x1b6, 9280 }, + /*II_0F_71_02*/{ 0x1cd, 6458 }, + /*II_66_0F_71_02*/{ 0x1ce, 6458 }, + /*II_0F_71_04*/{ 0x1cd, 6717 }, + /*II_66_0F_71_04*/{ 0x1ce, 6717 }, + /*II_0F_71_06*/{ 0x1cd, 7031 }, + /*II_66_0F_71_06*/{ 0x1ce, 7031 }, + /*II_0F_72_02*/{ 0x1cd, 6473 }, + /*II_66_0F_72_02*/{ 0x1ce, 6473 }, + /*II_0F_72_04*/{ 0x1cd, 6732 }, + /*II_66_0F_72_04*/{ 0x1ce, 6732 }, + /*II_0F_72_06*/{ 0x1cd, 7046 }, + /*II_66_0F_72_06*/{ 0x1ce, 7046 }, + /*II_0F_73_02*/{ 0x1cd, 6488 }, + /*II_66_0F_73_02*/{ 0x1ce, 6488 }, + /*II_66_0F_73_03*/{ 0x1ce, 9852 }, + /*II_0F_73_06*/{ 0x1cd, 7061 }, + /*II_66_0F_73_06*/{ 0x1ce, 7061 }, + /*II_66_0F_73_07*/{ 0x1ce, 9869 }, + /*II_F3_0F_AE_00*/{ 0x1d0, 9904 }, + /*II_F3_0F_AE_01*/{ 0x1d0, 9934 }, + /*II_0F_AE_02*/{ 0x116, 9944 }, + /*II_F3_0F_AE_02*/{ 0x1d0, 9953 }, + /*II_0F_AE_03*/{ 0x116, 9973 }, + /*II_F3_0F_AE_03*/{ 0x1d0, 9982 }, + /*II_0F_C7_06*/{ 0x1d2, 10002 }, + /*II_66_0F_C7_06*/{ 0x188, 10011 }, + /*II_F3_0F_C7_06*/{ 0x188, 10020 } +}; + +_InstInfoEx InstInfosEx[381] = { + /*II_69*/{ { 0x34, 117 }, 0x0, 3, 0, 0, 0 }, + /*II_6B*/{ { 0x34, 117 }, 0x0, 5, 0, 0, 0 }, + /*II_98*/{ { 0x4e, 228 }, 0x0, 0, 0, 233, 239 }, + /*II_99*/{ { 0x4e, 245 }, 0x0, 0, 0, 250, 255 }, + /*II_E3*/{ { 0x76, 427 }, 0x0, 0, 0, 433, 440 }, + /*II_0F_A4*/{ { 0xac, 876 }, 0x0, 1, 0, 0, 0 }, + /*II_0F_A5*/{ { 0xac, 876 }, 0x0, 52, 0, 0, 0 }, + /*II_0F_AC*/{ { 0xac, 892 }, 0x0, 1, 0, 0, 0 }, + /*II_0F_AD*/{ { 0xac, 892 }, 0x0, 52, 0, 0, 0 }, + /*II_V_0F_10*/{ { 0x126, 2139 }, 0x41, 0, 0, 0, 0 }, + /*II_V_66_0F_10*/{ { 0x126, 2148 }, 0x41, 0, 0, 0, 0 }, + /*II_V_F3_0F_10*/{ { 0x127, 2157 }, 0x20, 69, 0, 0, 0 }, + /*II_V_F2_0F_10*/{ { 0x127, 2165 }, 0x20, 69, 0, 0, 0 }, + /*II_VRR_F3_0F_10*/{ { 0x128, 2157 }, 0x60, 0, 0, 0, 0 }, + /*II_VRR_F2_0F_10*/{ { 0x129, 2165 }, 0x60, 0, 0, 0, 0 }, + /*II_V_0F_11*/{ { 0x12e, 2139 }, 0x41, 0, 0, 0, 0 }, + /*II_V_66_0F_11*/{ { 0x12e, 2148 }, 0x41, 0, 0, 0, 0 }, + /*II_V_F3_0F_11*/{ { 0x127, 2157 }, 0x20, 69, 0, 0, 0 }, + /*II_V_F2_0F_11*/{ { 0x127, 2165 }, 0x20, 69, 0, 0, 0 }, + /*II_VRR_F3_0F_11*/{ { 0x12f, 2157 }, 0x60, 0, 0, 0, 0 }, + /*II_VRR_F2_0F_11*/{ { 0x130, 2165 }, 0x60, 0, 0, 0, 0 }, + /*II_0F_12*/{ { 0x131, 2173 }, 0x0, 0, 0, 2182, 0 }, + /*II_V_0F_12*/{ { 0x134, 2217 }, 0x0, 72, 0, 2227, 0 }, + /*II_V_66_0F_12*/{ { 0x135, 2236 }, 0x0, 46, 0, 0, 0 }, + /*II_V_F3_0F_12*/{ { 0x126, 2245 }, 0x41, 0, 0, 0, 0 }, + /*II_V_F2_0F_12*/{ { 0x136, 2256 }, 0x41, 0, 0, 0, 0 }, + /*II_V_0F_13*/{ { 0x139, 2227 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_13*/{ { 0x139, 2236 }, 0x40, 0, 0, 0, 0 }, + /*II_V_0F_14*/{ { 0x13c, 2286 }, 0x1, 90, 0, 0, 0 }, + /*II_V_66_0F_14*/{ { 0x13c, 2297 }, 0x1, 90, 0, 0, 0 }, + /*II_V_0F_15*/{ { 0x13c, 2328 }, 0x1, 90, 0, 0, 0 }, + /*II_V_66_0F_15*/{ { 0x13c, 2339 }, 0x1, 90, 0, 0, 0 }, + /*II_0F_16*/{ { 0x131, 2350 }, 0x0, 0, 0, 2359, 0 }, + /*II_V_0F_16*/{ { 0x134, 2385 }, 0x0, 72, 0, 2395, 0 }, + /*II_V_66_0F_16*/{ { 0x135, 2404 }, 0x0, 46, 0, 0, 0 }, + /*II_V_F3_0F_16*/{ { 0x126, 2413 }, 0x41, 0, 0, 0, 0 }, + /*II_V_0F_17*/{ { 0x139, 2395 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_17*/{ { 0x139, 2404 }, 0x40, 0, 0, 0, 0 }, + /*II_V_0F_28*/{ { 0x126, 2489 }, 0x41, 0, 0, 0, 0 }, + /*II_V_66_0F_28*/{ { 0x126, 2498 }, 0x41, 0, 0, 0, 0 }, + /*II_V_0F_29*/{ { 0x12e, 2489 }, 0x41, 0, 0, 0, 0 }, + /*II_V_66_0F_29*/{ { 0x12e, 2498 }, 0x41, 0, 0, 0, 0 }, + /*II_V_F3_0F_2A*/{ { 0x135, 2547 }, 0x2, 79, 0, 0, 0 }, + /*II_V_F2_0F_2A*/{ { 0x135, 2558 }, 0x2, 79, 0, 0, 0 }, + /*II_V_0F_2B*/{ { 0x147, 2605 }, 0x41, 0, 0, 0, 0 }, + /*II_V_66_0F_2B*/{ { 0x147, 2615 }, 0x41, 0, 0, 0, 0 }, + /*II_V_F3_0F_2C*/{ { 0x14c, 2669 }, 0x42, 0, 0, 0, 0 }, + /*II_V_F2_0F_2C*/{ { 0x14c, 2681 }, 0x42, 0, 0, 0, 0 }, + /*II_V_F3_0F_2D*/{ { 0x14c, 2733 }, 0x42, 0, 0, 0, 0 }, + /*II_V_F2_0F_2D*/{ { 0x14c, 2744 }, 0x42, 0, 0, 0, 0 }, + /*II_V_0F_2E*/{ { 0x14f, 2773 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_2E*/{ { 0x150, 2783 }, 0x40, 0, 0, 0, 0 }, + /*II_V_0F_2F*/{ { 0x14f, 2809 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_2F*/{ { 0x150, 2818 }, 0x40, 0, 0, 0, 0 }, + /*II_V_0F_50*/{ { 0x153, 2847 }, 0x41, 0, 0, 0, 0 }, + /*II_V_66_0F_50*/{ { 0x153, 2858 }, 0x41, 0, 0, 0, 0 }, + /*II_V_0F_51*/{ { 0x126, 2901 }, 0x41, 0, 0, 0, 0 }, + /*II_V_66_0F_51*/{ { 0x126, 2910 }, 0x41, 0, 0, 0, 0 }, + /*II_V_F3_0F_51*/{ { 0x135, 2919 }, 0x0, 71, 0, 0, 0 }, + /*II_V_F2_0F_51*/{ { 0x135, 2928 }, 0x0, 72, 0, 0, 0 }, + /*II_V_0F_52*/{ { 0x126, 2955 }, 0x41, 0, 0, 0, 0 }, + /*II_V_F3_0F_52*/{ { 0x135, 2965 }, 0x0, 71, 0, 0, 0 }, + /*II_V_0F_53*/{ { 0x126, 2989 }, 0x41, 0, 0, 0, 0 }, + /*II_V_F3_0F_53*/{ { 0x135, 2997 }, 0x0, 71, 0, 0, 0 }, + /*II_V_0F_54*/{ { 0x13c, 3019 }, 0x1, 90, 0, 0, 0 }, + /*II_V_66_0F_54*/{ { 0x13c, 3027 }, 0x1, 90, 0, 0, 0 }, + /*II_V_0F_55*/{ { 0x13c, 3051 }, 0x1, 90, 0, 0, 0 }, + /*II_V_66_0F_55*/{ { 0x13c, 3060 }, 0x1, 90, 0, 0, 0 }, + /*II_V_0F_56*/{ { 0x13c, 3081 }, 0x1, 90, 0, 0, 0 }, + /*II_V_66_0F_56*/{ { 0x13c, 3088 }, 0x1, 90, 0, 0, 0 }, + /*II_V_0F_57*/{ { 0x13c, 3109 }, 0x1, 90, 0, 0, 0 }, + /*II_V_66_0F_57*/{ { 0x13c, 3117 }, 0x1, 90, 0, 0, 0 }, + /*II_V_0F_58*/{ { 0x13c, 3153 }, 0x1, 90, 0, 0, 0 }, + /*II_V_66_0F_58*/{ { 0x13c, 3161 }, 0x1, 90, 0, 0, 0 }, + /*II_V_F3_0F_58*/{ { 0x135, 3169 }, 0x0, 71, 0, 0, 0 }, + /*II_V_F2_0F_58*/{ { 0x135, 3177 }, 0x0, 72, 0, 0, 0 }, + /*II_V_0F_59*/{ { 0x13c, 3213 }, 0x1, 90, 0, 0, 0 }, + /*II_V_66_0F_59*/{ { 0x13c, 3221 }, 0x1, 90, 0, 0, 0 }, + /*II_V_F3_0F_59*/{ { 0x135, 3229 }, 0x0, 71, 0, 0, 0 }, + /*II_V_F2_0F_59*/{ { 0x135, 3237 }, 0x0, 72, 0, 0, 0 }, + /*II_V_0F_5A*/{ { 0x156, 3285 }, 0x41, 0, 0, 0, 0 }, + /*II_V_66_0F_5A*/{ { 0x157, 3296 }, 0x41, 0, 0, 0, 0 }, + /*II_V_F3_0F_5A*/{ { 0x135, 3307 }, 0x0, 71, 0, 0, 0 }, + /*II_V_F2_0F_5A*/{ { 0x135, 3318 }, 0x0, 72, 0, 0, 0 }, + /*II_V_0F_5B*/{ { 0x126, 3360 }, 0x41, 0, 0, 0, 0 }, + /*II_V_66_0F_5B*/{ { 0x126, 3371 }, 0x41, 0, 0, 0, 0 }, + /*II_V_F3_0F_5B*/{ { 0x126, 3382 }, 0x41, 0, 0, 0, 0 }, + /*II_V_0F_5C*/{ { 0x13c, 3422 }, 0x1, 90, 0, 0, 0 }, + /*II_V_66_0F_5C*/{ { 0x13c, 3430 }, 0x1, 90, 0, 0, 0 }, + /*II_V_F3_0F_5C*/{ { 0x135, 3438 }, 0x0, 71, 0, 0, 0 }, + /*II_V_F2_0F_5C*/{ { 0x135, 3446 }, 0x0, 72, 0, 0, 0 }, + /*II_V_0F_5D*/{ { 0x13c, 3482 }, 0x1, 90, 0, 0, 0 }, + /*II_V_66_0F_5D*/{ { 0x13c, 3490 }, 0x1, 90, 0, 0, 0 }, + /*II_V_F3_0F_5D*/{ { 0x135, 3498 }, 0x0, 71, 0, 0, 0 }, + /*II_V_F2_0F_5D*/{ { 0x135, 3506 }, 0x0, 72, 0, 0, 0 }, + /*II_V_0F_5E*/{ { 0x13c, 3542 }, 0x1, 90, 0, 0, 0 }, + /*II_V_66_0F_5E*/{ { 0x13c, 3550 }, 0x1, 90, 0, 0, 0 }, + /*II_V_F3_0F_5E*/{ { 0x135, 3558 }, 0x0, 71, 0, 0, 0 }, + /*II_V_F2_0F_5E*/{ { 0x135, 3566 }, 0x0, 72, 0, 0, 0 }, + /*II_V_0F_5F*/{ { 0x13c, 3602 }, 0x1, 90, 0, 0, 0 }, + /*II_V_66_0F_5F*/{ { 0x13c, 3610 }, 0x1, 90, 0, 0, 0 }, + /*II_V_F3_0F_5F*/{ { 0x135, 3618 }, 0x0, 71, 0, 0, 0 }, + /*II_V_F2_0F_5F*/{ { 0x135, 3626 }, 0x0, 72, 0, 0, 0 }, + /*II_V_66_0F_60*/{ { 0x135, 3645 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_61*/{ { 0x135, 3668 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_62*/{ { 0x135, 3691 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_63*/{ { 0x135, 3713 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_64*/{ { 0x135, 3733 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_65*/{ { 0x135, 3752 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_66*/{ { 0x135, 3771 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_67*/{ { 0x135, 3791 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_68*/{ { 0x135, 3813 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_69*/{ { 0x135, 3836 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_6A*/{ { 0x135, 3859 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_6B*/{ { 0x135, 3881 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_6C*/{ { 0x135, 3904 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_6D*/{ { 0x135, 3929 }, 0x0, 73, 0, 0, 0 }, + /*II_0F_6E*/{ { 0x15a, 3942 }, 0x0, 0, 0, 0, 3948 }, + /*II_66_0F_6E*/{ { 0x15b, 3942 }, 0x0, 0, 0, 0, 3948 }, + /*II_V_66_0F_6E*/{ { 0x15c, 3954 }, 0x46, 0, 0, 3961, 0 }, + /*II_V_66_0F_6F*/{ { 0x126, 3984 }, 0x41, 0, 0, 0, 0 }, + /*II_V_F3_0F_6F*/{ { 0x126, 3993 }, 0x41, 0, 0, 0, 0 }, + /*II_0F_70*/{ { 0x15e, 4002 }, 0x0, 1, 0, 0, 0 }, + /*II_66_0F_70*/{ { 0x15f, 4010 }, 0x0, 1, 0, 0, 0 }, + /*II_F3_0F_70*/{ { 0x15f, 4018 }, 0x0, 1, 0, 0, 0 }, + /*II_F2_0F_70*/{ { 0x15f, 4027 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_70*/{ { 0x160, 4036 }, 0x40, 1, 0, 0, 0 }, + /*II_V_F3_0F_70*/{ { 0x160, 4045 }, 0x40, 1, 0, 0, 0 }, + /*II_V_F2_0F_70*/{ { 0x160, 4055 }, 0x40, 1, 0, 0, 0 }, + /*II_V_66_0F_74*/{ { 0x135, 4074 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_75*/{ { 0x135, 4093 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_76*/{ { 0x135, 4112 }, 0x0, 73, 0, 0, 0 }, + /*II_V_0F_77*/{ { 0x162, 4128 }, 0x49, 0, 0, 4140, 0 }, + /*II_66_0F_78*/{ { 0x164, 4158 }, 0x0, 8, 0, 0, 0 }, + /*II_F2_0F_78*/{ { 0x165, 4165 }, 0x0, 7, 8, 0, 0 }, + /*II_V_66_0F_7C*/{ { 0x13c, 4219 }, 0x1, 90, 0, 0, 0 }, + /*II_V_F2_0F_7C*/{ { 0x13c, 4228 }, 0x1, 90, 0, 0, 0 }, + /*II_V_66_0F_7D*/{ { 0x13c, 4253 }, 0x1, 90, 0, 0, 0 }, + /*II_V_F2_0F_7D*/{ { 0x13c, 4262 }, 0x1, 90, 0, 0, 0 }, + /*II_0F_7E*/{ { 0x16c, 3942 }, 0x0, 0, 0, 0, 3948 }, + /*II_66_0F_7E*/{ { 0x16d, 3942 }, 0x0, 0, 0, 0, 3948 }, + /*II_V_66_0F_7E*/{ { 0x16e, 3954 }, 0x46, 0, 0, 3961, 0 }, + /*II_V_F3_0F_7E*/{ { 0x150, 3961 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_7F*/{ { 0x12e, 3984 }, 0x41, 0, 0, 0, 0 }, + /*II_V_F3_0F_7F*/{ { 0x12e, 3993 }, 0x41, 0, 0, 0, 0 }, + /*II_0F_AE_04*/{ { 0x170, 4271 }, 0x0, 0, 0, 0, 4278 }, + /*II_0F_AE_05*/{ { 0x171, 4287 }, 0x0, 0, 0, 4295, 4303 }, + /*II_0F_AE_06*/{ { 0x171, 4313 }, 0x0, 0, 0, 4321, 4331 }, + /*II_0F_AE_07*/{ { 0x172, 4343 }, 0x0, 0, 0, 4351, 0 }, + /*II_0F_C2*/{ { 0x179, 4392 }, 0x0, 0, 0, 4401, 4410 }, + /*II_66_0F_C2*/{ { 0x17a, 4471 }, 0x0, 0, 0, 4480, 4489 }, + /*II_F3_0F_C2*/{ { 0x17b, 4550 }, 0x0, 0, 0, 4559, 4568 }, + /*II_F2_0F_C2*/{ { 0x17c, 4629 }, 0x0, 0, 0, 4638, 4647 }, + /*II_V_0F_C2*/{ { 0x17d, 4708 }, 0x1, 90, 0, 4718, 4728 }, + /*II_V_66_0F_C2*/{ { 0x17d, 5110 }, 0x1, 90, 0, 5120, 5130 }, + /*II_V_F3_0F_C2*/{ { 0x17e, 5512 }, 0x0, 71, 0, 5522, 5532 }, + /*II_V_F2_0F_C2*/{ { 0x17e, 5914 }, 0x0, 72, 0, 5924, 5934 }, + /*II_0F_C4*/{ { 0x17f, 6316 }, 0x0, 1, 0, 0, 0 }, + /*II_66_0F_C4*/{ { 0x180, 6316 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_C4*/{ { 0x181, 6324 }, 0x0, 25, 1, 0, 0 }, + /*II_0F_C5*/{ { 0x182, 6333 }, 0x0, 1, 0, 0, 0 }, + /*II_66_0F_C5*/{ { 0x183, 6333 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_C5*/{ { 0x184, 6341 }, 0x40, 1, 0, 0, 0 }, + /*II_0F_C6*/{ { 0x185, 6350 }, 0x0, 1, 0, 0, 0 }, + /*II_66_0F_C6*/{ { 0x15f, 6358 }, 0x0, 1, 0, 0, 0 }, + /*II_V_0F_C6*/{ { 0x186, 6366 }, 0x1, 90, 1, 0, 0 }, + /*II_V_66_0F_C6*/{ { 0x186, 6375 }, 0x1, 90, 1, 0, 0 }, + /*II_0F_C7_01*/{ { 0x187, 6384 }, 0x0, 0, 0, 0, 6395 }, + /*II_V_66_0F_D0*/{ { 0x13c, 6436 }, 0x1, 90, 0, 0, 0 }, + /*II_V_F2_0F_D0*/{ { 0x13c, 6447 }, 0x1, 90, 0, 0, 0 }, + /*II_V_66_0F_D1*/{ { 0x135, 6465 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_D2*/{ { 0x135, 6480 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_D3*/{ { 0x135, 6495 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_D4*/{ { 0x135, 6510 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_D5*/{ { 0x135, 6526 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_D6*/{ { 0x18b, 3961 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_D7*/{ { 0x18e, 6563 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_D8*/{ { 0x135, 6583 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_D9*/{ { 0x135, 6602 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_DA*/{ { 0x135, 6620 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_DB*/{ { 0x135, 6635 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_DC*/{ { 0x135, 6651 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_DD*/{ { 0x135, 6651 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_DE*/{ { 0x135, 6678 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_DF*/{ { 0x135, 6694 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_E0*/{ { 0x135, 6709 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_E1*/{ { 0x135, 6724 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_E2*/{ { 0x135, 6739 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_E3*/{ { 0x135, 6754 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_E4*/{ { 0x135, 6771 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_E5*/{ { 0x135, 6789 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_E6*/{ { 0x157, 6829 }, 0x41, 0, 0, 0, 0 }, + /*II_V_F3_0F_E6*/{ { 0x156, 6841 }, 0x41, 0, 0, 0, 0 }, + /*II_V_F2_0F_E6*/{ { 0x157, 6852 }, 0x41, 0, 0, 0, 0 }, + /*II_V_66_0F_E7*/{ { 0x147, 6880 }, 0x41, 0, 0, 0, 0 }, + /*II_V_66_0F_E8*/{ { 0x135, 6898 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_E9*/{ { 0x135, 6915 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_EA*/{ { 0x135, 6932 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_EB*/{ { 0x135, 6946 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_EC*/{ { 0x135, 6960 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_ED*/{ { 0x135, 6977 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_EE*/{ { 0x135, 6994 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_EF*/{ { 0x135, 7009 }, 0x0, 73, 0, 0, 0 }, + /*II_V_F2_0F_F0*/{ { 0x192, 7023 }, 0x41, 0, 0, 0, 0 }, + /*II_V_66_0F_F1*/{ { 0x135, 7038 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_F2*/{ { 0x135, 7053 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_F3*/{ { 0x135, 7068 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_F4*/{ { 0x135, 7085 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_F5*/{ { 0x135, 7104 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_F6*/{ { 0x135, 7122 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_F7*/{ { 0x196, 7153 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_F8*/{ { 0x135, 7173 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_F9*/{ { 0x135, 7188 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_FA*/{ { 0x135, 7203 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_FB*/{ { 0x135, 7218 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_FC*/{ { 0x135, 7233 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_FD*/{ { 0x135, 7248 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_FE*/{ { 0x135, 7263 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_00*/{ { 0x135, 7371 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_01*/{ { 0x135, 7388 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_02*/{ { 0x135, 7405 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_03*/{ { 0x135, 7423 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_04*/{ { 0x135, 7444 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_05*/{ { 0x135, 7464 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_06*/{ { 0x135, 7481 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_07*/{ { 0x135, 7499 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_08*/{ { 0x135, 7517 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_09*/{ { 0x135, 7534 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_0A*/{ { 0x135, 7551 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_0B*/{ { 0x135, 7570 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_0C*/{ { 0x13c, 7581 }, 0x1, 90, 0, 0, 0 }, + /*II_V_66_0F_38_0D*/{ { 0x13c, 7592 }, 0x1, 90, 0, 0, 0 }, + /*II_V_66_0F_38_0E*/{ { 0x126, 7603 }, 0x41, 0, 0, 0, 0 }, + /*II_V_66_0F_38_0F*/{ { 0x126, 7612 }, 0x41, 0, 0, 0, 0 }, + /*II_66_0F_38_10*/{ { 0x19f, 7621 }, 0x0, 74, 0, 0, 0 }, + /*II_66_0F_38_14*/{ { 0x19f, 7631 }, 0x0, 74, 0, 0, 0 }, + /*II_66_0F_38_15*/{ { 0x19f, 7641 }, 0x0, 74, 0, 0, 0 }, + /*II_V_66_0F_38_17*/{ { 0x126, 7658 }, 0x41, 0, 0, 0, 0 }, + /*II_V_66_0F_38_18*/{ { 0x1a1, 7666 }, 0x41, 0, 0, 0, 0 }, + /*II_V_66_0F_38_19*/{ { 0x1a2, 7680 }, 0x50, 0, 0, 0, 0 }, + /*II_V_66_0F_38_1A*/{ { 0x1a3, 7694 }, 0x50, 0, 0, 0, 0 }, + /*II_V_66_0F_38_1C*/{ { 0x1a4, 7717 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_38_1D*/{ { 0x1a4, 7732 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_38_1E*/{ { 0x1a4, 7747 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_38_20*/{ { 0x150, 7765 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_38_21*/{ { 0x14f, 7786 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_38_22*/{ { 0x1a8, 7807 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_38_23*/{ { 0x150, 7828 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_38_24*/{ { 0x14f, 7849 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_38_25*/{ { 0x150, 7870 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_38_28*/{ { 0x135, 7889 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_29*/{ { 0x135, 7907 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_2A*/{ { 0x1ab, 7927 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_38_2B*/{ { 0x135, 7948 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_2C*/{ { 0x13c, 7959 }, 0x1, 92, 0, 0, 0 }, + /*II_V_66_0F_38_2D*/{ { 0x13c, 7971 }, 0x1, 92, 0, 0, 0 }, + /*II_V_66_0F_38_2E*/{ { 0x1ac, 7959 }, 0x1, 83, 0, 0, 0 }, + /*II_V_66_0F_38_2F*/{ { 0x1ac, 7971 }, 0x1, 83, 0, 0, 0 }, + /*II_V_66_0F_38_30*/{ { 0x150, 7993 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_38_31*/{ { 0x14f, 8014 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_38_32*/{ { 0x1a8, 8035 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_38_33*/{ { 0x150, 8056 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_38_34*/{ { 0x14f, 8077 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_38_35*/{ { 0x150, 8098 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_38_37*/{ { 0x135, 8118 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_38*/{ { 0x135, 8136 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_39*/{ { 0x135, 8153 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_3A*/{ { 0x135, 8170 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_3B*/{ { 0x135, 8187 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_3C*/{ { 0x135, 8204 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_3D*/{ { 0x135, 8221 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_3E*/{ { 0x135, 8238 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_3F*/{ { 0x135, 8255 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_40*/{ { 0x135, 8272 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_41*/{ { 0x1a4, 8293 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_38_96*/{ { 0x1ae, 8332 }, 0x7, 90, 0, 8348, 0 }, + /*II_V_66_0F_38_97*/{ { 0x1ae, 8364 }, 0x7, 90, 0, 8380, 0 }, + /*II_V_66_0F_38_98*/{ { 0x1ae, 8396 }, 0x7, 90, 0, 8409, 0 }, + /*II_V_66_0F_38_99*/{ { 0x1af, 8422 }, 0x6, 80, 0, 8435, 0 }, + /*II_V_66_0F_38_9A*/{ { 0x1ae, 8448 }, 0x7, 90, 0, 8461, 0 }, + /*II_V_66_0F_38_9B*/{ { 0x1af, 8474 }, 0x6, 80, 0, 8487, 0 }, + /*II_V_66_0F_38_9C*/{ { 0x1ae, 8500 }, 0x7, 90, 0, 8514, 0 }, + /*II_V_66_0F_38_9D*/{ { 0x1af, 8528 }, 0x6, 80, 0, 8542, 0 }, + /*II_V_66_0F_38_9E*/{ { 0x1ae, 8556 }, 0x7, 90, 0, 8570, 0 }, + /*II_V_66_0F_38_9F*/{ { 0x1af, 8584 }, 0x6, 80, 0, 8598, 0 }, + /*II_V_66_0F_38_A6*/{ { 0x1ae, 8612 }, 0x7, 90, 0, 8628, 0 }, + /*II_V_66_0F_38_A7*/{ { 0x1ae, 8644 }, 0x7, 90, 0, 8660, 0 }, + /*II_V_66_0F_38_A8*/{ { 0x1ae, 8676 }, 0x7, 90, 0, 8689, 0 }, + /*II_V_66_0F_38_A9*/{ { 0x1af, 8702 }, 0x6, 80, 0, 8715, 0 }, + /*II_V_66_0F_38_AA*/{ { 0x1ae, 8728 }, 0x7, 90, 0, 8741, 0 }, + /*II_V_66_0F_38_AB*/{ { 0x1af, 8754 }, 0x6, 80, 0, 8767, 0 }, + /*II_V_66_0F_38_AC*/{ { 0x1ae, 8780 }, 0x7, 90, 0, 8794, 0 }, + /*II_V_66_0F_38_AD*/{ { 0x1af, 8808 }, 0x6, 80, 0, 8822, 0 }, + /*II_V_66_0F_38_AE*/{ { 0x1ae, 8836 }, 0x7, 90, 0, 8850, 0 }, + /*II_V_66_0F_38_AF*/{ { 0x1af, 8864 }, 0x6, 80, 0, 8878, 0 }, + /*II_V_66_0F_38_B6*/{ { 0x1ae, 8892 }, 0x7, 90, 0, 8908, 0 }, + /*II_V_66_0F_38_B7*/{ { 0x1ae, 8924 }, 0x7, 90, 0, 8940, 0 }, + /*II_V_66_0F_38_B8*/{ { 0x1ae, 8956 }, 0x7, 90, 0, 8969, 0 }, + /*II_V_66_0F_38_B9*/{ { 0x1af, 8982 }, 0x6, 80, 0, 8995, 0 }, + /*II_V_66_0F_38_BA*/{ { 0x1ae, 9008 }, 0x7, 90, 0, 9021, 0 }, + /*II_V_66_0F_38_BB*/{ { 0x1af, 9034 }, 0x6, 80, 0, 9047, 0 }, + /*II_V_66_0F_38_BC*/{ { 0x1ae, 9060 }, 0x7, 90, 0, 9074, 0 }, + /*II_V_66_0F_38_BD*/{ { 0x1af, 9088 }, 0x6, 80, 0, 9102, 0 }, + /*II_V_66_0F_38_BE*/{ { 0x1ae, 9116 }, 0x7, 90, 0, 9130, 0 }, + /*II_V_66_0F_38_BF*/{ { 0x1af, 9144 }, 0x6, 80, 0, 9158, 0 }, + /*II_V_66_0F_38_DB*/{ { 0x1b1, 9180 }, 0x40, 0, 0, 0, 0 }, + /*II_V_66_0F_38_DC*/{ { 0x1b2, 9197 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_DD*/{ { 0x1b2, 9218 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_DE*/{ { 0x1b2, 9239 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_38_DF*/{ { 0x1b2, 9260 }, 0x0, 73, 0, 0, 0 }, + /*II_V_66_0F_3A_04*/{ { 0x1b7, 7581 }, 0x41, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_05*/{ { 0x1b7, 7592 }, 0x41, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_06*/{ { 0x1b8, 9287 }, 0x10, 86, 1, 0, 0 }, + /*II_66_0F_3A_08*/{ { 0x19f, 9299 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_08*/{ { 0x1b7, 9308 }, 0x41, 1, 0, 0, 0 }, + /*II_66_0F_3A_09*/{ { 0x19f, 9318 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_09*/{ { 0x1b7, 9327 }, 0x41, 1, 0, 0, 0 }, + /*II_66_0F_3A_0A*/{ { 0x1b9, 9337 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_0A*/{ { 0x181, 9346 }, 0x0, 71, 1, 0, 0 }, + /*II_66_0F_3A_0B*/{ { 0x1ba, 9356 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_0B*/{ { 0x181, 9365 }, 0x0, 72, 1, 0, 0 }, + /*II_66_0F_3A_0C*/{ { 0x19f, 9375 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_0C*/{ { 0x186, 9384 }, 0x1, 90, 1, 0, 0 }, + /*II_66_0F_3A_0D*/{ { 0x19f, 9394 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_0D*/{ { 0x186, 9403 }, 0x1, 90, 1, 0, 0 }, + /*II_66_0F_3A_0E*/{ { 0x19f, 9413 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_0E*/{ { 0x181, 9422 }, 0x0, 73, 1, 0, 0 }, + /*II_0F_3A_0F*/{ { 0x1bb, 9432 }, 0x0, 1, 0, 0, 0 }, + /*II_66_0F_3A_0F*/{ { 0x1bc, 9432 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_0F*/{ { 0x181, 9441 }, 0x0, 73, 1, 0, 0 }, + /*II_66_0F_3A_14*/{ { 0x1bd, 9451 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_14*/{ { 0x1be, 9459 }, 0x40, 1, 0, 0, 0 }, + /*II_66_0F_3A_15*/{ { 0x1bf, 6333 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_15*/{ { 0x1c0, 6341 }, 0x40, 1, 0, 0, 0 }, + /*II_66_0F_3A_16*/{ { 0x1c1, 9468 }, 0x0, 1, 0, 0, 9476 }, + /*II_V_66_0F_3A_16*/{ { 0x1c2, 9484 }, 0x46, 1, 0, 9493, 0 }, + /*II_66_0F_3A_17*/{ { 0x1c3, 9502 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_17*/{ { 0x1c4, 9513 }, 0x40, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_18*/{ { 0x1b8, 9525 }, 0x10, 73, 1, 0, 0 }, + /*II_V_66_0F_3A_19*/{ { 0x1c5, 9538 }, 0x50, 1, 0, 0, 0 }, + /*II_66_0F_3A_20*/{ { 0x1c6, 9552 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_20*/{ { 0x181, 9560 }, 0x0, 76, 1, 0, 0 }, + /*II_66_0F_3A_21*/{ { 0x1b9, 9569 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_21*/{ { 0x181, 9579 }, 0x0, 71, 1, 0, 0 }, + /*II_66_0F_3A_22*/{ { 0x1c7, 9590 }, 0x0, 1, 0, 0, 9598 }, + /*II_V_66_0F_3A_22*/{ { 0x181, 9606 }, 0x6, 79, 1, 9615, 0 }, + /*II_66_0F_3A_40*/{ { 0x19f, 9624 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_40*/{ { 0x186, 9630 }, 0x1, 90, 1, 0, 0 }, + /*II_66_0F_3A_41*/{ { 0x19f, 9637 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_41*/{ { 0x181, 9643 }, 0x0, 73, 1, 0, 0 }, + /*II_66_0F_3A_42*/{ { 0x19f, 9650 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_42*/{ { 0x181, 9659 }, 0x0, 73, 1, 0, 0 }, + /*II_66_0F_3A_44*/{ { 0x1c8, 9669 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_44*/{ { 0x1c9, 9680 }, 0x0, 73, 1, 0, 0 }, + /*II_V_66_0F_3A_4A*/{ { 0x186, 9692 }, 0x1, 90, 84, 0, 0 }, + /*II_V_66_0F_3A_4B*/{ { 0x186, 9703 }, 0x1, 90, 84, 0, 0 }, + /*II_V_66_0F_3A_4C*/{ { 0x181, 9714 }, 0x0, 73, 82, 0, 0 }, + /*II_66_0F_3A_60*/{ { 0x1ca, 9725 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_60*/{ { 0x160, 9736 }, 0x40, 1, 0, 0, 0 }, + /*II_66_0F_3A_61*/{ { 0x1ca, 9748 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_61*/{ { 0x160, 9759 }, 0x40, 1, 0, 0, 0 }, + /*II_66_0F_3A_62*/{ { 0x1ca, 9771 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_62*/{ { 0x160, 9782 }, 0x40, 1, 0, 0, 0 }, + /*II_66_0F_3A_63*/{ { 0x1ca, 9794 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_63*/{ { 0x160, 9805 }, 0x40, 1, 0, 0, 0 }, + /*II_66_0F_3A_DF*/{ { 0x1cb, 9817 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_3A_DF*/{ { 0x1cc, 9834 }, 0x40, 1, 0, 0, 0 }, + /*II_V_66_0F_71_02*/{ { 0x1cf, 6465 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_71_04*/{ { 0x1cf, 6724 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_71_06*/{ { 0x1cf, 7038 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_72_02*/{ { 0x1cf, 6480 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_72_04*/{ { 0x1cf, 6739 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_72_06*/{ { 0x1cf, 7053 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_73_02*/{ { 0x1cf, 6495 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_73_03*/{ { 0x1cf, 9860 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_73_06*/{ { 0x1cf, 7068 }, 0x0, 1, 0, 0, 0 }, + /*II_V_66_0F_73_07*/{ { 0x1cf, 9877 }, 0x0, 1, 0, 0, 0 }, + /*II_0F_AE_00*/{ { 0x170, 9886 }, 0x0, 0, 0, 0, 9894 }, + /*II_0F_AE_01*/{ { 0x170, 9914 }, 0x0, 0, 0, 0, 9923 }, + /*II_V_0F_AE_02*/{ { 0x1d1, 9963 }, 0x40, 0, 0, 0, 0 }, + /*II_V_0F_AE_03*/{ { 0x1d1, 9992 }, 0x40, 0, 0, 0, 0 } +}; + +_InstNode InstructionsTree[5688] = { + /* 0 - _00 */ 0x2000, + /* 1 - _01 */ 0x2001, + /* 2 - _02 */ 0x2002, + /* 3 - _03 */ 0x2003, + /* 4 - _04 */ 0x2004, + /* 5 - _05 */ 0x2005, + /* 6 - _06 */ 0x2006, + /* 7 - _07 */ 0x2007, + /* 8 - _08 */ 0x2008, + /* 9 - _09 */ 0x2009, + /* a - _0A */ 0x200a, + /* b - _0B */ 0x200b, + /* c - _0C */ 0x200c, + /* d - _0D */ 0x200d, + /* e - _0E */ 0x200e, + /* f - _0F */ 0x8100, + /* 10 - _10 */ 0x200f, + /* 11 - _11 */ 0x2010, + /* 12 - _12 */ 0x2011, + /* 13 - _13 */ 0x2012, + /* 14 - _14 */ 0x2013, + /* 15 - _15 */ 0x2014, + /* 16 - _16 */ 0x2015, + /* 17 - _17 */ 0x2016, + /* 18 - _18 */ 0x2017, + /* 19 - _19 */ 0x2018, + /* 1a - _1A */ 0x2019, + /* 1b - _1B */ 0x201a, + /* 1c - _1C */ 0x201b, + /* 1d - _1D */ 0x201c, + /* 1e - _1E */ 0x201d, + /* 1f - _1F */ 0x201e, + /* 20 - _20 */ 0x201f, + /* 21 - _21 */ 0x2020, + /* 22 - _22 */ 0x2021, + /* 23 - _23 */ 0x2022, + /* 24 - _24 */ 0x2023, + /* 25 - _25 */ 0x2024, + /* 26 - */ 0, + /* 27 - _27 */ 0x2025, + /* 28 - _28 */ 0x2026, + /* 29 - _29 */ 0x2027, + /* 2a - _2A */ 0x2028, + /* 2b - _2B */ 0x2029, + /* 2c - _2C */ 0x202a, + /* 2d - _2D */ 0x202b, + /* 2e - */ 0, + /* 2f - _2F */ 0x202c, + /* 30 - _30 */ 0x202d, + /* 31 - _31 */ 0x202e, + /* 32 - _32 */ 0x202f, + /* 33 - _33 */ 0x2030, + /* 34 - _34 */ 0x2031, + /* 35 - _35 */ 0x2032, + /* 36 - */ 0, + /* 37 - _37 */ 0x2033, + /* 38 - _38 */ 0x2034, + /* 39 - _39 */ 0x2035, + /* 3a - _3A */ 0x2036, + /* 3b - _3B */ 0x2037, + /* 3c - _3C */ 0x2038, + /* 3d - _3D */ 0x2039, + /* 3e - */ 0, + /* 3f - _3F */ 0x203a, + /* 40 - _40 */ 0x203b, + /* 41 - _40 */ 0x203c, + /* 42 - _40 */ 0x203d, + /* 43 - _40 */ 0x203e, + /* 44 - _40 */ 0x203f, + /* 45 - _40 */ 0x2040, + /* 46 - _40 */ 0x2041, + /* 47 - _40 */ 0x2042, + /* 48 - _48 */ 0x2043, + /* 49 - _48 */ 0x2044, + /* 4a - _48 */ 0x2045, + /* 4b - _48 */ 0x2046, + /* 4c - _48 */ 0x2047, + /* 4d - _48 */ 0x2048, + /* 4e - _48 */ 0x2049, + /* 4f - _48 */ 0x204a, + /* 50 - _50 */ 0x204b, + /* 51 - _50 */ 0x204c, + /* 52 - _50 */ 0x204d, + /* 53 - _50 */ 0x204e, + /* 54 - _50 */ 0x204f, + /* 55 - _50 */ 0x2050, + /* 56 - _50 */ 0x2051, + /* 57 - _50 */ 0x2052, + /* 58 - _58 */ 0x2053, + /* 59 - _58 */ 0x2054, + /* 5a - _58 */ 0x2055, + /* 5b - _58 */ 0x2056, + /* 5c - _58 */ 0x2057, + /* 5d - _58 */ 0x2058, + /* 5e - _58 */ 0x2059, + /* 5f - _58 */ 0x205a, + /* 60 - _60 */ 0x205b, + /* 61 - _61 */ 0x205c, + /* 62 - _62 */ 0x205d, + /* 63 - _63 */ 0x205e, + /* 64 - */ 0, + /* 65 - */ 0, + /* 66 - */ 0, + /* 67 - */ 0, + /* 68 - _68 */ 0x205f, + /* 69 - _69 */ 0x4000, + /* 6a - _6A */ 0x2060, + /* 6b - _6B */ 0x4001, + /* 6c - _6C */ 0x2061, + /* 6d - _6D */ 0x2062, + /* 6e - _6E */ 0x2063, + /* 6f - _6F */ 0x2064, + /* 70 - _70 */ 0x2065, + /* 71 - _71 */ 0x2066, + /* 72 - _72 */ 0x2067, + /* 73 - _73 */ 0x2068, + /* 74 - _74 */ 0x2069, + /* 75 - _75 */ 0x206a, + /* 76 - _76 */ 0x206b, + /* 77 - _77 */ 0x206c, + /* 78 - _78 */ 0x206d, + /* 79 - _79 */ 0x206e, + /* 7a - _7A */ 0x206f, + /* 7b - _7B */ 0x2070, + /* 7c - _7C */ 0x2071, + /* 7d - _7D */ 0x2072, + /* 7e - _7E */ 0x2073, + /* 7f - _7F */ 0x2074, + /* 80 - _80 */ 0x6200, + /* 81 - _81 */ 0x6208, + /* 82 - _82 */ 0x6210, + /* 83 - _83 */ 0x6218, + /* 84 - _84 */ 0x2075, + /* 85 - _85 */ 0x2076, + /* 86 - _86 */ 0x2077, + /* 87 - _87 */ 0x2078, + /* 88 - _88 */ 0x2079, + /* 89 - _89 */ 0x207a, + /* 8a - _8A */ 0x207b, + /* 8b - _8B */ 0x207c, + /* 8c - _8C */ 0x207d, + /* 8d - _8D */ 0x207e, + /* 8e - _8E */ 0x207f, + /* 8f - _8F */ 0x6220, + /* 90 - _90 */ 0x2080, + /* 91 - _91 */ 0x2081, + /* 92 - _92 */ 0x2082, + /* 93 - _93 */ 0x2083, + /* 94 - _94 */ 0x2084, + /* 95 - _95 */ 0x2085, + /* 96 - _96 */ 0x2086, + /* 97 - _97 */ 0x2087, + /* 98 - _98 */ 0x4002, + /* 99 - _99 */ 0x4003, + /* 9a - _9A */ 0x2088, + /* 9b - */ 0, + /* 9c - _9C */ 0x2089, + /* 9d - _9D */ 0x208a, + /* 9e - _9E */ 0x208b, + /* 9f - _9F */ 0x208c, + /* a0 - _A0 */ 0x208d, + /* a1 - _A1 */ 0x208e, + /* a2 - _A2 */ 0x208f, + /* a3 - _A3 */ 0x2090, + /* a4 - _A4 */ 0x2091, + /* a5 - _A5 */ 0x2092, + /* a6 - _A6 */ 0x2093, + /* a7 - _A7 */ 0x2094, + /* a8 - _A8 */ 0x2095, + /* a9 - _A9 */ 0x2096, + /* aa - _AA */ 0x2097, + /* ab - _AB */ 0x2098, + /* ac - _AC */ 0x2099, + /* ad - _AD */ 0x209a, + /* ae - _AE */ 0x209b, + /* af - _AF */ 0x209c, + /* b0 - _B0 */ 0x209d, + /* b1 - _B0 */ 0x209e, + /* b2 - _B0 */ 0x209f, + /* b3 - _B0 */ 0x20a0, + /* b4 - _B0 */ 0x20a1, + /* b5 - _B0 */ 0x20a2, + /* b6 - _B0 */ 0x20a3, + /* b7 - _B0 */ 0x20a4, + /* b8 - _B8 */ 0x20a5, + /* b9 - _B8 */ 0x20a6, + /* ba - _B8 */ 0x20a7, + /* bb - _B8 */ 0x20a8, + /* bc - _B8 */ 0x20a9, + /* bd - _B8 */ 0x20aa, + /* be - _B8 */ 0x20ab, + /* bf - _B8 */ 0x20ac, + /* c0 - _C0 */ 0x6228, + /* c1 - _C1 */ 0x6230, + /* c2 - _C2 */ 0x20ad, + /* c3 - _C3 */ 0x20ae, + /* c4 - _C4 */ 0x20af, + /* c5 - _C5 */ 0x20b0, + /* c6 - _C6 */ 0xa238, + /* c7 - _C7 */ 0xa280, + /* c8 - _C8 */ 0x20b1, + /* c9 - _C9 */ 0x20b2, + /* ca - _CA */ 0x20b3, + /* cb - _CB */ 0x20b4, + /* cc - _CC */ 0x20b5, + /* cd - _CD */ 0x20b6, + /* ce - _CE */ 0x20b7, + /* cf - _CF */ 0x20b8, + /* d0 - _D0 */ 0x62c8, + /* d1 - _D1 */ 0x62d0, + /* d2 - _D2 */ 0x62d8, + /* d3 - _D3 */ 0x62e0, + /* d4 - _D4 */ 0x20b9, + /* d5 - _D5 */ 0x20ba, + /* d6 - _D6 */ 0x20bb, + /* d7 - _D7 */ 0x20bc, + /* d8 - _D8 */ 0xa2e8, + /* d9 - _D9 */ 0xa330, + /* da - _DA */ 0xa378, + /* db - _DB */ 0xa3c0, + /* dc - _DC */ 0xa408, + /* dd - _DD */ 0xa450, + /* de - _DE */ 0xa498, + /* df - _DF */ 0xa4e0, + /* e0 - _E0 */ 0x20bd, + /* e1 - _E1 */ 0x20be, + /* e2 - _E2 */ 0x20bf, + /* e3 - _E3 */ 0x4004, + /* e4 - _E4 */ 0x20c0, + /* e5 - _E5 */ 0x20c1, + /* e6 - _E6 */ 0x20c2, + /* e7 - _E7 */ 0x20c3, + /* e8 - _E8 */ 0x20c4, + /* e9 - _E9 */ 0x20c5, + /* ea - _EA */ 0x20c6, + /* eb - _EB */ 0x20c7, + /* ec - _EC */ 0x20c8, + /* ed - _ED */ 0x20c9, + /* ee - _EE */ 0x20ca, + /* ef - _EF */ 0x20cb, + /* f0 - */ 0, + /* f1 - _F1 */ 0x20cc, + /* f2 - */ 0, + /* f3 - */ 0, + /* f4 - _F4 */ 0x20cd, + /* f5 - _F5 */ 0x20ce, + /* f6 - _F6 */ 0x6528, + /* f7 - _F7 */ 0x6530, + /* f8 - _F8 */ 0x20cf, + /* f9 - _F9 */ 0x20d0, + /* fa - _FA */ 0x20d1, + /* fb - _FB */ 0x20d2, + /* fc - _FC */ 0x20d3, + /* fd - _FD */ 0x20d4, + /* fe - _FE */ 0x6538, + /* ff - _FF */ 0x6540, + /* 100 - _0F_00 */ 0x6548, + /* 101 - _0F_01 */ 0xa550, + /* 102 - _0F_02 */ 0x20d5, + /* 103 - _0F_03 */ 0x20d6, + /* 104 - */ 0, + /* 105 - _0F_05 */ 0x20d7, + /* 106 - _0F_06 */ 0x20d8, + /* 107 - _0F_07 */ 0x20d9, + /* 108 - _0F_08 */ 0x20da, + /* 109 - _0F_09 */ 0x20db, + /* 10a - */ 0, + /* 10b - _0F_0B */ 0x20dc, + /* 10c - */ 0, + /* 10d - _0F_0D */ 0x6598, + /* 10e - _0F_0E */ 0x20dd, + /* 10f - _0F_0F */ 0x85a0, + /* 110 - _0F_10 */ 0xc6a0, + /* 111 - _0F_11 */ 0xc6ac, + /* 112 - _0F_12 */ 0xc6b8, + /* 113 - _0F_13 */ 0xc6c4, + /* 114 - _0F_14 */ 0xc6d0, + /* 115 - _0F_15 */ 0xc6dc, + /* 116 - _0F_16 */ 0xc6e8, + /* 117 - _0F_17 */ 0xc6f4, + /* 118 - _0F_18 */ 0x6700, + /* 119 - */ 0, + /* 11a - */ 0, + /* 11b - */ 0, + /* 11c - */ 0, + /* 11d - */ 0, + /* 11e - */ 0, + /* 11f - _0F_1F */ 0x20de, + /* 120 - _0F_20 */ 0x20df, + /* 121 - _0F_21 */ 0x20e0, + /* 122 - _0F_22 */ 0x20e1, + /* 123 - _0F_23 */ 0x20e2, + /* 124 - */ 0, + /* 125 - */ 0, + /* 126 - */ 0, + /* 127 - */ 0, + /* 128 - _0F_28 */ 0xc708, + /* 129 - _0F_29 */ 0xc714, + /* 12a - _0F_2A */ 0xc720, + /* 12b - _0F_2B */ 0xc72c, + /* 12c - _0F_2C */ 0xc738, + /* 12d - _0F_2D */ 0xc744, + /* 12e - _0F_2E */ 0xc750, + /* 12f - _0F_2F */ 0xc75c, + /* 130 - _0F_30 */ 0x20e3, + /* 131 - _0F_31 */ 0x20e4, + /* 132 - _0F_32 */ 0x20e5, + /* 133 - _0F_33 */ 0x20e6, + /* 134 - _0F_34 */ 0x20e7, + /* 135 - _0F_35 */ 0x20e8, + /* 136 - */ 0, + /* 137 - _0F_37 */ 0x20e9, + /* 138 - _0F_38 */ 0x8768, + /* 139 - */ 0, + /* 13a - _0F_3A */ 0x8868, + /* 13b - */ 0, + /* 13c - */ 0, + /* 13d - */ 0, + /* 13e - */ 0, + /* 13f - */ 0, + /* 140 - _0F_40 */ 0x20ea, + /* 141 - _0F_41 */ 0x20eb, + /* 142 - _0F_42 */ 0x20ec, + /* 143 - _0F_43 */ 0x20ed, + /* 144 - _0F_44 */ 0x20ee, + /* 145 - _0F_45 */ 0x20ef, + /* 146 - _0F_46 */ 0x20f0, + /* 147 - _0F_47 */ 0x20f1, + /* 148 - _0F_48 */ 0x20f2, + /* 149 - _0F_49 */ 0x20f3, + /* 14a - _0F_4A */ 0x20f4, + /* 14b - _0F_4B */ 0x20f5, + /* 14c - _0F_4C */ 0x20f6, + /* 14d - _0F_4D */ 0x20f7, + /* 14e - _0F_4E */ 0x20f8, + /* 14f - _0F_4F */ 0x20f9, + /* 150 - _0F_50 */ 0xc968, + /* 151 - _0F_51 */ 0xc974, + /* 152 - _0F_52 */ 0xc980, + /* 153 - _0F_53 */ 0xc98c, + /* 154 - _0F_54 */ 0xc998, + /* 155 - _0F_55 */ 0xc9a4, + /* 156 - _0F_56 */ 0xc9b0, + /* 157 - _0F_57 */ 0xc9bc, + /* 158 - _0F_58 */ 0xc9c8, + /* 159 - _0F_59 */ 0xc9d4, + /* 15a - _0F_5A */ 0xc9e0, + /* 15b - _0F_5B */ 0xc9ec, + /* 15c - _0F_5C */ 0xc9f8, + /* 15d - _0F_5D */ 0xca04, + /* 15e - _0F_5E */ 0xca10, + /* 15f - _0F_5F */ 0xca1c, + /* 160 - _0F_60 */ 0xca28, + /* 161 - _0F_61 */ 0xca34, + /* 162 - _0F_62 */ 0xca40, + /* 163 - _0F_63 */ 0xca4c, + /* 164 - _0F_64 */ 0xca58, + /* 165 - _0F_65 */ 0xca64, + /* 166 - _0F_66 */ 0xca70, + /* 167 - _0F_67 */ 0xca7c, + /* 168 - _0F_68 */ 0xca88, + /* 169 - _0F_69 */ 0xca94, + /* 16a - _0F_6A */ 0xcaa0, + /* 16b - _0F_6B */ 0xcaac, + /* 16c - _0F_6C */ 0xcab8, + /* 16d - _0F_6D */ 0xcac4, + /* 16e - _0F_6E */ 0xcad0, + /* 16f - _0F_6F */ 0xcadc, + /* 170 - _0F_70 */ 0xcae8, + /* 171 - _0F_71 */ 0x6af4, + /* 172 - _0F_72 */ 0x6afc, + /* 173 - _0F_73 */ 0x6b04, + /* 174 - _0F_74 */ 0xcb0c, + /* 175 - _0F_75 */ 0xcb18, + /* 176 - _0F_76 */ 0xcb24, + /* 177 - _0F_77 */ 0xcb30, + /* 178 - _0F_78 */ 0xcb3c, + /* 179 - _0F_79 */ 0xcb48, + /* 17a - _0F_7A */ 0x8b54, + /* 17b - */ 0, + /* 17c - _0F_7C */ 0xcc54, + /* 17d - _0F_7D */ 0xcc60, + /* 17e - _0F_7E */ 0xcc6c, + /* 17f - _0F_7F */ 0xcc78, + /* 180 - _0F_80 */ 0x20fa, + /* 181 - _0F_81 */ 0x20fb, + /* 182 - _0F_82 */ 0x20fc, + /* 183 - _0F_83 */ 0x20fd, + /* 184 - _0F_84 */ 0x20fe, + /* 185 - _0F_85 */ 0x20ff, + /* 186 - _0F_86 */ 0x2100, + /* 187 - _0F_87 */ 0x2101, + /* 188 - _0F_88 */ 0x2102, + /* 189 - _0F_89 */ 0x2103, + /* 18a - _0F_8A */ 0x2104, + /* 18b - _0F_8B */ 0x2105, + /* 18c - _0F_8C */ 0x2106, + /* 18d - _0F_8D */ 0x2107, + /* 18e - _0F_8E */ 0x2108, + /* 18f - _0F_8F */ 0x2109, + /* 190 - _0F_90 */ 0x210a, + /* 191 - _0F_91 */ 0x210b, + /* 192 - _0F_92 */ 0x210c, + /* 193 - _0F_93 */ 0x210d, + /* 194 - _0F_94 */ 0x210e, + /* 195 - _0F_95 */ 0x210f, + /* 196 - _0F_96 */ 0x2110, + /* 197 - _0F_97 */ 0x2111, + /* 198 - _0F_98 */ 0x2112, + /* 199 - _0F_99 */ 0x2113, + /* 19a - _0F_9A */ 0x2114, + /* 19b - _0F_9B */ 0x2115, + /* 19c - _0F_9C */ 0x2116, + /* 19d - _0F_9D */ 0x2117, + /* 19e - _0F_9E */ 0x2118, + /* 19f - _0F_9F */ 0x2119, + /* 1a0 - _0F_A0 */ 0x211a, + /* 1a1 - _0F_A1 */ 0x211b, + /* 1a2 - _0F_A2 */ 0x211c, + /* 1a3 - _0F_A3 */ 0x211d, + /* 1a4 - _0F_A4 */ 0x4005, + /* 1a5 - _0F_A5 */ 0x4006, + /* 1a6 - */ 0, + /* 1a7 - */ 0, + /* 1a8 - _0F_A8 */ 0x211e, + /* 1a9 - _0F_A9 */ 0x211f, + /* 1aa - _0F_AA */ 0x2120, + /* 1ab - _0F_AB */ 0x2121, + /* 1ac - _0F_AC */ 0x4007, + /* 1ad - _0F_AD */ 0x4008, + /* 1ae - _0F_AE */ 0x6c84, + /* 1af - _0F_AF */ 0x2122, + /* 1b0 - _0F_B0 */ 0x2123, + /* 1b1 - _0F_B1 */ 0x2124, + /* 1b2 - _0F_B2 */ 0x2125, + /* 1b3 - _0F_B3 */ 0x2126, + /* 1b4 - _0F_B4 */ 0x2127, + /* 1b5 - _0F_B5 */ 0x2128, + /* 1b6 - _0F_B6 */ 0x2129, + /* 1b7 - _0F_B7 */ 0x212a, + /* 1b8 - _0F_B8 */ 0xcc8c, + /* 1b9 - _0F_B9 */ 0x212b, + /* 1ba - _0F_BA */ 0x6c98, + /* 1bb - _0F_BB */ 0x212c, + /* 1bc - _0F_BC */ 0xcca0, + /* 1bd - _0F_BD */ 0xccac, + /* 1be - _0F_BE */ 0x212d, + /* 1bf - _0F_BF */ 0x212e, + /* 1c0 - _0F_C0 */ 0x212f, + /* 1c1 - _0F_C1 */ 0x2130, + /* 1c2 - _0F_C2 */ 0xccb8, + /* 1c3 - _0F_C3 */ 0x2131, + /* 1c4 - _0F_C4 */ 0xccc4, + /* 1c5 - _0F_C5 */ 0xccd0, + /* 1c6 - _0F_C6 */ 0xccdc, + /* 1c7 - _0F_C7 */ 0x6ce8, + /* 1c8 - _0F_C8 */ 0x2132, + /* 1c9 - _0F_C8 */ 0x2133, + /* 1ca - _0F_C8 */ 0x2134, + /* 1cb - _0F_C8 */ 0x2135, + /* 1cc - _0F_C8 */ 0x2136, + /* 1cd - _0F_C8 */ 0x2137, + /* 1ce - _0F_C8 */ 0x2138, + /* 1cf - _0F_C8 */ 0x2139, + /* 1d0 - _0F_D0 */ 0xccf0, + /* 1d1 - _0F_D1 */ 0xccfc, + /* 1d2 - _0F_D2 */ 0xcd08, + /* 1d3 - _0F_D3 */ 0xcd14, + /* 1d4 - _0F_D4 */ 0xcd20, + /* 1d5 - _0F_D5 */ 0xcd2c, + /* 1d6 - _0F_D6 */ 0xcd38, + /* 1d7 - _0F_D7 */ 0xcd44, + /* 1d8 - _0F_D8 */ 0xcd50, + /* 1d9 - _0F_D9 */ 0xcd5c, + /* 1da - _0F_DA */ 0xcd68, + /* 1db - _0F_DB */ 0xcd74, + /* 1dc - _0F_DC */ 0xcd80, + /* 1dd - _0F_DD */ 0xcd8c, + /* 1de - _0F_DE */ 0xcd98, + /* 1df - _0F_DF */ 0xcda4, + /* 1e0 - _0F_E0 */ 0xcdb0, + /* 1e1 - _0F_E1 */ 0xcdbc, + /* 1e2 - _0F_E2 */ 0xcdc8, + /* 1e3 - _0F_E3 */ 0xcdd4, + /* 1e4 - _0F_E4 */ 0xcde0, + /* 1e5 - _0F_E5 */ 0xcdec, + /* 1e6 - _0F_E6 */ 0xcdf8, + /* 1e7 - _0F_E7 */ 0xce04, + /* 1e8 - _0F_E8 */ 0xce10, + /* 1e9 - _0F_E9 */ 0xce1c, + /* 1ea - _0F_EA */ 0xce28, + /* 1eb - _0F_EB */ 0xce34, + /* 1ec - _0F_EC */ 0xce40, + /* 1ed - _0F_ED */ 0xce4c, + /* 1ee - _0F_EE */ 0xce58, + /* 1ef - _0F_EF */ 0xce64, + /* 1f0 - _0F_F0 */ 0xce70, + /* 1f1 - _0F_F1 */ 0xce7c, + /* 1f2 - _0F_F2 */ 0xce88, + /* 1f3 - _0F_F3 */ 0xce94, + /* 1f4 - _0F_F4 */ 0xcea0, + /* 1f5 - _0F_F5 */ 0xceac, + /* 1f6 - _0F_F6 */ 0xceb8, + /* 1f7 - _0F_F7 */ 0xcec4, + /* 1f8 - _0F_F8 */ 0xced0, + /* 1f9 - _0F_F9 */ 0xcedc, + /* 1fa - _0F_FA */ 0xcee8, + /* 1fb - _0F_FB */ 0xcef4, + /* 1fc - _0F_FC */ 0xcf00, + /* 1fd - _0F_FD */ 0xcf0c, + /* 1fe - _0F_FE */ 0xcf18, + /* 1ff - */ 0, + /* 200 - _80_00 */ 0x213a, + /* 201 - _80_01 */ 0x213b, + /* 202 - _80_02 */ 0x213c, + /* 203 - _80_03 */ 0x213d, + /* 204 - _80_04 */ 0x213e, + /* 205 - _80_05 */ 0x213f, + /* 206 - _80_06 */ 0x2140, + /* 207 - _80_07 */ 0x2141, + /* 208 - _81_00 */ 0x2142, + /* 209 - _81_01 */ 0x2143, + /* 20a - _81_02 */ 0x2144, + /* 20b - _81_03 */ 0x2145, + /* 20c - _81_04 */ 0x2146, + /* 20d - _81_05 */ 0x2147, + /* 20e - _81_06 */ 0x2148, + /* 20f - _81_07 */ 0x2149, + /* 210 - _82_00 */ 0x214a, + /* 211 - _82_01 */ 0x214b, + /* 212 - _82_02 */ 0x214c, + /* 213 - _82_03 */ 0x214d, + /* 214 - _82_04 */ 0x214e, + /* 215 - _82_05 */ 0x214f, + /* 216 - _82_06 */ 0x2150, + /* 217 - _82_07 */ 0x2151, + /* 218 - _83_00 */ 0x2152, + /* 219 - _83_01 */ 0x2153, + /* 21a - _83_02 */ 0x2154, + /* 21b - _83_03 */ 0x2155, + /* 21c - _83_04 */ 0x2156, + /* 21d - _83_05 */ 0x2157, + /* 21e - _83_06 */ 0x2158, + /* 21f - _83_07 */ 0x2159, + /* 220 - _8F_00 */ 0x215a, + /* 221 - */ 0, + /* 222 - */ 0, + /* 223 - */ 0, + /* 224 - */ 0, + /* 225 - */ 0, + /* 226 - */ 0, + /* 227 - */ 0, + /* 228 - _C0_00 */ 0x215b, + /* 229 - _C0_01 */ 0x215c, + /* 22a - _C0_02 */ 0x215d, + /* 22b - _C0_03 */ 0x215e, + /* 22c - _C0_04 */ 0x215f, + /* 22d - _C0_05 */ 0x2160, + /* 22e - _C0_06 */ 0x2161, + /* 22f - _C0_07 */ 0x2162, + /* 230 - _C1_00 */ 0x2163, + /* 231 - _C1_01 */ 0x2164, + /* 232 - _C1_02 */ 0x2165, + /* 233 - _C1_03 */ 0x2166, + /* 234 - _C1_04 */ 0x2167, + /* 235 - _C1_05 */ 0x2168, + /* 236 - _C1_06 */ 0x2169, + /* 237 - _C1_07 */ 0x216a, + /* 238 - _C6_00 */ 0x216b, + /* 239 - */ 0, + /* 23a - */ 0, + /* 23b - */ 0, + /* 23c - */ 0, + /* 23d - */ 0, + /* 23e - */ 0, + /* 23f - */ 0, + /* 240 - */ 0, + /* 241 - */ 0, + /* 242 - */ 0, + /* 243 - */ 0, + /* 244 - */ 0, + /* 245 - */ 0, + /* 246 - */ 0, + /* 247 - */ 0, + /* 248 - */ 0, + /* 249 - */ 0, + /* 24a - */ 0, + /* 24b - */ 0, + /* 24c - */ 0, + /* 24d - */ 0, + /* 24e - */ 0, + /* 24f - */ 0, + /* 250 - */ 0, + /* 251 - */ 0, + /* 252 - */ 0, + /* 253 - */ 0, + /* 254 - */ 0, + /* 255 - */ 0, + /* 256 - */ 0, + /* 257 - */ 0, + /* 258 - */ 0, + /* 259 - */ 0, + /* 25a - */ 0, + /* 25b - */ 0, + /* 25c - */ 0, + /* 25d - */ 0, + /* 25e - */ 0, + /* 25f - */ 0, + /* 260 - */ 0, + /* 261 - */ 0, + /* 262 - */ 0, + /* 263 - */ 0, + /* 264 - */ 0, + /* 265 - */ 0, + /* 266 - */ 0, + /* 267 - */ 0, + /* 268 - */ 0, + /* 269 - */ 0, + /* 26a - */ 0, + /* 26b - */ 0, + /* 26c - */ 0, + /* 26d - */ 0, + /* 26e - */ 0, + /* 26f - */ 0, + /* 270 - */ 0, + /* 271 - */ 0, + /* 272 - */ 0, + /* 273 - */ 0, + /* 274 - */ 0, + /* 275 - */ 0, + /* 276 - */ 0, + /* 277 - */ 0, + /* 278 - _C6_F8 */ 0x216c, + /* 279 - */ 0, + /* 27a - */ 0, + /* 27b - */ 0, + /* 27c - */ 0, + /* 27d - */ 0, + /* 27e - */ 0, + /* 27f - */ 0, + /* 280 - _C7_00 */ 0x216d, + /* 281 - */ 0, + /* 282 - */ 0, + /* 283 - */ 0, + /* 284 - */ 0, + /* 285 - */ 0, + /* 286 - */ 0, + /* 287 - */ 0, + /* 288 - */ 0, + /* 289 - */ 0, + /* 28a - */ 0, + /* 28b - */ 0, + /* 28c - */ 0, + /* 28d - */ 0, + /* 28e - */ 0, + /* 28f - */ 0, + /* 290 - */ 0, + /* 291 - */ 0, + /* 292 - */ 0, + /* 293 - */ 0, + /* 294 - */ 0, + /* 295 - */ 0, + /* 296 - */ 0, + /* 297 - */ 0, + /* 298 - */ 0, + /* 299 - */ 0, + /* 29a - */ 0, + /* 29b - */ 0, + /* 29c - */ 0, + /* 29d - */ 0, + /* 29e - */ 0, + /* 29f - */ 0, + /* 2a0 - */ 0, + /* 2a1 - */ 0, + /* 2a2 - */ 0, + /* 2a3 - */ 0, + /* 2a4 - */ 0, + /* 2a5 - */ 0, + /* 2a6 - */ 0, + /* 2a7 - */ 0, + /* 2a8 - */ 0, + /* 2a9 - */ 0, + /* 2aa - */ 0, + /* 2ab - */ 0, + /* 2ac - */ 0, + /* 2ad - */ 0, + /* 2ae - */ 0, + /* 2af - */ 0, + /* 2b0 - */ 0, + /* 2b1 - */ 0, + /* 2b2 - */ 0, + /* 2b3 - */ 0, + /* 2b4 - */ 0, + /* 2b5 - */ 0, + /* 2b6 - */ 0, + /* 2b7 - */ 0, + /* 2b8 - */ 0, + /* 2b9 - */ 0, + /* 2ba - */ 0, + /* 2bb - */ 0, + /* 2bc - */ 0, + /* 2bd - */ 0, + /* 2be - */ 0, + /* 2bf - */ 0, + /* 2c0 - _C7_F8 */ 0x216e, + /* 2c1 - */ 0, + /* 2c2 - */ 0, + /* 2c3 - */ 0, + /* 2c4 - */ 0, + /* 2c5 - */ 0, + /* 2c6 - */ 0, + /* 2c7 - */ 0, + /* 2c8 - _D0_00 */ 0x216f, + /* 2c9 - _D0_01 */ 0x2170, + /* 2ca - _D0_02 */ 0x2171, + /* 2cb - _D0_03 */ 0x2172, + /* 2cc - _D0_04 */ 0x2173, + /* 2cd - _D0_05 */ 0x2174, + /* 2ce - _D0_06 */ 0x2175, + /* 2cf - _D0_07 */ 0x2176, + /* 2d0 - _D1_00 */ 0x2177, + /* 2d1 - _D1_01 */ 0x2178, + /* 2d2 - _D1_02 */ 0x2179, + /* 2d3 - _D1_03 */ 0x217a, + /* 2d4 - _D1_04 */ 0x217b, + /* 2d5 - _D1_05 */ 0x217c, + /* 2d6 - _D1_06 */ 0x217d, + /* 2d7 - _D1_07 */ 0x217e, + /* 2d8 - _D2_00 */ 0x217f, + /* 2d9 - _D2_01 */ 0x2180, + /* 2da - _D2_02 */ 0x2181, + /* 2db - _D2_03 */ 0x2182, + /* 2dc - _D2_04 */ 0x2183, + /* 2dd - _D2_05 */ 0x2184, + /* 2de - _D2_06 */ 0x2185, + /* 2df - _D2_07 */ 0x2186, + /* 2e0 - _D3_00 */ 0x2187, + /* 2e1 - _D3_01 */ 0x2188, + /* 2e2 - _D3_02 */ 0x2189, + /* 2e3 - _D3_03 */ 0x218a, + /* 2e4 - _D3_04 */ 0x218b, + /* 2e5 - _D3_05 */ 0x218c, + /* 2e6 - _D3_06 */ 0x218d, + /* 2e7 - _D3_07 */ 0x218e, + /* 2e8 - _D8_00 */ 0x218f, + /* 2e9 - _D8_01 */ 0x2190, + /* 2ea - _D8_02 */ 0x2191, + /* 2eb - _D8_03 */ 0x2192, + /* 2ec - _D8_04 */ 0x2193, + /* 2ed - _D8_05 */ 0x2194, + /* 2ee - _D8_06 */ 0x2195, + /* 2ef - _D8_07 */ 0x2196, + /* 2f0 - _D8_C0 */ 0x2197, + /* 2f1 - _D8_C0 */ 0x2198, + /* 2f2 - _D8_C0 */ 0x2199, + /* 2f3 - _D8_C0 */ 0x219a, + /* 2f4 - _D8_C0 */ 0x219b, + /* 2f5 - _D8_C0 */ 0x219c, + /* 2f6 - _D8_C0 */ 0x219d, + /* 2f7 - _D8_C0 */ 0x219e, + /* 2f8 - _D8_C8 */ 0x219f, + /* 2f9 - _D8_C8 */ 0x21a0, + /* 2fa - _D8_C8 */ 0x21a1, + /* 2fb - _D8_C8 */ 0x21a2, + /* 2fc - _D8_C8 */ 0x21a3, + /* 2fd - _D8_C8 */ 0x21a4, + /* 2fe - _D8_C8 */ 0x21a5, + /* 2ff - _D8_C8 */ 0x21a6, + /* 300 - _D8_D0 */ 0x21a7, + /* 301 - _D8_D0 */ 0x21a8, + /* 302 - _D8_D0 */ 0x21a9, + /* 303 - _D8_D0 */ 0x21aa, + /* 304 - _D8_D0 */ 0x21ab, + /* 305 - _D8_D0 */ 0x21ac, + /* 306 - _D8_D0 */ 0x21ad, + /* 307 - _D8_D0 */ 0x21ae, + /* 308 - _D8_D8 */ 0x21af, + /* 309 - _D8_D9 */ 0x21b0, + /* 30a - _D8_D8 */ 0x21b1, + /* 30b - _D8_D8 */ 0x21b2, + /* 30c - _D8_D8 */ 0x21b3, + /* 30d - _D8_D8 */ 0x21b4, + /* 30e - _D8_D8 */ 0x21b5, + /* 30f - _D8_D8 */ 0x21b6, + /* 310 - _D8_E0 */ 0x21b7, + /* 311 - _D8_E0 */ 0x21b8, + /* 312 - _D8_E0 */ 0x21b9, + /* 313 - _D8_E0 */ 0x21ba, + /* 314 - _D8_E0 */ 0x21bb, + /* 315 - _D8_E0 */ 0x21bc, + /* 316 - _D8_E0 */ 0x21bd, + /* 317 - _D8_E0 */ 0x21be, + /* 318 - _D8_E8 */ 0x21bf, + /* 319 - _D8_E8 */ 0x21c0, + /* 31a - _D8_E8 */ 0x21c1, + /* 31b - _D8_E8 */ 0x21c2, + /* 31c - _D8_E8 */ 0x21c3, + /* 31d - _D8_E8 */ 0x21c4, + /* 31e - _D8_E8 */ 0x21c5, + /* 31f - _D8_E8 */ 0x21c6, + /* 320 - _D8_F0 */ 0x21c7, + /* 321 - _D8_F0 */ 0x21c8, + /* 322 - _D8_F0 */ 0x21c9, + /* 323 - _D8_F0 */ 0x21ca, + /* 324 - _D8_F0 */ 0x21cb, + /* 325 - _D8_F0 */ 0x21cc, + /* 326 - _D8_F0 */ 0x21cd, + /* 327 - _D8_F0 */ 0x21ce, + /* 328 - _D8_F8 */ 0x21cf, + /* 329 - _D8_F8 */ 0x21d0, + /* 32a - _D8_F8 */ 0x21d1, + /* 32b - _D8_F8 */ 0x21d2, + /* 32c - _D8_F8 */ 0x21d3, + /* 32d - _D8_F8 */ 0x21d4, + /* 32e - _D8_F8 */ 0x21d5, + /* 32f - _D8_F8 */ 0x21d6, + /* 330 - _D9_00 */ 0x21d7, + /* 331 - */ 0, + /* 332 - _D9_02 */ 0x21d8, + /* 333 - _D9_03 */ 0x21d9, + /* 334 - _D9_04 */ 0x21da, + /* 335 - _D9_05 */ 0x21db, + /* 336 - _D9_06 */ 0xcf24, + /* 337 - _D9_07 */ 0xcf30, + /* 338 - _D9_C0 */ 0x21dc, + /* 339 - _D9_C0 */ 0x21dd, + /* 33a - _D9_C0 */ 0x21de, + /* 33b - _D9_C0 */ 0x21df, + /* 33c - _D9_C0 */ 0x21e0, + /* 33d - _D9_C0 */ 0x21e1, + /* 33e - _D9_C0 */ 0x21e2, + /* 33f - _D9_C0 */ 0x21e3, + /* 340 - _D9_C8 */ 0x21e4, + /* 341 - _D9_C9 */ 0x21e5, + /* 342 - _D9_C8 */ 0x21e6, + /* 343 - _D9_C8 */ 0x21e7, + /* 344 - _D9_C8 */ 0x21e8, + /* 345 - _D9_C8 */ 0x21e9, + /* 346 - _D9_C8 */ 0x21ea, + /* 347 - _D9_C8 */ 0x21eb, + /* 348 - _D9_D0 */ 0x21ec, + /* 349 - */ 0, + /* 34a - */ 0, + /* 34b - */ 0, + /* 34c - */ 0, + /* 34d - */ 0, + /* 34e - */ 0, + /* 34f - */ 0, + /* 350 - */ 0, + /* 351 - */ 0, + /* 352 - */ 0, + /* 353 - */ 0, + /* 354 - */ 0, + /* 355 - */ 0, + /* 356 - */ 0, + /* 357 - */ 0, + /* 358 - _D9_E0 */ 0x21ed, + /* 359 - _D9_E1 */ 0x21ee, + /* 35a - */ 0, + /* 35b - */ 0, + /* 35c - _D9_E4 */ 0x21ef, + /* 35d - _D9_E5 */ 0x21f0, + /* 35e - */ 0, + /* 35f - */ 0, + /* 360 - _D9_E8 */ 0x21f1, + /* 361 - _D9_E9 */ 0x21f2, + /* 362 - _D9_EA */ 0x21f3, + /* 363 - _D9_EB */ 0x21f4, + /* 364 - _D9_EC */ 0x21f5, + /* 365 - _D9_ED */ 0x21f6, + /* 366 - _D9_EE */ 0x21f7, + /* 367 - */ 0, + /* 368 - _D9_F0 */ 0x21f8, + /* 369 - _D9_F1 */ 0x21f9, + /* 36a - _D9_F2 */ 0x21fa, + /* 36b - _D9_F3 */ 0x21fb, + /* 36c - _D9_F4 */ 0x21fc, + /* 36d - _D9_F5 */ 0x21fd, + /* 36e - _D9_F6 */ 0x21fe, + /* 36f - _D9_F7 */ 0x21ff, + /* 370 - _D9_F8 */ 0x2200, + /* 371 - _D9_F9 */ 0x2201, + /* 372 - _D9_FA */ 0x2202, + /* 373 - _D9_FB */ 0x2203, + /* 374 - _D9_FC */ 0x2204, + /* 375 - _D9_FD */ 0x2205, + /* 376 - _D9_FE */ 0x2206, + /* 377 - _D9_FF */ 0x2207, + /* 378 - _DA_00 */ 0x2208, + /* 379 - _DA_01 */ 0x2209, + /* 37a - _DA_02 */ 0x220a, + /* 37b - _DA_03 */ 0x220b, + /* 37c - _DA_04 */ 0x220c, + /* 37d - _DA_05 */ 0x220d, + /* 37e - _DA_06 */ 0x220e, + /* 37f - _DA_07 */ 0x220f, + /* 380 - _DA_C0 */ 0x2210, + /* 381 - _DA_C0 */ 0x2211, + /* 382 - _DA_C0 */ 0x2212, + /* 383 - _DA_C0 */ 0x2213, + /* 384 - _DA_C0 */ 0x2214, + /* 385 - _DA_C0 */ 0x2215, + /* 386 - _DA_C0 */ 0x2216, + /* 387 - _DA_C0 */ 0x2217, + /* 388 - _DA_C8 */ 0x2218, + /* 389 - _DA_C8 */ 0x2219, + /* 38a - _DA_C8 */ 0x221a, + /* 38b - _DA_C8 */ 0x221b, + /* 38c - _DA_C8 */ 0x221c, + /* 38d - _DA_C8 */ 0x221d, + /* 38e - _DA_C8 */ 0x221e, + /* 38f - _DA_C8 */ 0x221f, + /* 390 - _DA_D0 */ 0x2220, + /* 391 - _DA_D0 */ 0x2221, + /* 392 - _DA_D0 */ 0x2222, + /* 393 - _DA_D0 */ 0x2223, + /* 394 - _DA_D0 */ 0x2224, + /* 395 - _DA_D0 */ 0x2225, + /* 396 - _DA_D0 */ 0x2226, + /* 397 - _DA_D0 */ 0x2227, + /* 398 - _DA_D8 */ 0x2228, + /* 399 - _DA_D8 */ 0x2229, + /* 39a - _DA_D8 */ 0x222a, + /* 39b - _DA_D8 */ 0x222b, + /* 39c - _DA_D8 */ 0x222c, + /* 39d - _DA_D8 */ 0x222d, + /* 39e - _DA_D8 */ 0x222e, + /* 39f - _DA_D8 */ 0x222f, + /* 3a0 - */ 0, + /* 3a1 - */ 0, + /* 3a2 - */ 0, + /* 3a3 - */ 0, + /* 3a4 - */ 0, + /* 3a5 - */ 0, + /* 3a6 - */ 0, + /* 3a7 - */ 0, + /* 3a8 - */ 0, + /* 3a9 - _DA_E9 */ 0x2230, + /* 3aa - */ 0, + /* 3ab - */ 0, + /* 3ac - */ 0, + /* 3ad - */ 0, + /* 3ae - */ 0, + /* 3af - */ 0, + /* 3b0 - */ 0, + /* 3b1 - */ 0, + /* 3b2 - */ 0, + /* 3b3 - */ 0, + /* 3b4 - */ 0, + /* 3b5 - */ 0, + /* 3b6 - */ 0, + /* 3b7 - */ 0, + /* 3b8 - */ 0, + /* 3b9 - */ 0, + /* 3ba - */ 0, + /* 3bb - */ 0, + /* 3bc - */ 0, + /* 3bd - */ 0, + /* 3be - */ 0, + /* 3bf - */ 0, + /* 3c0 - _DB_00 */ 0x2231, + /* 3c1 - _DB_01 */ 0x2232, + /* 3c2 - _DB_02 */ 0x2233, + /* 3c3 - _DB_03 */ 0x2234, + /* 3c4 - */ 0, + /* 3c5 - _DB_05 */ 0x2235, + /* 3c6 - */ 0, + /* 3c7 - _DB_07 */ 0x2236, + /* 3c8 - _DB_C0 */ 0x2237, + /* 3c9 - _DB_C0 */ 0x2238, + /* 3ca - _DB_C0 */ 0x2239, + /* 3cb - _DB_C0 */ 0x223a, + /* 3cc - _DB_C0 */ 0x223b, + /* 3cd - _DB_C0 */ 0x223c, + /* 3ce - _DB_C0 */ 0x223d, + /* 3cf - _DB_C0 */ 0x223e, + /* 3d0 - _DB_C8 */ 0x223f, + /* 3d1 - _DB_C8 */ 0x2240, + /* 3d2 - _DB_C8 */ 0x2241, + /* 3d3 - _DB_C8 */ 0x2242, + /* 3d4 - _DB_C8 */ 0x2243, + /* 3d5 - _DB_C8 */ 0x2244, + /* 3d6 - _DB_C8 */ 0x2245, + /* 3d7 - _DB_C8 */ 0x2246, + /* 3d8 - _DB_D0 */ 0x2247, + /* 3d9 - _DB_D0 */ 0x2248, + /* 3da - _DB_D0 */ 0x2249, + /* 3db - _DB_D0 */ 0x224a, + /* 3dc - _DB_D0 */ 0x224b, + /* 3dd - _DB_D0 */ 0x224c, + /* 3de - _DB_D0 */ 0x224d, + /* 3df - _DB_D0 */ 0x224e, + /* 3e0 - _DB_D8 */ 0x224f, + /* 3e1 - _DB_D8 */ 0x2250, + /* 3e2 - _DB_D8 */ 0x2251, + /* 3e3 - _DB_D8 */ 0x2252, + /* 3e4 - _DB_D8 */ 0x2253, + /* 3e5 - _DB_D8 */ 0x2254, + /* 3e6 - _DB_D8 */ 0x2255, + /* 3e7 - _DB_D8 */ 0x2256, + /* 3e8 - _DB_E0 */ 0x2257, + /* 3e9 - _DB_E1 */ 0x2258, + /* 3ea - _DB_E2 */ 0xcf3c, + /* 3eb - _DB_E3 */ 0xcf48, + /* 3ec - _DB_E4 */ 0x2259, + /* 3ed - */ 0, + /* 3ee - */ 0, + /* 3ef - */ 0, + /* 3f0 - _DB_E8 */ 0x225a, + /* 3f1 - _DB_E8 */ 0x225b, + /* 3f2 - _DB_E8 */ 0x225c, + /* 3f3 - _DB_E8 */ 0x225d, + /* 3f4 - _DB_E8 */ 0x225e, + /* 3f5 - _DB_E8 */ 0x225f, + /* 3f6 - _DB_E8 */ 0x2260, + /* 3f7 - _DB_E8 */ 0x2261, + /* 3f8 - _DB_F0 */ 0x2262, + /* 3f9 - _DB_F0 */ 0x2263, + /* 3fa - _DB_F0 */ 0x2264, + /* 3fb - _DB_F0 */ 0x2265, + /* 3fc - _DB_F0 */ 0x2266, + /* 3fd - _DB_F0 */ 0x2267, + /* 3fe - _DB_F0 */ 0x2268, + /* 3ff - _DB_F0 */ 0x2269, + /* 400 - */ 0, + /* 401 - */ 0, + /* 402 - */ 0, + /* 403 - */ 0, + /* 404 - */ 0, + /* 405 - */ 0, + /* 406 - */ 0, + /* 407 - */ 0, + /* 408 - _DC_00 */ 0x226a, + /* 409 - _DC_01 */ 0x226b, + /* 40a - _DC_02 */ 0x226c, + /* 40b - _DC_03 */ 0x226d, + /* 40c - _DC_04 */ 0x226e, + /* 40d - _DC_05 */ 0x226f, + /* 40e - _DC_06 */ 0x2270, + /* 40f - _DC_07 */ 0x2271, + /* 410 - _DC_C0 */ 0x2272, + /* 411 - _DC_C0 */ 0x2273, + /* 412 - _DC_C0 */ 0x2274, + /* 413 - _DC_C0 */ 0x2275, + /* 414 - _DC_C0 */ 0x2276, + /* 415 - _DC_C0 */ 0x2277, + /* 416 - _DC_C0 */ 0x2278, + /* 417 - _DC_C0 */ 0x2279, + /* 418 - _DC_C8 */ 0x227a, + /* 419 - _DC_C8 */ 0x227b, + /* 41a - _DC_C8 */ 0x227c, + /* 41b - _DC_C8 */ 0x227d, + /* 41c - _DC_C8 */ 0x227e, + /* 41d - _DC_C8 */ 0x227f, + /* 41e - _DC_C8 */ 0x2280, + /* 41f - _DC_C8 */ 0x2281, + /* 420 - */ 0, + /* 421 - */ 0, + /* 422 - */ 0, + /* 423 - */ 0, + /* 424 - */ 0, + /* 425 - */ 0, + /* 426 - */ 0, + /* 427 - */ 0, + /* 428 - */ 0, + /* 429 - */ 0, + /* 42a - */ 0, + /* 42b - */ 0, + /* 42c - */ 0, + /* 42d - */ 0, + /* 42e - */ 0, + /* 42f - */ 0, + /* 430 - _DC_E0 */ 0x2282, + /* 431 - _DC_E0 */ 0x2283, + /* 432 - _DC_E0 */ 0x2284, + /* 433 - _DC_E0 */ 0x2285, + /* 434 - _DC_E0 */ 0x2286, + /* 435 - _DC_E0 */ 0x2287, + /* 436 - _DC_E0 */ 0x2288, + /* 437 - _DC_E0 */ 0x2289, + /* 438 - _DC_E8 */ 0x228a, + /* 439 - _DC_E8 */ 0x228b, + /* 43a - _DC_E8 */ 0x228c, + /* 43b - _DC_E8 */ 0x228d, + /* 43c - _DC_E8 */ 0x228e, + /* 43d - _DC_E8 */ 0x228f, + /* 43e - _DC_E8 */ 0x2290, + /* 43f - _DC_E8 */ 0x2291, + /* 440 - _DC_F0 */ 0x2292, + /* 441 - _DC_F0 */ 0x2293, + /* 442 - _DC_F0 */ 0x2294, + /* 443 - _DC_F0 */ 0x2295, + /* 444 - _DC_F0 */ 0x2296, + /* 445 - _DC_F0 */ 0x2297, + /* 446 - _DC_F0 */ 0x2298, + /* 447 - _DC_F0 */ 0x2299, + /* 448 - _DC_F8 */ 0x229a, + /* 449 - _DC_F8 */ 0x229b, + /* 44a - _DC_F8 */ 0x229c, + /* 44b - _DC_F8 */ 0x229d, + /* 44c - _DC_F8 */ 0x229e, + /* 44d - _DC_F8 */ 0x229f, + /* 44e - _DC_F8 */ 0x22a0, + /* 44f - _DC_F8 */ 0x22a1, + /* 450 - _DD_00 */ 0x22a2, + /* 451 - _DD_01 */ 0x22a3, + /* 452 - _DD_02 */ 0x22a4, + /* 453 - _DD_03 */ 0x22a5, + /* 454 - _DD_04 */ 0x22a6, + /* 455 - */ 0, + /* 456 - _DD_06 */ 0xcf54, + /* 457 - _DD_07 */ 0xcf60, + /* 458 - _DD_C0 */ 0x22a7, + /* 459 - _DD_C0 */ 0x22a8, + /* 45a - _DD_C0 */ 0x22a9, + /* 45b - _DD_C0 */ 0x22aa, + /* 45c - _DD_C0 */ 0x22ab, + /* 45d - _DD_C0 */ 0x22ac, + /* 45e - _DD_C0 */ 0x22ad, + /* 45f - _DD_C0 */ 0x22ae, + /* 460 - */ 0, + /* 461 - */ 0, + /* 462 - */ 0, + /* 463 - */ 0, + /* 464 - */ 0, + /* 465 - */ 0, + /* 466 - */ 0, + /* 467 - */ 0, + /* 468 - _DD_D0 */ 0x22af, + /* 469 - _DD_D0 */ 0x22b0, + /* 46a - _DD_D0 */ 0x22b1, + /* 46b - _DD_D0 */ 0x22b2, + /* 46c - _DD_D0 */ 0x22b3, + /* 46d - _DD_D0 */ 0x22b4, + /* 46e - _DD_D0 */ 0x22b5, + /* 46f - _DD_D0 */ 0x22b6, + /* 470 - _DD_D8 */ 0x22b7, + /* 471 - _DD_D8 */ 0x22b8, + /* 472 - _DD_D8 */ 0x22b9, + /* 473 - _DD_D8 */ 0x22ba, + /* 474 - _DD_D8 */ 0x22bb, + /* 475 - _DD_D8 */ 0x22bc, + /* 476 - _DD_D8 */ 0x22bd, + /* 477 - _DD_D8 */ 0x22be, + /* 478 - _DD_E0 */ 0x22bf, + /* 479 - _DD_E1 */ 0x22c0, + /* 47a - _DD_E0 */ 0x22c1, + /* 47b - _DD_E0 */ 0x22c2, + /* 47c - _DD_E0 */ 0x22c3, + /* 47d - _DD_E0 */ 0x22c4, + /* 47e - _DD_E0 */ 0x22c5, + /* 47f - _DD_E0 */ 0x22c6, + /* 480 - _DD_E8 */ 0x22c7, + /* 481 - _DD_E9 */ 0x22c8, + /* 482 - _DD_E8 */ 0x22c9, + /* 483 - _DD_E8 */ 0x22ca, + /* 484 - _DD_E8 */ 0x22cb, + /* 485 - _DD_E8 */ 0x22cc, + /* 486 - _DD_E8 */ 0x22cd, + /* 487 - _DD_E8 */ 0x22ce, + /* 488 - */ 0, + /* 489 - */ 0, + /* 48a - */ 0, + /* 48b - */ 0, + /* 48c - */ 0, + /* 48d - */ 0, + /* 48e - */ 0, + /* 48f - */ 0, + /* 490 - */ 0, + /* 491 - */ 0, + /* 492 - */ 0, + /* 493 - */ 0, + /* 494 - */ 0, + /* 495 - */ 0, + /* 496 - */ 0, + /* 497 - */ 0, + /* 498 - _DE_00 */ 0x22cf, + /* 499 - _DE_01 */ 0x22d0, + /* 49a - _DE_02 */ 0x22d1, + /* 49b - _DE_03 */ 0x22d2, + /* 49c - _DE_04 */ 0x22d3, + /* 49d - _DE_05 */ 0x22d4, + /* 49e - _DE_06 */ 0x22d5, + /* 49f - _DE_07 */ 0x22d6, + /* 4a0 - _DE_C0 */ 0x22d7, + /* 4a1 - _DE_C1 */ 0x22d8, + /* 4a2 - _DE_C0 */ 0x22d9, + /* 4a3 - _DE_C0 */ 0x22da, + /* 4a4 - _DE_C0 */ 0x22db, + /* 4a5 - _DE_C0 */ 0x22dc, + /* 4a6 - _DE_C0 */ 0x22dd, + /* 4a7 - _DE_C0 */ 0x22de, + /* 4a8 - _DE_C8 */ 0x22df, + /* 4a9 - _DE_C9 */ 0x22e0, + /* 4aa - _DE_C8 */ 0x22e1, + /* 4ab - _DE_C8 */ 0x22e2, + /* 4ac - _DE_C8 */ 0x22e3, + /* 4ad - _DE_C8 */ 0x22e4, + /* 4ae - _DE_C8 */ 0x22e5, + /* 4af - _DE_C8 */ 0x22e6, + /* 4b0 - */ 0, + /* 4b1 - */ 0, + /* 4b2 - */ 0, + /* 4b3 - */ 0, + /* 4b4 - */ 0, + /* 4b5 - */ 0, + /* 4b6 - */ 0, + /* 4b7 - */ 0, + /* 4b8 - */ 0, + /* 4b9 - _DE_D9 */ 0x22e7, + /* 4ba - */ 0, + /* 4bb - */ 0, + /* 4bc - */ 0, + /* 4bd - */ 0, + /* 4be - */ 0, + /* 4bf - */ 0, + /* 4c0 - _DE_E0 */ 0x22e8, + /* 4c1 - _DE_E1 */ 0x22e9, + /* 4c2 - _DE_E0 */ 0x22ea, + /* 4c3 - _DE_E0 */ 0x22eb, + /* 4c4 - _DE_E0 */ 0x22ec, + /* 4c5 - _DE_E0 */ 0x22ed, + /* 4c6 - _DE_E0 */ 0x22ee, + /* 4c7 - _DE_E0 */ 0x22ef, + /* 4c8 - _DE_E8 */ 0x22f0, + /* 4c9 - _DE_E9 */ 0x22f1, + /* 4ca - _DE_E8 */ 0x22f2, + /* 4cb - _DE_E8 */ 0x22f3, + /* 4cc - _DE_E8 */ 0x22f4, + /* 4cd - _DE_E8 */ 0x22f5, + /* 4ce - _DE_E8 */ 0x22f6, + /* 4cf - _DE_E8 */ 0x22f7, + /* 4d0 - _DE_F0 */ 0x22f8, + /* 4d1 - _DE_F1 */ 0x22f9, + /* 4d2 - _DE_F0 */ 0x22fa, + /* 4d3 - _DE_F0 */ 0x22fb, + /* 4d4 - _DE_F0 */ 0x22fc, + /* 4d5 - _DE_F0 */ 0x22fd, + /* 4d6 - _DE_F0 */ 0x22fe, + /* 4d7 - _DE_F0 */ 0x22ff, + /* 4d8 - _DE_F8 */ 0x2300, + /* 4d9 - _DE_F9 */ 0x2301, + /* 4da - _DE_F8 */ 0x2302, + /* 4db - _DE_F8 */ 0x2303, + /* 4dc - _DE_F8 */ 0x2304, + /* 4dd - _DE_F8 */ 0x2305, + /* 4de - _DE_F8 */ 0x2306, + /* 4df - _DE_F8 */ 0x2307, + /* 4e0 - _DF_00 */ 0x2308, + /* 4e1 - _DF_01 */ 0x2309, + /* 4e2 - _DF_02 */ 0x230a, + /* 4e3 - _DF_03 */ 0x230b, + /* 4e4 - _DF_04 */ 0x230c, + /* 4e5 - _DF_05 */ 0x230d, + /* 4e6 - _DF_06 */ 0x230e, + /* 4e7 - _DF_07 */ 0x230f, + /* 4e8 - */ 0, + /* 4e9 - */ 0, + /* 4ea - */ 0, + /* 4eb - */ 0, + /* 4ec - */ 0, + /* 4ed - */ 0, + /* 4ee - */ 0, + /* 4ef - */ 0, + /* 4f0 - */ 0, + /* 4f1 - */ 0, + /* 4f2 - */ 0, + /* 4f3 - */ 0, + /* 4f4 - */ 0, + /* 4f5 - */ 0, + /* 4f6 - */ 0, + /* 4f7 - */ 0, + /* 4f8 - */ 0, + /* 4f9 - */ 0, + /* 4fa - */ 0, + /* 4fb - */ 0, + /* 4fc - */ 0, + /* 4fd - */ 0, + /* 4fe - */ 0, + /* 4ff - */ 0, + /* 500 - */ 0, + /* 501 - */ 0, + /* 502 - */ 0, + /* 503 - */ 0, + /* 504 - */ 0, + /* 505 - */ 0, + /* 506 - */ 0, + /* 507 - */ 0, + /* 508 - _DF_E0 */ 0xcf6c, + /* 509 - */ 0, + /* 50a - */ 0, + /* 50b - */ 0, + /* 50c - */ 0, + /* 50d - */ 0, + /* 50e - */ 0, + /* 50f - */ 0, + /* 510 - _DF_E8 */ 0x2310, + /* 511 - _DF_E8 */ 0x2311, + /* 512 - _DF_E8 */ 0x2312, + /* 513 - _DF_E8 */ 0x2313, + /* 514 - _DF_E8 */ 0x2314, + /* 515 - _DF_E8 */ 0x2315, + /* 516 - _DF_E8 */ 0x2316, + /* 517 - _DF_E8 */ 0x2317, + /* 518 - _DF_F0 */ 0x2318, + /* 519 - _DF_F0 */ 0x2319, + /* 51a - _DF_F0 */ 0x231a, + /* 51b - _DF_F0 */ 0x231b, + /* 51c - _DF_F0 */ 0x231c, + /* 51d - _DF_F0 */ 0x231d, + /* 51e - _DF_F0 */ 0x231e, + /* 51f - _DF_F0 */ 0x231f, + /* 520 - */ 0, + /* 521 - */ 0, + /* 522 - */ 0, + /* 523 - */ 0, + /* 524 - */ 0, + /* 525 - */ 0, + /* 526 - */ 0, + /* 527 - */ 0, + /* 528 - _F6_00 */ 0x2320, + /* 529 - */ 0, + /* 52a - _F6_02 */ 0x2321, + /* 52b - _F6_03 */ 0x2322, + /* 52c - _F6_04 */ 0x2323, + /* 52d - _F6_05 */ 0x2324, + /* 52e - _F6_06 */ 0x2325, + /* 52f - _F6_07 */ 0x2326, + /* 530 - _F7_00 */ 0x2327, + /* 531 - */ 0, + /* 532 - _F7_02 */ 0x2328, + /* 533 - _F7_03 */ 0x2329, + /* 534 - _F7_04 */ 0x232a, + /* 535 - _F7_05 */ 0x232b, + /* 536 - _F7_06 */ 0x232c, + /* 537 - _F7_07 */ 0x232d, + /* 538 - _FE_00 */ 0x232e, + /* 539 - _FE_01 */ 0x232f, + /* 53a - */ 0, + /* 53b - */ 0, + /* 53c - */ 0, + /* 53d - */ 0, + /* 53e - */ 0, + /* 53f - */ 0, + /* 540 - _FF_00 */ 0x2330, + /* 541 - _FF_01 */ 0x2331, + /* 542 - _FF_02 */ 0x2332, + /* 543 - _FF_03 */ 0x2333, + /* 544 - _FF_04 */ 0x2334, + /* 545 - _FF_05 */ 0x2335, + /* 546 - _FF_06 */ 0x2336, + /* 547 - */ 0, + /* 548 - _0F_00_00 */ 0x2337, + /* 549 - _0F_00_01 */ 0x2338, + /* 54a - _0F_00_02 */ 0x2339, + /* 54b - _0F_00_03 */ 0x233a, + /* 54c - _0F_00_04 */ 0x233b, + /* 54d - _0F_00_05 */ 0x233c, + /* 54e - */ 0, + /* 54f - */ 0, + /* 550 - _0F_01_00 */ 0x233d, + /* 551 - _0F_01_01 */ 0x233e, + /* 552 - _0F_01_02 */ 0x233f, + /* 553 - _0F_01_03 */ 0x2340, + /* 554 - _0F_01_04 */ 0x2341, + /* 555 - */ 0, + /* 556 - _0F_01_06 */ 0x2342, + /* 557 - _0F_01_07 */ 0x2343, + /* 558 - */ 0, + /* 559 - _0F_01_C1 */ 0x2344, + /* 55a - _0F_01_C2 */ 0x2345, + /* 55b - _0F_01_C3 */ 0x2346, + /* 55c - _0F_01_C4 */ 0x2347, + /* 55d - */ 0, + /* 55e - */ 0, + /* 55f - */ 0, + /* 560 - _0F_01_C8 */ 0x2348, + /* 561 - _0F_01_C9 */ 0x2349, + /* 562 - */ 0, + /* 563 - */ 0, + /* 564 - */ 0, + /* 565 - */ 0, + /* 566 - */ 0, + /* 567 - */ 0, + /* 568 - _0F_01_D0 */ 0x234a, + /* 569 - _0F_01_D1 */ 0x234b, + /* 56a - */ 0, + /* 56b - */ 0, + /* 56c - _0F_01_D4 */ 0x234c, + /* 56d - _0F_01_D5 */ 0x234d, + /* 56e - */ 0, + /* 56f - */ 0, + /* 570 - _0F_01_D8 */ 0x234e, + /* 571 - _0F_01_D9 */ 0x234f, + /* 572 - _0F_01_DA */ 0x2350, + /* 573 - _0F_01_DB */ 0x2351, + /* 574 - _0F_01_DC */ 0x2352, + /* 575 - _0F_01_DD */ 0x2353, + /* 576 - _0F_01_DE */ 0x2354, + /* 577 - _0F_01_DF */ 0x2355, + /* 578 - */ 0, + /* 579 - */ 0, + /* 57a - */ 0, + /* 57b - */ 0, + /* 57c - */ 0, + /* 57d - */ 0, + /* 57e - */ 0, + /* 57f - */ 0, + /* 580 - */ 0, + /* 581 - */ 0, + /* 582 - */ 0, + /* 583 - */ 0, + /* 584 - */ 0, + /* 585 - */ 0, + /* 586 - */ 0, + /* 587 - */ 0, + /* 588 - */ 0, + /* 589 - */ 0, + /* 58a - */ 0, + /* 58b - */ 0, + /* 58c - */ 0, + /* 58d - */ 0, + /* 58e - */ 0, + /* 58f - */ 0, + /* 590 - _0F_01_F8 */ 0x2356, + /* 591 - _0F_01_F9 */ 0x2357, + /* 592 - */ 0, + /* 593 - */ 0, + /* 594 - */ 0, + /* 595 - */ 0, + /* 596 - */ 0, + /* 597 - */ 0, + /* 598 - _0F_0D_00 */ 0x2358, + /* 599 - _0F_0D_01 */ 0x2359, + /* 59a - */ 0, + /* 59b - */ 0, + /* 59c - */ 0, + /* 59d - */ 0, + /* 59e - */ 0, + /* 59f - */ 0, + /* 5a0 - */ 0, + /* 5a1 - */ 0, + /* 5a2 - */ 0, + /* 5a3 - */ 0, + /* 5a4 - */ 0, + /* 5a5 - */ 0, + /* 5a6 - */ 0, + /* 5a7 - */ 0, + /* 5a8 - */ 0, + /* 5a9 - */ 0, + /* 5aa - */ 0, + /* 5ab - */ 0, + /* 5ac - _0F_0F_0C */ 0x235a, + /* 5ad - _0F_0F_0D */ 0x235b, + /* 5ae - */ 0, + /* 5af - */ 0, + /* 5b0 - */ 0, + /* 5b1 - */ 0, + /* 5b2 - */ 0, + /* 5b3 - */ 0, + /* 5b4 - */ 0, + /* 5b5 - */ 0, + /* 5b6 - */ 0, + /* 5b7 - */ 0, + /* 5b8 - */ 0, + /* 5b9 - */ 0, + /* 5ba - */ 0, + /* 5bb - */ 0, + /* 5bc - _0F_0F_1C */ 0x235c, + /* 5bd - _0F_0F_1D */ 0x235d, + /* 5be - */ 0, + /* 5bf - */ 0, + /* 5c0 - */ 0, + /* 5c1 - */ 0, + /* 5c2 - */ 0, + /* 5c3 - */ 0, + /* 5c4 - */ 0, + /* 5c5 - */ 0, + /* 5c6 - */ 0, + /* 5c7 - */ 0, + /* 5c8 - */ 0, + /* 5c9 - */ 0, + /* 5ca - */ 0, + /* 5cb - */ 0, + /* 5cc - */ 0, + /* 5cd - */ 0, + /* 5ce - */ 0, + /* 5cf - */ 0, + /* 5d0 - */ 0, + /* 5d1 - */ 0, + /* 5d2 - */ 0, + /* 5d3 - */ 0, + /* 5d4 - */ 0, + /* 5d5 - */ 0, + /* 5d6 - */ 0, + /* 5d7 - */ 0, + /* 5d8 - */ 0, + /* 5d9 - */ 0, + /* 5da - */ 0, + /* 5db - */ 0, + /* 5dc - */ 0, + /* 5dd - */ 0, + /* 5de - */ 0, + /* 5df - */ 0, + /* 5e0 - */ 0, + /* 5e1 - */ 0, + /* 5e2 - */ 0, + /* 5e3 - */ 0, + /* 5e4 - */ 0, + /* 5e5 - */ 0, + /* 5e6 - */ 0, + /* 5e7 - */ 0, + /* 5e8 - */ 0, + /* 5e9 - */ 0, + /* 5ea - */ 0, + /* 5eb - */ 0, + /* 5ec - */ 0, + /* 5ed - */ 0, + /* 5ee - */ 0, + /* 5ef - */ 0, + /* 5f0 - */ 0, + /* 5f1 - */ 0, + /* 5f2 - */ 0, + /* 5f3 - */ 0, + /* 5f4 - */ 0, + /* 5f5 - */ 0, + /* 5f6 - */ 0, + /* 5f7 - */ 0, + /* 5f8 - */ 0, + /* 5f9 - */ 0, + /* 5fa - */ 0, + /* 5fb - */ 0, + /* 5fc - */ 0, + /* 5fd - */ 0, + /* 5fe - */ 0, + /* 5ff - */ 0, + /* 600 - */ 0, + /* 601 - */ 0, + /* 602 - */ 0, + /* 603 - */ 0, + /* 604 - */ 0, + /* 605 - */ 0, + /* 606 - */ 0, + /* 607 - */ 0, + /* 608 - */ 0, + /* 609 - */ 0, + /* 60a - */ 0, + /* 60b - */ 0, + /* 60c - */ 0, + /* 60d - */ 0, + /* 60e - */ 0, + /* 60f - */ 0, + /* 610 - */ 0, + /* 611 - */ 0, + /* 612 - */ 0, + /* 613 - */ 0, + /* 614 - */ 0, + /* 615 - */ 0, + /* 616 - */ 0, + /* 617 - */ 0, + /* 618 - */ 0, + /* 619 - */ 0, + /* 61a - */ 0, + /* 61b - */ 0, + /* 61c - */ 0, + /* 61d - */ 0, + /* 61e - */ 0, + /* 61f - */ 0, + /* 620 - */ 0, + /* 621 - */ 0, + /* 622 - */ 0, + /* 623 - */ 0, + /* 624 - */ 0, + /* 625 - */ 0, + /* 626 - */ 0, + /* 627 - */ 0, + /* 628 - */ 0, + /* 629 - */ 0, + /* 62a - _0F_0F_8A */ 0x235e, + /* 62b - */ 0, + /* 62c - */ 0, + /* 62d - */ 0, + /* 62e - _0F_0F_8E */ 0x235f, + /* 62f - */ 0, + /* 630 - _0F_0F_90 */ 0x2360, + /* 631 - */ 0, + /* 632 - */ 0, + /* 633 - */ 0, + /* 634 - _0F_0F_94 */ 0x2361, + /* 635 - */ 0, + /* 636 - _0F_0F_96 */ 0x2362, + /* 637 - _0F_0F_97 */ 0x2363, + /* 638 - */ 0, + /* 639 - */ 0, + /* 63a - _0F_0F_9A */ 0x2364, + /* 63b - */ 0, + /* 63c - */ 0, + /* 63d - */ 0, + /* 63e - _0F_0F_9E */ 0x2365, + /* 63f - */ 0, + /* 640 - _0F_0F_A0 */ 0x2366, + /* 641 - */ 0, + /* 642 - */ 0, + /* 643 - */ 0, + /* 644 - _0F_0F_A4 */ 0x2367, + /* 645 - */ 0, + /* 646 - _0F_0F_A6 */ 0x2368, + /* 647 - _0F_0F_A7 */ 0x2369, + /* 648 - */ 0, + /* 649 - */ 0, + /* 64a - _0F_0F_AA */ 0x236a, + /* 64b - */ 0, + /* 64c - */ 0, + /* 64d - */ 0, + /* 64e - _0F_0F_AE */ 0x236b, + /* 64f - */ 0, + /* 650 - _0F_0F_B0 */ 0x236c, + /* 651 - */ 0, + /* 652 - */ 0, + /* 653 - */ 0, + /* 654 - _0F_0F_B4 */ 0x236d, + /* 655 - */ 0, + /* 656 - _0F_0F_B6 */ 0x236e, + /* 657 - _0F_0F_B7 */ 0x236f, + /* 658 - */ 0, + /* 659 - */ 0, + /* 65a - */ 0, + /* 65b - _0F_0F_BB */ 0x2370, + /* 65c - */ 0, + /* 65d - */ 0, + /* 65e - */ 0, + /* 65f - _0F_0F_BF */ 0x2371, + /* 660 - */ 0, + /* 661 - */ 0, + /* 662 - */ 0, + /* 663 - */ 0, + /* 664 - */ 0, + /* 665 - */ 0, + /* 666 - */ 0, + /* 667 - */ 0, + /* 668 - */ 0, + /* 669 - */ 0, + /* 66a - */ 0, + /* 66b - */ 0, + /* 66c - */ 0, + /* 66d - */ 0, + /* 66e - */ 0, + /* 66f - */ 0, + /* 670 - */ 0, + /* 671 - */ 0, + /* 672 - */ 0, + /* 673 - */ 0, + /* 674 - */ 0, + /* 675 - */ 0, + /* 676 - */ 0, + /* 677 - */ 0, + /* 678 - */ 0, + /* 679 - */ 0, + /* 67a - */ 0, + /* 67b - */ 0, + /* 67c - */ 0, + /* 67d - */ 0, + /* 67e - */ 0, + /* 67f - */ 0, + /* 680 - */ 0, + /* 681 - */ 0, + /* 682 - */ 0, + /* 683 - */ 0, + /* 684 - */ 0, + /* 685 - */ 0, + /* 686 - */ 0, + /* 687 - */ 0, + /* 688 - */ 0, + /* 689 - */ 0, + /* 68a - */ 0, + /* 68b - */ 0, + /* 68c - */ 0, + /* 68d - */ 0, + /* 68e - */ 0, + /* 68f - */ 0, + /* 690 - */ 0, + /* 691 - */ 0, + /* 692 - */ 0, + /* 693 - */ 0, + /* 694 - */ 0, + /* 695 - */ 0, + /* 696 - */ 0, + /* 697 - */ 0, + /* 698 - */ 0, + /* 699 - */ 0, + /* 69a - */ 0, + /* 69b - */ 0, + /* 69c - */ 0, + /* 69d - */ 0, + /* 69e - */ 0, + /* 69f - */ 0, + /* 6a0 - _0F_10 */ 0x2372, + /* 6a1 - _66_0F_10 */ 0x2373, + /* 6a2 - _F3_0F_10 */ 0x2374, + /* 6a3 - _F2_0F_10 */ 0x2375, + /* 6a4 - _V_0F_10 */ 0x4009, + /* 6a5 - _V_66_0F_10 */ 0x400a, + /* 6a6 - _V_F3_0F_10 */ 0x400b, + /* 6a7 - _V_F2_0F_10 */ 0x400c, + /* 6a8 - */ 0, + /* 6a9 - */ 0, + /* 6aa - _VRR_F3_0F_10 */ 0x400d, + /* 6ab - _VRR_F2_0F_10 */ 0x400e, + /* 6ac - _0F_11 */ 0x2376, + /* 6ad - _66_0F_11 */ 0x2377, + /* 6ae - _F3_0F_11 */ 0x2378, + /* 6af - _F2_0F_11 */ 0x2379, + /* 6b0 - _V_0F_11 */ 0x400f, + /* 6b1 - _V_66_0F_11 */ 0x4010, + /* 6b2 - _V_F3_0F_11 */ 0x4011, + /* 6b3 - _V_F2_0F_11 */ 0x4012, + /* 6b4 - */ 0, + /* 6b5 - */ 0, + /* 6b6 - _VRR_F3_0F_11 */ 0x4013, + /* 6b7 - _VRR_F2_0F_11 */ 0x4014, + /* 6b8 - _0F_12 */ 0x4015, + /* 6b9 - _66_0F_12 */ 0x237a, + /* 6ba - _F3_0F_12 */ 0x237b, + /* 6bb - _F2_0F_12 */ 0x237c, + /* 6bc - _V_0F_12 */ 0x4016, + /* 6bd - _V_66_0F_12 */ 0x4017, + /* 6be - _V_F3_0F_12 */ 0x4018, + /* 6bf - _V_F2_0F_12 */ 0x4019, + /* 6c0 - */ 0, + /* 6c1 - */ 0, + /* 6c2 - */ 0, + /* 6c3 - */ 0, + /* 6c4 - _0F_13 */ 0x237d, + /* 6c5 - _66_0F_13 */ 0x237e, + /* 6c6 - */ 0, + /* 6c7 - */ 0, + /* 6c8 - _V_0F_13 */ 0x401a, + /* 6c9 - _V_66_0F_13 */ 0x401b, + /* 6ca - */ 0, + /* 6cb - */ 0, + /* 6cc - */ 0, + /* 6cd - */ 0, + /* 6ce - */ 0, + /* 6cf - */ 0, + /* 6d0 - _0F_14 */ 0x237f, + /* 6d1 - _66_0F_14 */ 0x2380, + /* 6d2 - */ 0, + /* 6d3 - */ 0, + /* 6d4 - _V_0F_14 */ 0x401c, + /* 6d5 - _V_66_0F_14 */ 0x401d, + /* 6d6 - */ 0, + /* 6d7 - */ 0, + /* 6d8 - */ 0, + /* 6d9 - */ 0, + /* 6da - */ 0, + /* 6db - */ 0, + /* 6dc - _0F_15 */ 0x2381, + /* 6dd - _66_0F_15 */ 0x2382, + /* 6de - */ 0, + /* 6df - */ 0, + /* 6e0 - _V_0F_15 */ 0x401e, + /* 6e1 - _V_66_0F_15 */ 0x401f, + /* 6e2 - */ 0, + /* 6e3 - */ 0, + /* 6e4 - */ 0, + /* 6e5 - */ 0, + /* 6e6 - */ 0, + /* 6e7 - */ 0, + /* 6e8 - _0F_16 */ 0x4020, + /* 6e9 - _66_0F_16 */ 0x2383, + /* 6ea - _F3_0F_16 */ 0x2384, + /* 6eb - */ 0, + /* 6ec - _V_0F_16 */ 0x4021, + /* 6ed - _V_66_0F_16 */ 0x4022, + /* 6ee - _V_F3_0F_16 */ 0x4023, + /* 6ef - */ 0, + /* 6f0 - */ 0, + /* 6f1 - */ 0, + /* 6f2 - */ 0, + /* 6f3 - */ 0, + /* 6f4 - _0F_17 */ 0x2385, + /* 6f5 - _66_0F_17 */ 0x2386, + /* 6f6 - */ 0, + /* 6f7 - */ 0, + /* 6f8 - _V_0F_17 */ 0x4024, + /* 6f9 - _V_66_0F_17 */ 0x4025, + /* 6fa - */ 0, + /* 6fb - */ 0, + /* 6fc - */ 0, + /* 6fd - */ 0, + /* 6fe - */ 0, + /* 6ff - */ 0, + /* 700 - _0F_18_00 */ 0x2387, + /* 701 - _0F_18_01 */ 0x2388, + /* 702 - _0F_18_02 */ 0x2389, + /* 703 - _0F_18_03 */ 0x238a, + /* 704 - */ 0, + /* 705 - */ 0, + /* 706 - */ 0, + /* 707 - */ 0, + /* 708 - _0F_28 */ 0x238b, + /* 709 - _66_0F_28 */ 0x238c, + /* 70a - */ 0, + /* 70b - */ 0, + /* 70c - _V_0F_28 */ 0x4026, + /* 70d - _V_66_0F_28 */ 0x4027, + /* 70e - */ 0, + /* 70f - */ 0, + /* 710 - */ 0, + /* 711 - */ 0, + /* 712 - */ 0, + /* 713 - */ 0, + /* 714 - _0F_29 */ 0x238d, + /* 715 - _66_0F_29 */ 0x238e, + /* 716 - */ 0, + /* 717 - */ 0, + /* 718 - _V_0F_29 */ 0x4028, + /* 719 - _V_66_0F_29 */ 0x4029, + /* 71a - */ 0, + /* 71b - */ 0, + /* 71c - */ 0, + /* 71d - */ 0, + /* 71e - */ 0, + /* 71f - */ 0, + /* 720 - _0F_2A */ 0x238f, + /* 721 - _66_0F_2A */ 0x2390, + /* 722 - _F3_0F_2A */ 0x2391, + /* 723 - _F2_0F_2A */ 0x2392, + /* 724 - */ 0, + /* 725 - */ 0, + /* 726 - _V_F3_0F_2A */ 0x402a, + /* 727 - _V_F2_0F_2A */ 0x402b, + /* 728 - */ 0, + /* 729 - */ 0, + /* 72a - */ 0, + /* 72b - */ 0, + /* 72c - _0F_2B */ 0x2393, + /* 72d - _66_0F_2B */ 0x2394, + /* 72e - _F3_0F_2B */ 0x2395, + /* 72f - _F2_0F_2B */ 0x2396, + /* 730 - _V_0F_2B */ 0x402c, + /* 731 - _V_66_0F_2B */ 0x402d, + /* 732 - */ 0, + /* 733 - */ 0, + /* 734 - */ 0, + /* 735 - */ 0, + /* 736 - */ 0, + /* 737 - */ 0, + /* 738 - _0F_2C */ 0x2397, + /* 739 - _66_0F_2C */ 0x2398, + /* 73a - _F3_0F_2C */ 0x2399, + /* 73b - _F2_0F_2C */ 0x239a, + /* 73c - */ 0, + /* 73d - */ 0, + /* 73e - _V_F3_0F_2C */ 0x402e, + /* 73f - _V_F2_0F_2C */ 0x402f, + /* 740 - */ 0, + /* 741 - */ 0, + /* 742 - */ 0, + /* 743 - */ 0, + /* 744 - _0F_2D */ 0x239b, + /* 745 - _66_0F_2D */ 0x239c, + /* 746 - _F3_0F_2D */ 0x239d, + /* 747 - _F2_0F_2D */ 0x239e, + /* 748 - */ 0, + /* 749 - */ 0, + /* 74a - _V_F3_0F_2D */ 0x4030, + /* 74b - _V_F2_0F_2D */ 0x4031, + /* 74c - */ 0, + /* 74d - */ 0, + /* 74e - */ 0, + /* 74f - */ 0, + /* 750 - _0F_2E */ 0x239f, + /* 751 - _66_0F_2E */ 0x23a0, + /* 752 - */ 0, + /* 753 - */ 0, + /* 754 - _V_0F_2E */ 0x4032, + /* 755 - _V_66_0F_2E */ 0x4033, + /* 756 - */ 0, + /* 757 - */ 0, + /* 758 - */ 0, + /* 759 - */ 0, + /* 75a - */ 0, + /* 75b - */ 0, + /* 75c - _0F_2F */ 0x23a1, + /* 75d - _66_0F_2F */ 0x23a2, + /* 75e - */ 0, + /* 75f - */ 0, + /* 760 - _V_0F_2F */ 0x4034, + /* 761 - _V_66_0F_2F */ 0x4035, + /* 762 - */ 0, + /* 763 - */ 0, + /* 764 - */ 0, + /* 765 - */ 0, + /* 766 - */ 0, + /* 767 - */ 0, + /* 768 - _0F_38_00 */ 0xcf78, + /* 769 - _0F_38_01 */ 0xcf84, + /* 76a - _0F_38_02 */ 0xcf90, + /* 76b - _0F_38_03 */ 0xcf9c, + /* 76c - _0F_38_04 */ 0xcfa8, + /* 76d - _0F_38_05 */ 0xcfb4, + /* 76e - _0F_38_06 */ 0xcfc0, + /* 76f - _0F_38_07 */ 0xcfcc, + /* 770 - _0F_38_08 */ 0xcfd8, + /* 771 - _0F_38_09 */ 0xcfe4, + /* 772 - _0F_38_0A */ 0xcff0, + /* 773 - _0F_38_0B */ 0xcffc, + /* 774 - _0F_38_0C */ 0xd008, + /* 775 - _0F_38_0D */ 0xd014, + /* 776 - _0F_38_0E */ 0xd020, + /* 777 - _0F_38_0F */ 0xd02c, + /* 778 - _0F_38_10 */ 0xd038, + /* 779 - */ 0, + /* 77a - */ 0, + /* 77b - */ 0, + /* 77c - _0F_38_14 */ 0xd044, + /* 77d - _0F_38_15 */ 0xd050, + /* 77e - */ 0, + /* 77f - _0F_38_17 */ 0xd05c, + /* 780 - _0F_38_18 */ 0xd068, + /* 781 - _0F_38_19 */ 0xd074, + /* 782 - _0F_38_1A */ 0xd080, + /* 783 - */ 0, + /* 784 - _0F_38_1C */ 0xd08c, + /* 785 - _0F_38_1D */ 0xd098, + /* 786 - _0F_38_1E */ 0xd0a4, + /* 787 - */ 0, + /* 788 - _0F_38_20 */ 0xd0b0, + /* 789 - _0F_38_21 */ 0xd0bc, + /* 78a - _0F_38_22 */ 0xd0c8, + /* 78b - _0F_38_23 */ 0xd0d4, + /* 78c - _0F_38_24 */ 0xd0e0, + /* 78d - _0F_38_25 */ 0xd0ec, + /* 78e - */ 0, + /* 78f - */ 0, + /* 790 - _0F_38_28 */ 0xd0f8, + /* 791 - _0F_38_29 */ 0xd104, + /* 792 - _0F_38_2A */ 0xd110, + /* 793 - _0F_38_2B */ 0xd11c, + /* 794 - _0F_38_2C */ 0xd128, + /* 795 - _0F_38_2D */ 0xd134, + /* 796 - _0F_38_2E */ 0xd140, + /* 797 - _0F_38_2F */ 0xd14c, + /* 798 - _0F_38_30 */ 0xd158, + /* 799 - _0F_38_31 */ 0xd164, + /* 79a - _0F_38_32 */ 0xd170, + /* 79b - _0F_38_33 */ 0xd17c, + /* 79c - _0F_38_34 */ 0xd188, + /* 79d - _0F_38_35 */ 0xd194, + /* 79e - */ 0, + /* 79f - _0F_38_37 */ 0xd1a0, + /* 7a0 - _0F_38_38 */ 0xd1ac, + /* 7a1 - _0F_38_39 */ 0xd1b8, + /* 7a2 - _0F_38_3A */ 0xd1c4, + /* 7a3 - _0F_38_3B */ 0xd1d0, + /* 7a4 - _0F_38_3C */ 0xd1dc, + /* 7a5 - _0F_38_3D */ 0xd1e8, + /* 7a6 - _0F_38_3E */ 0xd1f4, + /* 7a7 - _0F_38_3F */ 0xd200, + /* 7a8 - _0F_38_40 */ 0xd20c, + /* 7a9 - _0F_38_41 */ 0xd218, + /* 7aa - */ 0, + /* 7ab - */ 0, + /* 7ac - */ 0, + /* 7ad - */ 0, + /* 7ae - */ 0, + /* 7af - */ 0, + /* 7b0 - */ 0, + /* 7b1 - */ 0, + /* 7b2 - */ 0, + /* 7b3 - */ 0, + /* 7b4 - */ 0, + /* 7b5 - */ 0, + /* 7b6 - */ 0, + /* 7b7 - */ 0, + /* 7b8 - */ 0, + /* 7b9 - */ 0, + /* 7ba - */ 0, + /* 7bb - */ 0, + /* 7bc - */ 0, + /* 7bd - */ 0, + /* 7be - */ 0, + /* 7bf - */ 0, + /* 7c0 - */ 0, + /* 7c1 - */ 0, + /* 7c2 - */ 0, + /* 7c3 - */ 0, + /* 7c4 - */ 0, + /* 7c5 - */ 0, + /* 7c6 - */ 0, + /* 7c7 - */ 0, + /* 7c8 - */ 0, + /* 7c9 - */ 0, + /* 7ca - */ 0, + /* 7cb - */ 0, + /* 7cc - */ 0, + /* 7cd - */ 0, + /* 7ce - */ 0, + /* 7cf - */ 0, + /* 7d0 - */ 0, + /* 7d1 - */ 0, + /* 7d2 - */ 0, + /* 7d3 - */ 0, + /* 7d4 - */ 0, + /* 7d5 - */ 0, + /* 7d6 - */ 0, + /* 7d7 - */ 0, + /* 7d8 - */ 0, + /* 7d9 - */ 0, + /* 7da - */ 0, + /* 7db - */ 0, + /* 7dc - */ 0, + /* 7dd - */ 0, + /* 7de - */ 0, + /* 7df - */ 0, + /* 7e0 - */ 0, + /* 7e1 - */ 0, + /* 7e2 - */ 0, + /* 7e3 - */ 0, + /* 7e4 - */ 0, + /* 7e5 - */ 0, + /* 7e6 - */ 0, + /* 7e7 - */ 0, + /* 7e8 - _0F_38_80 */ 0xd224, + /* 7e9 - _0F_38_81 */ 0xd230, + /* 7ea - _0F_38_82 */ 0xd23c, + /* 7eb - */ 0, + /* 7ec - */ 0, + /* 7ed - */ 0, + /* 7ee - */ 0, + /* 7ef - */ 0, + /* 7f0 - */ 0, + /* 7f1 - */ 0, + /* 7f2 - */ 0, + /* 7f3 - */ 0, + /* 7f4 - */ 0, + /* 7f5 - */ 0, + /* 7f6 - */ 0, + /* 7f7 - */ 0, + /* 7f8 - */ 0, + /* 7f9 - */ 0, + /* 7fa - */ 0, + /* 7fb - */ 0, + /* 7fc - */ 0, + /* 7fd - */ 0, + /* 7fe - _0F_38_96 */ 0xd248, + /* 7ff - _0F_38_97 */ 0xd254, + /* 800 - _0F_38_98 */ 0xd260, + /* 801 - _0F_38_99 */ 0xd26c, + /* 802 - _0F_38_9A */ 0xd278, + /* 803 - _0F_38_9B */ 0xd284, + /* 804 - _0F_38_9C */ 0xd290, + /* 805 - _0F_38_9D */ 0xd29c, + /* 806 - _0F_38_9E */ 0xd2a8, + /* 807 - _0F_38_9F */ 0xd2b4, + /* 808 - */ 0, + /* 809 - */ 0, + /* 80a - */ 0, + /* 80b - */ 0, + /* 80c - */ 0, + /* 80d - */ 0, + /* 80e - _0F_38_A6 */ 0xd2c0, + /* 80f - _0F_38_A7 */ 0xd2cc, + /* 810 - _0F_38_A8 */ 0xd2d8, + /* 811 - _0F_38_A9 */ 0xd2e4, + /* 812 - _0F_38_AA */ 0xd2f0, + /* 813 - _0F_38_AB */ 0xd2fc, + /* 814 - _0F_38_AC */ 0xd308, + /* 815 - _0F_38_AD */ 0xd314, + /* 816 - _0F_38_AE */ 0xd320, + /* 817 - _0F_38_AF */ 0xd32c, + /* 818 - */ 0, + /* 819 - */ 0, + /* 81a - */ 0, + /* 81b - */ 0, + /* 81c - */ 0, + /* 81d - */ 0, + /* 81e - _0F_38_B6 */ 0xd338, + /* 81f - _0F_38_B7 */ 0xd344, + /* 820 - _0F_38_B8 */ 0xd350, + /* 821 - _0F_38_B9 */ 0xd35c, + /* 822 - _0F_38_BA */ 0xd368, + /* 823 - _0F_38_BB */ 0xd374, + /* 824 - _0F_38_BC */ 0xd380, + /* 825 - _0F_38_BD */ 0xd38c, + /* 826 - _0F_38_BE */ 0xd398, + /* 827 - _0F_38_BF */ 0xd3a4, + /* 828 - */ 0, + /* 829 - */ 0, + /* 82a - */ 0, + /* 82b - */ 0, + /* 82c - */ 0, + /* 82d - */ 0, + /* 82e - */ 0, + /* 82f - */ 0, + /* 830 - */ 0, + /* 831 - */ 0, + /* 832 - */ 0, + /* 833 - */ 0, + /* 834 - */ 0, + /* 835 - */ 0, + /* 836 - */ 0, + /* 837 - */ 0, + /* 838 - */ 0, + /* 839 - */ 0, + /* 83a - */ 0, + /* 83b - */ 0, + /* 83c - */ 0, + /* 83d - */ 0, + /* 83e - */ 0, + /* 83f - */ 0, + /* 840 - */ 0, + /* 841 - */ 0, + /* 842 - */ 0, + /* 843 - _0F_38_DB */ 0xd3b0, + /* 844 - _0F_38_DC */ 0xd3bc, + /* 845 - _0F_38_DD */ 0xd3c8, + /* 846 - _0F_38_DE */ 0xd3d4, + /* 847 - _0F_38_DF */ 0xd3e0, + /* 848 - */ 0, + /* 849 - */ 0, + /* 84a - */ 0, + /* 84b - */ 0, + /* 84c - */ 0, + /* 84d - */ 0, + /* 84e - */ 0, + /* 84f - */ 0, + /* 850 - */ 0, + /* 851 - */ 0, + /* 852 - */ 0, + /* 853 - */ 0, + /* 854 - */ 0, + /* 855 - */ 0, + /* 856 - */ 0, + /* 857 - */ 0, + /* 858 - _0F_38_F0 */ 0xd3ec, + /* 859 - _0F_38_F1 */ 0xd3f8, + /* 85a - */ 0, + /* 85b - */ 0, + /* 85c - */ 0, + /* 85d - */ 0, + /* 85e - */ 0, + /* 85f - */ 0, + /* 860 - */ 0, + /* 861 - */ 0, + /* 862 - */ 0, + /* 863 - */ 0, + /* 864 - */ 0, + /* 865 - */ 0, + /* 866 - */ 0, + /* 867 - */ 0, + /* 868 - */ 0, + /* 869 - */ 0, + /* 86a - */ 0, + /* 86b - */ 0, + /* 86c - _0F_3A_04 */ 0xd404, + /* 86d - _0F_3A_05 */ 0xd410, + /* 86e - _0F_3A_06 */ 0xd41c, + /* 86f - */ 0, + /* 870 - _0F_3A_08 */ 0xd428, + /* 871 - _0F_3A_09 */ 0xd434, + /* 872 - _0F_3A_0A */ 0xd440, + /* 873 - _0F_3A_0B */ 0xd44c, + /* 874 - _0F_3A_0C */ 0xd458, + /* 875 - _0F_3A_0D */ 0xd464, + /* 876 - _0F_3A_0E */ 0xd470, + /* 877 - _0F_3A_0F */ 0xd47c, + /* 878 - */ 0, + /* 879 - */ 0, + /* 87a - */ 0, + /* 87b - */ 0, + /* 87c - _0F_3A_14 */ 0xd488, + /* 87d - _0F_3A_15 */ 0xd494, + /* 87e - _0F_3A_16 */ 0xd4a0, + /* 87f - _0F_3A_17 */ 0xd4ac, + /* 880 - _0F_3A_18 */ 0xd4b8, + /* 881 - _0F_3A_19 */ 0xd4c4, + /* 882 - */ 0, + /* 883 - */ 0, + /* 884 - */ 0, + /* 885 - */ 0, + /* 886 - */ 0, + /* 887 - */ 0, + /* 888 - _0F_3A_20 */ 0xd4d0, + /* 889 - _0F_3A_21 */ 0xd4dc, + /* 88a - _0F_3A_22 */ 0xd4e8, + /* 88b - */ 0, + /* 88c - */ 0, + /* 88d - */ 0, + /* 88e - */ 0, + /* 88f - */ 0, + /* 890 - */ 0, + /* 891 - */ 0, + /* 892 - */ 0, + /* 893 - */ 0, + /* 894 - */ 0, + /* 895 - */ 0, + /* 896 - */ 0, + /* 897 - */ 0, + /* 898 - */ 0, + /* 899 - */ 0, + /* 89a - */ 0, + /* 89b - */ 0, + /* 89c - */ 0, + /* 89d - */ 0, + /* 89e - */ 0, + /* 89f - */ 0, + /* 8a0 - */ 0, + /* 8a1 - */ 0, + /* 8a2 - */ 0, + /* 8a3 - */ 0, + /* 8a4 - */ 0, + /* 8a5 - */ 0, + /* 8a6 - */ 0, + /* 8a7 - */ 0, + /* 8a8 - _0F_3A_40 */ 0xd4f4, + /* 8a9 - _0F_3A_41 */ 0xd500, + /* 8aa - _0F_3A_42 */ 0xd50c, + /* 8ab - */ 0, + /* 8ac - _0F_3A_44 */ 0xd518, + /* 8ad - */ 0, + /* 8ae - */ 0, + /* 8af - */ 0, + /* 8b0 - */ 0, + /* 8b1 - */ 0, + /* 8b2 - _0F_3A_4A */ 0xd524, + /* 8b3 - _0F_3A_4B */ 0xd530, + /* 8b4 - _0F_3A_4C */ 0xd53c, + /* 8b5 - */ 0, + /* 8b6 - */ 0, + /* 8b7 - */ 0, + /* 8b8 - */ 0, + /* 8b9 - */ 0, + /* 8ba - */ 0, + /* 8bb - */ 0, + /* 8bc - */ 0, + /* 8bd - */ 0, + /* 8be - */ 0, + /* 8bf - */ 0, + /* 8c0 - */ 0, + /* 8c1 - */ 0, + /* 8c2 - */ 0, + /* 8c3 - */ 0, + /* 8c4 - */ 0, + /* 8c5 - */ 0, + /* 8c6 - */ 0, + /* 8c7 - */ 0, + /* 8c8 - _0F_3A_60 */ 0xd548, + /* 8c9 - _0F_3A_61 */ 0xd554, + /* 8ca - _0F_3A_62 */ 0xd560, + /* 8cb - _0F_3A_63 */ 0xd56c, + /* 8cc - */ 0, + /* 8cd - */ 0, + /* 8ce - */ 0, + /* 8cf - */ 0, + /* 8d0 - */ 0, + /* 8d1 - */ 0, + /* 8d2 - */ 0, + /* 8d3 - */ 0, + /* 8d4 - */ 0, + /* 8d5 - */ 0, + /* 8d6 - */ 0, + /* 8d7 - */ 0, + /* 8d8 - */ 0, + /* 8d9 - */ 0, + /* 8da - */ 0, + /* 8db - */ 0, + /* 8dc - */ 0, + /* 8dd - */ 0, + /* 8de - */ 0, + /* 8df - */ 0, + /* 8e0 - */ 0, + /* 8e1 - */ 0, + /* 8e2 - */ 0, + /* 8e3 - */ 0, + /* 8e4 - */ 0, + /* 8e5 - */ 0, + /* 8e6 - */ 0, + /* 8e7 - */ 0, + /* 8e8 - */ 0, + /* 8e9 - */ 0, + /* 8ea - */ 0, + /* 8eb - */ 0, + /* 8ec - */ 0, + /* 8ed - */ 0, + /* 8ee - */ 0, + /* 8ef - */ 0, + /* 8f0 - */ 0, + /* 8f1 - */ 0, + /* 8f2 - */ 0, + /* 8f3 - */ 0, + /* 8f4 - */ 0, + /* 8f5 - */ 0, + /* 8f6 - */ 0, + /* 8f7 - */ 0, + /* 8f8 - */ 0, + /* 8f9 - */ 0, + /* 8fa - */ 0, + /* 8fb - */ 0, + /* 8fc - */ 0, + /* 8fd - */ 0, + /* 8fe - */ 0, + /* 8ff - */ 0, + /* 900 - */ 0, + /* 901 - */ 0, + /* 902 - */ 0, + /* 903 - */ 0, + /* 904 - */ 0, + /* 905 - */ 0, + /* 906 - */ 0, + /* 907 - */ 0, + /* 908 - */ 0, + /* 909 - */ 0, + /* 90a - */ 0, + /* 90b - */ 0, + /* 90c - */ 0, + /* 90d - */ 0, + /* 90e - */ 0, + /* 90f - */ 0, + /* 910 - */ 0, + /* 911 - */ 0, + /* 912 - */ 0, + /* 913 - */ 0, + /* 914 - */ 0, + /* 915 - */ 0, + /* 916 - */ 0, + /* 917 - */ 0, + /* 918 - */ 0, + /* 919 - */ 0, + /* 91a - */ 0, + /* 91b - */ 0, + /* 91c - */ 0, + /* 91d - */ 0, + /* 91e - */ 0, + /* 91f - */ 0, + /* 920 - */ 0, + /* 921 - */ 0, + /* 922 - */ 0, + /* 923 - */ 0, + /* 924 - */ 0, + /* 925 - */ 0, + /* 926 - */ 0, + /* 927 - */ 0, + /* 928 - */ 0, + /* 929 - */ 0, + /* 92a - */ 0, + /* 92b - */ 0, + /* 92c - */ 0, + /* 92d - */ 0, + /* 92e - */ 0, + /* 92f - */ 0, + /* 930 - */ 0, + /* 931 - */ 0, + /* 932 - */ 0, + /* 933 - */ 0, + /* 934 - */ 0, + /* 935 - */ 0, + /* 936 - */ 0, + /* 937 - */ 0, + /* 938 - */ 0, + /* 939 - */ 0, + /* 93a - */ 0, + /* 93b - */ 0, + /* 93c - */ 0, + /* 93d - */ 0, + /* 93e - */ 0, + /* 93f - */ 0, + /* 940 - */ 0, + /* 941 - */ 0, + /* 942 - */ 0, + /* 943 - */ 0, + /* 944 - */ 0, + /* 945 - */ 0, + /* 946 - */ 0, + /* 947 - _0F_3A_DF */ 0xd578, + /* 948 - */ 0, + /* 949 - */ 0, + /* 94a - */ 0, + /* 94b - */ 0, + /* 94c - */ 0, + /* 94d - */ 0, + /* 94e - */ 0, + /* 94f - */ 0, + /* 950 - */ 0, + /* 951 - */ 0, + /* 952 - */ 0, + /* 953 - */ 0, + /* 954 - */ 0, + /* 955 - */ 0, + /* 956 - */ 0, + /* 957 - */ 0, + /* 958 - */ 0, + /* 959 - */ 0, + /* 95a - */ 0, + /* 95b - */ 0, + /* 95c - */ 0, + /* 95d - */ 0, + /* 95e - */ 0, + /* 95f - */ 0, + /* 960 - */ 0, + /* 961 - */ 0, + /* 962 - */ 0, + /* 963 - */ 0, + /* 964 - */ 0, + /* 965 - */ 0, + /* 966 - */ 0, + /* 967 - */ 0, + /* 968 - _0F_50 */ 0x23a3, + /* 969 - _66_0F_50 */ 0x23a4, + /* 96a - */ 0, + /* 96b - */ 0, + /* 96c - _V_0F_50 */ 0x4036, + /* 96d - _V_66_0F_50 */ 0x4037, + /* 96e - */ 0, + /* 96f - */ 0, + /* 970 - */ 0, + /* 971 - */ 0, + /* 972 - */ 0, + /* 973 - */ 0, + /* 974 - _0F_51 */ 0x23a5, + /* 975 - _66_0F_51 */ 0x23a6, + /* 976 - _F3_0F_51 */ 0x23a7, + /* 977 - _F2_0F_51 */ 0x23a8, + /* 978 - _V_0F_51 */ 0x4038, + /* 979 - _V_66_0F_51 */ 0x4039, + /* 97a - _V_F3_0F_51 */ 0x403a, + /* 97b - _V_F2_0F_51 */ 0x403b, + /* 97c - */ 0, + /* 97d - */ 0, + /* 97e - */ 0, + /* 97f - */ 0, + /* 980 - _0F_52 */ 0x23a9, + /* 981 - */ 0, + /* 982 - _F3_0F_52 */ 0x23aa, + /* 983 - */ 0, + /* 984 - _V_0F_52 */ 0x403c, + /* 985 - */ 0, + /* 986 - _V_F3_0F_52 */ 0x403d, + /* 987 - */ 0, + /* 988 - */ 0, + /* 989 - */ 0, + /* 98a - */ 0, + /* 98b - */ 0, + /* 98c - _0F_53 */ 0x23ab, + /* 98d - */ 0, + /* 98e - _F3_0F_53 */ 0x23ac, + /* 98f - */ 0, + /* 990 - _V_0F_53 */ 0x403e, + /* 991 - */ 0, + /* 992 - _V_F3_0F_53 */ 0x403f, + /* 993 - */ 0, + /* 994 - */ 0, + /* 995 - */ 0, + /* 996 - */ 0, + /* 997 - */ 0, + /* 998 - _0F_54 */ 0x23ad, + /* 999 - _66_0F_54 */ 0x23ae, + /* 99a - */ 0, + /* 99b - */ 0, + /* 99c - _V_0F_54 */ 0x4040, + /* 99d - _V_66_0F_54 */ 0x4041, + /* 99e - */ 0, + /* 99f - */ 0, + /* 9a0 - */ 0, + /* 9a1 - */ 0, + /* 9a2 - */ 0, + /* 9a3 - */ 0, + /* 9a4 - _0F_55 */ 0x23af, + /* 9a5 - _66_0F_55 */ 0x23b0, + /* 9a6 - */ 0, + /* 9a7 - */ 0, + /* 9a8 - _V_0F_55 */ 0x4042, + /* 9a9 - _V_66_0F_55 */ 0x4043, + /* 9aa - */ 0, + /* 9ab - */ 0, + /* 9ac - */ 0, + /* 9ad - */ 0, + /* 9ae - */ 0, + /* 9af - */ 0, + /* 9b0 - _0F_56 */ 0x23b1, + /* 9b1 - _66_0F_56 */ 0x23b2, + /* 9b2 - */ 0, + /* 9b3 - */ 0, + /* 9b4 - _V_0F_56 */ 0x4044, + /* 9b5 - _V_66_0F_56 */ 0x4045, + /* 9b6 - */ 0, + /* 9b7 - */ 0, + /* 9b8 - */ 0, + /* 9b9 - */ 0, + /* 9ba - */ 0, + /* 9bb - */ 0, + /* 9bc - _0F_57 */ 0x23b3, + /* 9bd - _66_0F_57 */ 0x23b4, + /* 9be - */ 0, + /* 9bf - */ 0, + /* 9c0 - _V_0F_57 */ 0x4046, + /* 9c1 - _V_66_0F_57 */ 0x4047, + /* 9c2 - */ 0, + /* 9c3 - */ 0, + /* 9c4 - */ 0, + /* 9c5 - */ 0, + /* 9c6 - */ 0, + /* 9c7 - */ 0, + /* 9c8 - _0F_58 */ 0x23b5, + /* 9c9 - _66_0F_58 */ 0x23b6, + /* 9ca - _F3_0F_58 */ 0x23b7, + /* 9cb - _F2_0F_58 */ 0x23b8, + /* 9cc - _V_0F_58 */ 0x4048, + /* 9cd - _V_66_0F_58 */ 0x4049, + /* 9ce - _V_F3_0F_58 */ 0x404a, + /* 9cf - _V_F2_0F_58 */ 0x404b, + /* 9d0 - */ 0, + /* 9d1 - */ 0, + /* 9d2 - */ 0, + /* 9d3 - */ 0, + /* 9d4 - _0F_59 */ 0x23b9, + /* 9d5 - _66_0F_59 */ 0x23ba, + /* 9d6 - _F3_0F_59 */ 0x23bb, + /* 9d7 - _F2_0F_59 */ 0x23bc, + /* 9d8 - _V_0F_59 */ 0x404c, + /* 9d9 - _V_66_0F_59 */ 0x404d, + /* 9da - _V_F3_0F_59 */ 0x404e, + /* 9db - _V_F2_0F_59 */ 0x404f, + /* 9dc - */ 0, + /* 9dd - */ 0, + /* 9de - */ 0, + /* 9df - */ 0, + /* 9e0 - _0F_5A */ 0x23bd, + /* 9e1 - _66_0F_5A */ 0x23be, + /* 9e2 - _F3_0F_5A */ 0x23bf, + /* 9e3 - _F2_0F_5A */ 0x23c0, + /* 9e4 - _V_0F_5A */ 0x4050, + /* 9e5 - _V_66_0F_5A */ 0x4051, + /* 9e6 - _V_F3_0F_5A */ 0x4052, + /* 9e7 - _V_F2_0F_5A */ 0x4053, + /* 9e8 - */ 0, + /* 9e9 - */ 0, + /* 9ea - */ 0, + /* 9eb - */ 0, + /* 9ec - _0F_5B */ 0x23c1, + /* 9ed - _66_0F_5B */ 0x23c2, + /* 9ee - _F3_0F_5B */ 0x23c3, + /* 9ef - */ 0, + /* 9f0 - _V_0F_5B */ 0x4054, + /* 9f1 - _V_66_0F_5B */ 0x4055, + /* 9f2 - _V_F3_0F_5B */ 0x4056, + /* 9f3 - */ 0, + /* 9f4 - */ 0, + /* 9f5 - */ 0, + /* 9f6 - */ 0, + /* 9f7 - */ 0, + /* 9f8 - _0F_5C */ 0x23c4, + /* 9f9 - _66_0F_5C */ 0x23c5, + /* 9fa - _F3_0F_5C */ 0x23c6, + /* 9fb - _F2_0F_5C */ 0x23c7, + /* 9fc - _V_0F_5C */ 0x4057, + /* 9fd - _V_66_0F_5C */ 0x4058, + /* 9fe - _V_F3_0F_5C */ 0x4059, + /* 9ff - _V_F2_0F_5C */ 0x405a, + /* a00 - */ 0, + /* a01 - */ 0, + /* a02 - */ 0, + /* a03 - */ 0, + /* a04 - _0F_5D */ 0x23c8, + /* a05 - _66_0F_5D */ 0x23c9, + /* a06 - _F3_0F_5D */ 0x23ca, + /* a07 - _F2_0F_5D */ 0x23cb, + /* a08 - _V_0F_5D */ 0x405b, + /* a09 - _V_66_0F_5D */ 0x405c, + /* a0a - _V_F3_0F_5D */ 0x405d, + /* a0b - _V_F2_0F_5D */ 0x405e, + /* a0c - */ 0, + /* a0d - */ 0, + /* a0e - */ 0, + /* a0f - */ 0, + /* a10 - _0F_5E */ 0x23cc, + /* a11 - _66_0F_5E */ 0x23cd, + /* a12 - _F3_0F_5E */ 0x23ce, + /* a13 - _F2_0F_5E */ 0x23cf, + /* a14 - _V_0F_5E */ 0x405f, + /* a15 - _V_66_0F_5E */ 0x4060, + /* a16 - _V_F3_0F_5E */ 0x4061, + /* a17 - _V_F2_0F_5E */ 0x4062, + /* a18 - */ 0, + /* a19 - */ 0, + /* a1a - */ 0, + /* a1b - */ 0, + /* a1c - _0F_5F */ 0x23d0, + /* a1d - _66_0F_5F */ 0x23d1, + /* a1e - _F3_0F_5F */ 0x23d2, + /* a1f - _F2_0F_5F */ 0x23d3, + /* a20 - _V_0F_5F */ 0x4063, + /* a21 - _V_66_0F_5F */ 0x4064, + /* a22 - _V_F3_0F_5F */ 0x4065, + /* a23 - _V_F2_0F_5F */ 0x4066, + /* a24 - */ 0, + /* a25 - */ 0, + /* a26 - */ 0, + /* a27 - */ 0, + /* a28 - _0F_60 */ 0x23d4, + /* a29 - _66_0F_60 */ 0x23d5, + /* a2a - */ 0, + /* a2b - */ 0, + /* a2c - */ 0, + /* a2d - _V_66_0F_60 */ 0x4067, + /* a2e - */ 0, + /* a2f - */ 0, + /* a30 - */ 0, + /* a31 - */ 0, + /* a32 - */ 0, + /* a33 - */ 0, + /* a34 - _0F_61 */ 0x23d6, + /* a35 - _66_0F_61 */ 0x23d7, + /* a36 - */ 0, + /* a37 - */ 0, + /* a38 - */ 0, + /* a39 - _V_66_0F_61 */ 0x4068, + /* a3a - */ 0, + /* a3b - */ 0, + /* a3c - */ 0, + /* a3d - */ 0, + /* a3e - */ 0, + /* a3f - */ 0, + /* a40 - _0F_62 */ 0x23d8, + /* a41 - _66_0F_62 */ 0x23d9, + /* a42 - */ 0, + /* a43 - */ 0, + /* a44 - */ 0, + /* a45 - _V_66_0F_62 */ 0x4069, + /* a46 - */ 0, + /* a47 - */ 0, + /* a48 - */ 0, + /* a49 - */ 0, + /* a4a - */ 0, + /* a4b - */ 0, + /* a4c - _0F_63 */ 0x23da, + /* a4d - _66_0F_63 */ 0x23db, + /* a4e - */ 0, + /* a4f - */ 0, + /* a50 - */ 0, + /* a51 - _V_66_0F_63 */ 0x406a, + /* a52 - */ 0, + /* a53 - */ 0, + /* a54 - */ 0, + /* a55 - */ 0, + /* a56 - */ 0, + /* a57 - */ 0, + /* a58 - _0F_64 */ 0x23dc, + /* a59 - _66_0F_64 */ 0x23dd, + /* a5a - */ 0, + /* a5b - */ 0, + /* a5c - */ 0, + /* a5d - _V_66_0F_64 */ 0x406b, + /* a5e - */ 0, + /* a5f - */ 0, + /* a60 - */ 0, + /* a61 - */ 0, + /* a62 - */ 0, + /* a63 - */ 0, + /* a64 - _0F_65 */ 0x23de, + /* a65 - _66_0F_65 */ 0x23df, + /* a66 - */ 0, + /* a67 - */ 0, + /* a68 - */ 0, + /* a69 - _V_66_0F_65 */ 0x406c, + /* a6a - */ 0, + /* a6b - */ 0, + /* a6c - */ 0, + /* a6d - */ 0, + /* a6e - */ 0, + /* a6f - */ 0, + /* a70 - _0F_66 */ 0x23e0, + /* a71 - _66_0F_66 */ 0x23e1, + /* a72 - */ 0, + /* a73 - */ 0, + /* a74 - */ 0, + /* a75 - _V_66_0F_66 */ 0x406d, + /* a76 - */ 0, + /* a77 - */ 0, + /* a78 - */ 0, + /* a79 - */ 0, + /* a7a - */ 0, + /* a7b - */ 0, + /* a7c - _0F_67 */ 0x23e2, + /* a7d - _66_0F_67 */ 0x23e3, + /* a7e - */ 0, + /* a7f - */ 0, + /* a80 - */ 0, + /* a81 - _V_66_0F_67 */ 0x406e, + /* a82 - */ 0, + /* a83 - */ 0, + /* a84 - */ 0, + /* a85 - */ 0, + /* a86 - */ 0, + /* a87 - */ 0, + /* a88 - _0F_68 */ 0x23e4, + /* a89 - _66_0F_68 */ 0x23e5, + /* a8a - */ 0, + /* a8b - */ 0, + /* a8c - */ 0, + /* a8d - _V_66_0F_68 */ 0x406f, + /* a8e - */ 0, + /* a8f - */ 0, + /* a90 - */ 0, + /* a91 - */ 0, + /* a92 - */ 0, + /* a93 - */ 0, + /* a94 - _0F_69 */ 0x23e6, + /* a95 - _66_0F_69 */ 0x23e7, + /* a96 - */ 0, + /* a97 - */ 0, + /* a98 - */ 0, + /* a99 - _V_66_0F_69 */ 0x4070, + /* a9a - */ 0, + /* a9b - */ 0, + /* a9c - */ 0, + /* a9d - */ 0, + /* a9e - */ 0, + /* a9f - */ 0, + /* aa0 - _0F_6A */ 0x23e8, + /* aa1 - _66_0F_6A */ 0x23e9, + /* aa2 - */ 0, + /* aa3 - */ 0, + /* aa4 - */ 0, + /* aa5 - _V_66_0F_6A */ 0x4071, + /* aa6 - */ 0, + /* aa7 - */ 0, + /* aa8 - */ 0, + /* aa9 - */ 0, + /* aaa - */ 0, + /* aab - */ 0, + /* aac - _0F_6B */ 0x23ea, + /* aad - _66_0F_6B */ 0x23eb, + /* aae - */ 0, + /* aaf - */ 0, + /* ab0 - */ 0, + /* ab1 - _V_66_0F_6B */ 0x4072, + /* ab2 - */ 0, + /* ab3 - */ 0, + /* ab4 - */ 0, + /* ab5 - */ 0, + /* ab6 - */ 0, + /* ab7 - */ 0, + /* ab8 - */ 0, + /* ab9 - _66_0F_6C */ 0x23ec, + /* aba - */ 0, + /* abb - */ 0, + /* abc - */ 0, + /* abd - _V_66_0F_6C */ 0x4073, + /* abe - */ 0, + /* abf - */ 0, + /* ac0 - */ 0, + /* ac1 - */ 0, + /* ac2 - */ 0, + /* ac3 - */ 0, + /* ac4 - */ 0, + /* ac5 - _66_0F_6D */ 0x23ed, + /* ac6 - */ 0, + /* ac7 - */ 0, + /* ac8 - */ 0, + /* ac9 - _V_66_0F_6D */ 0x4074, + /* aca - */ 0, + /* acb - */ 0, + /* acc - */ 0, + /* acd - */ 0, + /* ace - */ 0, + /* acf - */ 0, + /* ad0 - _0F_6E */ 0x4075, + /* ad1 - _66_0F_6E */ 0x4076, + /* ad2 - */ 0, + /* ad3 - */ 0, + /* ad4 - */ 0, + /* ad5 - _V_66_0F_6E */ 0x4077, + /* ad6 - */ 0, + /* ad7 - */ 0, + /* ad8 - */ 0, + /* ad9 - */ 0, + /* ada - */ 0, + /* adb - */ 0, + /* adc - _0F_6F */ 0x23ee, + /* add - _66_0F_6F */ 0x23ef, + /* ade - _F3_0F_6F */ 0x23f0, + /* adf - */ 0, + /* ae0 - */ 0, + /* ae1 - _V_66_0F_6F */ 0x4078, + /* ae2 - _V_F3_0F_6F */ 0x4079, + /* ae3 - */ 0, + /* ae4 - */ 0, + /* ae5 - */ 0, + /* ae6 - */ 0, + /* ae7 - */ 0, + /* ae8 - _0F_70 */ 0x407a, + /* ae9 - _66_0F_70 */ 0x407b, + /* aea - _F3_0F_70 */ 0x407c, + /* aeb - _F2_0F_70 */ 0x407d, + /* aec - */ 0, + /* aed - _V_66_0F_70 */ 0x407e, + /* aee - _V_F3_0F_70 */ 0x407f, + /* aef - _V_F2_0F_70 */ 0x4080, + /* af0 - */ 0, + /* af1 - */ 0, + /* af2 - */ 0, + /* af3 - */ 0, + /* af4 - */ 0, + /* af5 - */ 0, + /* af6 - _0F_71_02 */ 0xd584, + /* af7 - */ 0, + /* af8 - _0F_71_04 */ 0xd590, + /* af9 - */ 0, + /* afa - _0F_71_06 */ 0xd59c, + /* afb - */ 0, + /* afc - */ 0, + /* afd - */ 0, + /* afe - _0F_72_02 */ 0xd5a8, + /* aff - */ 0, + /* b00 - _0F_72_04 */ 0xd5b4, + /* b01 - */ 0, + /* b02 - _0F_72_06 */ 0xd5c0, + /* b03 - */ 0, + /* b04 - */ 0, + /* b05 - */ 0, + /* b06 - _0F_73_02 */ 0xd5cc, + /* b07 - _0F_73_03 */ 0xd5d8, + /* b08 - */ 0, + /* b09 - */ 0, + /* b0a - _0F_73_06 */ 0xd5e4, + /* b0b - _0F_73_07 */ 0xd5f0, + /* b0c - _0F_74 */ 0x23f1, + /* b0d - _66_0F_74 */ 0x23f2, + /* b0e - */ 0, + /* b0f - */ 0, + /* b10 - */ 0, + /* b11 - _V_66_0F_74 */ 0x4081, + /* b12 - */ 0, + /* b13 - */ 0, + /* b14 - */ 0, + /* b15 - */ 0, + /* b16 - */ 0, + /* b17 - */ 0, + /* b18 - _0F_75 */ 0x23f3, + /* b19 - _66_0F_75 */ 0x23f4, + /* b1a - */ 0, + /* b1b - */ 0, + /* b1c - */ 0, + /* b1d - _V_66_0F_75 */ 0x4082, + /* b1e - */ 0, + /* b1f - */ 0, + /* b20 - */ 0, + /* b21 - */ 0, + /* b22 - */ 0, + /* b23 - */ 0, + /* b24 - _0F_76 */ 0x23f5, + /* b25 - _66_0F_76 */ 0x23f6, + /* b26 - */ 0, + /* b27 - */ 0, + /* b28 - */ 0, + /* b29 - _V_66_0F_76 */ 0x4083, + /* b2a - */ 0, + /* b2b - */ 0, + /* b2c - */ 0, + /* b2d - */ 0, + /* b2e - */ 0, + /* b2f - */ 0, + /* b30 - _0F_77 */ 0x23f7, + /* b31 - */ 0, + /* b32 - */ 0, + /* b33 - */ 0, + /* b34 - _V_0F_77 */ 0x4084, + /* b35 - */ 0, + /* b36 - */ 0, + /* b37 - */ 0, + /* b38 - */ 0, + /* b39 - */ 0, + /* b3a - */ 0, + /* b3b - */ 0, + /* b3c - _0F_78 */ 0x23f8, + /* b3d - _66_0F_78 */ 0x4085, + /* b3e - */ 0, + /* b3f - _F2_0F_78 */ 0x4086, + /* b40 - */ 0, + /* b41 - */ 0, + /* b42 - */ 0, + /* b43 - */ 0, + /* b44 - */ 0, + /* b45 - */ 0, + /* b46 - */ 0, + /* b47 - */ 0, + /* b48 - _0F_79 */ 0x23f9, + /* b49 - _66_0F_79 */ 0x23fa, + /* b4a - */ 0, + /* b4b - _F2_0F_79 */ 0x23fb, + /* b4c - */ 0, + /* b4d - */ 0, + /* b4e - */ 0, + /* b4f - */ 0, + /* b50 - */ 0, + /* b51 - */ 0, + /* b52 - */ 0, + /* b53 - */ 0, + /* b54 - */ 0, + /* b55 - */ 0, + /* b56 - */ 0, + /* b57 - */ 0, + /* b58 - */ 0, + /* b59 - */ 0, + /* b5a - */ 0, + /* b5b - */ 0, + /* b5c - */ 0, + /* b5d - */ 0, + /* b5e - */ 0, + /* b5f - */ 0, + /* b60 - */ 0, + /* b61 - */ 0, + /* b62 - */ 0, + /* b63 - */ 0, + /* b64 - */ 0, + /* b65 - */ 0, + /* b66 - */ 0, + /* b67 - */ 0, + /* b68 - */ 0, + /* b69 - */ 0, + /* b6a - */ 0, + /* b6b - */ 0, + /* b6c - */ 0, + /* b6d - */ 0, + /* b6e - */ 0, + /* b6f - */ 0, + /* b70 - */ 0, + /* b71 - */ 0, + /* b72 - */ 0, + /* b73 - */ 0, + /* b74 - */ 0, + /* b75 - */ 0, + /* b76 - */ 0, + /* b77 - */ 0, + /* b78 - */ 0, + /* b79 - */ 0, + /* b7a - */ 0, + /* b7b - */ 0, + /* b7c - */ 0, + /* b7d - */ 0, + /* b7e - */ 0, + /* b7f - */ 0, + /* b80 - */ 0, + /* b81 - */ 0, + /* b82 - */ 0, + /* b83 - */ 0, + /* b84 - _0F_7A_30 */ 0x23fc, + /* b85 - _0F_7A_31 */ 0x23fd, + /* b86 - */ 0, + /* b87 - */ 0, + /* b88 - */ 0, + /* b89 - */ 0, + /* b8a - */ 0, + /* b8b - */ 0, + /* b8c - */ 0, + /* b8d - */ 0, + /* b8e - */ 0, + /* b8f - */ 0, + /* b90 - */ 0, + /* b91 - */ 0, + /* b92 - */ 0, + /* b93 - */ 0, + /* b94 - */ 0, + /* b95 - */ 0, + /* b96 - */ 0, + /* b97 - */ 0, + /* b98 - */ 0, + /* b99 - */ 0, + /* b9a - */ 0, + /* b9b - */ 0, + /* b9c - */ 0, + /* b9d - */ 0, + /* b9e - */ 0, + /* b9f - */ 0, + /* ba0 - */ 0, + /* ba1 - */ 0, + /* ba2 - */ 0, + /* ba3 - */ 0, + /* ba4 - */ 0, + /* ba5 - */ 0, + /* ba6 - */ 0, + /* ba7 - */ 0, + /* ba8 - */ 0, + /* ba9 - */ 0, + /* baa - */ 0, + /* bab - */ 0, + /* bac - */ 0, + /* bad - */ 0, + /* bae - */ 0, + /* baf - */ 0, + /* bb0 - */ 0, + /* bb1 - */ 0, + /* bb2 - */ 0, + /* bb3 - */ 0, + /* bb4 - */ 0, + /* bb5 - */ 0, + /* bb6 - */ 0, + /* bb7 - */ 0, + /* bb8 - */ 0, + /* bb9 - */ 0, + /* bba - */ 0, + /* bbb - */ 0, + /* bbc - */ 0, + /* bbd - */ 0, + /* bbe - */ 0, + /* bbf - */ 0, + /* bc0 - */ 0, + /* bc1 - */ 0, + /* bc2 - */ 0, + /* bc3 - */ 0, + /* bc4 - */ 0, + /* bc5 - */ 0, + /* bc6 - */ 0, + /* bc7 - */ 0, + /* bc8 - */ 0, + /* bc9 - */ 0, + /* bca - */ 0, + /* bcb - */ 0, + /* bcc - */ 0, + /* bcd - */ 0, + /* bce - */ 0, + /* bcf - */ 0, + /* bd0 - */ 0, + /* bd1 - */ 0, + /* bd2 - */ 0, + /* bd3 - */ 0, + /* bd4 - */ 0, + /* bd5 - */ 0, + /* bd6 - */ 0, + /* bd7 - */ 0, + /* bd8 - */ 0, + /* bd9 - */ 0, + /* bda - */ 0, + /* bdb - */ 0, + /* bdc - */ 0, + /* bdd - */ 0, + /* bde - */ 0, + /* bdf - */ 0, + /* be0 - */ 0, + /* be1 - */ 0, + /* be2 - */ 0, + /* be3 - */ 0, + /* be4 - */ 0, + /* be5 - */ 0, + /* be6 - */ 0, + /* be7 - */ 0, + /* be8 - */ 0, + /* be9 - */ 0, + /* bea - */ 0, + /* beb - */ 0, + /* bec - */ 0, + /* bed - */ 0, + /* bee - */ 0, + /* bef - */ 0, + /* bf0 - */ 0, + /* bf1 - */ 0, + /* bf2 - */ 0, + /* bf3 - */ 0, + /* bf4 - */ 0, + /* bf5 - */ 0, + /* bf6 - */ 0, + /* bf7 - */ 0, + /* bf8 - */ 0, + /* bf9 - */ 0, + /* bfa - */ 0, + /* bfb - */ 0, + /* bfc - */ 0, + /* bfd - */ 0, + /* bfe - */ 0, + /* bff - */ 0, + /* c00 - */ 0, + /* c01 - */ 0, + /* c02 - */ 0, + /* c03 - */ 0, + /* c04 - */ 0, + /* c05 - */ 0, + /* c06 - */ 0, + /* c07 - */ 0, + /* c08 - */ 0, + /* c09 - */ 0, + /* c0a - */ 0, + /* c0b - */ 0, + /* c0c - */ 0, + /* c0d - */ 0, + /* c0e - */ 0, + /* c0f - */ 0, + /* c10 - */ 0, + /* c11 - */ 0, + /* c12 - */ 0, + /* c13 - */ 0, + /* c14 - */ 0, + /* c15 - */ 0, + /* c16 - */ 0, + /* c17 - */ 0, + /* c18 - */ 0, + /* c19 - */ 0, + /* c1a - */ 0, + /* c1b - */ 0, + /* c1c - */ 0, + /* c1d - */ 0, + /* c1e - */ 0, + /* c1f - */ 0, + /* c20 - */ 0, + /* c21 - */ 0, + /* c22 - */ 0, + /* c23 - */ 0, + /* c24 - */ 0, + /* c25 - */ 0, + /* c26 - */ 0, + /* c27 - */ 0, + /* c28 - */ 0, + /* c29 - */ 0, + /* c2a - */ 0, + /* c2b - */ 0, + /* c2c - */ 0, + /* c2d - */ 0, + /* c2e - */ 0, + /* c2f - */ 0, + /* c30 - */ 0, + /* c31 - */ 0, + /* c32 - */ 0, + /* c33 - */ 0, + /* c34 - */ 0, + /* c35 - */ 0, + /* c36 - */ 0, + /* c37 - */ 0, + /* c38 - */ 0, + /* c39 - */ 0, + /* c3a - */ 0, + /* c3b - */ 0, + /* c3c - */ 0, + /* c3d - */ 0, + /* c3e - */ 0, + /* c3f - */ 0, + /* c40 - */ 0, + /* c41 - */ 0, + /* c42 - */ 0, + /* c43 - */ 0, + /* c44 - */ 0, + /* c45 - */ 0, + /* c46 - */ 0, + /* c47 - */ 0, + /* c48 - */ 0, + /* c49 - */ 0, + /* c4a - */ 0, + /* c4b - */ 0, + /* c4c - */ 0, + /* c4d - */ 0, + /* c4e - */ 0, + /* c4f - */ 0, + /* c50 - */ 0, + /* c51 - */ 0, + /* c52 - */ 0, + /* c53 - */ 0, + /* c54 - */ 0, + /* c55 - _66_0F_7C */ 0x23fe, + /* c56 - */ 0, + /* c57 - _F2_0F_7C */ 0x23ff, + /* c58 - */ 0, + /* c59 - _V_66_0F_7C */ 0x4087, + /* c5a - */ 0, + /* c5b - _V_F2_0F_7C */ 0x4088, + /* c5c - */ 0, + /* c5d - */ 0, + /* c5e - */ 0, + /* c5f - */ 0, + /* c60 - */ 0, + /* c61 - _66_0F_7D */ 0x2400, + /* c62 - */ 0, + /* c63 - _F2_0F_7D */ 0x2401, + /* c64 - */ 0, + /* c65 - _V_66_0F_7D */ 0x4089, + /* c66 - */ 0, + /* c67 - _V_F2_0F_7D */ 0x408a, + /* c68 - */ 0, + /* c69 - */ 0, + /* c6a - */ 0, + /* c6b - */ 0, + /* c6c - _0F_7E */ 0x408b, + /* c6d - _66_0F_7E */ 0x408c, + /* c6e - _F3_0F_7E */ 0x2402, + /* c6f - */ 0, + /* c70 - */ 0, + /* c71 - _V_66_0F_7E */ 0x408d, + /* c72 - _V_F3_0F_7E */ 0x408e, + /* c73 - */ 0, + /* c74 - */ 0, + /* c75 - */ 0, + /* c76 - */ 0, + /* c77 - */ 0, + /* c78 - _0F_7F */ 0x2403, + /* c79 - _66_0F_7F */ 0x2404, + /* c7a - _F3_0F_7F */ 0x2405, + /* c7b - */ 0, + /* c7c - */ 0, + /* c7d - _V_66_0F_7F */ 0x408f, + /* c7e - _V_F3_0F_7F */ 0x4090, + /* c7f - */ 0, + /* c80 - */ 0, + /* c81 - */ 0, + /* c82 - */ 0, + /* c83 - */ 0, + /* c84 - _0F_AE_00 */ 0xd5fc, + /* c85 - _0F_AE_01 */ 0xd608, + /* c86 - _0F_AE_02 */ 0xd614, + /* c87 - _0F_AE_03 */ 0xd620, + /* c88 - _0F_AE_04 */ 0x4091, + /* c89 - _0F_AE_05 */ 0x4092, + /* c8a - _0F_AE_06 */ 0x4093, + /* c8b - _0F_AE_07 */ 0x4094, + /* c8c - */ 0, + /* c8d - */ 0, + /* c8e - _F3_0F_B8 */ 0x2406, + /* c8f - */ 0, + /* c90 - */ 0, + /* c91 - */ 0, + /* c92 - */ 0, + /* c93 - */ 0, + /* c94 - */ 0, + /* c95 - */ 0, + /* c96 - */ 0, + /* c97 - */ 0, + /* c98 - */ 0, + /* c99 - */ 0, + /* c9a - */ 0, + /* c9b - */ 0, + /* c9c - _0F_BA_04 */ 0x2407, + /* c9d - _0F_BA_05 */ 0x2408, + /* c9e - _0F_BA_06 */ 0x2409, + /* c9f - _0F_BA_07 */ 0x240a, + /* ca0 - _0F_BC */ 0x240b, + /* ca1 - */ 0, + /* ca2 - _F3_0F_BC */ 0x240c, + /* ca3 - */ 0, + /* ca4 - */ 0, + /* ca5 - */ 0, + /* ca6 - */ 0, + /* ca7 - */ 0, + /* ca8 - */ 0, + /* ca9 - */ 0, + /* caa - */ 0, + /* cab - */ 0, + /* cac - _0F_BD */ 0x240d, + /* cad - */ 0, + /* cae - _F3_0F_BD */ 0x240e, + /* caf - */ 0, + /* cb0 - */ 0, + /* cb1 - */ 0, + /* cb2 - */ 0, + /* cb3 - */ 0, + /* cb4 - */ 0, + /* cb5 - */ 0, + /* cb6 - */ 0, + /* cb7 - */ 0, + /* cb8 - _0F_C2 */ 0x4095, + /* cb9 - _66_0F_C2 */ 0x4096, + /* cba - _F3_0F_C2 */ 0x4097, + /* cbb - _F2_0F_C2 */ 0x4098, + /* cbc - _V_0F_C2 */ 0x4099, + /* cbd - _V_66_0F_C2 */ 0x409a, + /* cbe - _V_F3_0F_C2 */ 0x409b, + /* cbf - _V_F2_0F_C2 */ 0x409c, + /* cc0 - */ 0, + /* cc1 - */ 0, + /* cc2 - */ 0, + /* cc3 - */ 0, + /* cc4 - _0F_C4 */ 0x409d, + /* cc5 - _66_0F_C4 */ 0x409e, + /* cc6 - */ 0, + /* cc7 - */ 0, + /* cc8 - */ 0, + /* cc9 - _V_66_0F_C4 */ 0x409f, + /* cca - */ 0, + /* ccb - */ 0, + /* ccc - */ 0, + /* ccd - */ 0, + /* cce - */ 0, + /* ccf - */ 0, + /* cd0 - _0F_C5 */ 0x40a0, + /* cd1 - _66_0F_C5 */ 0x40a1, + /* cd2 - */ 0, + /* cd3 - */ 0, + /* cd4 - */ 0, + /* cd5 - _V_66_0F_C5 */ 0x40a2, + /* cd6 - */ 0, + /* cd7 - */ 0, + /* cd8 - */ 0, + /* cd9 - */ 0, + /* cda - */ 0, + /* cdb - */ 0, + /* cdc - _0F_C6 */ 0x40a3, + /* cdd - _66_0F_C6 */ 0x40a4, + /* cde - */ 0, + /* cdf - */ 0, + /* ce0 - _V_0F_C6 */ 0x40a5, + /* ce1 - _V_66_0F_C6 */ 0x40a6, + /* ce2 - */ 0, + /* ce3 - */ 0, + /* ce4 - */ 0, + /* ce5 - */ 0, + /* ce6 - */ 0, + /* ce7 - */ 0, + /* ce8 - */ 0, + /* ce9 - _0F_C7_01 */ 0x40a7, + /* cea - */ 0, + /* ceb - */ 0, + /* cec - */ 0, + /* ced - */ 0, + /* cee - _0F_C7_06 */ 0xd62c, + /* cef - _0F_C7_07 */ 0x240f, + /* cf0 - */ 0, + /* cf1 - _66_0F_D0 */ 0x2410, + /* cf2 - */ 0, + /* cf3 - _F2_0F_D0 */ 0x2411, + /* cf4 - */ 0, + /* cf5 - _V_66_0F_D0 */ 0x40a8, + /* cf6 - */ 0, + /* cf7 - _V_F2_0F_D0 */ 0x40a9, + /* cf8 - */ 0, + /* cf9 - */ 0, + /* cfa - */ 0, + /* cfb - */ 0, + /* cfc - _0F_D1 */ 0x2412, + /* cfd - _66_0F_D1 */ 0x2413, + /* cfe - */ 0, + /* cff - */ 0, + /* d00 - */ 0, + /* d01 - _V_66_0F_D1 */ 0x40aa, + /* d02 - */ 0, + /* d03 - */ 0, + /* d04 - */ 0, + /* d05 - */ 0, + /* d06 - */ 0, + /* d07 - */ 0, + /* d08 - _0F_D2 */ 0x2414, + /* d09 - _66_0F_D2 */ 0x2415, + /* d0a - */ 0, + /* d0b - */ 0, + /* d0c - */ 0, + /* d0d - _V_66_0F_D2 */ 0x40ab, + /* d0e - */ 0, + /* d0f - */ 0, + /* d10 - */ 0, + /* d11 - */ 0, + /* d12 - */ 0, + /* d13 - */ 0, + /* d14 - _0F_D3 */ 0x2416, + /* d15 - _66_0F_D3 */ 0x2417, + /* d16 - */ 0, + /* d17 - */ 0, + /* d18 - */ 0, + /* d19 - _V_66_0F_D3 */ 0x40ac, + /* d1a - */ 0, + /* d1b - */ 0, + /* d1c - */ 0, + /* d1d - */ 0, + /* d1e - */ 0, + /* d1f - */ 0, + /* d20 - _0F_D4 */ 0x2418, + /* d21 - _66_0F_D4 */ 0x2419, + /* d22 - */ 0, + /* d23 - */ 0, + /* d24 - */ 0, + /* d25 - _V_66_0F_D4 */ 0x40ad, + /* d26 - */ 0, + /* d27 - */ 0, + /* d28 - */ 0, + /* d29 - */ 0, + /* d2a - */ 0, + /* d2b - */ 0, + /* d2c - _0F_D5 */ 0x241a, + /* d2d - _66_0F_D5 */ 0x241b, + /* d2e - */ 0, + /* d2f - */ 0, + /* d30 - */ 0, + /* d31 - _V_66_0F_D5 */ 0x40ae, + /* d32 - */ 0, + /* d33 - */ 0, + /* d34 - */ 0, + /* d35 - */ 0, + /* d36 - */ 0, + /* d37 - */ 0, + /* d38 - */ 0, + /* d39 - _66_0F_D6 */ 0x241c, + /* d3a - _F3_0F_D6 */ 0x241d, + /* d3b - _F2_0F_D6 */ 0x241e, + /* d3c - */ 0, + /* d3d - _V_66_0F_D6 */ 0x40af, + /* d3e - */ 0, + /* d3f - */ 0, + /* d40 - */ 0, + /* d41 - */ 0, + /* d42 - */ 0, + /* d43 - */ 0, + /* d44 - _0F_D7 */ 0x241f, + /* d45 - _66_0F_D7 */ 0x2420, + /* d46 - */ 0, + /* d47 - */ 0, + /* d48 - */ 0, + /* d49 - _V_66_0F_D7 */ 0x40b0, + /* d4a - */ 0, + /* d4b - */ 0, + /* d4c - */ 0, + /* d4d - */ 0, + /* d4e - */ 0, + /* d4f - */ 0, + /* d50 - _0F_D8 */ 0x2421, + /* d51 - _66_0F_D8 */ 0x2422, + /* d52 - */ 0, + /* d53 - */ 0, + /* d54 - */ 0, + /* d55 - _V_66_0F_D8 */ 0x40b1, + /* d56 - */ 0, + /* d57 - */ 0, + /* d58 - */ 0, + /* d59 - */ 0, + /* d5a - */ 0, + /* d5b - */ 0, + /* d5c - _0F_D9 */ 0x2423, + /* d5d - _66_0F_D9 */ 0x2424, + /* d5e - */ 0, + /* d5f - */ 0, + /* d60 - */ 0, + /* d61 - _V_66_0F_D9 */ 0x40b2, + /* d62 - */ 0, + /* d63 - */ 0, + /* d64 - */ 0, + /* d65 - */ 0, + /* d66 - */ 0, + /* d67 - */ 0, + /* d68 - _0F_DA */ 0x2425, + /* d69 - _66_0F_DA */ 0x2426, + /* d6a - */ 0, + /* d6b - */ 0, + /* d6c - */ 0, + /* d6d - _V_66_0F_DA */ 0x40b3, + /* d6e - */ 0, + /* d6f - */ 0, + /* d70 - */ 0, + /* d71 - */ 0, + /* d72 - */ 0, + /* d73 - */ 0, + /* d74 - _0F_DB */ 0x2427, + /* d75 - _66_0F_DB */ 0x2428, + /* d76 - */ 0, + /* d77 - */ 0, + /* d78 - */ 0, + /* d79 - _V_66_0F_DB */ 0x40b4, + /* d7a - */ 0, + /* d7b - */ 0, + /* d7c - */ 0, + /* d7d - */ 0, + /* d7e - */ 0, + /* d7f - */ 0, + /* d80 - _0F_DC */ 0x2429, + /* d81 - _66_0F_DC */ 0x242a, + /* d82 - */ 0, + /* d83 - */ 0, + /* d84 - */ 0, + /* d85 - _V_66_0F_DC */ 0x40b5, + /* d86 - */ 0, + /* d87 - */ 0, + /* d88 - */ 0, + /* d89 - */ 0, + /* d8a - */ 0, + /* d8b - */ 0, + /* d8c - _0F_DD */ 0x242b, + /* d8d - _66_0F_DD */ 0x242c, + /* d8e - */ 0, + /* d8f - */ 0, + /* d90 - */ 0, + /* d91 - _V_66_0F_DD */ 0x40b6, + /* d92 - */ 0, + /* d93 - */ 0, + /* d94 - */ 0, + /* d95 - */ 0, + /* d96 - */ 0, + /* d97 - */ 0, + /* d98 - _0F_DE */ 0x242d, + /* d99 - _66_0F_DE */ 0x242e, + /* d9a - */ 0, + /* d9b - */ 0, + /* d9c - */ 0, + /* d9d - _V_66_0F_DE */ 0x40b7, + /* d9e - */ 0, + /* d9f - */ 0, + /* da0 - */ 0, + /* da1 - */ 0, + /* da2 - */ 0, + /* da3 - */ 0, + /* da4 - _0F_DF */ 0x242f, + /* da5 - _66_0F_DF */ 0x2430, + /* da6 - */ 0, + /* da7 - */ 0, + /* da8 - */ 0, + /* da9 - _V_66_0F_DF */ 0x40b8, + /* daa - */ 0, + /* dab - */ 0, + /* dac - */ 0, + /* dad - */ 0, + /* dae - */ 0, + /* daf - */ 0, + /* db0 - _0F_E0 */ 0x2431, + /* db1 - _66_0F_E0 */ 0x2432, + /* db2 - */ 0, + /* db3 - */ 0, + /* db4 - */ 0, + /* db5 - _V_66_0F_E0 */ 0x40b9, + /* db6 - */ 0, + /* db7 - */ 0, + /* db8 - */ 0, + /* db9 - */ 0, + /* dba - */ 0, + /* dbb - */ 0, + /* dbc - _0F_E1 */ 0x2433, + /* dbd - _66_0F_E1 */ 0x2434, + /* dbe - */ 0, + /* dbf - */ 0, + /* dc0 - */ 0, + /* dc1 - _V_66_0F_E1 */ 0x40ba, + /* dc2 - */ 0, + /* dc3 - */ 0, + /* dc4 - */ 0, + /* dc5 - */ 0, + /* dc6 - */ 0, + /* dc7 - */ 0, + /* dc8 - _0F_E2 */ 0x2435, + /* dc9 - _66_0F_E2 */ 0x2436, + /* dca - */ 0, + /* dcb - */ 0, + /* dcc - */ 0, + /* dcd - _V_66_0F_E2 */ 0x40bb, + /* dce - */ 0, + /* dcf - */ 0, + /* dd0 - */ 0, + /* dd1 - */ 0, + /* dd2 - */ 0, + /* dd3 - */ 0, + /* dd4 - _0F_E3 */ 0x2437, + /* dd5 - _66_0F_E3 */ 0x2438, + /* dd6 - */ 0, + /* dd7 - */ 0, + /* dd8 - */ 0, + /* dd9 - _V_66_0F_E3 */ 0x40bc, + /* dda - */ 0, + /* ddb - */ 0, + /* ddc - */ 0, + /* ddd - */ 0, + /* dde - */ 0, + /* ddf - */ 0, + /* de0 - _0F_E4 */ 0x2439, + /* de1 - _66_0F_E4 */ 0x243a, + /* de2 - */ 0, + /* de3 - */ 0, + /* de4 - */ 0, + /* de5 - _V_66_0F_E4 */ 0x40bd, + /* de6 - */ 0, + /* de7 - */ 0, + /* de8 - */ 0, + /* de9 - */ 0, + /* dea - */ 0, + /* deb - */ 0, + /* dec - _0F_E5 */ 0x243b, + /* ded - _66_0F_E5 */ 0x243c, + /* dee - */ 0, + /* def - */ 0, + /* df0 - */ 0, + /* df1 - _V_66_0F_E5 */ 0x40be, + /* df2 - */ 0, + /* df3 - */ 0, + /* df4 - */ 0, + /* df5 - */ 0, + /* df6 - */ 0, + /* df7 - */ 0, + /* df8 - */ 0, + /* df9 - _66_0F_E6 */ 0x243d, + /* dfa - _F3_0F_E6 */ 0x243e, + /* dfb - _F2_0F_E6 */ 0x243f, + /* dfc - */ 0, + /* dfd - _V_66_0F_E6 */ 0x40bf, + /* dfe - _V_F3_0F_E6 */ 0x40c0, + /* dff - _V_F2_0F_E6 */ 0x40c1, + /* e00 - */ 0, + /* e01 - */ 0, + /* e02 - */ 0, + /* e03 - */ 0, + /* e04 - _0F_E7 */ 0x2440, + /* e05 - _66_0F_E7 */ 0x2441, + /* e06 - */ 0, + /* e07 - */ 0, + /* e08 - */ 0, + /* e09 - _V_66_0F_E7 */ 0x40c2, + /* e0a - */ 0, + /* e0b - */ 0, + /* e0c - */ 0, + /* e0d - */ 0, + /* e0e - */ 0, + /* e0f - */ 0, + /* e10 - _0F_E8 */ 0x2442, + /* e11 - _66_0F_E8 */ 0x2443, + /* e12 - */ 0, + /* e13 - */ 0, + /* e14 - */ 0, + /* e15 - _V_66_0F_E8 */ 0x40c3, + /* e16 - */ 0, + /* e17 - */ 0, + /* e18 - */ 0, + /* e19 - */ 0, + /* e1a - */ 0, + /* e1b - */ 0, + /* e1c - _0F_E9 */ 0x2444, + /* e1d - _66_0F_E9 */ 0x2445, + /* e1e - */ 0, + /* e1f - */ 0, + /* e20 - */ 0, + /* e21 - _V_66_0F_E9 */ 0x40c4, + /* e22 - */ 0, + /* e23 - */ 0, + /* e24 - */ 0, + /* e25 - */ 0, + /* e26 - */ 0, + /* e27 - */ 0, + /* e28 - _0F_EA */ 0x2446, + /* e29 - _66_0F_EA */ 0x2447, + /* e2a - */ 0, + /* e2b - */ 0, + /* e2c - */ 0, + /* e2d - _V_66_0F_EA */ 0x40c5, + /* e2e - */ 0, + /* e2f - */ 0, + /* e30 - */ 0, + /* e31 - */ 0, + /* e32 - */ 0, + /* e33 - */ 0, + /* e34 - _0F_EB */ 0x2448, + /* e35 - _66_0F_EB */ 0x2449, + /* e36 - */ 0, + /* e37 - */ 0, + /* e38 - */ 0, + /* e39 - _V_66_0F_EB */ 0x40c6, + /* e3a - */ 0, + /* e3b - */ 0, + /* e3c - */ 0, + /* e3d - */ 0, + /* e3e - */ 0, + /* e3f - */ 0, + /* e40 - _0F_EC */ 0x244a, + /* e41 - _66_0F_EC */ 0x244b, + /* e42 - */ 0, + /* e43 - */ 0, + /* e44 - */ 0, + /* e45 - _V_66_0F_EC */ 0x40c7, + /* e46 - */ 0, + /* e47 - */ 0, + /* e48 - */ 0, + /* e49 - */ 0, + /* e4a - */ 0, + /* e4b - */ 0, + /* e4c - _0F_ED */ 0x244c, + /* e4d - _66_0F_ED */ 0x244d, + /* e4e - */ 0, + /* e4f - */ 0, + /* e50 - */ 0, + /* e51 - _V_66_0F_ED */ 0x40c8, + /* e52 - */ 0, + /* e53 - */ 0, + /* e54 - */ 0, + /* e55 - */ 0, + /* e56 - */ 0, + /* e57 - */ 0, + /* e58 - _0F_EE */ 0x244e, + /* e59 - _66_0F_EE */ 0x244f, + /* e5a - */ 0, + /* e5b - */ 0, + /* e5c - */ 0, + /* e5d - _V_66_0F_EE */ 0x40c9, + /* e5e - */ 0, + /* e5f - */ 0, + /* e60 - */ 0, + /* e61 - */ 0, + /* e62 - */ 0, + /* e63 - */ 0, + /* e64 - _0F_EF */ 0x2450, + /* e65 - _66_0F_EF */ 0x2451, + /* e66 - */ 0, + /* e67 - */ 0, + /* e68 - */ 0, + /* e69 - _V_66_0F_EF */ 0x40ca, + /* e6a - */ 0, + /* e6b - */ 0, + /* e6c - */ 0, + /* e6d - */ 0, + /* e6e - */ 0, + /* e6f - */ 0, + /* e70 - */ 0, + /* e71 - */ 0, + /* e72 - */ 0, + /* e73 - _F2_0F_F0 */ 0x2452, + /* e74 - */ 0, + /* e75 - */ 0, + /* e76 - */ 0, + /* e77 - _V_F2_0F_F0 */ 0x40cb, + /* e78 - */ 0, + /* e79 - */ 0, + /* e7a - */ 0, + /* e7b - */ 0, + /* e7c - _0F_F1 */ 0x2453, + /* e7d - _66_0F_F1 */ 0x2454, + /* e7e - */ 0, + /* e7f - */ 0, + /* e80 - */ 0, + /* e81 - _V_66_0F_F1 */ 0x40cc, + /* e82 - */ 0, + /* e83 - */ 0, + /* e84 - */ 0, + /* e85 - */ 0, + /* e86 - */ 0, + /* e87 - */ 0, + /* e88 - _0F_F2 */ 0x2455, + /* e89 - _66_0F_F2 */ 0x2456, + /* e8a - */ 0, + /* e8b - */ 0, + /* e8c - */ 0, + /* e8d - _V_66_0F_F2 */ 0x40cd, + /* e8e - */ 0, + /* e8f - */ 0, + /* e90 - */ 0, + /* e91 - */ 0, + /* e92 - */ 0, + /* e93 - */ 0, + /* e94 - _0F_F3 */ 0x2457, + /* e95 - _66_0F_F3 */ 0x2458, + /* e96 - */ 0, + /* e97 - */ 0, + /* e98 - */ 0, + /* e99 - _V_66_0F_F3 */ 0x40ce, + /* e9a - */ 0, + /* e9b - */ 0, + /* e9c - */ 0, + /* e9d - */ 0, + /* e9e - */ 0, + /* e9f - */ 0, + /* ea0 - _0F_F4 */ 0x2459, + /* ea1 - _66_0F_F4 */ 0x245a, + /* ea2 - */ 0, + /* ea3 - */ 0, + /* ea4 - */ 0, + /* ea5 - _V_66_0F_F4 */ 0x40cf, + /* ea6 - */ 0, + /* ea7 - */ 0, + /* ea8 - */ 0, + /* ea9 - */ 0, + /* eaa - */ 0, + /* eab - */ 0, + /* eac - _0F_F5 */ 0x245b, + /* ead - _66_0F_F5 */ 0x245c, + /* eae - */ 0, + /* eaf - */ 0, + /* eb0 - */ 0, + /* eb1 - _V_66_0F_F5 */ 0x40d0, + /* eb2 - */ 0, + /* eb3 - */ 0, + /* eb4 - */ 0, + /* eb5 - */ 0, + /* eb6 - */ 0, + /* eb7 - */ 0, + /* eb8 - _0F_F6 */ 0x245d, + /* eb9 - _66_0F_F6 */ 0x245e, + /* eba - */ 0, + /* ebb - */ 0, + /* ebc - */ 0, + /* ebd - _V_66_0F_F6 */ 0x40d1, + /* ebe - */ 0, + /* ebf - */ 0, + /* ec0 - */ 0, + /* ec1 - */ 0, + /* ec2 - */ 0, + /* ec3 - */ 0, + /* ec4 - _0F_F7 */ 0x245f, + /* ec5 - _66_0F_F7 */ 0x2460, + /* ec6 - */ 0, + /* ec7 - */ 0, + /* ec8 - */ 0, + /* ec9 - _V_66_0F_F7 */ 0x40d2, + /* eca - */ 0, + /* ecb - */ 0, + /* ecc - */ 0, + /* ecd - */ 0, + /* ece - */ 0, + /* ecf - */ 0, + /* ed0 - _0F_F8 */ 0x2461, + /* ed1 - _66_0F_F8 */ 0x2462, + /* ed2 - */ 0, + /* ed3 - */ 0, + /* ed4 - */ 0, + /* ed5 - _V_66_0F_F8 */ 0x40d3, + /* ed6 - */ 0, + /* ed7 - */ 0, + /* ed8 - */ 0, + /* ed9 - */ 0, + /* eda - */ 0, + /* edb - */ 0, + /* edc - _0F_F9 */ 0x2463, + /* edd - _66_0F_F9 */ 0x2464, + /* ede - */ 0, + /* edf - */ 0, + /* ee0 - */ 0, + /* ee1 - _V_66_0F_F9 */ 0x40d4, + /* ee2 - */ 0, + /* ee3 - */ 0, + /* ee4 - */ 0, + /* ee5 - */ 0, + /* ee6 - */ 0, + /* ee7 - */ 0, + /* ee8 - _0F_FA */ 0x2465, + /* ee9 - _66_0F_FA */ 0x2466, + /* eea - */ 0, + /* eeb - */ 0, + /* eec - */ 0, + /* eed - _V_66_0F_FA */ 0x40d5, + /* eee - */ 0, + /* eef - */ 0, + /* ef0 - */ 0, + /* ef1 - */ 0, + /* ef2 - */ 0, + /* ef3 - */ 0, + /* ef4 - _0F_FB */ 0x2467, + /* ef5 - _66_0F_FB */ 0x2468, + /* ef6 - */ 0, + /* ef7 - */ 0, + /* ef8 - */ 0, + /* ef9 - _V_66_0F_FB */ 0x40d6, + /* efa - */ 0, + /* efb - */ 0, + /* efc - */ 0, + /* efd - */ 0, + /* efe - */ 0, + /* eff - */ 0, + /* f00 - _0F_FC */ 0x2469, + /* f01 - _66_0F_FC */ 0x246a, + /* f02 - */ 0, + /* f03 - */ 0, + /* f04 - */ 0, + /* f05 - _V_66_0F_FC */ 0x40d7, + /* f06 - */ 0, + /* f07 - */ 0, + /* f08 - */ 0, + /* f09 - */ 0, + /* f0a - */ 0, + /* f0b - */ 0, + /* f0c - _0F_FD */ 0x246b, + /* f0d - _66_0F_FD */ 0x246c, + /* f0e - */ 0, + /* f0f - */ 0, + /* f10 - */ 0, + /* f11 - _V_66_0F_FD */ 0x40d8, + /* f12 - */ 0, + /* f13 - */ 0, + /* f14 - */ 0, + /* f15 - */ 0, + /* f16 - */ 0, + /* f17 - */ 0, + /* f18 - _0F_FE */ 0x246d, + /* f19 - _66_0F_FE */ 0x246e, + /* f1a - */ 0, + /* f1b - */ 0, + /* f1c - */ 0, + /* f1d - _V_66_0F_FE */ 0x40d9, + /* f1e - */ 0, + /* f1f - */ 0, + /* f20 - */ 0, + /* f21 - */ 0, + /* f22 - */ 0, + /* f23 - */ 0, + /* f24 - _D9_06 */ 0x246f, + /* f25 - _9B_D9_06 */ 0x2470, + /* f26 - */ 0, + /* f27 - */ 0, + /* f28 - */ 0, + /* f29 - */ 0, + /* f2a - */ 0, + /* f2b - */ 0, + /* f2c - */ 0, + /* f2d - */ 0, + /* f2e - */ 0, + /* f2f - */ 0, + /* f30 - _D9_07 */ 0x2471, + /* f31 - _9B_D9_07 */ 0x2472, + /* f32 - */ 0, + /* f33 - */ 0, + /* f34 - */ 0, + /* f35 - */ 0, + /* f36 - */ 0, + /* f37 - */ 0, + /* f38 - */ 0, + /* f39 - */ 0, + /* f3a - */ 0, + /* f3b - */ 0, + /* f3c - _DB_E2 */ 0x2473, + /* f3d - _9B_DB_E2 */ 0x2474, + /* f3e - */ 0, + /* f3f - */ 0, + /* f40 - */ 0, + /* f41 - */ 0, + /* f42 - */ 0, + /* f43 - */ 0, + /* f44 - */ 0, + /* f45 - */ 0, + /* f46 - */ 0, + /* f47 - */ 0, + /* f48 - _DB_E3 */ 0x2475, + /* f49 - _9B_DB_E3 */ 0x2476, + /* f4a - */ 0, + /* f4b - */ 0, + /* f4c - */ 0, + /* f4d - */ 0, + /* f4e - */ 0, + /* f4f - */ 0, + /* f50 - */ 0, + /* f51 - */ 0, + /* f52 - */ 0, + /* f53 - */ 0, + /* f54 - _DD_06 */ 0x2477, + /* f55 - _9B_DD_06 */ 0x2478, + /* f56 - */ 0, + /* f57 - */ 0, + /* f58 - */ 0, + /* f59 - */ 0, + /* f5a - */ 0, + /* f5b - */ 0, + /* f5c - */ 0, + /* f5d - */ 0, + /* f5e - */ 0, + /* f5f - */ 0, + /* f60 - _DD_07 */ 0x2479, + /* f61 - _9B_DD_07 */ 0x247a, + /* f62 - */ 0, + /* f63 - */ 0, + /* f64 - */ 0, + /* f65 - */ 0, + /* f66 - */ 0, + /* f67 - */ 0, + /* f68 - */ 0, + /* f69 - */ 0, + /* f6a - */ 0, + /* f6b - */ 0, + /* f6c - _DF_E0 */ 0x247b, + /* f6d - _9B_DF_E0 */ 0x247c, + /* f6e - */ 0, + /* f6f - */ 0, + /* f70 - */ 0, + /* f71 - */ 0, + /* f72 - */ 0, + /* f73 - */ 0, + /* f74 - */ 0, + /* f75 - */ 0, + /* f76 - */ 0, + /* f77 - */ 0, + /* f78 - _0F_38_00 */ 0x247d, + /* f79 - _66_0F_38_00 */ 0x247e, + /* f7a - */ 0, + /* f7b - */ 0, + /* f7c - */ 0, + /* f7d - _V_66_0F_38_00 */ 0x40da, + /* f7e - */ 0, + /* f7f - */ 0, + /* f80 - */ 0, + /* f81 - */ 0, + /* f82 - */ 0, + /* f83 - */ 0, + /* f84 - _0F_38_01 */ 0x247f, + /* f85 - _66_0F_38_01 */ 0x2480, + /* f86 - */ 0, + /* f87 - */ 0, + /* f88 - */ 0, + /* f89 - _V_66_0F_38_01 */ 0x40db, + /* f8a - */ 0, + /* f8b - */ 0, + /* f8c - */ 0, + /* f8d - */ 0, + /* f8e - */ 0, + /* f8f - */ 0, + /* f90 - _0F_38_02 */ 0x2481, + /* f91 - _66_0F_38_02 */ 0x2482, + /* f92 - */ 0, + /* f93 - */ 0, + /* f94 - */ 0, + /* f95 - _V_66_0F_38_02 */ 0x40dc, + /* f96 - */ 0, + /* f97 - */ 0, + /* f98 - */ 0, + /* f99 - */ 0, + /* f9a - */ 0, + /* f9b - */ 0, + /* f9c - _0F_38_03 */ 0x2483, + /* f9d - _66_0F_38_03 */ 0x2484, + /* f9e - */ 0, + /* f9f - */ 0, + /* fa0 - */ 0, + /* fa1 - _V_66_0F_38_03 */ 0x40dd, + /* fa2 - */ 0, + /* fa3 - */ 0, + /* fa4 - */ 0, + /* fa5 - */ 0, + /* fa6 - */ 0, + /* fa7 - */ 0, + /* fa8 - _0F_38_04 */ 0x2485, + /* fa9 - _66_0F_38_04 */ 0x2486, + /* faa - */ 0, + /* fab - */ 0, + /* fac - */ 0, + /* fad - _V_66_0F_38_04 */ 0x40de, + /* fae - */ 0, + /* faf - */ 0, + /* fb0 - */ 0, + /* fb1 - */ 0, + /* fb2 - */ 0, + /* fb3 - */ 0, + /* fb4 - _0F_38_05 */ 0x2487, + /* fb5 - _66_0F_38_05 */ 0x2488, + /* fb6 - */ 0, + /* fb7 - */ 0, + /* fb8 - */ 0, + /* fb9 - _V_66_0F_38_05 */ 0x40df, + /* fba - */ 0, + /* fbb - */ 0, + /* fbc - */ 0, + /* fbd - */ 0, + /* fbe - */ 0, + /* fbf - */ 0, + /* fc0 - _0F_38_06 */ 0x2489, + /* fc1 - _66_0F_38_06 */ 0x248a, + /* fc2 - */ 0, + /* fc3 - */ 0, + /* fc4 - */ 0, + /* fc5 - _V_66_0F_38_06 */ 0x40e0, + /* fc6 - */ 0, + /* fc7 - */ 0, + /* fc8 - */ 0, + /* fc9 - */ 0, + /* fca - */ 0, + /* fcb - */ 0, + /* fcc - _0F_38_07 */ 0x248b, + /* fcd - _66_0F_38_07 */ 0x248c, + /* fce - */ 0, + /* fcf - */ 0, + /* fd0 - */ 0, + /* fd1 - _V_66_0F_38_07 */ 0x40e1, + /* fd2 - */ 0, + /* fd3 - */ 0, + /* fd4 - */ 0, + /* fd5 - */ 0, + /* fd6 - */ 0, + /* fd7 - */ 0, + /* fd8 - _0F_38_08 */ 0x248d, + /* fd9 - _66_0F_38_08 */ 0x248e, + /* fda - */ 0, + /* fdb - */ 0, + /* fdc - */ 0, + /* fdd - _V_66_0F_38_08 */ 0x40e2, + /* fde - */ 0, + /* fdf - */ 0, + /* fe0 - */ 0, + /* fe1 - */ 0, + /* fe2 - */ 0, + /* fe3 - */ 0, + /* fe4 - _0F_38_09 */ 0x248f, + /* fe5 - _66_0F_38_09 */ 0x2490, + /* fe6 - */ 0, + /* fe7 - */ 0, + /* fe8 - */ 0, + /* fe9 - _V_66_0F_38_09 */ 0x40e3, + /* fea - */ 0, + /* feb - */ 0, + /* fec - */ 0, + /* fed - */ 0, + /* fee - */ 0, + /* fef - */ 0, + /* ff0 - _0F_38_0A */ 0x2491, + /* ff1 - _66_0F_38_0A */ 0x2492, + /* ff2 - */ 0, + /* ff3 - */ 0, + /* ff4 - */ 0, + /* ff5 - _V_66_0F_38_0A */ 0x40e4, + /* ff6 - */ 0, + /* ff7 - */ 0, + /* ff8 - */ 0, + /* ff9 - */ 0, + /* ffa - */ 0, + /* ffb - */ 0, + /* ffc - _0F_38_0B */ 0x2493, + /* ffd - _66_0F_38_0B */ 0x2494, + /* ffe - */ 0, + /* fff - */ 0, + /* 1000 - */ 0, + /* 1001 - _V_66_0F_38_0B */ 0x40e5, + /* 1002 - */ 0, + /* 1003 - */ 0, + /* 1004 - */ 0, + /* 1005 - */ 0, + /* 1006 - */ 0, + /* 1007 - */ 0, + /* 1008 - */ 0, + /* 1009 - */ 0, + /* 100a - */ 0, + /* 100b - */ 0, + /* 100c - */ 0, + /* 100d - _V_66_0F_38_0C */ 0x40e6, + /* 100e - */ 0, + /* 100f - */ 0, + /* 1010 - */ 0, + /* 1011 - */ 0, + /* 1012 - */ 0, + /* 1013 - */ 0, + /* 1014 - */ 0, + /* 1015 - */ 0, + /* 1016 - */ 0, + /* 1017 - */ 0, + /* 1018 - */ 0, + /* 1019 - _V_66_0F_38_0D */ 0x40e7, + /* 101a - */ 0, + /* 101b - */ 0, + /* 101c - */ 0, + /* 101d - */ 0, + /* 101e - */ 0, + /* 101f - */ 0, + /* 1020 - */ 0, + /* 1021 - */ 0, + /* 1022 - */ 0, + /* 1023 - */ 0, + /* 1024 - */ 0, + /* 1025 - _V_66_0F_38_0E */ 0x40e8, + /* 1026 - */ 0, + /* 1027 - */ 0, + /* 1028 - */ 0, + /* 1029 - */ 0, + /* 102a - */ 0, + /* 102b - */ 0, + /* 102c - */ 0, + /* 102d - */ 0, + /* 102e - */ 0, + /* 102f - */ 0, + /* 1030 - */ 0, + /* 1031 - _V_66_0F_38_0F */ 0x40e9, + /* 1032 - */ 0, + /* 1033 - */ 0, + /* 1034 - */ 0, + /* 1035 - */ 0, + /* 1036 - */ 0, + /* 1037 - */ 0, + /* 1038 - */ 0, + /* 1039 - _66_0F_38_10 */ 0x40ea, + /* 103a - */ 0, + /* 103b - */ 0, + /* 103c - */ 0, + /* 103d - */ 0, + /* 103e - */ 0, + /* 103f - */ 0, + /* 1040 - */ 0, + /* 1041 - */ 0, + /* 1042 - */ 0, + /* 1043 - */ 0, + /* 1044 - */ 0, + /* 1045 - _66_0F_38_14 */ 0x40eb, + /* 1046 - */ 0, + /* 1047 - */ 0, + /* 1048 - */ 0, + /* 1049 - */ 0, + /* 104a - */ 0, + /* 104b - */ 0, + /* 104c - */ 0, + /* 104d - */ 0, + /* 104e - */ 0, + /* 104f - */ 0, + /* 1050 - */ 0, + /* 1051 - _66_0F_38_15 */ 0x40ec, + /* 1052 - */ 0, + /* 1053 - */ 0, + /* 1054 - */ 0, + /* 1055 - */ 0, + /* 1056 - */ 0, + /* 1057 - */ 0, + /* 1058 - */ 0, + /* 1059 - */ 0, + /* 105a - */ 0, + /* 105b - */ 0, + /* 105c - */ 0, + /* 105d - _66_0F_38_17 */ 0x2495, + /* 105e - */ 0, + /* 105f - */ 0, + /* 1060 - */ 0, + /* 1061 - _V_66_0F_38_17 */ 0x40ed, + /* 1062 - */ 0, + /* 1063 - */ 0, + /* 1064 - */ 0, + /* 1065 - */ 0, + /* 1066 - */ 0, + /* 1067 - */ 0, + /* 1068 - */ 0, + /* 1069 - */ 0, + /* 106a - */ 0, + /* 106b - */ 0, + /* 106c - */ 0, + /* 106d - _V_66_0F_38_18 */ 0x40ee, + /* 106e - */ 0, + /* 106f - */ 0, + /* 1070 - */ 0, + /* 1071 - */ 0, + /* 1072 - */ 0, + /* 1073 - */ 0, + /* 1074 - */ 0, + /* 1075 - */ 0, + /* 1076 - */ 0, + /* 1077 - */ 0, + /* 1078 - */ 0, + /* 1079 - _V_66_0F_38_19 */ 0x40ef, + /* 107a - */ 0, + /* 107b - */ 0, + /* 107c - */ 0, + /* 107d - */ 0, + /* 107e - */ 0, + /* 107f - */ 0, + /* 1080 - */ 0, + /* 1081 - */ 0, + /* 1082 - */ 0, + /* 1083 - */ 0, + /* 1084 - */ 0, + /* 1085 - _V_66_0F_38_1A */ 0x40f0, + /* 1086 - */ 0, + /* 1087 - */ 0, + /* 1088 - */ 0, + /* 1089 - */ 0, + /* 108a - */ 0, + /* 108b - */ 0, + /* 108c - _0F_38_1C */ 0x2496, + /* 108d - _66_0F_38_1C */ 0x2497, + /* 108e - */ 0, + /* 108f - */ 0, + /* 1090 - */ 0, + /* 1091 - _V_66_0F_38_1C */ 0x40f1, + /* 1092 - */ 0, + /* 1093 - */ 0, + /* 1094 - */ 0, + /* 1095 - */ 0, + /* 1096 - */ 0, + /* 1097 - */ 0, + /* 1098 - _0F_38_1D */ 0x2498, + /* 1099 - _66_0F_38_1D */ 0x2499, + /* 109a - */ 0, + /* 109b - */ 0, + /* 109c - */ 0, + /* 109d - _V_66_0F_38_1D */ 0x40f2, + /* 109e - */ 0, + /* 109f - */ 0, + /* 10a0 - */ 0, + /* 10a1 - */ 0, + /* 10a2 - */ 0, + /* 10a3 - */ 0, + /* 10a4 - _0F_38_1E */ 0x249a, + /* 10a5 - _66_0F_38_1E */ 0x249b, + /* 10a6 - */ 0, + /* 10a7 - */ 0, + /* 10a8 - */ 0, + /* 10a9 - _V_66_0F_38_1E */ 0x40f3, + /* 10aa - */ 0, + /* 10ab - */ 0, + /* 10ac - */ 0, + /* 10ad - */ 0, + /* 10ae - */ 0, + /* 10af - */ 0, + /* 10b0 - */ 0, + /* 10b1 - _66_0F_38_20 */ 0x249c, + /* 10b2 - */ 0, + /* 10b3 - */ 0, + /* 10b4 - */ 0, + /* 10b5 - _V_66_0F_38_20 */ 0x40f4, + /* 10b6 - */ 0, + /* 10b7 - */ 0, + /* 10b8 - */ 0, + /* 10b9 - */ 0, + /* 10ba - */ 0, + /* 10bb - */ 0, + /* 10bc - */ 0, + /* 10bd - _66_0F_38_21 */ 0x249d, + /* 10be - */ 0, + /* 10bf - */ 0, + /* 10c0 - */ 0, + /* 10c1 - _V_66_0F_38_21 */ 0x40f5, + /* 10c2 - */ 0, + /* 10c3 - */ 0, + /* 10c4 - */ 0, + /* 10c5 - */ 0, + /* 10c6 - */ 0, + /* 10c7 - */ 0, + /* 10c8 - */ 0, + /* 10c9 - _66_0F_38_22 */ 0x249e, + /* 10ca - */ 0, + /* 10cb - */ 0, + /* 10cc - */ 0, + /* 10cd - _V_66_0F_38_22 */ 0x40f6, + /* 10ce - */ 0, + /* 10cf - */ 0, + /* 10d0 - */ 0, + /* 10d1 - */ 0, + /* 10d2 - */ 0, + /* 10d3 - */ 0, + /* 10d4 - */ 0, + /* 10d5 - _66_0F_38_23 */ 0x249f, + /* 10d6 - */ 0, + /* 10d7 - */ 0, + /* 10d8 - */ 0, + /* 10d9 - _V_66_0F_38_23 */ 0x40f7, + /* 10da - */ 0, + /* 10db - */ 0, + /* 10dc - */ 0, + /* 10dd - */ 0, + /* 10de - */ 0, + /* 10df - */ 0, + /* 10e0 - */ 0, + /* 10e1 - _66_0F_38_24 */ 0x24a0, + /* 10e2 - */ 0, + /* 10e3 - */ 0, + /* 10e4 - */ 0, + /* 10e5 - _V_66_0F_38_24 */ 0x40f8, + /* 10e6 - */ 0, + /* 10e7 - */ 0, + /* 10e8 - */ 0, + /* 10e9 - */ 0, + /* 10ea - */ 0, + /* 10eb - */ 0, + /* 10ec - */ 0, + /* 10ed - _66_0F_38_25 */ 0x24a1, + /* 10ee - */ 0, + /* 10ef - */ 0, + /* 10f0 - */ 0, + /* 10f1 - _V_66_0F_38_25 */ 0x40f9, + /* 10f2 - */ 0, + /* 10f3 - */ 0, + /* 10f4 - */ 0, + /* 10f5 - */ 0, + /* 10f6 - */ 0, + /* 10f7 - */ 0, + /* 10f8 - */ 0, + /* 10f9 - _66_0F_38_28 */ 0x24a2, + /* 10fa - */ 0, + /* 10fb - */ 0, + /* 10fc - */ 0, + /* 10fd - _V_66_0F_38_28 */ 0x40fa, + /* 10fe - */ 0, + /* 10ff - */ 0, + /* 1100 - */ 0, + /* 1101 - */ 0, + /* 1102 - */ 0, + /* 1103 - */ 0, + /* 1104 - */ 0, + /* 1105 - _66_0F_38_29 */ 0x24a3, + /* 1106 - */ 0, + /* 1107 - */ 0, + /* 1108 - */ 0, + /* 1109 - _V_66_0F_38_29 */ 0x40fb, + /* 110a - */ 0, + /* 110b - */ 0, + /* 110c - */ 0, + /* 110d - */ 0, + /* 110e - */ 0, + /* 110f - */ 0, + /* 1110 - */ 0, + /* 1111 - _66_0F_38_2A */ 0x24a4, + /* 1112 - */ 0, + /* 1113 - */ 0, + /* 1114 - */ 0, + /* 1115 - _V_66_0F_38_2A */ 0x40fc, + /* 1116 - */ 0, + /* 1117 - */ 0, + /* 1118 - */ 0, + /* 1119 - */ 0, + /* 111a - */ 0, + /* 111b - */ 0, + /* 111c - */ 0, + /* 111d - _66_0F_38_2B */ 0x24a5, + /* 111e - */ 0, + /* 111f - */ 0, + /* 1120 - */ 0, + /* 1121 - _V_66_0F_38_2B */ 0x40fd, + /* 1122 - */ 0, + /* 1123 - */ 0, + /* 1124 - */ 0, + /* 1125 - */ 0, + /* 1126 - */ 0, + /* 1127 - */ 0, + /* 1128 - */ 0, + /* 1129 - */ 0, + /* 112a - */ 0, + /* 112b - */ 0, + /* 112c - */ 0, + /* 112d - _V_66_0F_38_2C */ 0x40fe, + /* 112e - */ 0, + /* 112f - */ 0, + /* 1130 - */ 0, + /* 1131 - */ 0, + /* 1132 - */ 0, + /* 1133 - */ 0, + /* 1134 - */ 0, + /* 1135 - */ 0, + /* 1136 - */ 0, + /* 1137 - */ 0, + /* 1138 - */ 0, + /* 1139 - _V_66_0F_38_2D */ 0x40ff, + /* 113a - */ 0, + /* 113b - */ 0, + /* 113c - */ 0, + /* 113d - */ 0, + /* 113e - */ 0, + /* 113f - */ 0, + /* 1140 - */ 0, + /* 1141 - */ 0, + /* 1142 - */ 0, + /* 1143 - */ 0, + /* 1144 - */ 0, + /* 1145 - _V_66_0F_38_2E */ 0x4100, + /* 1146 - */ 0, + /* 1147 - */ 0, + /* 1148 - */ 0, + /* 1149 - */ 0, + /* 114a - */ 0, + /* 114b - */ 0, + /* 114c - */ 0, + /* 114d - */ 0, + /* 114e - */ 0, + /* 114f - */ 0, + /* 1150 - */ 0, + /* 1151 - _V_66_0F_38_2F */ 0x4101, + /* 1152 - */ 0, + /* 1153 - */ 0, + /* 1154 - */ 0, + /* 1155 - */ 0, + /* 1156 - */ 0, + /* 1157 - */ 0, + /* 1158 - */ 0, + /* 1159 - _66_0F_38_30 */ 0x24a6, + /* 115a - */ 0, + /* 115b - */ 0, + /* 115c - */ 0, + /* 115d - _V_66_0F_38_30 */ 0x4102, + /* 115e - */ 0, + /* 115f - */ 0, + /* 1160 - */ 0, + /* 1161 - */ 0, + /* 1162 - */ 0, + /* 1163 - */ 0, + /* 1164 - */ 0, + /* 1165 - _66_0F_38_31 */ 0x24a7, + /* 1166 - */ 0, + /* 1167 - */ 0, + /* 1168 - */ 0, + /* 1169 - _V_66_0F_38_31 */ 0x4103, + /* 116a - */ 0, + /* 116b - */ 0, + /* 116c - */ 0, + /* 116d - */ 0, + /* 116e - */ 0, + /* 116f - */ 0, + /* 1170 - */ 0, + /* 1171 - _66_0F_38_32 */ 0x24a8, + /* 1172 - */ 0, + /* 1173 - */ 0, + /* 1174 - */ 0, + /* 1175 - _V_66_0F_38_32 */ 0x4104, + /* 1176 - */ 0, + /* 1177 - */ 0, + /* 1178 - */ 0, + /* 1179 - */ 0, + /* 117a - */ 0, + /* 117b - */ 0, + /* 117c - */ 0, + /* 117d - _66_0F_38_33 */ 0x24a9, + /* 117e - */ 0, + /* 117f - */ 0, + /* 1180 - */ 0, + /* 1181 - _V_66_0F_38_33 */ 0x4105, + /* 1182 - */ 0, + /* 1183 - */ 0, + /* 1184 - */ 0, + /* 1185 - */ 0, + /* 1186 - */ 0, + /* 1187 - */ 0, + /* 1188 - */ 0, + /* 1189 - _66_0F_38_34 */ 0x24aa, + /* 118a - */ 0, + /* 118b - */ 0, + /* 118c - */ 0, + /* 118d - _V_66_0F_38_34 */ 0x4106, + /* 118e - */ 0, + /* 118f - */ 0, + /* 1190 - */ 0, + /* 1191 - */ 0, + /* 1192 - */ 0, + /* 1193 - */ 0, + /* 1194 - */ 0, + /* 1195 - _66_0F_38_35 */ 0x24ab, + /* 1196 - */ 0, + /* 1197 - */ 0, + /* 1198 - */ 0, + /* 1199 - _V_66_0F_38_35 */ 0x4107, + /* 119a - */ 0, + /* 119b - */ 0, + /* 119c - */ 0, + /* 119d - */ 0, + /* 119e - */ 0, + /* 119f - */ 0, + /* 11a0 - */ 0, + /* 11a1 - _66_0F_38_37 */ 0x24ac, + /* 11a2 - */ 0, + /* 11a3 - */ 0, + /* 11a4 - */ 0, + /* 11a5 - _V_66_0F_38_37 */ 0x4108, + /* 11a6 - */ 0, + /* 11a7 - */ 0, + /* 11a8 - */ 0, + /* 11a9 - */ 0, + /* 11aa - */ 0, + /* 11ab - */ 0, + /* 11ac - */ 0, + /* 11ad - _66_0F_38_38 */ 0x24ad, + /* 11ae - */ 0, + /* 11af - */ 0, + /* 11b0 - */ 0, + /* 11b1 - _V_66_0F_38_38 */ 0x4109, + /* 11b2 - */ 0, + /* 11b3 - */ 0, + /* 11b4 - */ 0, + /* 11b5 - */ 0, + /* 11b6 - */ 0, + /* 11b7 - */ 0, + /* 11b8 - */ 0, + /* 11b9 - _66_0F_38_39 */ 0x24ae, + /* 11ba - */ 0, + /* 11bb - */ 0, + /* 11bc - */ 0, + /* 11bd - _V_66_0F_38_39 */ 0x410a, + /* 11be - */ 0, + /* 11bf - */ 0, + /* 11c0 - */ 0, + /* 11c1 - */ 0, + /* 11c2 - */ 0, + /* 11c3 - */ 0, + /* 11c4 - */ 0, + /* 11c5 - _66_0F_38_3A */ 0x24af, + /* 11c6 - */ 0, + /* 11c7 - */ 0, + /* 11c8 - */ 0, + /* 11c9 - _V_66_0F_38_3A */ 0x410b, + /* 11ca - */ 0, + /* 11cb - */ 0, + /* 11cc - */ 0, + /* 11cd - */ 0, + /* 11ce - */ 0, + /* 11cf - */ 0, + /* 11d0 - */ 0, + /* 11d1 - _66_0F_38_3B */ 0x24b0, + /* 11d2 - */ 0, + /* 11d3 - */ 0, + /* 11d4 - */ 0, + /* 11d5 - _V_66_0F_38_3B */ 0x410c, + /* 11d6 - */ 0, + /* 11d7 - */ 0, + /* 11d8 - */ 0, + /* 11d9 - */ 0, + /* 11da - */ 0, + /* 11db - */ 0, + /* 11dc - */ 0, + /* 11dd - _66_0F_38_3C */ 0x24b1, + /* 11de - */ 0, + /* 11df - */ 0, + /* 11e0 - */ 0, + /* 11e1 - _V_66_0F_38_3C */ 0x410d, + /* 11e2 - */ 0, + /* 11e3 - */ 0, + /* 11e4 - */ 0, + /* 11e5 - */ 0, + /* 11e6 - */ 0, + /* 11e7 - */ 0, + /* 11e8 - */ 0, + /* 11e9 - _66_0F_38_3D */ 0x24b2, + /* 11ea - */ 0, + /* 11eb - */ 0, + /* 11ec - */ 0, + /* 11ed - _V_66_0F_38_3D */ 0x410e, + /* 11ee - */ 0, + /* 11ef - */ 0, + /* 11f0 - */ 0, + /* 11f1 - */ 0, + /* 11f2 - */ 0, + /* 11f3 - */ 0, + /* 11f4 - */ 0, + /* 11f5 - _66_0F_38_3E */ 0x24b3, + /* 11f6 - */ 0, + /* 11f7 - */ 0, + /* 11f8 - */ 0, + /* 11f9 - _V_66_0F_38_3E */ 0x410f, + /* 11fa - */ 0, + /* 11fb - */ 0, + /* 11fc - */ 0, + /* 11fd - */ 0, + /* 11fe - */ 0, + /* 11ff - */ 0, + /* 1200 - */ 0, + /* 1201 - _66_0F_38_3F */ 0x24b4, + /* 1202 - */ 0, + /* 1203 - */ 0, + /* 1204 - */ 0, + /* 1205 - _V_66_0F_38_3F */ 0x4110, + /* 1206 - */ 0, + /* 1207 - */ 0, + /* 1208 - */ 0, + /* 1209 - */ 0, + /* 120a - */ 0, + /* 120b - */ 0, + /* 120c - */ 0, + /* 120d - _66_0F_38_40 */ 0x24b5, + /* 120e - */ 0, + /* 120f - */ 0, + /* 1210 - */ 0, + /* 1211 - _V_66_0F_38_40 */ 0x4111, + /* 1212 - */ 0, + /* 1213 - */ 0, + /* 1214 - */ 0, + /* 1215 - */ 0, + /* 1216 - */ 0, + /* 1217 - */ 0, + /* 1218 - */ 0, + /* 1219 - _66_0F_38_41 */ 0x24b6, + /* 121a - */ 0, + /* 121b - */ 0, + /* 121c - */ 0, + /* 121d - _V_66_0F_38_41 */ 0x4112, + /* 121e - */ 0, + /* 121f - */ 0, + /* 1220 - */ 0, + /* 1221 - */ 0, + /* 1222 - */ 0, + /* 1223 - */ 0, + /* 1224 - */ 0, + /* 1225 - _66_0F_38_80 */ 0x24b7, + /* 1226 - */ 0, + /* 1227 - */ 0, + /* 1228 - */ 0, + /* 1229 - */ 0, + /* 122a - */ 0, + /* 122b - */ 0, + /* 122c - */ 0, + /* 122d - */ 0, + /* 122e - */ 0, + /* 122f - */ 0, + /* 1230 - */ 0, + /* 1231 - _66_0F_38_81 */ 0x24b8, + /* 1232 - */ 0, + /* 1233 - */ 0, + /* 1234 - */ 0, + /* 1235 - */ 0, + /* 1236 - */ 0, + /* 1237 - */ 0, + /* 1238 - */ 0, + /* 1239 - */ 0, + /* 123a - */ 0, + /* 123b - */ 0, + /* 123c - */ 0, + /* 123d - _66_0F_38_82 */ 0x24b9, + /* 123e - */ 0, + /* 123f - */ 0, + /* 1240 - */ 0, + /* 1241 - */ 0, + /* 1242 - */ 0, + /* 1243 - */ 0, + /* 1244 - */ 0, + /* 1245 - */ 0, + /* 1246 - */ 0, + /* 1247 - */ 0, + /* 1248 - */ 0, + /* 1249 - */ 0, + /* 124a - */ 0, + /* 124b - */ 0, + /* 124c - */ 0, + /* 124d - _V_66_0F_38_96 */ 0x4113, + /* 124e - */ 0, + /* 124f - */ 0, + /* 1250 - */ 0, + /* 1251 - */ 0, + /* 1252 - */ 0, + /* 1253 - */ 0, + /* 1254 - */ 0, + /* 1255 - */ 0, + /* 1256 - */ 0, + /* 1257 - */ 0, + /* 1258 - */ 0, + /* 1259 - _V_66_0F_38_97 */ 0x4114, + /* 125a - */ 0, + /* 125b - */ 0, + /* 125c - */ 0, + /* 125d - */ 0, + /* 125e - */ 0, + /* 125f - */ 0, + /* 1260 - */ 0, + /* 1261 - */ 0, + /* 1262 - */ 0, + /* 1263 - */ 0, + /* 1264 - */ 0, + /* 1265 - _V_66_0F_38_98 */ 0x4115, + /* 1266 - */ 0, + /* 1267 - */ 0, + /* 1268 - */ 0, + /* 1269 - */ 0, + /* 126a - */ 0, + /* 126b - */ 0, + /* 126c - */ 0, + /* 126d - */ 0, + /* 126e - */ 0, + /* 126f - */ 0, + /* 1270 - */ 0, + /* 1271 - _V_66_0F_38_99 */ 0x4116, + /* 1272 - */ 0, + /* 1273 - */ 0, + /* 1274 - */ 0, + /* 1275 - */ 0, + /* 1276 - */ 0, + /* 1277 - */ 0, + /* 1278 - */ 0, + /* 1279 - */ 0, + /* 127a - */ 0, + /* 127b - */ 0, + /* 127c - */ 0, + /* 127d - _V_66_0F_38_9A */ 0x4117, + /* 127e - */ 0, + /* 127f - */ 0, + /* 1280 - */ 0, + /* 1281 - */ 0, + /* 1282 - */ 0, + /* 1283 - */ 0, + /* 1284 - */ 0, + /* 1285 - */ 0, + /* 1286 - */ 0, + /* 1287 - */ 0, + /* 1288 - */ 0, + /* 1289 - _V_66_0F_38_9B */ 0x4118, + /* 128a - */ 0, + /* 128b - */ 0, + /* 128c - */ 0, + /* 128d - */ 0, + /* 128e - */ 0, + /* 128f - */ 0, + /* 1290 - */ 0, + /* 1291 - */ 0, + /* 1292 - */ 0, + /* 1293 - */ 0, + /* 1294 - */ 0, + /* 1295 - _V_66_0F_38_9C */ 0x4119, + /* 1296 - */ 0, + /* 1297 - */ 0, + /* 1298 - */ 0, + /* 1299 - */ 0, + /* 129a - */ 0, + /* 129b - */ 0, + /* 129c - */ 0, + /* 129d - */ 0, + /* 129e - */ 0, + /* 129f - */ 0, + /* 12a0 - */ 0, + /* 12a1 - _V_66_0F_38_9D */ 0x411a, + /* 12a2 - */ 0, + /* 12a3 - */ 0, + /* 12a4 - */ 0, + /* 12a5 - */ 0, + /* 12a6 - */ 0, + /* 12a7 - */ 0, + /* 12a8 - */ 0, + /* 12a9 - */ 0, + /* 12aa - */ 0, + /* 12ab - */ 0, + /* 12ac - */ 0, + /* 12ad - _V_66_0F_38_9E */ 0x411b, + /* 12ae - */ 0, + /* 12af - */ 0, + /* 12b0 - */ 0, + /* 12b1 - */ 0, + /* 12b2 - */ 0, + /* 12b3 - */ 0, + /* 12b4 - */ 0, + /* 12b5 - */ 0, + /* 12b6 - */ 0, + /* 12b7 - */ 0, + /* 12b8 - */ 0, + /* 12b9 - _V_66_0F_38_9F */ 0x411c, + /* 12ba - */ 0, + /* 12bb - */ 0, + /* 12bc - */ 0, + /* 12bd - */ 0, + /* 12be - */ 0, + /* 12bf - */ 0, + /* 12c0 - */ 0, + /* 12c1 - */ 0, + /* 12c2 - */ 0, + /* 12c3 - */ 0, + /* 12c4 - */ 0, + /* 12c5 - _V_66_0F_38_A6 */ 0x411d, + /* 12c6 - */ 0, + /* 12c7 - */ 0, + /* 12c8 - */ 0, + /* 12c9 - */ 0, + /* 12ca - */ 0, + /* 12cb - */ 0, + /* 12cc - */ 0, + /* 12cd - */ 0, + /* 12ce - */ 0, + /* 12cf - */ 0, + /* 12d0 - */ 0, + /* 12d1 - _V_66_0F_38_A7 */ 0x411e, + /* 12d2 - */ 0, + /* 12d3 - */ 0, + /* 12d4 - */ 0, + /* 12d5 - */ 0, + /* 12d6 - */ 0, + /* 12d7 - */ 0, + /* 12d8 - */ 0, + /* 12d9 - */ 0, + /* 12da - */ 0, + /* 12db - */ 0, + /* 12dc - */ 0, + /* 12dd - _V_66_0F_38_A8 */ 0x411f, + /* 12de - */ 0, + /* 12df - */ 0, + /* 12e0 - */ 0, + /* 12e1 - */ 0, + /* 12e2 - */ 0, + /* 12e3 - */ 0, + /* 12e4 - */ 0, + /* 12e5 - */ 0, + /* 12e6 - */ 0, + /* 12e7 - */ 0, + /* 12e8 - */ 0, + /* 12e9 - _V_66_0F_38_A9 */ 0x4120, + /* 12ea - */ 0, + /* 12eb - */ 0, + /* 12ec - */ 0, + /* 12ed - */ 0, + /* 12ee - */ 0, + /* 12ef - */ 0, + /* 12f0 - */ 0, + /* 12f1 - */ 0, + /* 12f2 - */ 0, + /* 12f3 - */ 0, + /* 12f4 - */ 0, + /* 12f5 - _V_66_0F_38_AA */ 0x4121, + /* 12f6 - */ 0, + /* 12f7 - */ 0, + /* 12f8 - */ 0, + /* 12f9 - */ 0, + /* 12fa - */ 0, + /* 12fb - */ 0, + /* 12fc - */ 0, + /* 12fd - */ 0, + /* 12fe - */ 0, + /* 12ff - */ 0, + /* 1300 - */ 0, + /* 1301 - _V_66_0F_38_AB */ 0x4122, + /* 1302 - */ 0, + /* 1303 - */ 0, + /* 1304 - */ 0, + /* 1305 - */ 0, + /* 1306 - */ 0, + /* 1307 - */ 0, + /* 1308 - */ 0, + /* 1309 - */ 0, + /* 130a - */ 0, + /* 130b - */ 0, + /* 130c - */ 0, + /* 130d - _V_66_0F_38_AC */ 0x4123, + /* 130e - */ 0, + /* 130f - */ 0, + /* 1310 - */ 0, + /* 1311 - */ 0, + /* 1312 - */ 0, + /* 1313 - */ 0, + /* 1314 - */ 0, + /* 1315 - */ 0, + /* 1316 - */ 0, + /* 1317 - */ 0, + /* 1318 - */ 0, + /* 1319 - _V_66_0F_38_AD */ 0x4124, + /* 131a - */ 0, + /* 131b - */ 0, + /* 131c - */ 0, + /* 131d - */ 0, + /* 131e - */ 0, + /* 131f - */ 0, + /* 1320 - */ 0, + /* 1321 - */ 0, + /* 1322 - */ 0, + /* 1323 - */ 0, + /* 1324 - */ 0, + /* 1325 - _V_66_0F_38_AE */ 0x4125, + /* 1326 - */ 0, + /* 1327 - */ 0, + /* 1328 - */ 0, + /* 1329 - */ 0, + /* 132a - */ 0, + /* 132b - */ 0, + /* 132c - */ 0, + /* 132d - */ 0, + /* 132e - */ 0, + /* 132f - */ 0, + /* 1330 - */ 0, + /* 1331 - _V_66_0F_38_AF */ 0x4126, + /* 1332 - */ 0, + /* 1333 - */ 0, + /* 1334 - */ 0, + /* 1335 - */ 0, + /* 1336 - */ 0, + /* 1337 - */ 0, + /* 1338 - */ 0, + /* 1339 - */ 0, + /* 133a - */ 0, + /* 133b - */ 0, + /* 133c - */ 0, + /* 133d - _V_66_0F_38_B6 */ 0x4127, + /* 133e - */ 0, + /* 133f - */ 0, + /* 1340 - */ 0, + /* 1341 - */ 0, + /* 1342 - */ 0, + /* 1343 - */ 0, + /* 1344 - */ 0, + /* 1345 - */ 0, + /* 1346 - */ 0, + /* 1347 - */ 0, + /* 1348 - */ 0, + /* 1349 - _V_66_0F_38_B7 */ 0x4128, + /* 134a - */ 0, + /* 134b - */ 0, + /* 134c - */ 0, + /* 134d - */ 0, + /* 134e - */ 0, + /* 134f - */ 0, + /* 1350 - */ 0, + /* 1351 - */ 0, + /* 1352 - */ 0, + /* 1353 - */ 0, + /* 1354 - */ 0, + /* 1355 - _V_66_0F_38_B8 */ 0x4129, + /* 1356 - */ 0, + /* 1357 - */ 0, + /* 1358 - */ 0, + /* 1359 - */ 0, + /* 135a - */ 0, + /* 135b - */ 0, + /* 135c - */ 0, + /* 135d - */ 0, + /* 135e - */ 0, + /* 135f - */ 0, + /* 1360 - */ 0, + /* 1361 - _V_66_0F_38_B9 */ 0x412a, + /* 1362 - */ 0, + /* 1363 - */ 0, + /* 1364 - */ 0, + /* 1365 - */ 0, + /* 1366 - */ 0, + /* 1367 - */ 0, + /* 1368 - */ 0, + /* 1369 - */ 0, + /* 136a - */ 0, + /* 136b - */ 0, + /* 136c - */ 0, + /* 136d - _V_66_0F_38_BA */ 0x412b, + /* 136e - */ 0, + /* 136f - */ 0, + /* 1370 - */ 0, + /* 1371 - */ 0, + /* 1372 - */ 0, + /* 1373 - */ 0, + /* 1374 - */ 0, + /* 1375 - */ 0, + /* 1376 - */ 0, + /* 1377 - */ 0, + /* 1378 - */ 0, + /* 1379 - _V_66_0F_38_BB */ 0x412c, + /* 137a - */ 0, + /* 137b - */ 0, + /* 137c - */ 0, + /* 137d - */ 0, + /* 137e - */ 0, + /* 137f - */ 0, + /* 1380 - */ 0, + /* 1381 - */ 0, + /* 1382 - */ 0, + /* 1383 - */ 0, + /* 1384 - */ 0, + /* 1385 - _V_66_0F_38_BC */ 0x412d, + /* 1386 - */ 0, + /* 1387 - */ 0, + /* 1388 - */ 0, + /* 1389 - */ 0, + /* 138a - */ 0, + /* 138b - */ 0, + /* 138c - */ 0, + /* 138d - */ 0, + /* 138e - */ 0, + /* 138f - */ 0, + /* 1390 - */ 0, + /* 1391 - _V_66_0F_38_BD */ 0x412e, + /* 1392 - */ 0, + /* 1393 - */ 0, + /* 1394 - */ 0, + /* 1395 - */ 0, + /* 1396 - */ 0, + /* 1397 - */ 0, + /* 1398 - */ 0, + /* 1399 - */ 0, + /* 139a - */ 0, + /* 139b - */ 0, + /* 139c - */ 0, + /* 139d - _V_66_0F_38_BE */ 0x412f, + /* 139e - */ 0, + /* 139f - */ 0, + /* 13a0 - */ 0, + /* 13a1 - */ 0, + /* 13a2 - */ 0, + /* 13a3 - */ 0, + /* 13a4 - */ 0, + /* 13a5 - */ 0, + /* 13a6 - */ 0, + /* 13a7 - */ 0, + /* 13a8 - */ 0, + /* 13a9 - _V_66_0F_38_BF */ 0x4130, + /* 13aa - */ 0, + /* 13ab - */ 0, + /* 13ac - */ 0, + /* 13ad - */ 0, + /* 13ae - */ 0, + /* 13af - */ 0, + /* 13b0 - */ 0, + /* 13b1 - _66_0F_38_DB */ 0x24ba, + /* 13b2 - */ 0, + /* 13b3 - */ 0, + /* 13b4 - */ 0, + /* 13b5 - _V_66_0F_38_DB */ 0x4131, + /* 13b6 - */ 0, + /* 13b7 - */ 0, + /* 13b8 - */ 0, + /* 13b9 - */ 0, + /* 13ba - */ 0, + /* 13bb - */ 0, + /* 13bc - */ 0, + /* 13bd - _66_0F_38_DC */ 0x24bb, + /* 13be - */ 0, + /* 13bf - */ 0, + /* 13c0 - */ 0, + /* 13c1 - _V_66_0F_38_DC */ 0x4132, + /* 13c2 - */ 0, + /* 13c3 - */ 0, + /* 13c4 - */ 0, + /* 13c5 - */ 0, + /* 13c6 - */ 0, + /* 13c7 - */ 0, + /* 13c8 - */ 0, + /* 13c9 - _66_0F_38_DD */ 0x24bc, + /* 13ca - */ 0, + /* 13cb - */ 0, + /* 13cc - */ 0, + /* 13cd - _V_66_0F_38_DD */ 0x4133, + /* 13ce - */ 0, + /* 13cf - */ 0, + /* 13d0 - */ 0, + /* 13d1 - */ 0, + /* 13d2 - */ 0, + /* 13d3 - */ 0, + /* 13d4 - */ 0, + /* 13d5 - _66_0F_38_DE */ 0x24bd, + /* 13d6 - */ 0, + /* 13d7 - */ 0, + /* 13d8 - */ 0, + /* 13d9 - _V_66_0F_38_DE */ 0x4134, + /* 13da - */ 0, + /* 13db - */ 0, + /* 13dc - */ 0, + /* 13dd - */ 0, + /* 13de - */ 0, + /* 13df - */ 0, + /* 13e0 - */ 0, + /* 13e1 - _66_0F_38_DF */ 0x24be, + /* 13e2 - */ 0, + /* 13e3 - */ 0, + /* 13e4 - */ 0, + /* 13e5 - _V_66_0F_38_DF */ 0x4135, + /* 13e6 - */ 0, + /* 13e7 - */ 0, + /* 13e8 - */ 0, + /* 13e9 - */ 0, + /* 13ea - */ 0, + /* 13eb - */ 0, + /* 13ec - _0F_38_F0 */ 0x24bf, + /* 13ed - */ 0, + /* 13ee - */ 0, + /* 13ef - _F2_0F_38_F0 */ 0x24c0, + /* 13f0 - */ 0, + /* 13f1 - */ 0, + /* 13f2 - */ 0, + /* 13f3 - */ 0, + /* 13f4 - */ 0, + /* 13f5 - */ 0, + /* 13f6 - */ 0, + /* 13f7 - */ 0, + /* 13f8 - _0F_38_F1 */ 0x24c1, + /* 13f9 - */ 0, + /* 13fa - */ 0, + /* 13fb - _F2_0F_38_F1 */ 0x24c2, + /* 13fc - */ 0, + /* 13fd - */ 0, + /* 13fe - */ 0, + /* 13ff - */ 0, + /* 1400 - */ 0, + /* 1401 - */ 0, + /* 1402 - */ 0, + /* 1403 - */ 0, + /* 1404 - */ 0, + /* 1405 - */ 0, + /* 1406 - */ 0, + /* 1407 - */ 0, + /* 1408 - */ 0, + /* 1409 - _V_66_0F_3A_04 */ 0x4136, + /* 140a - */ 0, + /* 140b - */ 0, + /* 140c - */ 0, + /* 140d - */ 0, + /* 140e - */ 0, + /* 140f - */ 0, + /* 1410 - */ 0, + /* 1411 - */ 0, + /* 1412 - */ 0, + /* 1413 - */ 0, + /* 1414 - */ 0, + /* 1415 - _V_66_0F_3A_05 */ 0x4137, + /* 1416 - */ 0, + /* 1417 - */ 0, + /* 1418 - */ 0, + /* 1419 - */ 0, + /* 141a - */ 0, + /* 141b - */ 0, + /* 141c - */ 0, + /* 141d - */ 0, + /* 141e - */ 0, + /* 141f - */ 0, + /* 1420 - */ 0, + /* 1421 - _V_66_0F_3A_06 */ 0x4138, + /* 1422 - */ 0, + /* 1423 - */ 0, + /* 1424 - */ 0, + /* 1425 - */ 0, + /* 1426 - */ 0, + /* 1427 - */ 0, + /* 1428 - */ 0, + /* 1429 - _66_0F_3A_08 */ 0x4139, + /* 142a - */ 0, + /* 142b - */ 0, + /* 142c - */ 0, + /* 142d - _V_66_0F_3A_08 */ 0x413a, + /* 142e - */ 0, + /* 142f - */ 0, + /* 1430 - */ 0, + /* 1431 - */ 0, + /* 1432 - */ 0, + /* 1433 - */ 0, + /* 1434 - */ 0, + /* 1435 - _66_0F_3A_09 */ 0x413b, + /* 1436 - */ 0, + /* 1437 - */ 0, + /* 1438 - */ 0, + /* 1439 - _V_66_0F_3A_09 */ 0x413c, + /* 143a - */ 0, + /* 143b - */ 0, + /* 143c - */ 0, + /* 143d - */ 0, + /* 143e - */ 0, + /* 143f - */ 0, + /* 1440 - */ 0, + /* 1441 - _66_0F_3A_0A */ 0x413d, + /* 1442 - */ 0, + /* 1443 - */ 0, + /* 1444 - */ 0, + /* 1445 - _V_66_0F_3A_0A */ 0x413e, + /* 1446 - */ 0, + /* 1447 - */ 0, + /* 1448 - */ 0, + /* 1449 - */ 0, + /* 144a - */ 0, + /* 144b - */ 0, + /* 144c - */ 0, + /* 144d - _66_0F_3A_0B */ 0x413f, + /* 144e - */ 0, + /* 144f - */ 0, + /* 1450 - */ 0, + /* 1451 - _V_66_0F_3A_0B */ 0x4140, + /* 1452 - */ 0, + /* 1453 - */ 0, + /* 1454 - */ 0, + /* 1455 - */ 0, + /* 1456 - */ 0, + /* 1457 - */ 0, + /* 1458 - */ 0, + /* 1459 - _66_0F_3A_0C */ 0x4141, + /* 145a - */ 0, + /* 145b - */ 0, + /* 145c - */ 0, + /* 145d - _V_66_0F_3A_0C */ 0x4142, + /* 145e - */ 0, + /* 145f - */ 0, + /* 1460 - */ 0, + /* 1461 - */ 0, + /* 1462 - */ 0, + /* 1463 - */ 0, + /* 1464 - */ 0, + /* 1465 - _66_0F_3A_0D */ 0x4143, + /* 1466 - */ 0, + /* 1467 - */ 0, + /* 1468 - */ 0, + /* 1469 - _V_66_0F_3A_0D */ 0x4144, + /* 146a - */ 0, + /* 146b - */ 0, + /* 146c - */ 0, + /* 146d - */ 0, + /* 146e - */ 0, + /* 146f - */ 0, + /* 1470 - */ 0, + /* 1471 - _66_0F_3A_0E */ 0x4145, + /* 1472 - */ 0, + /* 1473 - */ 0, + /* 1474 - */ 0, + /* 1475 - _V_66_0F_3A_0E */ 0x4146, + /* 1476 - */ 0, + /* 1477 - */ 0, + /* 1478 - */ 0, + /* 1479 - */ 0, + /* 147a - */ 0, + /* 147b - */ 0, + /* 147c - _0F_3A_0F */ 0x4147, + /* 147d - _66_0F_3A_0F */ 0x4148, + /* 147e - */ 0, + /* 147f - */ 0, + /* 1480 - */ 0, + /* 1481 - _V_66_0F_3A_0F */ 0x4149, + /* 1482 - */ 0, + /* 1483 - */ 0, + /* 1484 - */ 0, + /* 1485 - */ 0, + /* 1486 - */ 0, + /* 1487 - */ 0, + /* 1488 - */ 0, + /* 1489 - _66_0F_3A_14 */ 0x414a, + /* 148a - */ 0, + /* 148b - */ 0, + /* 148c - */ 0, + /* 148d - _V_66_0F_3A_14 */ 0x414b, + /* 148e - */ 0, + /* 148f - */ 0, + /* 1490 - */ 0, + /* 1491 - */ 0, + /* 1492 - */ 0, + /* 1493 - */ 0, + /* 1494 - */ 0, + /* 1495 - _66_0F_3A_15 */ 0x414c, + /* 1496 - */ 0, + /* 1497 - */ 0, + /* 1498 - */ 0, + /* 1499 - _V_66_0F_3A_15 */ 0x414d, + /* 149a - */ 0, + /* 149b - */ 0, + /* 149c - */ 0, + /* 149d - */ 0, + /* 149e - */ 0, + /* 149f - */ 0, + /* 14a0 - */ 0, + /* 14a1 - _66_0F_3A_16 */ 0x414e, + /* 14a2 - */ 0, + /* 14a3 - */ 0, + /* 14a4 - */ 0, + /* 14a5 - _V_66_0F_3A_16 */ 0x414f, + /* 14a6 - */ 0, + /* 14a7 - */ 0, + /* 14a8 - */ 0, + /* 14a9 - */ 0, + /* 14aa - */ 0, + /* 14ab - */ 0, + /* 14ac - */ 0, + /* 14ad - _66_0F_3A_17 */ 0x4150, + /* 14ae - */ 0, + /* 14af - */ 0, + /* 14b0 - */ 0, + /* 14b1 - _V_66_0F_3A_17 */ 0x4151, + /* 14b2 - */ 0, + /* 14b3 - */ 0, + /* 14b4 - */ 0, + /* 14b5 - */ 0, + /* 14b6 - */ 0, + /* 14b7 - */ 0, + /* 14b8 - */ 0, + /* 14b9 - */ 0, + /* 14ba - */ 0, + /* 14bb - */ 0, + /* 14bc - */ 0, + /* 14bd - _V_66_0F_3A_18 */ 0x4152, + /* 14be - */ 0, + /* 14bf - */ 0, + /* 14c0 - */ 0, + /* 14c1 - */ 0, + /* 14c2 - */ 0, + /* 14c3 - */ 0, + /* 14c4 - */ 0, + /* 14c5 - */ 0, + /* 14c6 - */ 0, + /* 14c7 - */ 0, + /* 14c8 - */ 0, + /* 14c9 - _V_66_0F_3A_19 */ 0x4153, + /* 14ca - */ 0, + /* 14cb - */ 0, + /* 14cc - */ 0, + /* 14cd - */ 0, + /* 14ce - */ 0, + /* 14cf - */ 0, + /* 14d0 - */ 0, + /* 14d1 - _66_0F_3A_20 */ 0x4154, + /* 14d2 - */ 0, + /* 14d3 - */ 0, + /* 14d4 - */ 0, + /* 14d5 - _V_66_0F_3A_20 */ 0x4155, + /* 14d6 - */ 0, + /* 14d7 - */ 0, + /* 14d8 - */ 0, + /* 14d9 - */ 0, + /* 14da - */ 0, + /* 14db - */ 0, + /* 14dc - */ 0, + /* 14dd - _66_0F_3A_21 */ 0x4156, + /* 14de - */ 0, + /* 14df - */ 0, + /* 14e0 - */ 0, + /* 14e1 - _V_66_0F_3A_21 */ 0x4157, + /* 14e2 - */ 0, + /* 14e3 - */ 0, + /* 14e4 - */ 0, + /* 14e5 - */ 0, + /* 14e6 - */ 0, + /* 14e7 - */ 0, + /* 14e8 - */ 0, + /* 14e9 - _66_0F_3A_22 */ 0x4158, + /* 14ea - */ 0, + /* 14eb - */ 0, + /* 14ec - */ 0, + /* 14ed - _V_66_0F_3A_22 */ 0x4159, + /* 14ee - */ 0, + /* 14ef - */ 0, + /* 14f0 - */ 0, + /* 14f1 - */ 0, + /* 14f2 - */ 0, + /* 14f3 - */ 0, + /* 14f4 - */ 0, + /* 14f5 - _66_0F_3A_40 */ 0x415a, + /* 14f6 - */ 0, + /* 14f7 - */ 0, + /* 14f8 - */ 0, + /* 14f9 - _V_66_0F_3A_40 */ 0x415b, + /* 14fa - */ 0, + /* 14fb - */ 0, + /* 14fc - */ 0, + /* 14fd - */ 0, + /* 14fe - */ 0, + /* 14ff - */ 0, + /* 1500 - */ 0, + /* 1501 - _66_0F_3A_41 */ 0x415c, + /* 1502 - */ 0, + /* 1503 - */ 0, + /* 1504 - */ 0, + /* 1505 - _V_66_0F_3A_41 */ 0x415d, + /* 1506 - */ 0, + /* 1507 - */ 0, + /* 1508 - */ 0, + /* 1509 - */ 0, + /* 150a - */ 0, + /* 150b - */ 0, + /* 150c - */ 0, + /* 150d - _66_0F_3A_42 */ 0x415e, + /* 150e - */ 0, + /* 150f - */ 0, + /* 1510 - */ 0, + /* 1511 - _V_66_0F_3A_42 */ 0x415f, + /* 1512 - */ 0, + /* 1513 - */ 0, + /* 1514 - */ 0, + /* 1515 - */ 0, + /* 1516 - */ 0, + /* 1517 - */ 0, + /* 1518 - */ 0, + /* 1519 - _66_0F_3A_44 */ 0x4160, + /* 151a - */ 0, + /* 151b - */ 0, + /* 151c - */ 0, + /* 151d - _V_66_0F_3A_44 */ 0x4161, + /* 151e - */ 0, + /* 151f - */ 0, + /* 1520 - */ 0, + /* 1521 - */ 0, + /* 1522 - */ 0, + /* 1523 - */ 0, + /* 1524 - */ 0, + /* 1525 - */ 0, + /* 1526 - */ 0, + /* 1527 - */ 0, + /* 1528 - */ 0, + /* 1529 - _V_66_0F_3A_4A */ 0x4162, + /* 152a - */ 0, + /* 152b - */ 0, + /* 152c - */ 0, + /* 152d - */ 0, + /* 152e - */ 0, + /* 152f - */ 0, + /* 1530 - */ 0, + /* 1531 - */ 0, + /* 1532 - */ 0, + /* 1533 - */ 0, + /* 1534 - */ 0, + /* 1535 - _V_66_0F_3A_4B */ 0x4163, + /* 1536 - */ 0, + /* 1537 - */ 0, + /* 1538 - */ 0, + /* 1539 - */ 0, + /* 153a - */ 0, + /* 153b - */ 0, + /* 153c - */ 0, + /* 153d - */ 0, + /* 153e - */ 0, + /* 153f - */ 0, + /* 1540 - */ 0, + /* 1541 - _V_66_0F_3A_4C */ 0x4164, + /* 1542 - */ 0, + /* 1543 - */ 0, + /* 1544 - */ 0, + /* 1545 - */ 0, + /* 1546 - */ 0, + /* 1547 - */ 0, + /* 1548 - */ 0, + /* 1549 - _66_0F_3A_60 */ 0x4165, + /* 154a - */ 0, + /* 154b - */ 0, + /* 154c - */ 0, + /* 154d - _V_66_0F_3A_60 */ 0x4166, + /* 154e - */ 0, + /* 154f - */ 0, + /* 1550 - */ 0, + /* 1551 - */ 0, + /* 1552 - */ 0, + /* 1553 - */ 0, + /* 1554 - */ 0, + /* 1555 - _66_0F_3A_61 */ 0x4167, + /* 1556 - */ 0, + /* 1557 - */ 0, + /* 1558 - */ 0, + /* 1559 - _V_66_0F_3A_61 */ 0x4168, + /* 155a - */ 0, + /* 155b - */ 0, + /* 155c - */ 0, + /* 155d - */ 0, + /* 155e - */ 0, + /* 155f - */ 0, + /* 1560 - */ 0, + /* 1561 - _66_0F_3A_62 */ 0x4169, + /* 1562 - */ 0, + /* 1563 - */ 0, + /* 1564 - */ 0, + /* 1565 - _V_66_0F_3A_62 */ 0x416a, + /* 1566 - */ 0, + /* 1567 - */ 0, + /* 1568 - */ 0, + /* 1569 - */ 0, + /* 156a - */ 0, + /* 156b - */ 0, + /* 156c - */ 0, + /* 156d - _66_0F_3A_63 */ 0x416b, + /* 156e - */ 0, + /* 156f - */ 0, + /* 1570 - */ 0, + /* 1571 - _V_66_0F_3A_63 */ 0x416c, + /* 1572 - */ 0, + /* 1573 - */ 0, + /* 1574 - */ 0, + /* 1575 - */ 0, + /* 1576 - */ 0, + /* 1577 - */ 0, + /* 1578 - */ 0, + /* 1579 - _66_0F_3A_DF */ 0x416d, + /* 157a - */ 0, + /* 157b - */ 0, + /* 157c - */ 0, + /* 157d - _V_66_0F_3A_DF */ 0x416e, + /* 157e - */ 0, + /* 157f - */ 0, + /* 1580 - */ 0, + /* 1581 - */ 0, + /* 1582 - */ 0, + /* 1583 - */ 0, + /* 1584 - _0F_71_02 */ 0x24c3, + /* 1585 - _66_0F_71_02 */ 0x24c4, + /* 1586 - */ 0, + /* 1587 - */ 0, + /* 1588 - */ 0, + /* 1589 - _V_66_0F_71_02 */ 0x416f, + /* 158a - */ 0, + /* 158b - */ 0, + /* 158c - */ 0, + /* 158d - */ 0, + /* 158e - */ 0, + /* 158f - */ 0, + /* 1590 - _0F_71_04 */ 0x24c5, + /* 1591 - _66_0F_71_04 */ 0x24c6, + /* 1592 - */ 0, + /* 1593 - */ 0, + /* 1594 - */ 0, + /* 1595 - _V_66_0F_71_04 */ 0x4170, + /* 1596 - */ 0, + /* 1597 - */ 0, + /* 1598 - */ 0, + /* 1599 - */ 0, + /* 159a - */ 0, + /* 159b - */ 0, + /* 159c - _0F_71_06 */ 0x24c7, + /* 159d - _66_0F_71_06 */ 0x24c8, + /* 159e - */ 0, + /* 159f - */ 0, + /* 15a0 - */ 0, + /* 15a1 - _V_66_0F_71_06 */ 0x4171, + /* 15a2 - */ 0, + /* 15a3 - */ 0, + /* 15a4 - */ 0, + /* 15a5 - */ 0, + /* 15a6 - */ 0, + /* 15a7 - */ 0, + /* 15a8 - _0F_72_02 */ 0x24c9, + /* 15a9 - _66_0F_72_02 */ 0x24ca, + /* 15aa - */ 0, + /* 15ab - */ 0, + /* 15ac - */ 0, + /* 15ad - _V_66_0F_72_02 */ 0x4172, + /* 15ae - */ 0, + /* 15af - */ 0, + /* 15b0 - */ 0, + /* 15b1 - */ 0, + /* 15b2 - */ 0, + /* 15b3 - */ 0, + /* 15b4 - _0F_72_04 */ 0x24cb, + /* 15b5 - _66_0F_72_04 */ 0x24cc, + /* 15b6 - */ 0, + /* 15b7 - */ 0, + /* 15b8 - */ 0, + /* 15b9 - _V_66_0F_72_04 */ 0x4173, + /* 15ba - */ 0, + /* 15bb - */ 0, + /* 15bc - */ 0, + /* 15bd - */ 0, + /* 15be - */ 0, + /* 15bf - */ 0, + /* 15c0 - _0F_72_06 */ 0x24cd, + /* 15c1 - _66_0F_72_06 */ 0x24ce, + /* 15c2 - */ 0, + /* 15c3 - */ 0, + /* 15c4 - */ 0, + /* 15c5 - _V_66_0F_72_06 */ 0x4174, + /* 15c6 - */ 0, + /* 15c7 - */ 0, + /* 15c8 - */ 0, + /* 15c9 - */ 0, + /* 15ca - */ 0, + /* 15cb - */ 0, + /* 15cc - _0F_73_02 */ 0x24cf, + /* 15cd - _66_0F_73_02 */ 0x24d0, + /* 15ce - */ 0, + /* 15cf - */ 0, + /* 15d0 - */ 0, + /* 15d1 - _V_66_0F_73_02 */ 0x4175, + /* 15d2 - */ 0, + /* 15d3 - */ 0, + /* 15d4 - */ 0, + /* 15d5 - */ 0, + /* 15d6 - */ 0, + /* 15d7 - */ 0, + /* 15d8 - */ 0, + /* 15d9 - _66_0F_73_03 */ 0x24d1, + /* 15da - */ 0, + /* 15db - */ 0, + /* 15dc - */ 0, + /* 15dd - _V_66_0F_73_03 */ 0x4176, + /* 15de - */ 0, + /* 15df - */ 0, + /* 15e0 - */ 0, + /* 15e1 - */ 0, + /* 15e2 - */ 0, + /* 15e3 - */ 0, + /* 15e4 - _0F_73_06 */ 0x24d2, + /* 15e5 - _66_0F_73_06 */ 0x24d3, + /* 15e6 - */ 0, + /* 15e7 - */ 0, + /* 15e8 - */ 0, + /* 15e9 - _V_66_0F_73_06 */ 0x4177, + /* 15ea - */ 0, + /* 15eb - */ 0, + /* 15ec - */ 0, + /* 15ed - */ 0, + /* 15ee - */ 0, + /* 15ef - */ 0, + /* 15f0 - */ 0, + /* 15f1 - _66_0F_73_07 */ 0x24d4, + /* 15f2 - */ 0, + /* 15f3 - */ 0, + /* 15f4 - */ 0, + /* 15f5 - _V_66_0F_73_07 */ 0x4178, + /* 15f6 - */ 0, + /* 15f7 - */ 0, + /* 15f8 - */ 0, + /* 15f9 - */ 0, + /* 15fa - */ 0, + /* 15fb - */ 0, + /* 15fc - _0F_AE_00 */ 0x4179, + /* 15fd - */ 0, + /* 15fe - _F3_0F_AE_00 */ 0x24d5, + /* 15ff - */ 0, + /* 1600 - */ 0, + /* 1601 - */ 0, + /* 1602 - */ 0, + /* 1603 - */ 0, + /* 1604 - */ 0, + /* 1605 - */ 0, + /* 1606 - */ 0, + /* 1607 - */ 0, + /* 1608 - _0F_AE_01 */ 0x417a, + /* 1609 - */ 0, + /* 160a - _F3_0F_AE_01 */ 0x24d6, + /* 160b - */ 0, + /* 160c - */ 0, + /* 160d - */ 0, + /* 160e - */ 0, + /* 160f - */ 0, + /* 1610 - */ 0, + /* 1611 - */ 0, + /* 1612 - */ 0, + /* 1613 - */ 0, + /* 1614 - _0F_AE_02 */ 0x24d7, + /* 1615 - */ 0, + /* 1616 - _F3_0F_AE_02 */ 0x24d8, + /* 1617 - */ 0, + /* 1618 - _V_0F_AE_02 */ 0x417b, + /* 1619 - */ 0, + /* 161a - */ 0, + /* 161b - */ 0, + /* 161c - */ 0, + /* 161d - */ 0, + /* 161e - */ 0, + /* 161f - */ 0, + /* 1620 - _0F_AE_03 */ 0x24d9, + /* 1621 - */ 0, + /* 1622 - _F3_0F_AE_03 */ 0x24da, + /* 1623 - */ 0, + /* 1624 - _V_0F_AE_03 */ 0x417c, + /* 1625 - */ 0, + /* 1626 - */ 0, + /* 1627 - */ 0, + /* 1628 - */ 0, + /* 1629 - */ 0, + /* 162a - */ 0, + /* 162b - */ 0, + /* 162c - _0F_C7_06 */ 0x24db, + /* 162d - _66_0F_C7_06 */ 0x24dc, + /* 162e - _F3_0F_C7_06 */ 0x24dd, + /* 162f - */ 0, + /* 1630 - */ 0, + /* 1631 - */ 0, + /* 1632 - */ 0, + /* 1633 - */ 0, + /* 1634 - */ 0, + /* 1635 - */ 0, + /* 1636 - */ 0, + /* 1637 - */ 0 +}; + +_InstSharedInfo InstSharedInfoTable[470] = { + { 0, 9, 15, 8, 245, 0, 0 }, + { 0, 11, 17, 8, 245, 0, 0 }, + { 0, 15, 9, 8, 245, 0, 0 }, + { 0, 17, 11, 8, 245, 0, 0 }, + { 1, 1, 33, 8, 245, 0, 0 }, + { 1, 3, 35, 8, 245, 0, 0 }, + { 2, 0, 32, 8, 0, 0, 0 }, + { 3, 0, 32, 8, 0, 0, 0 }, + { 0, 9, 15, 8, 196, 16, 0 }, + { 0, 11, 17, 8, 196, 16, 0 }, + { 0, 15, 9, 8, 196, 16, 0 }, + { 0, 17, 11, 8, 196, 16, 0 }, + { 1, 1, 33, 8, 196, 16, 0 }, + { 1, 3, 35, 8, 196, 16, 0 }, + { 4, 0, 32, 8, 0, 0, 0 }, + { 0, 9, 15, 8, 245, 1, 0 }, + { 0, 11, 17, 8, 245, 1, 0 }, + { 0, 15, 9, 8, 245, 1, 0 }, + { 0, 17, 11, 8, 245, 1, 0 }, + { 1, 1, 33, 8, 245, 1, 0 }, + { 1, 3, 35, 8, 245, 1, 0 }, + { 5, 0, 32, 8, 0, 0, 0 }, + { 6, 0, 32, 8, 0, 0, 0 }, + { 7, 0, 32, 8, 0, 0, 0 }, + { 8, 0, 32, 8, 0, 0, 0 }, + { 0, 9, 15, 8, 229, 0, 16 }, + { 0, 11, 17, 8, 229, 0, 16 }, + { 0, 15, 9, 8, 229, 0, 16 }, + { 0, 17, 11, 8, 229, 0, 16 }, + { 1, 1, 33, 8, 229, 0, 16 }, + { 1, 3, 35, 8, 229, 0, 16 }, + { 9, 0, 0, 8, 213, 17, 32 }, + { 0, 9, 15, 8, 196, 0, 16 }, + { 0, 11, 17, 8, 196, 0, 16 }, + { 0, 15, 9, 8, 196, 0, 16 }, + { 0, 17, 11, 8, 196, 0, 16 }, + { 1, 1, 33, 8, 196, 0, 16 }, + { 1, 3, 35, 8, 196, 0, 16 }, + { 9, 0, 0, 8, 17, 16, 228 }, + { 10, 9, 15, 8, 245, 0, 0 }, + { 10, 11, 17, 8, 245, 0, 0 }, + { 10, 15, 9, 8, 245, 0, 0 }, + { 10, 17, 11, 8, 245, 0, 0 }, + { 11, 1, 33, 8, 245, 0, 0 }, + { 11, 3, 35, 8, 245, 0, 0 }, + { 12, 0, 54, 8, 244, 0, 0 }, + { 13, 0, 54, 8, 0, 0, 0 }, + { 14, 0, 54, 8, 0, 0, 0 }, + { 15, 0, 0, 8, 0, 0, 0 }, + { 16, 42, 11, 8, 0, 0, 0 }, + { 10, 10, 16, 8, 64, 0, 0 }, + { 13, 0, 3, 8, 0, 0, 0 }, + { 17, 17, 11, 8, 33, 0, 212 }, + { 18, 0, 5, 8, 0, 0, 0 }, + { 19, 59, 56, 8, 0, 8, 0 }, + { 20, 59, 56, 8, 0, 8, 0 }, + { 19, 55, 59, 8, 0, 8, 0 }, + { 20, 55, 59, 8, 0, 8, 0 }, + { 13, 0, 40, 13, 0, 32, 0 }, + { 13, 0, 40, 13, 0, 1, 0 }, + { 13, 0, 40, 13, 0, 64, 0 }, + { 13, 0, 40, 13, 0, 65, 0 }, + { 13, 0, 40, 13, 0, 128, 0 }, + { 13, 0, 40, 13, 0, 4, 0 }, + { 13, 0, 40, 13, 0, 160, 0 }, + { 13, 0, 40, 13, 0, 224, 0 }, + { 10, 9, 15, 8, 196, 0, 16 }, + { 10, 11, 17, 8, 196, 0, 16 }, + { 0, 9, 15, 8, 0, 0, 0 }, + { 0, 11, 17, 8, 0, 0, 0 }, + { 21, 9, 15, 8, 0, 0, 0 }, + { 21, 11, 17, 8, 0, 0, 0 }, + { 21, 15, 9, 8, 0, 0, 0 }, + { 21, 17, 11, 8, 0, 0, 0 }, + { 21, 31, 28, 8, 0, 0, 0 }, + { 21, 42, 11, 8, 0, 0, 0 }, + { 21, 28, 31, 8, 0, 0, 0 }, + { 1, 35, 54, 8, 0, 0, 0 }, + { 22, 0, 0, 8, 0, 0, 0 }, + { 9, 0, 38, 9, 0, 0, 0 }, + { 23, 0, 0, 8, 0, 0, 0 }, + { 23, 0, 0, 8, 255, 0, 0 }, + { 11, 0, 0, 8, 213, 0, 0 }, + { 11, 0, 0, 8, 0, 0, 0 }, + { 1, 49, 33, 8, 0, 0, 0 }, + { 1, 50, 35, 8, 0, 0, 0 }, + { 1, 33, 49, 8, 0, 0, 0 }, + { 1, 35, 50, 8, 0, 0, 0 }, + { 24, 55, 56, 8, 0, 8, 0 }, + { 25, 55, 56, 8, 0, 8, 0 }, + { 19, 56, 55, 8, 245, 8, 0 }, + { 26, 56, 55, 8, 245, 8, 0 }, + { 11, 1, 33, 8, 196, 0, 16 }, + { 11, 3, 35, 8, 196, 0, 16 }, + { 19, 33, 56, 8, 0, 8, 0 }, + { 26, 35, 56, 8, 0, 8, 0 }, + { 19, 55, 33, 8, 0, 8, 0 }, + { 26, 55, 35, 8, 0, 8, 0 }, + { 19, 33, 56, 8, 245, 8, 0 }, + { 26, 35, 56, 8, 245, 8, 0 }, + { 1, 1, 53, 8, 0, 0, 0 }, + { 27, 3, 54, 8, 0, 0, 0 }, + { 13, 0, 2, 10, 0, 0, 0 }, + { 13, 0, 0, 10, 0, 0, 0 }, + { 16, 37, 11, 8, 0, 0, 0 }, + { 13, 8, 6, 8, 0, 0, 0 }, + { 13, 0, 0, 8, 0, 0, 0 }, + { 28, 0, 2, 10, 0, 0, 0 }, + { 28, 0, 0, 10, 0, 0, 0 }, + { 11, 0, 0, 14, 0, 0, 0 }, + { 11, 0, 1, 14, 0, 0, 0 }, + { 9, 0, 0, 14, 0, 0, 0 }, + { 28, 0, 0, 10, 255, 0, 0 }, + { 9, 0, 1, 8, 196, 0, 49 }, + { 9, 0, 0, 8, 0, 0, 0 }, + { 29, 0, 57, 8, 0, 0, 0 }, + { 30, 0, 40, 13, 0, 64, 0 }, + { 30, 0, 40, 13, 0, 0, 0 }, + { 31, 0, 40, 13, 0, 0, 0 }, + { 1, 1, 33, 8, 0, 0, 0 }, + { 1, 1, 36, 8, 0, 0, 0 }, + { 11, 33, 1, 8, 0, 0, 0 }, + { 11, 36, 1, 8, 0, 0, 0 }, + { 13, 0, 41, 9, 0, 0, 0 }, + { 13, 0, 41, 12, 0, 0, 0 }, + { 9, 0, 38, 12, 0, 0, 0 }, + { 13, 0, 40, 12, 0, 0, 0 }, + { 1, 59, 33, 8, 0, 0, 0 }, + { 1, 59, 36, 8, 0, 0, 0 }, + { 11, 33, 59, 8, 0, 0, 0 }, + { 11, 36, 59, 8, 0, 0, 0 }, + { 11, 0, 0, 8, 1, 0, 0 }, + { 11, 0, 0, 8, 2, 0, 0 }, + { 11, 0, 0, 8, 8, 0, 0 }, + { 10, 16, 11, 8, 64, 0, 0 }, + { 32, 0, 0, 27, 0, 0, 0 }, + { 32, 0, 0, 8, 0, 0, 0 }, + { 32, 0, 0, 14, 0, 0, 0 }, + { 11, 0, 0, 96, 0, 0, 0 }, + { 10, 0, 17, 8, 0, 0, 0 }, + { 33, 29, 14, 8, 0, 0, 0 }, + { 33, 30, 14, 8, 0, 0, 0 }, + { 33, 14, 29, 8, 0, 0, 0 }, + { 33, 14, 30, 8, 0, 0, 0 }, + { 34, 0, 0, 8, 0, 0, 0 }, + { 35, 17, 11, 31, 0, 32, 0 }, + { 35, 17, 11, 31, 0, 1, 0 }, + { 35, 17, 11, 31, 0, 64, 0 }, + { 35, 17, 11, 31, 0, 65, 0 }, + { 35, 17, 11, 31, 0, 128, 0 }, + { 35, 17, 11, 31, 0, 4, 0 }, + { 35, 17, 11, 31, 0, 160, 0 }, + { 35, 17, 11, 31, 0, 224, 0 }, + { 32, 0, 41, 13, 0, 32, 0 }, + { 32, 0, 41, 13, 0, 1, 0 }, + { 32, 0, 41, 13, 0, 64, 0 }, + { 32, 0, 41, 13, 0, 65, 0 }, + { 32, 0, 41, 13, 0, 128, 0 }, + { 32, 0, 41, 13, 0, 4, 0 }, + { 32, 0, 41, 13, 0, 160, 0 }, + { 32, 0, 41, 13, 0, 224, 0 }, + { 35, 0, 15, 8, 0, 32, 0 }, + { 35, 0, 15, 8, 0, 1, 0 }, + { 35, 0, 15, 8, 0, 64, 0 }, + { 35, 0, 15, 8, 0, 65, 0 }, + { 35, 0, 15, 8, 0, 128, 0 }, + { 35, 0, 15, 8, 0, 4, 0 }, + { 35, 0, 15, 8, 0, 160, 0 }, + { 35, 0, 15, 8, 0, 224, 0 }, + { 36, 0, 32, 8, 0, 0, 0 }, + { 37, 0, 32, 8, 0, 0, 0 }, + { 35, 11, 17, 8, 1, 0, 244 }, + { 38, 11, 17, 8, 197, 0, 48 }, + { 39, 0, 32, 8, 0, 0, 0 }, + { 40, 0, 32, 8, 0, 0, 0 }, + { 32, 0, 0, 8, 255, 0, 0 }, + { 41, 11, 17, 8, 1, 0, 244 }, + { 35, 17, 11, 8, 33, 0, 212 }, + { 41, 9, 15, 8, 245, 0, 0 }, + { 41, 11, 17, 8, 245, 0, 0 }, + { 42, 37, 11, 8, 0, 0, 0 }, + { 35, 15, 11, 8, 0, 0, 0 }, + { 43, 16, 11, 8, 0, 0, 0 }, + { 43, 13, 45, 48, 0, 0, 0 }, + { 44, 0, 54, 8, 0, 0, 0 }, + { 45, 1, 15, 8, 245, 0, 0 }, + { 45, 1, 15, 8, 196, 16, 0 }, + { 45, 1, 15, 8, 245, 1, 0 }, + { 45, 1, 15, 8, 229, 0, 16 }, + { 45, 1, 15, 8, 196, 0, 16 }, + { 46, 1, 15, 8, 245, 0, 0 }, + { 45, 3, 17, 8, 245, 0, 0 }, + { 45, 3, 17, 8, 196, 16, 0 }, + { 45, 3, 17, 8, 245, 1, 0 }, + { 45, 3, 17, 8, 229, 0, 16 }, + { 45, 3, 17, 8, 196, 0, 16 }, + { 46, 3, 17, 8, 245, 0, 0 }, + { 47, 1, 15, 8, 245, 0, 0 }, + { 47, 1, 15, 8, 196, 16, 0 }, + { 47, 1, 15, 8, 245, 1, 0 }, + { 47, 1, 15, 8, 229, 0, 16 }, + { 47, 1, 15, 8, 196, 0, 16 }, + { 48, 1, 15, 8, 245, 0, 0 }, + { 45, 5, 17, 8, 245, 0, 0 }, + { 49, 5, 17, 8, 196, 16, 0 }, + { 45, 5, 17, 8, 245, 1, 0 }, + { 49, 5, 17, 8, 229, 0, 16 }, + { 49, 5, 17, 8, 196, 0, 16 }, + { 46, 5, 17, 8, 245, 0, 0 }, + { 50, 0, 17, 8, 0, 0, 0 }, + { 51, 1, 15, 8, 1, 0, 32 }, + { 51, 1, 15, 8, 1, 1, 32 }, + { 51, 1, 15, 8, 197, 0, 48 }, + { 51, 1, 17, 8, 1, 0, 32 }, + { 51, 1, 17, 8, 1, 1, 32 }, + { 51, 1, 17, 8, 197, 0, 48 }, + { 52, 1, 15, 8, 0, 0, 0 }, + { 53, 0, 1, 24, 0, 0, 0 }, + { 52, 3, 17, 8, 0, 0, 0 }, + { 53, 0, 41, 24, 0, 0, 0 }, + { 51, 51, 15, 8, 33, 0, 0 }, + { 51, 51, 15, 8, 33, 1, 0 }, + { 51, 51, 15, 8, 229, 0, 16 }, + { 51, 51, 17, 8, 33, 0, 0 }, + { 51, 51, 17, 8, 33, 1, 0 }, + { 51, 51, 17, 8, 229, 0, 16 }, + { 51, 52, 15, 8, 1, 0, 32 }, + { 51, 52, 15, 8, 1, 1, 32 }, + { 51, 52, 15, 8, 197, 0, 48 }, + { 51, 52, 17, 8, 1, 0, 32 }, + { 51, 52, 17, 8, 1, 1, 32 }, + { 51, 52, 17, 8, 197, 0, 48 }, + { 46, 0, 21, 16, 0, 0, 0 }, + { 54, 0, 62, 16, 0, 0, 0 }, + { 54, 0, 61, 16, 0, 0, 0 }, + { 54, 0, 0, 16, 0, 0, 0 }, + { 51, 0, 21, 16, 0, 0, 0 }, + { 46, 0, 42, 16, 0, 0, 0 }, + { 46, 0, 20, 16, 0, 0, 0 }, + { 55, 0, 62, 24, 0, 1, 0 }, + { 55, 0, 62, 24, 0, 64, 0 }, + { 55, 0, 62, 24, 0, 65, 0 }, + { 55, 0, 62, 24, 0, 4, 0 }, + { 56, 0, 21, 56, 0, 0, 0 }, + { 46, 0, 23, 16, 0, 0, 0 }, + { 51, 0, 23, 16, 0, 0, 0 }, + { 55, 0, 62, 16, 69, 0, 0 }, + { 55, 0, 62, 24, 69, 0, 0 }, + { 46, 0, 22, 16, 0, 0, 0 }, + { 54, 0, 63, 16, 0, 0, 0 }, + { 56, 0, 22, 56, 0, 0, 0 }, + { 51, 0, 22, 16, 0, 0, 0 }, + { 56, 0, 20, 56, 0, 0, 0 }, + { 51, 0, 20, 16, 0, 0, 0 }, + { 46, 1, 15, 8, 196, 0, 16 }, + { 45, 0, 15, 8, 0, 0, 0 }, + { 45, 0, 15, 8, 245, 0, 0 }, + { 51, 0, 15, 8, 33, 0, 212 }, + { 51, 0, 15, 8, 0, 0, 245 }, + { 46, 3, 17, 8, 196, 0, 16 }, + { 45, 0, 17, 8, 0, 0, 0 }, + { 45, 0, 17, 8, 245, 0, 0 }, + { 51, 0, 17, 8, 33, 0, 212 }, + { 51, 0, 17, 8, 0, 0, 245 }, + { 45, 0, 15, 8, 244, 0, 0 }, + { 45, 0, 17, 8, 244, 0, 0 }, + { 57, 0, 17, 9, 0, 0, 0 }, + { 58, 0, 37, 9, 0, 0, 0 }, + { 57, 0, 17, 12, 0, 0, 0 }, + { 58, 0, 37, 12, 0, 0, 0 }, + { 57, 0, 17, 8, 0, 0, 0 }, + { 46, 0, 17, 8, 0, 0, 0 }, + { 46, 0, 16, 8, 0, 0, 0 }, + { 56, 0, 16, 8, 0, 0, 0 }, + { 46, 0, 16, 8, 64, 0, 0 }, + { 57, 0, 39, 8, 0, 0, 0 }, + { 52, 0, 28, 8, 0, 0, 0 }, + { 59, 0, 16, 8, 0, 0, 0 }, + { 56, 0, 42, 8, 0, 0, 0 }, + { 55, 0, 0, 112, 0, 0, 0 }, + { 55, 0, 0, 8, 0, 0, 0 }, + { 13, 0, 0, 24, 0, 0, 0 }, + { 56, 0, 58, 120, 0, 0, 0 }, + { 55, 0, 0, 120, 0, 0, 0 }, + { 55, 0, 58, 120, 0, 0, 0 }, + { 55, 60, 58, 120, 0, 0, 0 }, + { 60, 0, 0, 8, 0, 0, 0 }, + { 56, 0, 42, 96, 0, 0, 0 }, + { 61, 67, 64, 104, 0, 0, 0 }, + { 61, 67, 64, 96, 0, 0, 0 }, + { 35, 73, 68, 40, 0, 0, 0 }, + { 35, 73, 68, 48, 0, 0, 0 }, + { 35, 71, 68, 40, 0, 0, 0 }, + { 35, 72, 68, 48, 0, 0, 0 }, + { 62, 90, 83, 128, 0, 0, 0 }, + { 63, 81, 68, 128, 0, 0, 0 }, + { 64, 44, 68, 128, 0, 0, 0 }, + { 64, 46, 68, 128, 0, 0, 0 }, + { 35, 68, 73, 40, 0, 0, 0 }, + { 35, 68, 73, 48, 0, 0, 0 }, + { 35, 68, 71, 40, 0, 0, 0 }, + { 35, 68, 72, 48, 0, 0, 0 }, + { 62, 83, 90, 128, 0, 0, 0 }, + { 64, 68, 44, 128, 0, 0, 0 }, + { 64, 68, 46, 128, 0, 0, 0 }, + { 65, 72, 68, 40, 0, 0, 0 }, + { 35, 46, 68, 48, 0, 0, 0 }, + { 35, 72, 68, 56, 0, 0, 0 }, + { 66, 81, 68, 128, 0, 0, 0 }, + { 67, 81, 68, 128, 0, 0, 0 }, + { 62, 89, 83, 128, 0, 0, 0 }, + { 35, 68, 46, 40, 0, 0, 0 }, + { 35, 68, 46, 48, 0, 0, 0 }, + { 62, 68, 46, 128, 0, 0, 0 }, + { 34, 73, 68, 40, 0, 0, 0 }, + { 34, 73, 68, 48, 0, 0, 0 }, + { 67, 88, 83, 128, 0, 0, 0 }, + { 35, 73, 68, 56, 0, 0, 0 }, + { 56, 0, 42, 40, 0, 0, 0 }, + { 34, 67, 68, 40, 0, 0, 0 }, + { 34, 67, 68, 48, 0, 0, 0 }, + { 42, 18, 68, 40, 0, 0, 0 }, + { 42, 18, 68, 48, 0, 0, 0 }, + { 35, 68, 47, 40, 0, 0, 0 }, + { 35, 68, 47, 48, 0, 0, 0 }, + { 35, 68, 44, 88, 0, 0, 0 }, + { 35, 68, 46, 88, 0, 0, 0 }, + { 62, 83, 92, 128, 0, 0, 0 }, + { 34, 72, 64, 40, 0, 0, 0 }, + { 34, 73, 64, 48, 0, 0, 0 }, + { 42, 71, 13, 40, 0, 0, 0 }, + { 42, 72, 13, 48, 0, 0, 0 }, + { 62, 80, 78, 128, 0, 0, 0 }, + { 34, 71, 68, 40, 69, 0, 0 }, + { 34, 72, 68, 48, 0, 0, 0 }, + { 62, 71, 68, 128, 0, 0, 0 }, + { 62, 72, 68, 128, 0, 0, 0 }, + { 68, 69, 12, 40, 0, 0, 0 }, + { 68, 69, 12, 48, 0, 0, 0 }, + { 69, 83, 13, 128, 0, 0, 0 }, + { 34, 71, 68, 40, 0, 0, 0 }, + { 34, 71, 68, 48, 0, 0, 0 }, + { 62, 91, 83, 128, 0, 0, 0 }, + { 62, 90, 68, 128, 0, 0, 0 }, + { 34, 66, 64, 32, 0, 0, 0 }, + { 34, 67, 64, 32, 0, 0, 0 }, + { 70, 18, 64, 32, 0, 0, 0 }, + { 70, 18, 68, 48, 0, 0, 0 }, + { 62, 79, 68, 128, 0, 0, 0 }, + { 35, 67, 64, 32, 0, 0, 0 }, + { 71, 67, 64, 40, 0, 0, 0 }, + { 71, 73, 68, 48, 0, 0, 0 }, + { 67, 73, 68, 128, 0, 0, 0 }, + { 32, 0, 0, 32, 0, 0, 0 }, + { 72, 0, 0, 128, 0, 0, 0 }, + { 73, 13, 18, 112, 0, 0, 0 }, + { 74, 7, 69, 88, 0, 0, 0 }, + { 75, 69, 68, 88, 0, 0, 0 }, + { 73, 18, 13, 112, 0, 0, 0 }, + { 34, 69, 68, 88, 0, 0, 0 }, + { 76, 69, 68, 88, 0, 0, 0 }, + { 32, 72, 68, 112, 0, 0, 0 }, + { 32, 68, 72, 112, 0, 0, 0 }, + { 34, 73, 68, 56, 0, 0, 0 }, + { 70, 64, 18, 32, 0, 0, 0 }, + { 70, 68, 18, 48, 0, 0, 0 }, + { 62, 68, 79, 128, 0, 0, 0 }, + { 35, 64, 67, 32, 0, 0, 0 }, + { 77, 0, 42, 8, 0, 0, 0 }, + { 78, 0, 43, 8, 0, 0, 0 }, + { 79, 0, 43, 8, 0, 0, 0 }, + { 80, 17, 11, 80, 64, 0, 0 }, + { 81, 1, 17, 8, 1, 0, 244 }, + { 49, 1, 17, 8, 1, 0, 244 }, + { 34, 17, 11, 8, 64, 0, 245 }, + { 82, 17, 11, 112, 0, 0, 0 }, + { 83, 17, 11, 8, 65, 0, 180 }, + { 84, 73, 68, 40, 0, 0, 0 }, + { 84, 73, 68, 48, 0, 0, 0 }, + { 84, 71, 68, 40, 0, 0, 0 }, + { 84, 72, 68, 48, 0, 0, 0 }, + { 85, 88, 83, 128, 0, 0, 0 }, + { 85, 81, 68, 128, 0, 0, 0 }, + { 71, 25, 64, 40, 0, 0, 0 }, + { 71, 25, 68, 48, 0, 0, 0 }, + { 86, 81, 68, 128, 0, 0, 0 }, + { 87, 65, 12, 40, 0, 0, 0 }, + { 71, 69, 12, 48, 0, 0, 0 }, + { 88, 68, 13, 128, 0, 0, 0 }, + { 71, 73, 68, 40, 0, 0, 0 }, + { 86, 88, 83, 128, 0, 0, 0 }, + { 89, 0, 48, 8, 64, 0, 0 }, + { 56, 0, 46, 112, 0, 0, 0 }, + { 68, 65, 68, 48, 0, 0, 0 }, + { 68, 69, 64, 48, 0, 0, 0 }, + { 62, 68, 72, 128, 0, 0, 0 }, + { 76, 65, 12, 40, 0, 0, 0 }, + { 76, 69, 12, 48, 0, 0, 0 }, + { 69, 68, 13, 128, 0, 0, 0 }, + { 34, 67, 64, 40, 0, 0, 0 }, + { 35, 64, 46, 40, 0, 0, 0 }, + { 34, 42, 68, 56, 0, 0, 0 }, + { 62, 92, 83, 128, 0, 0, 0 }, + { 34, 67, 64, 48, 0, 0, 0 }, + { 76, 65, 64, 40, 0, 0, 0 }, + { 76, 69, 68, 48, 0, 0, 0 }, + { 90, 69, 68, 128, 0, 0, 0 }, + { 51, 0, 42, 16, 0, 0, 0 }, + { 91, 0, 42, 16, 0, 0, 0 }, + { 91, 0, 20, 16, 0, 0, 0 }, + { 92, 0, 0, 16, 0, 0, 0 }, + { 93, 0, 34, 16, 0, 0, 0 }, + { 94, 0, 34, 16, 0, 0, 0 }, + { 34, 67, 64, 64, 0, 0, 0 }, + { 34, 73, 68, 64, 0, 0, 0 }, + { 71, 73, 68, 72, 0, 0, 0 }, + { 34, 73, 68, 80, 0, 0, 0 }, + { 62, 44, 83, 128, 0, 0, 0 }, + { 62, 46, 85, 128, 0, 0, 0 }, + { 62, 47, 85, 128, 0, 0, 0 }, + { 62, 73, 68, 128, 0, 0, 0 }, + { 34, 72, 68, 72, 0, 0, 0 }, + { 34, 71, 68, 72, 0, 0, 0 }, + { 34, 70, 68, 72, 0, 0, 0 }, + { 62, 70, 68, 128, 0, 0, 0 }, + { 34, 73, 68, 72, 0, 0, 0 }, + { 35, 47, 68, 72, 0, 0, 0 }, + { 62, 47, 68, 128, 0, 0, 0 }, + { 67, 88, 92, 128, 0, 0, 0 }, + { 73, 47, 13, 112, 0, 0, 0 }, + { 67, 88, 83, 136, 0, 0, 0 }, + { 67, 81, 68, 136, 0, 0, 0 }, + { 34, 73, 68, 152, 0, 0, 0 }, + { 62, 73, 68, 152, 0, 0, 0 }, + { 67, 81, 68, 152, 0, 0, 0 }, + { 35, 17, 11, 8, 0, 0, 0 }, + { 35, 15, 13, 80, 0, 0, 0 }, + { 35, 11, 17, 8, 0, 0, 0 }, + { 35, 17, 13, 80, 0, 0, 0 }, + { 67, 90, 83, 128, 0, 0, 0 }, + { 86, 87, 85, 128, 0, 0, 0 }, + { 71, 71, 68, 72, 0, 0, 0 }, + { 71, 72, 68, 72, 0, 0, 0 }, + { 71, 67, 64, 64, 0, 0, 0 }, + { 71, 73, 68, 64, 0, 0, 0 }, + { 71, 68, 26, 72, 0, 0, 0 }, + { 88, 68, 76, 128, 0, 0, 0 }, + { 71, 68, 27, 72, 0, 0, 0 }, + { 88, 68, 77, 128, 0, 0, 0 }, + { 95, 68, 18, 72, 0, 0, 0 }, + { 67, 68, 79, 128, 0, 0, 0 }, + { 71, 68, 18, 72, 0, 0, 0 }, + { 67, 68, 75, 128, 0, 0, 0 }, + { 67, 85, 73, 128, 0, 0, 0 }, + { 71, 24, 68, 72, 0, 0, 0 }, + { 95, 18, 68, 72, 0, 0, 0 }, + { 71, 73, 68, 144, 0, 0, 0 }, + { 86, 81, 68, 144, 0, 0, 0 }, + { 71, 73, 68, 80, 0, 0, 0 }, + { 71, 73, 68, 152, 0, 0, 0 }, + { 67, 73, 68, 152, 0, 0, 0 }, + { 96, 1, 65, 32, 0, 0, 0 }, + { 56, 1, 69, 48, 0, 0, 0 }, + { 97, 69, 81, 128, 0, 0, 0 }, + { 98, 0, 13, 112, 0, 0, 0 }, + { 64, 0, 44, 128, 0, 0, 0 }, + { 56, 0, 42, 112, 0, 0, 0 }, + { 99, 75, 13, 8, 0, 0, 0 }, + { 98, 0, 17, 8, 0, 0, 0 }, + { 100, 67, 64, 96, 0, 0, 0 } +}; + +uint16_t CmpMnemonicOffsets[8] = { + 0, 9, 18, 27, 39, 49, 59, 69 +}; +uint16_t VCmpMnemonicOffsets[32] = { + 0, 10, 20, 30, 43, 54, 65, 76, 87, 100, 111, 122, 135, 149, 159, 169, 181, 194, 207, 220, 235, 249, 263, 277, 290, 303, 317, 331, 347, 361, 374, 387 +}; diff --git a/distorm/src/insts.h b/distorm/src/insts.h new file mode 100644 index 0000000..946cacd --- /dev/null +++ b/distorm/src/insts.h @@ -0,0 +1,64 @@ +/* +insts.h + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#ifndef INSTS_H +#define INSTS_H + +#include "instructions.h" + + +/* Flags Table */ +extern _iflags FlagsTable[]; + +/* Root Trie DB */ +extern _InstSharedInfo InstSharedInfoTable[]; +extern _InstInfo InstInfos[]; +extern _InstInfoEx InstInfosEx[]; +extern _InstNode InstructionsTree[]; + +/* 3DNow! Trie DB */ +extern _InstNode Table_0F_0F; +/* AVX related: */ +extern _InstNode Table_0F, Table_0F_38, Table_0F_3A; + +/* + * The inst_lookup will return on of these two instructions according to the specified decoding mode. + * ARPL or MOVSXD on 64 bits is one byte instruction at index 0x63. + */ +extern _InstInfo II_MOVSXD; + +/* + * The NOP instruction can be prefixed by REX in 64bits, therefore we have to decide in runtime whether it's an XCHG or NOP instruction. + * If 0x90 is prefixed by a usable REX it will become XCHG, otherwise it will become a NOP. + * Also note that if it's prefixed by 0xf3, it becomes a Pause. + */ +extern _InstInfo II_NOP; +extern _InstInfo II_PAUSE; + +/* + * RDRAND and VMPTRLD share same 2.3 bytes opcode, and then alternates on the MOD bits, + * RDRAND is OT_FULL_REG while VMPTRLD is OT_MEM, and there's no such mixed type. + * So a hack into the inst_lookup was added for this decision, the DB isn't flexible enough. :( + */ +extern _InstInfo II_RDRAND; + +/* + * Used for letting the extract operand know the type of operands without knowing the + * instruction itself yet, because of the way those instructions work. + * See function instructions.c!inst_lookup_3dnow. + */ +extern _InstInfo II_3DNOW; + +/* Helper tables for pseudo compare mnemonics. */ +extern uint16_t CmpMnemonicOffsets[8]; /* SSE */ +extern uint16_t VCmpMnemonicOffsets[32]; /* AVX */ + +#endif /* INSTS_H */ diff --git a/distorm3.2-package/src/mnemonics.c b/distorm/src/mnemonics.c similarity index 68% rename from distorm3.2-package/src/mnemonics.c rename to distorm/src/mnemonics.c index 0c39a21..ff00ac5 100644 --- a/distorm3.2-package/src/mnemonics.c +++ b/distorm/src/mnemonics.c @@ -4,20 +4,8 @@ mnemonics.c diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. */ @@ -59,65 +47,66 @@ const unsigned char _MNEMONICS[] = "\x03" "LFS\0" "\x03" "LGS\0" "\x05" "MOVZX\0" "\x03" "BTC\0" "\x05" "MOVSX\0" \ "\x04" "XADD\0" "\x06" "MOVNTI\0" "\x05" "BSWAP\0" "\x03" "ROL\0" "\x03" "ROR\0" \ "\x03" "RCL\0" "\x03" "RCR\0" "\x03" "SHL\0" "\x03" "SHR\0" "\x03" "SAL\0" \ -"\x03" "SAR\0" "\x04" "FADD\0" "\x04" "FMUL\0" "\x04" "FCOM\0" "\x05" "FCOMP\0" \ -"\x04" "FSUB\0" "\x05" "FSUBR\0" "\x04" "FDIV\0" "\x05" "FDIVR\0" "\x03" "FLD\0" \ -"\x03" "FST\0" "\x04" "FSTP\0" "\x06" "FLDENV\0" "\x05" "FLDCW\0" "\x04" "FXCH\0" \ -"\x04" "FNOP\0" "\x04" "FCHS\0" "\x04" "FABS\0" "\x04" "FTST\0" "\x04" "FXAM\0" \ -"\x04" "FLD1\0" "\x06" "FLDL2T\0" "\x06" "FLDL2E\0" "\x05" "FLDPI\0" "\x06" "FLDLG2\0" \ -"\x06" "FLDLN2\0" "\x04" "FLDZ\0" "\x05" "F2XM1\0" "\x05" "FYL2X\0" "\x05" "FPTAN\0" \ -"\x06" "FPATAN\0" "\x07" "FXTRACT\0" "\x06" "FPREM1\0" "\x07" "FDECSTP\0" "\x07" "FINCSTP\0" \ -"\x05" "FPREM\0" "\x07" "FYL2XP1\0" "\x05" "FSQRT\0" "\x07" "FSINCOS\0" "\x07" "FRNDINT\0" \ -"\x06" "FSCALE\0" "\x04" "FSIN\0" "\x04" "FCOS\0" "\x05" "FIADD\0" "\x05" "FIMUL\0" \ -"\x05" "FICOM\0" "\x06" "FICOMP\0" "\x05" "FISUB\0" "\x06" "FISUBR\0" "\x05" "FIDIV\0" \ -"\x06" "FIDIVR\0" "\x06" "FCMOVB\0" "\x06" "FCMOVE\0" "\x07" "FCMOVBE\0" "\x06" "FCMOVU\0" \ -"\x07" "FUCOMPP\0" "\x04" "FILD\0" "\x06" "FISTTP\0" "\x04" "FIST\0" "\x05" "FISTP\0" \ -"\x07" "FCMOVNB\0" "\x07" "FCMOVNE\0" "\x08" "FCMOVNBE\0" "\x07" "FCMOVNU\0" \ -"\x04" "FENI\0" "\x06" "FEDISI\0" "\x06" "FSETPM\0" "\x06" "FUCOMI\0" "\x05" "FCOMI\0" \ -"\x06" "FRSTOR\0" "\x05" "FFREE\0" "\x05" "FUCOM\0" "\x06" "FUCOMP\0" "\x05" "FADDP\0" \ -"\x05" "FMULP\0" "\x06" "FCOMPP\0" "\x06" "FSUBRP\0" "\x05" "FSUBP\0" "\x06" "FDIVRP\0" \ -"\x05" "FDIVP\0" "\x04" "FBLD\0" "\x05" "FBSTP\0" "\x07" "FUCOMIP\0" "\x06" "FCOMIP\0" \ -"\x03" "NOT\0" "\x03" "NEG\0" "\x03" "MUL\0" "\x03" "DIV\0" "\x04" "IDIV\0" \ -"\x04" "SLDT\0" "\x03" "STR\0" "\x04" "LLDT\0" "\x03" "LTR\0" "\x04" "VERR\0" \ -"\x04" "VERW\0" "\x04" "SGDT\0" "\x04" "SIDT\0" "\x04" "LGDT\0" "\x04" "LIDT\0" \ -"\x04" "SMSW\0" "\x04" "LMSW\0" "\x06" "INVLPG\0" "\x06" "VMCALL\0" "\x08" "VMLAUNCH\0" \ -"\x08" "VMRESUME\0" "\x06" "VMXOFF\0" "\x07" "MONITOR\0" "\x05" "MWAIT\0" "\x06" "XGETBV\0" \ -"\x06" "XSETBV\0" "\x06" "VMFUNC\0" "\x05" "VMRUN\0" "\x07" "VMMCALL\0" "\x06" "VMLOAD\0" \ -"\x06" "VMSAVE\0" "\x04" "STGI\0" "\x04" "CLGI\0" "\x06" "SKINIT\0" "\x07" "INVLPGA\0" \ -"\x06" "SWAPGS\0" "\x06" "RDTSCP\0" "\x08" "PREFETCH\0" "\x09" "PREFETCHW\0" \ -"\x05" "PI2FW\0" "\x05" "PI2FD\0" "\x05" "PF2IW\0" "\x05" "PF2ID\0" "\x06" "PFNACC\0" \ -"\x07" "PFPNACC\0" "\x07" "PFCMPGE\0" "\x05" "PFMIN\0" "\x05" "PFRCP\0" "\x07" "PFRSQRT\0" \ -"\x05" "PFSUB\0" "\x05" "PFADD\0" "\x07" "PFCMPGT\0" "\x05" "PFMAX\0" "\x08" "PFRCPIT1\0" \ -"\x08" "PFRSQIT1\0" "\x06" "PFSUBR\0" "\x05" "PFACC\0" "\x07" "PFCMPEQ\0" "\x05" "PFMUL\0" \ -"\x08" "PFRCPIT2\0" "\x07" "PMULHRW\0" "\x06" "PSWAPD\0" "\x07" "PAVGUSB\0" \ -"\x06" "MOVUPS\0" "\x06" "MOVUPD\0" "\x05" "MOVSS\0" "\x05" "MOVSD\0" "\x07" "VMOVUPS\0" \ -"\x07" "VMOVUPD\0" "\x06" "VMOVSS\0" "\x06" "VMOVSD\0" "\x07" "MOVHLPS\0" "\x06" "MOVLPS\0" \ -"\x06" "MOVLPD\0" "\x08" "MOVSLDUP\0" "\x07" "MOVDDUP\0" "\x08" "VMOVHLPS\0" \ -"\x07" "VMOVLPS\0" "\x07" "VMOVLPD\0" "\x09" "VMOVSLDUP\0" "\x08" "VMOVDDUP\0" \ -"\x08" "UNPCKLPS\0" "\x08" "UNPCKLPD\0" "\x09" "VUNPCKLPS\0" "\x09" "VUNPCKLPD\0" \ -"\x08" "UNPCKHPS\0" "\x08" "UNPCKHPD\0" "\x09" "VUNPCKHPS\0" "\x09" "VUNPCKHPD\0" \ -"\x07" "MOVLHPS\0" "\x06" "MOVHPS\0" "\x06" "MOVHPD\0" "\x08" "MOVSHDUP\0" \ -"\x08" "VMOVLHPS\0" "\x07" "VMOVHPS\0" "\x07" "VMOVHPD\0" "\x09" "VMOVSHDUP\0" \ -"\x0b" "PREFETCHNTA\0" "\x0a" "PREFETCHT0\0" "\x0a" "PREFETCHT1\0" "\x0a" "PREFETCHT2\0" \ -"\x06" "MOVAPS\0" "\x06" "MOVAPD\0" "\x07" "VMOVAPS\0" "\x07" "VMOVAPD\0" "\x08" "CVTPI2PS\0" \ -"\x08" "CVTPI2PD\0" "\x08" "CVTSI2SS\0" "\x08" "CVTSI2SD\0" "\x09" "VCVTSI2SS\0" \ -"\x09" "VCVTSI2SD\0" "\x07" "MOVNTPS\0" "\x07" "MOVNTPD\0" "\x07" "MOVNTSS\0" \ -"\x07" "MOVNTSD\0" "\x08" "VMOVNTPS\0" "\x08" "VMOVNTPD\0" "\x09" "CVTTPS2PI\0" \ -"\x09" "CVTTPD2PI\0" "\x09" "CVTTSS2SI\0" "\x09" "CVTTSD2SI\0" "\x0a" "VCVTTSS2SI\0" \ -"\x0a" "VCVTTSD2SI\0" "\x08" "CVTPS2PI\0" "\x08" "CVTPD2PI\0" "\x08" "CVTSS2SI\0" \ -"\x08" "CVTSD2SI\0" "\x09" "VCVTSS2SI\0" "\x09" "VCVTSD2SI\0" "\x07" "UCOMISS\0" \ -"\x07" "UCOMISD\0" "\x08" "VUCOMISS\0" "\x08" "VUCOMISD\0" "\x06" "COMISS\0" \ -"\x06" "COMISD\0" "\x07" "VCOMISS\0" "\x07" "VCOMISD\0" "\x08" "MOVMSKPS\0" \ -"\x08" "MOVMSKPD\0" "\x09" "VMOVMSKPS\0" "\x09" "VMOVMSKPD\0" "\x06" "SQRTPS\0" \ -"\x06" "SQRTPD\0" "\x06" "SQRTSS\0" "\x06" "SQRTSD\0" "\x07" "VSQRTPS\0" "\x07" "VSQRTPD\0" \ -"\x07" "VSQRTSS\0" "\x07" "VSQRTSD\0" "\x07" "RSQRTPS\0" "\x07" "RSQRTSS\0" \ -"\x08" "VRSQRTPS\0" "\x08" "VRSQRTSS\0" "\x05" "RCPPS\0" "\x05" "RCPSS\0" "\x06" "VRCPPS\0" \ -"\x06" "VRCPSS\0" "\x05" "ANDPS\0" "\x05" "ANDPD\0" "\x06" "VANDPS\0" "\x06" "VANDPD\0" \ -"\x06" "ANDNPS\0" "\x06" "ANDNPD\0" "\x07" "VANDNPS\0" "\x07" "VANDNPD\0" "\x04" "ORPS\0" \ -"\x04" "ORPD\0" "\x05" "VORPS\0" "\x05" "VORPD\0" "\x05" "XORPS\0" "\x05" "XORPD\0" \ -"\x06" "VXORPS\0" "\x06" "VXORPD\0" "\x05" "ADDPS\0" "\x05" "ADDPD\0" "\x05" "ADDSS\0" \ -"\x05" "ADDSD\0" "\x06" "VADDPS\0" "\x06" "VADDPD\0" "\x06" "VADDSS\0" "\x06" "VADDSD\0" \ -"\x05" "MULPS\0" "\x05" "MULPD\0" "\x05" "MULSS\0" "\x05" "MULSD\0" "\x06" "VMULPS\0" \ -"\x06" "VMULPD\0" "\x06" "VMULSS\0" "\x06" "VMULSD\0" "\x08" "CVTPS2PD\0" "\x08" "CVTPD2PS\0" \ +"\x03" "SAR\0" "\x06" "XABORT\0" "\x06" "XBEGIN\0" "\x04" "FADD\0" "\x04" "FMUL\0" \ +"\x04" "FCOM\0" "\x05" "FCOMP\0" "\x04" "FSUB\0" "\x05" "FSUBR\0" "\x04" "FDIV\0" \ +"\x05" "FDIVR\0" "\x03" "FLD\0" "\x03" "FST\0" "\x04" "FSTP\0" "\x06" "FLDENV\0" \ +"\x05" "FLDCW\0" "\x04" "FXCH\0" "\x04" "FNOP\0" "\x04" "FCHS\0" "\x04" "FABS\0" \ +"\x04" "FTST\0" "\x04" "FXAM\0" "\x04" "FLD1\0" "\x06" "FLDL2T\0" "\x06" "FLDL2E\0" \ +"\x05" "FLDPI\0" "\x06" "FLDLG2\0" "\x06" "FLDLN2\0" "\x04" "FLDZ\0" "\x05" "F2XM1\0" \ +"\x05" "FYL2X\0" "\x05" "FPTAN\0" "\x06" "FPATAN\0" "\x07" "FXTRACT\0" "\x06" "FPREM1\0" \ +"\x07" "FDECSTP\0" "\x07" "FINCSTP\0" "\x05" "FPREM\0" "\x07" "FYL2XP1\0" "\x05" "FSQRT\0" \ +"\x07" "FSINCOS\0" "\x07" "FRNDINT\0" "\x06" "FSCALE\0" "\x04" "FSIN\0" "\x04" "FCOS\0" \ +"\x05" "FIADD\0" "\x05" "FIMUL\0" "\x05" "FICOM\0" "\x06" "FICOMP\0" "\x05" "FISUB\0" \ +"\x06" "FISUBR\0" "\x05" "FIDIV\0" "\x06" "FIDIVR\0" "\x06" "FCMOVB\0" "\x06" "FCMOVE\0" \ +"\x07" "FCMOVBE\0" "\x06" "FCMOVU\0" "\x07" "FUCOMPP\0" "\x04" "FILD\0" "\x06" "FISTTP\0" \ +"\x04" "FIST\0" "\x05" "FISTP\0" "\x07" "FCMOVNB\0" "\x07" "FCMOVNE\0" "\x08" "FCMOVNBE\0" \ +"\x07" "FCMOVNU\0" "\x04" "FENI\0" "\x06" "FEDISI\0" "\x06" "FSETPM\0" "\x06" "FUCOMI\0" \ +"\x05" "FCOMI\0" "\x06" "FRSTOR\0" "\x05" "FFREE\0" "\x05" "FUCOM\0" "\x06" "FUCOMP\0" \ +"\x05" "FADDP\0" "\x05" "FMULP\0" "\x06" "FCOMPP\0" "\x06" "FSUBRP\0" "\x05" "FSUBP\0" \ +"\x06" "FDIVRP\0" "\x05" "FDIVP\0" "\x04" "FBLD\0" "\x05" "FBSTP\0" "\x07" "FUCOMIP\0" \ +"\x06" "FCOMIP\0" "\x03" "NOT\0" "\x03" "NEG\0" "\x03" "MUL\0" "\x03" "DIV\0" \ +"\x04" "IDIV\0" "\x04" "SLDT\0" "\x03" "STR\0" "\x04" "LLDT\0" "\x03" "LTR\0" \ +"\x04" "VERR\0" "\x04" "VERW\0" "\x04" "SGDT\0" "\x04" "SIDT\0" "\x04" "LGDT\0" \ +"\x04" "LIDT\0" "\x04" "SMSW\0" "\x04" "LMSW\0" "\x06" "INVLPG\0" "\x06" "VMCALL\0" \ +"\x08" "VMLAUNCH\0" "\x08" "VMRESUME\0" "\x06" "VMXOFF\0" "\x07" "MONITOR\0" \ +"\x05" "MWAIT\0" "\x06" "XGETBV\0" "\x06" "XSETBV\0" "\x06" "VMFUNC\0" "\x04" "XEND\0" \ +"\x05" "VMRUN\0" "\x07" "VMMCALL\0" "\x06" "VMLOAD\0" "\x06" "VMSAVE\0" "\x04" "STGI\0" \ +"\x04" "CLGI\0" "\x06" "SKINIT\0" "\x07" "INVLPGA\0" "\x06" "SWAPGS\0" "\x06" "RDTSCP\0" \ +"\x08" "PREFETCH\0" "\x09" "PREFETCHW\0" "\x05" "PI2FW\0" "\x05" "PI2FD\0" \ +"\x05" "PF2IW\0" "\x05" "PF2ID\0" "\x06" "PFNACC\0" "\x07" "PFPNACC\0" "\x07" "PFCMPGE\0" \ +"\x05" "PFMIN\0" "\x05" "PFRCP\0" "\x07" "PFRSQRT\0" "\x05" "PFSUB\0" "\x05" "PFADD\0" \ +"\x07" "PFCMPGT\0" "\x05" "PFMAX\0" "\x08" "PFRCPIT1\0" "\x08" "PFRSQIT1\0" \ +"\x06" "PFSUBR\0" "\x05" "PFACC\0" "\x07" "PFCMPEQ\0" "\x05" "PFMUL\0" "\x08" "PFRCPIT2\0" \ +"\x07" "PMULHRW\0" "\x06" "PSWAPD\0" "\x07" "PAVGUSB\0" "\x06" "MOVUPS\0" "\x06" "MOVUPD\0" \ +"\x05" "MOVSS\0" "\x05" "MOVSD\0" "\x07" "VMOVUPS\0" "\x07" "VMOVUPD\0" "\x06" "VMOVSS\0" \ +"\x06" "VMOVSD\0" "\x07" "MOVHLPS\0" "\x06" "MOVLPS\0" "\x06" "MOVLPD\0" "\x08" "MOVSLDUP\0" \ +"\x07" "MOVDDUP\0" "\x08" "VMOVHLPS\0" "\x07" "VMOVLPS\0" "\x07" "VMOVLPD\0" \ +"\x09" "VMOVSLDUP\0" "\x08" "VMOVDDUP\0" "\x08" "UNPCKLPS\0" "\x08" "UNPCKLPD\0" \ +"\x09" "VUNPCKLPS\0" "\x09" "VUNPCKLPD\0" "\x08" "UNPCKHPS\0" "\x08" "UNPCKHPD\0" \ +"\x09" "VUNPCKHPS\0" "\x09" "VUNPCKHPD\0" "\x07" "MOVLHPS\0" "\x06" "MOVHPS\0" \ +"\x06" "MOVHPD\0" "\x08" "MOVSHDUP\0" "\x08" "VMOVLHPS\0" "\x07" "VMOVHPS\0" \ +"\x07" "VMOVHPD\0" "\x09" "VMOVSHDUP\0" "\x0b" "PREFETCHNTA\0" "\x0a" "PREFETCHT0\0" \ +"\x0a" "PREFETCHT1\0" "\x0a" "PREFETCHT2\0" "\x06" "MOVAPS\0" "\x06" "MOVAPD\0" \ +"\x07" "VMOVAPS\0" "\x07" "VMOVAPD\0" "\x08" "CVTPI2PS\0" "\x08" "CVTPI2PD\0" \ +"\x08" "CVTSI2SS\0" "\x08" "CVTSI2SD\0" "\x09" "VCVTSI2SS\0" "\x09" "VCVTSI2SD\0" \ +"\x07" "MOVNTPS\0" "\x07" "MOVNTPD\0" "\x07" "MOVNTSS\0" "\x07" "MOVNTSD\0" \ +"\x08" "VMOVNTPS\0" "\x08" "VMOVNTPD\0" "\x09" "CVTTPS2PI\0" "\x09" "CVTTPD2PI\0" \ +"\x09" "CVTTSS2SI\0" "\x09" "CVTTSD2SI\0" "\x0a" "VCVTTSS2SI\0" "\x0a" "VCVTTSD2SI\0" \ +"\x08" "CVTPS2PI\0" "\x08" "CVTPD2PI\0" "\x08" "CVTSS2SI\0" "\x08" "CVTSD2SI\0" \ +"\x09" "VCVTSS2SI\0" "\x09" "VCVTSD2SI\0" "\x07" "UCOMISS\0" "\x07" "UCOMISD\0" \ +"\x08" "VUCOMISS\0" "\x08" "VUCOMISD\0" "\x06" "COMISS\0" "\x06" "COMISD\0" \ +"\x07" "VCOMISS\0" "\x07" "VCOMISD\0" "\x08" "MOVMSKPS\0" "\x08" "MOVMSKPD\0" \ +"\x09" "VMOVMSKPS\0" "\x09" "VMOVMSKPD\0" "\x06" "SQRTPS\0" "\x06" "SQRTPD\0" \ +"\x06" "SQRTSS\0" "\x06" "SQRTSD\0" "\x07" "VSQRTPS\0" "\x07" "VSQRTPD\0" "\x07" "VSQRTSS\0" \ +"\x07" "VSQRTSD\0" "\x07" "RSQRTPS\0" "\x07" "RSQRTSS\0" "\x08" "VRSQRTPS\0" \ +"\x08" "VRSQRTSS\0" "\x05" "RCPPS\0" "\x05" "RCPSS\0" "\x06" "VRCPPS\0" "\x06" "VRCPSS\0" \ +"\x05" "ANDPS\0" "\x05" "ANDPD\0" "\x06" "VANDPS\0" "\x06" "VANDPD\0" "\x06" "ANDNPS\0" \ +"\x06" "ANDNPD\0" "\x07" "VANDNPS\0" "\x07" "VANDNPD\0" "\x04" "ORPS\0" "\x04" "ORPD\0" \ +"\x05" "VORPS\0" "\x05" "VORPD\0" "\x05" "XORPS\0" "\x05" "XORPD\0" "\x06" "VXORPS\0" \ +"\x06" "VXORPD\0" "\x05" "ADDPS\0" "\x05" "ADDPD\0" "\x05" "ADDSS\0" "\x05" "ADDSD\0" \ +"\x06" "VADDPS\0" "\x06" "VADDPD\0" "\x06" "VADDSS\0" "\x06" "VADDSD\0" "\x05" "MULPS\0" \ +"\x05" "MULPD\0" "\x05" "MULSS\0" "\x05" "MULSD\0" "\x06" "VMULPS\0" "\x06" "VMULPD\0" \ +"\x06" "VMULSS\0" "\x06" "VMULSD\0" "\x08" "CVTPS2PD\0" "\x08" "CVTPD2PS\0" \ "\x08" "CVTSS2SD\0" "\x08" "CVTSD2SS\0" "\x09" "VCVTPS2PD\0" "\x09" "VCVTPD2PS\0" \ "\x09" "VCVTSS2SD\0" "\x09" "VCVTSD2SS\0" "\x08" "CVTDQ2PS\0" "\x08" "CVTPS2DQ\0" \ "\x09" "CVTTPS2DQ\0" "\x09" "VCVTDQ2PS\0" "\x09" "VCVTPS2DQ\0" "\x0a" "VCVTTPS2DQ\0" \ @@ -272,23 +261,24 @@ const unsigned char _MNEMONICS[] = "\x06" "PSLLDQ\0" "\x07" "VPSLLDQ\0" "\x06" "FXSAVE\0" "\x08" "FXSAVE64\0" \ "\x08" "RDFSBASE\0" "\x07" "FXRSTOR\0" "\x09" "FXRSTOR64\0" "\x08" "RDGSBASE\0" \ "\x07" "LDMXCSR\0" "\x08" "WRFSBASE\0" "\x08" "VLDMXCSR\0" "\x07" "STMXCSR\0" \ -"\x08" "WRGSBASE\0" "\x08" "VSTMXCSR\0" "\x06" "RDRAND\0" "\x07" "VMPTRLD\0" \ -"\x07" "VMCLEAR\0" "\x05" "VMXON\0" "\x04" "WAIT\0" "\x06" "MOVSXD\0" "\x05" "PAUSE\0"; +"\x08" "WRGSBASE\0" "\x08" "VSTMXCSR\0" "\x07" "VMPTRLD\0" "\x07" "VMCLEAR\0" \ +"\x05" "VMXON\0" "\x06" "MOVSXD\0" "\x05" "PAUSE\0" "\x04" "WAIT\0" "\x06" "RDRAND\0" \ +"\x06" "_3DNOW\0"; const _WRegister _REGISTERS[] = { - {3, "RAX"}, {3, "RCX"}, {3, "RDX"}, {3, "RBX"}, {3, "RSP"}, {3, "RBP"}, {3, "RSI"}, {3, "RDI"}, {2, "R8"}, {2, "R9"}, {3, "R10"}, {3, "R11"}, {3, "R12"}, {3, "R13"}, {3, "R14"}, {3, "R15"}, - {3, "EAX"}, {3, "ECX"}, {3, "EDX"}, {3, "EBX"}, {3, "ESP"}, {3, "EBP"}, {3, "ESI"}, {3, "EDI"}, {3, "R8D"}, {3, "R9D"}, {4, "R10D"}, {4, "R11D"}, {4, "R12D"}, {4, "R13D"}, {4, "R14D"}, {4, "R15D"}, - {2, "AX"}, {2, "CX"}, {2, "DX"}, {2, "BX"}, {2, "SP"}, {2, "BP"}, {2, "SI"}, {2, "DI"}, {3, "R8W"}, {3, "R9W"}, {4, "R10W"}, {4, "R11W"}, {4, "R12W"}, {4, "R13W"}, {4, "R14W"}, {4, "R15W"}, - {2, "AL"}, {2, "CL"}, {2, "DL"}, {2, "BL"}, {2, "AH"}, {2, "CH"}, {2, "DH"}, {2, "BH"}, {3, "R8B"}, {3, "R9B"}, {4, "R10B"}, {4, "R11B"}, {4, "R12B"}, {4, "R13B"}, {4, "R14B"}, {4, "R15B"}, - {3, "SPL"}, {3, "BPL"}, {3, "SIL"}, {3, "DIL"}, - {2, "ES"}, {2, "CS"}, {2, "SS"}, {2, "DS"}, {2, "FS"}, {2, "GS"}, - {3, "RIP"}, - {3, "ST0"}, {3, "ST1"}, {3, "ST2"}, {3, "ST3"}, {3, "ST4"}, {3, "ST5"}, {3, "ST6"}, {3, "ST7"}, - {3, "MM0"}, {3, "MM1"}, {3, "MM2"}, {3, "MM3"}, {3, "MM4"}, {3, "MM5"}, {3, "MM6"}, {3, "MM7"}, - {4, "XMM0"}, {4, "XMM1"}, {4, "XMM2"}, {4, "XMM3"}, {4, "XMM4"}, {4, "XMM5"}, {4, "XMM6"}, {4, "XMM7"}, {4, "XMM8"}, {4, "XMM9"}, {5, "XMM10"}, {5, "XMM11"}, {5, "XMM12"}, {5, "XMM13"}, {5, "XMM14"}, {5, "XMM15"}, - {4, "YMM0"}, {4, "YMM1"}, {4, "YMM2"}, {4, "YMM3"}, {4, "YMM4"}, {4, "YMM5"}, {4, "YMM6"}, {4, "YMM7"}, {4, "YMM8"}, {4, "YMM9"}, {5, "YMM10"}, {5, "YMM11"}, {5, "YMM12"}, {5, "YMM13"}, {5, "YMM14"}, {5, "YMM15"}, - {3, "CR0"}, {0, ""}, {3, "CR2"}, {3, "CR3"}, {3, "CR4"}, {0, ""}, {0, ""}, {0, ""}, {3, "CR8"}, - {3, "DR0"}, {3, "DR1"}, {3, "DR2"}, {3, "DR3"}, {0, ""}, {0, ""}, {3, "DR6"}, {3, "DR7"} + { 3, "RAX" }, { 3, "RCX" }, { 3, "RDX" }, { 3, "RBX" }, { 3, "RSP" }, { 3, "RBP" }, { 3, "RSI" }, { 3, "RDI" }, { 2, "R8" }, { 2, "R9" }, { 3, "R10" }, { 3, "R11" }, { 3, "R12" }, { 3, "R13" }, { 3, "R14" }, { 3, "R15" }, + { 3, "EAX" }, { 3, "ECX" }, { 3, "EDX" }, { 3, "EBX" }, { 3, "ESP" }, { 3, "EBP" }, { 3, "ESI" }, { 3, "EDI" }, { 3, "R8D" }, { 3, "R9D" }, { 4, "R10D" }, { 4, "R11D" }, { 4, "R12D" }, { 4, "R13D" }, { 4, "R14D" }, { 4, "R15D" }, + { 2, "AX" }, { 2, "CX" }, { 2, "DX" }, { 2, "BX" }, { 2, "SP" }, { 2, "BP" }, { 2, "SI" }, { 2, "DI" }, { 3, "R8W" }, { 3, "R9W" }, { 4, "R10W" }, { 4, "R11W" }, { 4, "R12W" }, { 4, "R13W" }, { 4, "R14W" }, { 4, "R15W" }, + { 2, "AL" }, { 2, "CL" }, { 2, "DL" }, { 2, "BL" }, { 2, "AH" }, { 2, "CH" }, { 2, "DH" }, { 2, "BH" }, { 3, "R8B" }, { 3, "R9B" }, { 4, "R10B" }, { 4, "R11B" }, { 4, "R12B" }, { 4, "R13B" }, { 4, "R14B" }, { 4, "R15B" }, + { 3, "SPL" }, { 3, "BPL" }, { 3, "SIL" }, { 3, "DIL" }, + { 2, "ES" }, { 2, "CS" }, { 2, "SS" }, { 2, "DS" }, { 2, "FS" }, { 2, "GS" }, + { 3, "RIP" }, + { 3, "ST0" }, { 3, "ST1" }, { 3, "ST2" }, { 3, "ST3" }, { 3, "ST4" }, { 3, "ST5" }, { 3, "ST6" }, { 3, "ST7" }, + { 3, "MM0" }, { 3, "MM1" }, { 3, "MM2" }, { 3, "MM3" }, { 3, "MM4" }, { 3, "MM5" }, { 3, "MM6" }, { 3, "MM7" }, + { 4, "XMM0" }, { 4, "XMM1" }, { 4, "XMM2" }, { 4, "XMM3" }, { 4, "XMM4" }, { 4, "XMM5" }, { 4, "XMM6" }, { 4, "XMM7" }, { 4, "XMM8" }, { 4, "XMM9" }, { 5, "XMM10" }, { 5, "XMM11" }, { 5, "XMM12" }, { 5, "XMM13" }, { 5, "XMM14" }, { 5, "XMM15" }, + { 4, "YMM0" }, { 4, "YMM1" }, { 4, "YMM2" }, { 4, "YMM3" }, { 4, "YMM4" }, { 4, "YMM5" }, { 4, "YMM6" }, { 4, "YMM7" }, { 4, "YMM8" }, { 4, "YMM9" }, { 5, "YMM10" }, { 5, "YMM11" }, { 5, "YMM12" }, { 5, "YMM13" }, { 5, "YMM14" }, { 5, "YMM15" }, + { 3, "CR0" }, { 0, "" }, { 3, "CR2" }, { 3, "CR3" }, { 3, "CR4" }, { 0, "" }, { 0, "" }, { 0, "" }, { 3, "CR8" }, + { 3, "DR0" }, { 3, "DR1" }, { 3, "DR2" }, { 3, "DR3" }, { 0, "" }, { 0, "" }, { 3, "DR6" }, { 3, "DR7" } }; #endif /* DISTORM_LIGHT */ diff --git a/distorm3.2-package/src/operands.c b/distorm/src/operands.c similarity index 97% rename from distorm3.2-package/src/operands.c rename to distorm/src/operands.c index 817a06e..03a0c66 100644 --- a/distorm3.2-package/src/operands.c +++ b/distorm/src/operands.c @@ -4,20 +4,8 @@ operands.c diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. */ @@ -29,11 +17,11 @@ along with this program. If not, see /* Maps a register to its register-class mask. */ -uint16_t _REGISTERTORCLASS[] = /* Based on _RegisterType enumeration! */ -{RM_AX, RM_CX, RM_DX, RM_BX, RM_SP, RM_BP, RM_SI, RM_DI, 0, 0, 0, 0, 0, 0, 0, 0, - RM_AX, RM_CX, RM_DX, RM_BX, RM_SP, RM_BP, RM_SI, RM_DI, 0, 0, 0, 0, 0, 0, 0, 0, - RM_AX, RM_CX, RM_DX, RM_BX, RM_SP, RM_BP, RM_SI, RM_DI, 0, 0, 0, 0, 0, 0, 0, 0, - RM_AX, RM_CX, RM_DX, RM_BX, RM_AX, RM_CX, RM_DX, RM_BX, 0, 0, 0, 0, 0, 0, 0, 0, +uint32_t _REGISTERTORCLASS[] = /* Based on _RegisterType enumeration! */ +{RM_AX, RM_CX, RM_DX, RM_BX, RM_SP, RM_BP, RM_SI, RM_DI, RM_R8, RM_R9, RM_R10, RM_R11, RM_R12, RM_R13, RM_R14, RM_R15, + RM_AX, RM_CX, RM_DX, RM_BX, RM_SP, RM_BP, RM_SI, RM_DI, RM_R8, RM_R9, RM_R10, RM_R11, RM_R12, RM_R13, RM_R14, RM_R15, + RM_AX, RM_CX, RM_DX, RM_BX, RM_SP, RM_BP, RM_SI, RM_DI, RM_R8, RM_R9, RM_R10, RM_R11, RM_R12, RM_R13, RM_R14, RM_R15, + RM_AX, RM_CX, RM_DX, RM_BX, RM_AX, RM_CX, RM_DX, RM_BX, RM_R8, RM_R9, RM_R10, RM_R11, RM_R12, RM_R13, RM_R14, RM_R15, RM_SP, RM_BP, RM_SI, RM_DI, 0, 0, 0, 0, 0, 0, 0, @@ -501,14 +489,13 @@ static int operands_extract_modrm(_CodeInfo* ci, */ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, - _OpType type, _OperandNumberType opNum, + _iflags instFlags, _OpType type, _OperandNumberType opNum, unsigned int modrm, _PrefixState* ps, _DecodeType effOpSz, _DecodeType effAdrSz, int* lockableInstruction) { int ret = 0; unsigned int mod = 0, reg = 0, rm = 0, vexV = ps->vexV; unsigned int vrex = ps->vrex, typeHandled = TRUE; - _iflags instFlags = INST_INFO_FLAGS(ii); _Operand* op = &di->ops[opNum]; /* Used to indicate the size of the MEMORY INDIRECTION only. */ @@ -733,8 +720,12 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, op->type = O_IMM; di->imm_encoded_size = 4; if (ci->dt == Decode64Bits) { - /* Imm32 is sign extended to 64 bits! */ - op->size = 64; + /* + * Imm32 is sign extended to 64 bits! + * Originally the op size was 64, but later was changed to reflect real size of imm. + */ + op->size = 32; + /* Use this as an indicator that it should be signed extended. */ di->flags |= FLAG_IMM_SIGNED; if (!read_stream_safe_sint(ci, &di->imm.sqword, sizeof(int32_t))) return FALSE; } else { @@ -788,7 +779,7 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, if (ps->prefixExtType) { /* * If REX prefix is valid then we will have to use low bytes. - * This is a PASSIVE behaviour changer of REX prefix, it affects operands even if its value is 0x40 ! + * This is a PASSIVE behavior changer of REX prefix, it affects operands even if its value is 0x40 ! */ ps->usedPrefixes |= INST_PRE_REX; op->index = (uint8_t)operands_fix_8bit_rex_base(reg + ((vrex & PREFIX_EX_R) ? EX_GPR_BASE : 0)); diff --git a/distorm/src/operands.h b/distorm/src/operands.h new file mode 100644 index 0000000..883d59b --- /dev/null +++ b/distorm/src/operands.h @@ -0,0 +1,28 @@ +/* +operands.h + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#ifndef OPERANDS_H +#define OPERANDS_H + +#include "config.h" +#include "decoder.h" +#include "prefix.h" +#include "instructions.h" + + +extern uint32_t _REGISTERTORCLASS[]; + +int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, + _iflags instFlags, _OpType type, _OperandNumberType opNum, + unsigned int modrm, _PrefixState* ps, _DecodeType effOpSz, + _DecodeType effAdrSz, int* lockableInstruction); + +#endif /* OPERANDS_H */ diff --git a/distorm3.2-package/src/prefix.c b/distorm/src/prefix.c similarity index 94% rename from distorm3.2-package/src/prefix.c rename to distorm/src/prefix.c index 53f09b6..21a67f7 100644 --- a/distorm3.2-package/src/prefix.c +++ b/distorm/src/prefix.c @@ -4,20 +4,8 @@ prefix.c diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. */ diff --git a/distorm3.2-package/src/prefix.h b/distorm/src/prefix.h similarity index 77% rename from distorm3.2-package/src/prefix.h rename to distorm/src/prefix.h index 673aa50..f1f53c4 100644 --- a/distorm3.2-package/src/prefix.h +++ b/distorm/src/prefix.h @@ -4,20 +4,8 @@ prefix.h diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. */ diff --git a/distorm3.2-package/src/textdefs.c b/distorm/src/textdefs.c similarity index 90% rename from distorm3.2-package/src/textdefs.c rename to distorm/src/textdefs.c index eec26f1..d8cd75a 100644 --- a/distorm3.2-package/src/textdefs.c +++ b/distorm/src/textdefs.c @@ -4,20 +4,8 @@ textdefs.c diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. */ diff --git a/distorm3.2-package/src/textdefs.h b/distorm/src/textdefs.h similarity index 64% rename from distorm3.2-package/src/textdefs.h rename to distorm/src/textdefs.h index 275cf88..05cf8d7 100644 --- a/distorm3.2-package/src/textdefs.h +++ b/distorm/src/textdefs.h @@ -4,20 +4,8 @@ textdefs.h diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. */ @@ -55,8 +43,6 @@ Naming Convention: * all numbers are in HEX. */ -extern int8_t TextBTable[256][4]; - void _FASTCALL_ str_hex_b(_WString* s, unsigned int x); void _FASTCALL_ str_code_hb(_WString* s, unsigned int x); void _FASTCALL_ str_code_hdw(_WString* s, uint32_t x); diff --git a/distorm3.2-package/src/wstring.c b/distorm/src/wstring.c similarity index 54% rename from distorm3.2-package/src/wstring.c rename to distorm/src/wstring.c index 26b2260..5edce8f 100644 --- a/distorm3.2-package/src/wstring.c +++ b/distorm/src/wstring.c @@ -4,20 +4,8 @@ wstring.c diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. */ diff --git a/distorm3.2-package/src/wstring.h b/distorm/src/wstring.h similarity index 58% rename from distorm3.2-package/src/wstring.h rename to distorm/src/wstring.h index 6ff9ccf..1dbaa2f 100644 --- a/distorm3.2-package/src/wstring.h +++ b/distorm/src/wstring.h @@ -4,20 +4,8 @@ wstring.h diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. */ diff --git a/distorm3.2-package/src/x86defs.h b/distorm/src/x86defs.h similarity index 54% rename from distorm3.2-package/src/x86defs.h rename to distorm/src/x86defs.h index f35ff42..36fea6d 100644 --- a/distorm3.2-package/src/x86defs.h +++ b/distorm/src/x86defs.h @@ -4,29 +4,14 @@ x86defs.h diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see +Copyright (C) 2003-2016 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. */ #ifndef X86DEFS_H #define X86DEFS_H -#include "config.h" -#include "instructions.h" - #define SEG_REGS_MAX (6) #define CREGS_MAX (9) @@ -47,6 +32,12 @@ along with this program. If not, see /* Lea instruction byte code. */ #define INST_LEA_INDEX (0x8d) +/* NOP/XCHG instruction byte code. */ +#define INST_NOP_INDEX (0x90) + +/* ARPL/MOVSXD instruction byte code. */ +#define INST_ARPL_INDEX (0x63) + /* * Minimal MODR/M value of divided instructions. * It's 0xc0, two MSBs set, which indicates a general purpose register is used too. @@ -88,28 +79,4 @@ along with this program. If not, see /* Vector Lengh */ #define PREFIX_EX_L (0x10) -/* - * The inst_lookup will return on of these two instructions according to the specified decoding mode. - * ARPL or MOVSXD on 64 bits is one byte instruction at index 0x63. - */ -#define INST_ARPL_INDEX (0x63) -extern _InstInfo II_arpl; -extern _InstInfo II_movsxd; - -/* - * The NOP instruction can be prefixed by REX in 64bits, therefore we have to decide in runtime whether it's an XCHG or NOP instruction. - * If 0x90 is prefixed by a useable REX it will become XCHG, otherwise it will become a NOP. - * Also note that if it's prefixed by 0xf3, it becomes a Pause. - */ -#define INST_NOP_INDEX (0x90) -extern _InstInfo II_nop; -extern _InstInfo II_pause; - -/* - * Used for letting the extract operand know the type of operands without knowing the - * instruction itself yet, because of the way those instructions work. - * See function instructions.c!inst_lookup_3dnow. - */ -extern _InstInfo II_3dnow; - #endif /* X86DEFS_H */ diff --git a/distorm3.2-package/COPYING b/distorm3.2-package/COPYING deleted file mode 100644 index 94a9ed0..0000000 --- a/distorm3.2-package/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/distorm3.2-package/include/mnemonics.h b/distorm3.2-package/include/mnemonics.h deleted file mode 100644 index 652d64b..0000000 --- a/distorm3.2-package/include/mnemonics.h +++ /dev/null @@ -1,312 +0,0 @@ -/* -mnemonics.h - -diStorm3 - Powerful disassembler for X86/AMD64 -http://ragestorm.net/distorm/ -distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - - -#ifndef MNEMONICS_H -#define MNEMONICS_H - -#ifdef __cplusplus - extern "C" { -#endif - -#ifndef DISTORM_LIGHT - -typedef struct WMnemonic { - unsigned char length; - unsigned char p[1]; /* p is a null terminated string, which contains 'length' characters. */ -} _WMnemonic; - -typedef struct WRegister { - unsigned int length; - unsigned char p[6]; /* p is a null terminated string. */ -} _WRegister; - -extern const unsigned char _MNEMONICS[]; -extern const _WRegister _REGISTERS[]; - -#endif /* DISTORM_LIGHT */ - -#ifdef __cplusplus -} /* End Of Extern */ -#endif - -#define GET_REGISTER_NAME(r) (unsigned char*)_REGISTERS[(r)].p -#define GET_MNEMONIC_NAME(m) ((_WMnemonic*)&_MNEMONICS[(m)])->p - -typedef enum { - I_UNDEFINED = 0, I_AAA = 66, I_AAD = 389, I_AAM = 384, I_AAS = 76, I_ADC = 31, I_ADD = 11, I_ADDPD = 3110, - I_ADDPS = 3103, I_ADDSD = 3124, I_ADDSS = 3117, I_ADDSUBPD = 6394, I_ADDSUBPS = 6404, - I_AESDEC = 9209, I_AESDECLAST = 9226, I_AESENC = 9167, I_AESENCLAST = 9184, - I_AESIMC = 9150, I_AESKEYGENASSIST = 9795, I_AND = 41, I_ANDNPD = 3021, I_ANDNPS = 3013, - I_ANDPD = 2990, I_ANDPS = 2983, I_ARPL = 111, I_BLENDPD = 9372, I_BLENDPS = 9353, - I_BLENDVPD = 7619, I_BLENDVPS = 7609, I_BOUND = 104, I_BSF = 4346, I_BSR = 4358, - I_BSWAP = 960, I_BT = 872, I_BTC = 934, I_BTR = 912, I_BTS = 887, I_CALL = 456, - I_CALL_FAR = 260, I_CBW = 228, I_CDQ = 250, I_CDQE = 239, I_CLC = 492, I_CLD = 512, - I_CLFLUSH = 4329, I_CLGI = 1833, I_CLI = 502, I_CLTS = 541, I_CMC = 487, I_CMOVA = 694, - I_CMOVAE = 663, I_CMOVB = 656, I_CMOVBE = 686, I_CMOVG = 754, I_CMOVGE = 738, - I_CMOVL = 731, I_CMOVLE = 746, I_CMOVNO = 648, I_CMOVNP = 723, I_CMOVNS = 708, - I_CMOVNZ = 678, I_CMOVO = 641, I_CMOVP = 716, I_CMOVS = 701, I_CMOVZ = 671, - I_CMP = 71, I_CMPEQPD = 4449, I_CMPEQPS = 4370, I_CMPEQSD = 4607, I_CMPEQSS = 4528, - I_CMPLEPD = 4467, I_CMPLEPS = 4388, I_CMPLESD = 4625, I_CMPLESS = 4546, I_CMPLTPD = 4458, - I_CMPLTPS = 4379, I_CMPLTSD = 4616, I_CMPLTSS = 4537, I_CMPNEQPD = 4488, I_CMPNEQPS = 4409, - I_CMPNEQSD = 4646, I_CMPNEQSS = 4567, I_CMPNLEPD = 4508, I_CMPNLEPS = 4429, - I_CMPNLESD = 4666, I_CMPNLESS = 4587, I_CMPNLTPD = 4498, I_CMPNLTPS = 4419, - I_CMPNLTSD = 4656, I_CMPNLTSS = 4577, I_CMPORDPD = 4518, I_CMPORDPS = 4439, - I_CMPORDSD = 4676, I_CMPORDSS = 4597, I_CMPS = 301, I_CMPUNORDPD = 4476, I_CMPUNORDPS = 4397, - I_CMPUNORDSD = 4634, I_CMPUNORDSS = 4555, I_CMPXCHG = 898, I_CMPXCHG16B = 6373, - I_CMPXCHG8B = 6362, I_COMISD = 2779, I_COMISS = 2771, I_CPUID = 865, I_CQO = 255, - I_CRC32 = 9258, I_CVTDQ2PD = 6787, I_CVTDQ2PS = 3307, I_CVTPD2DQ = 6797, I_CVTPD2PI = 2681, - I_CVTPD2PS = 3233, I_CVTPH2PS = 4161, I_CVTPI2PD = 2495, I_CVTPI2PS = 2485, - I_CVTPS2DQ = 3317, I_CVTPS2PD = 3223, I_CVTPS2PH = 4171, I_CVTPS2PI = 2671, - I_CVTSD2SI = 2701, I_CVTSD2SS = 3253, I_CVTSI2SD = 2515, I_CVTSI2SS = 2505, - I_CVTSS2SD = 3243, I_CVTSS2SI = 2691, I_CVTTPD2DQ = 6776, I_CVTTPD2PI = 2614, - I_CVTTPS2DQ = 3327, I_CVTTPS2PI = 2603, I_CVTTSD2SI = 2636, I_CVTTSS2SI = 2625, - I_CWD = 245, I_CWDE = 233, I_DAA = 46, I_DAS = 56, I_DEC = 86, I_DIV = 1630, - I_DIVPD = 3499, I_DIVPS = 3492, I_DIVSD = 3513, I_DIVSS = 3506, I_DPPD = 9615, - I_DPPS = 9602, I_EMMS = 4100, I_ENTER = 340, I_EXTRACTPS = 9480, I_EXTRQ = 4136, - I_F2XM1 = 1176, I_FABS = 1107, I_FADD = 1007, I_FADDP = 1533, I_FBLD = 1585, - I_FBSTP = 1591, I_FCHS = 1101, I_FCLEX = 7289, I_FCMOVB = 1360, I_FCMOVBE = 1376, - I_FCMOVE = 1368, I_FCMOVNB = 1429, I_FCMOVNBE = 1447, I_FCMOVNE = 1438, I_FCMOVNU = 1457, - I_FCMOVU = 1385, I_FCOM = 1019, I_FCOMI = 1496, I_FCOMIP = 1607, I_FCOMP = 1025, - I_FCOMPP = 1547, I_FCOS = 1295, I_FDECSTP = 1222, I_FDIV = 1045, I_FDIVP = 1578, - I_FDIVR = 1051, I_FDIVRP = 1570, I_FEDISI = 1472, I_FEMMS = 574, I_FENI = 1466, - I_FFREE = 1511, I_FIADD = 1301, I_FICOM = 1315, I_FICOMP = 1322, I_FIDIV = 1345, - I_FIDIVR = 1352, I_FILD = 1402, I_FIMUL = 1308, I_FINCSTP = 1231, I_FINIT = 7304, - I_FIST = 1416, I_FISTP = 1422, I_FISTTP = 1408, I_FISUB = 1330, I_FISUBR = 1337, - I_FLD = 1058, I_FLD1 = 1125, I_FLDCW = 1082, I_FLDENV = 1074, I_FLDL2E = 1139, - I_FLDL2T = 1131, I_FLDLG2 = 1154, I_FLDLN2 = 1162, I_FLDPI = 1147, I_FLDZ = 1170, - I_FMUL = 1013, I_FMULP = 1540, I_FNCLEX = 7281, I_FNINIT = 7296, I_FNOP = 1095, - I_FNSAVE = 7311, I_FNSTCW = 7266, I_FNSTENV = 7249, I_FNSTSW = 7326, I_FPATAN = 1197, - I_FPREM = 1240, I_FPREM1 = 1214, I_FPTAN = 1190, I_FRNDINT = 1272, I_FRSTOR = 1503, - I_FSAVE = 7319, I_FSCALE = 1281, I_FSETPM = 1480, I_FSIN = 1289, I_FSINCOS = 1263, - I_FSQRT = 1256, I_FST = 1063, I_FSTCW = 7274, I_FSTENV = 7258, I_FSTP = 1068, - I_FSTSW = 7334, I_FSUB = 1032, I_FSUBP = 1563, I_FSUBR = 1038, I_FSUBRP = 1555, - I_FTST = 1113, I_FUCOM = 1518, I_FUCOMI = 1488, I_FUCOMIP = 1598, I_FUCOMP = 1525, - I_FUCOMPP = 1393, I_FXAM = 1119, I_FXCH = 1089, I_FXRSTOR = 9892, I_FXRSTOR64 = 9901, - I_FXSAVE = 9864, I_FXSAVE64 = 9872, I_FXTRACT = 1205, I_FYL2X = 1183, I_FYL2XP1 = 1247, - I_GETSEC = 633, I_HADDPD = 4181, I_HADDPS = 4189, I_HLT = 482, I_HSUBPD = 4215, - I_HSUBPS = 4223, I_IDIV = 1635, I_IMUL = 117, I_IN = 447, I_INC = 81, I_INS = 123, - I_INSERTPS = 9547, I_INSERTQ = 4143, I_INT = 367, I_INT_3 = 360, I_INT1 = 476, - I_INTO = 372, I_INVD = 555, I_INVEPT = 8284, I_INVLPG = 1711, I_INVLPGA = 1847, - I_INVPCID = 8301, I_INVVPID = 8292, I_IRET = 378, I_JA = 166, I_JAE = 147, - I_JB = 143, I_JBE = 161, I_JCXZ = 427, I_JECXZ = 433, I_JG = 202, I_JGE = 192, - I_JL = 188, I_JLE = 197, I_JMP = 462, I_JMP_FAR = 467, I_JNO = 138, I_JNP = 183, - I_JNS = 174, I_JNZ = 156, I_JO = 134, I_JP = 179, I_JRCXZ = 440, I_JS = 170, - I_JZ = 152, I_LAHF = 289, I_LAR = 522, I_LDDQU = 6994, I_LDMXCSR = 9922, I_LDS = 335, - I_LEA = 223, I_LEAVE = 347, I_LES = 330, I_LFENCE = 4265, I_LFS = 917, I_LGDT = 1687, - I_LGS = 922, I_LIDT = 1693, I_LLDT = 1652, I_LMSW = 1705, I_LODS = 313, I_LOOP = 421, - I_LOOPNZ = 406, I_LOOPZ = 414, I_LSL = 527, I_LSS = 907, I_LTR = 1658, I_LZCNT = 4363, - I_MASKMOVDQU = 7119, I_MASKMOVQ = 7109, I_MAXPD = 3559, I_MAXPS = 3552, I_MAXSD = 3573, - I_MAXSS = 3566, I_MFENCE = 4291, I_MINPD = 3439, I_MINPS = 3432, I_MINSD = 3453, - I_MINSS = 3446, I_MONITOR = 1755, I_MOV = 218, I_MOVAPD = 2459, I_MOVAPS = 2451, - I_MOVBE = 9251, I_MOVD = 3920, I_MOVDDUP = 2186, I_MOVDQ2Q = 6522, I_MOVDQA = 3946, - I_MOVDQU = 3954, I_MOVHLPS = 2151, I_MOVHPD = 2345, I_MOVHPS = 2337, I_MOVLHPS = 2328, - I_MOVLPD = 2168, I_MOVLPS = 2160, I_MOVMSKPD = 2815, I_MOVMSKPS = 2805, I_MOVNTDQ = 6849, - I_MOVNTDQA = 7895, I_MOVNTI = 952, I_MOVNTPD = 2556, I_MOVNTPS = 2547, I_MOVNTQ = 6841, - I_MOVNTSD = 2574, I_MOVNTSS = 2565, I_MOVQ = 3926, I_MOVQ2DQ = 6513, I_MOVS = 295, - I_MOVSD = 2110, I_MOVSHDUP = 2353, I_MOVSLDUP = 2176, I_MOVSS = 2103, I_MOVSX = 939, - I_MOVSXD = 10019, I_MOVUPD = 2095, I_MOVUPS = 2087, I_MOVZX = 927, I_MPSADBW = 9628, - I_MUL = 1625, I_MULPD = 3170, I_MULPS = 3163, I_MULSD = 3184, I_MULSS = 3177, - I_MWAIT = 1764, I_NEG = 1620, I_NOP = 581, I_NOT = 1615, I_OR = 27, I_ORPD = 3053, - I_ORPS = 3047, I_OUT = 451, I_OUTS = 128, I_PABSB = 7688, I_PABSD = 7718, I_PABSW = 7703, - I_PACKSSDW = 3849, I_PACKSSWB = 3681, I_PACKUSDW = 7916, I_PACKUSWB = 3759, - I_PADDB = 7204, I_PADDD = 7234, I_PADDQ = 6481, I_PADDSB = 6930, I_PADDSW = 6947, - I_PADDUSB = 6620, I_PADDUSW = 6639, I_PADDW = 7219, I_PALIGNR = 9410, I_PAND = 6607, - I_PANDN = 6665, I_PAUSE = 10027, I_PAVGB = 6680, I_PAVGUSB = 2078, I_PAVGW = 6725, - I_PBLENDVB = 7599, I_PBLENDW = 9391, I_PCLMULQDQ = 9647, I_PCMPEQB = 4043, - I_PCMPEQD = 4081, I_PCMPEQQ = 7876, I_PCMPEQW = 4062, I_PCMPESTRI = 9726, - I_PCMPESTRM = 9703, I_PCMPGTB = 3702, I_PCMPGTD = 3740, I_PCMPGTQ = 8087, - I_PCMPGTW = 3721, I_PCMPISTRI = 9772, I_PCMPISTRM = 9749, I_PEXTRB = 9429, - I_PEXTRD = 9446, I_PEXTRQ = 9454, I_PEXTRW = 6311, I_PF2ID = 1914, I_PF2IW = 1907, - I_PFACC = 2028, I_PFADD = 1977, I_PFCMPEQ = 2035, I_PFCMPGE = 1938, I_PFCMPGT = 1984, - I_PFMAX = 1993, I_PFMIN = 1947, I_PFMUL = 2044, I_PFNACC = 1921, I_PFPNACC = 1929, - I_PFRCP = 1954, I_PFRCPIT1 = 2000, I_PFRCPIT2 = 2051, I_PFRSQIT1 = 2010, I_PFRSQRT = 1961, - I_PFSUB = 1970, I_PFSUBR = 2020, I_PHADDD = 7375, I_PHADDSW = 7392, I_PHADDW = 7358, - I_PHMINPOSUW = 8259, I_PHSUBD = 7451, I_PHSUBSW = 7468, I_PHSUBW = 7434, I_PI2FD = 1900, - I_PI2FW = 1893, I_PINSRB = 9530, I_PINSRD = 9568, I_PINSRQ = 9576, I_PINSRW = 6294, - I_PMADDUBSW = 7411, I_PMADDWD = 7073, I_PMAXSB = 8174, I_PMAXSD = 8191, I_PMAXSW = 6964, - I_PMAXUB = 6648, I_PMAXUD = 8225, I_PMAXUW = 8208, I_PMINSB = 8106, I_PMINSD = 8123, - I_PMINSW = 6902, I_PMINUB = 6590, I_PMINUD = 8157, I_PMINUW = 8140, I_PMOVMSKB = 6531, - I_PMOVSXBD = 7754, I_PMOVSXBQ = 7775, I_PMOVSXBW = 7733, I_PMOVSXDQ = 7838, - I_PMOVSXWD = 7796, I_PMOVSXWQ = 7817, I_PMOVZXBD = 7982, I_PMOVZXBQ = 8003, - I_PMOVZXBW = 7961, I_PMOVZXDQ = 8066, I_PMOVZXWD = 8024, I_PMOVZXWQ = 8045, - I_PMULDQ = 7859, I_PMULHRSW = 7538, I_PMULHRW = 2061, I_PMULHUW = 6740, I_PMULHW = 6759, - I_PMULLD = 8242, I_PMULLW = 6496, I_PMULUDQ = 7054, I_POP = 22, I_POPA = 98, - I_POPCNT = 4338, I_POPF = 277, I_POR = 6919, I_PREFETCH = 1872, I_PREFETCHNTA = 2402, - I_PREFETCHT0 = 2415, I_PREFETCHT1 = 2427, I_PREFETCHT2 = 2439, I_PREFETCHW = 1882, - I_PSADBW = 7092, I_PSHUFB = 7341, I_PSHUFD = 3988, I_PSHUFHW = 3996, I_PSHUFLW = 4005, - I_PSHUFW = 3980, I_PSIGNB = 7487, I_PSIGND = 7521, I_PSIGNW = 7504, I_PSLLD = 7024, - I_PSLLDQ = 9847, I_PSLLQ = 7039, I_PSLLW = 7009, I_PSRAD = 6710, I_PSRAW = 6695, - I_PSRLD = 6451, I_PSRLDQ = 9830, I_PSRLQ = 6466, I_PSRLW = 6436, I_PSUBB = 7144, - I_PSUBD = 7174, I_PSUBQ = 7189, I_PSUBSB = 6868, I_PSUBSW = 6885, I_PSUBUSB = 6552, - I_PSUBUSW = 6571, I_PSUBW = 7159, I_PSWAPD = 2070, I_PTEST = 7629, I_PUNPCKHBW = 3780, - I_PUNPCKHDQ = 3826, I_PUNPCKHQDQ = 3895, I_PUNPCKHWD = 3803, I_PUNPCKLBW = 3612, - I_PUNPCKLDQ = 3658, I_PUNPCKLQDQ = 3870, I_PUNPCKLWD = 3635, I_PUSH = 16, - I_PUSHA = 91, I_PUSHF = 270, I_PXOR = 6981, I_RCL = 977, I_RCPPS = 2953, I_RCPSS = 2960, - I_RCR = 982, I_RDFSBASE = 9882, I_RDGSBASE = 9912, I_RDMSR = 600, I_RDPMC = 607, - I_RDRAND = 9980, I_RDTSC = 593, I_RDTSCP = 1864, I_RET = 325, I_RETF = 354, - I_ROL = 967, I_ROR = 972, I_ROUNDPD = 9296, I_ROUNDPS = 9277, I_ROUNDSD = 9334, - I_ROUNDSS = 9315, I_RSM = 882, I_RSQRTPS = 2915, I_RSQRTSS = 2924, I_SAHF = 283, - I_SAL = 997, I_SALC = 394, I_SAR = 1002, I_SBB = 36, I_SCAS = 319, I_SETA = 807, - I_SETAE = 780, I_SETB = 774, I_SETBE = 800, I_SETG = 859, I_SETGE = 845, I_SETL = 839, - I_SETLE = 852, I_SETNO = 767, I_SETNP = 832, I_SETNS = 819, I_SETNZ = 793, - I_SETO = 761, I_SETP = 826, I_SETS = 813, I_SETZ = 787, I_SFENCE = 4321, I_SGDT = 1675, - I_SHL = 987, I_SHLD = 876, I_SHR = 992, I_SHRD = 892, I_SHUFPD = 6336, I_SHUFPS = 6328, - I_SIDT = 1681, I_SKINIT = 1839, I_SLDT = 1641, I_SMSW = 1699, I_SQRTPD = 2855, - I_SQRTPS = 2847, I_SQRTSD = 2871, I_SQRTSS = 2863, I_STC = 497, I_STD = 517, - I_STGI = 1827, I_STI = 507, I_STMXCSR = 9951, I_STOS = 307, I_STR = 1647, I_SUB = 51, - I_SUBPD = 3379, I_SUBPS = 3372, I_SUBSD = 3393, I_SUBSS = 3386, I_SWAPGS = 1856, - I_SYSCALL = 532, I_SYSENTER = 614, I_SYSEXIT = 624, I_SYSRET = 547, I_TEST = 206, - I_TZCNT = 4351, I_UCOMISD = 2742, I_UCOMISS = 2733, I_UD2 = 569, I_UNPCKHPD = 2296, - I_UNPCKHPS = 2286, I_UNPCKLPD = 2254, I_UNPCKLPS = 2244, I_VADDPD = 3139, - I_VADDPS = 3131, I_VADDSD = 3155, I_VADDSS = 3147, I_VADDSUBPD = 6414, I_VADDSUBPS = 6425, - I_VAESDEC = 9217, I_VAESDECLAST = 9238, I_VAESENC = 9175, I_VAESENCLAST = 9196, - I_VAESIMC = 9158, I_VAESKEYGENASSIST = 9812, I_VANDNPD = 3038, I_VANDNPS = 3029, - I_VANDPD = 3005, I_VANDPS = 2997, I_VBLENDPD = 9381, I_VBLENDPS = 9362, I_VBLENDVPD = 9681, - I_VBLENDVPS = 9670, I_VBROADCASTF128 = 7672, I_VBROADCASTSD = 7658, I_VBROADCASTSS = 7644, - I_VCMPEQPD = 5088, I_VCMPEQPS = 4686, I_VCMPEQSD = 5892, I_VCMPEQSS = 5490, - I_VCMPEQ_OSPD = 5269, I_VCMPEQ_OSPS = 4867, I_VCMPEQ_OSSD = 6073, I_VCMPEQ_OSSS = 5671, - I_VCMPEQ_UQPD = 5175, I_VCMPEQ_UQPS = 4773, I_VCMPEQ_UQSD = 5979, I_VCMPEQ_UQSS = 5577, - I_VCMPEQ_USPD = 5378, I_VCMPEQ_USPS = 4976, I_VCMPEQ_USSD = 6182, I_VCMPEQ_USSS = 5780, - I_VCMPFALSEPD = 5210, I_VCMPFALSEPS = 4808, I_VCMPFALSESD = 6014, I_VCMPFALSESS = 5612, - I_VCMPFALSE_OSPD = 5419, I_VCMPFALSE_OSPS = 5017, I_VCMPFALSE_OSSD = 6223, - I_VCMPFALSE_OSSS = 5821, I_VCMPGEPD = 5237, I_VCMPGEPS = 4835, I_VCMPGESD = 6041, - I_VCMPGESS = 5639, I_VCMPGE_OQPD = 5449, I_VCMPGE_OQPS = 5047, I_VCMPGE_OQSD = 6253, - I_VCMPGE_OQSS = 5851, I_VCMPGTPD = 5247, I_VCMPGTPS = 4845, I_VCMPGTSD = 6051, - I_VCMPGTSS = 5649, I_VCMPGT_OQPD = 5462, I_VCMPGT_OQPS = 5060, I_VCMPGT_OQSD = 6266, - I_VCMPGT_OQSS = 5864, I_VCMPLEPD = 5108, I_VCMPLEPS = 4706, I_VCMPLESD = 5912, - I_VCMPLESS = 5510, I_VCMPLE_OQPD = 5295, I_VCMPLE_OQPS = 4893, I_VCMPLE_OQSD = 6099, - I_VCMPLE_OQSS = 5697, I_VCMPLTPD = 5098, I_VCMPLTPS = 4696, I_VCMPLTSD = 5902, - I_VCMPLTSS = 5500, I_VCMPLT_OQPD = 5282, I_VCMPLT_OQPS = 4880, I_VCMPLT_OQSD = 6086, - I_VCMPLT_OQSS = 5684, I_VCMPNEQPD = 5131, I_VCMPNEQPS = 4729, I_VCMPNEQSD = 5935, - I_VCMPNEQSS = 5533, I_VCMPNEQ_OQPD = 5223, I_VCMPNEQ_OQPS = 4821, I_VCMPNEQ_OQSD = 6027, - I_VCMPNEQ_OQSS = 5625, I_VCMPNEQ_OSPD = 5435, I_VCMPNEQ_OSPS = 5033, I_VCMPNEQ_OSSD = 6239, - I_VCMPNEQ_OSSS = 5837, I_VCMPNEQ_USPD = 5323, I_VCMPNEQ_USPS = 4921, I_VCMPNEQ_USSD = 6127, - I_VCMPNEQ_USSS = 5725, I_VCMPNGEPD = 5188, I_VCMPNGEPS = 4786, I_VCMPNGESD = 5992, - I_VCMPNGESS = 5590, I_VCMPNGE_UQPD = 5391, I_VCMPNGE_UQPS = 4989, I_VCMPNGE_UQSD = 6195, - I_VCMPNGE_UQSS = 5793, I_VCMPNGTPD = 5199, I_VCMPNGTPS = 4797, I_VCMPNGTSD = 6003, - I_VCMPNGTSS = 5601, I_VCMPNGT_UQPD = 5405, I_VCMPNGT_UQPS = 5003, I_VCMPNGT_UQSD = 6209, - I_VCMPNGT_UQSS = 5807, I_VCMPNLEPD = 5153, I_VCMPNLEPS = 4751, I_VCMPNLESD = 5957, - I_VCMPNLESS = 5555, I_VCMPNLE_UQPD = 5351, I_VCMPNLE_UQPS = 4949, I_VCMPNLE_UQSD = 6155, - I_VCMPNLE_UQSS = 5753, I_VCMPNLTPD = 5142, I_VCMPNLTPS = 4740, I_VCMPNLTSD = 5946, - I_VCMPNLTSS = 5544, I_VCMPNLT_UQPD = 5337, I_VCMPNLT_UQPS = 4935, I_VCMPNLT_UQSD = 6141, - I_VCMPNLT_UQSS = 5739, I_VCMPORDPD = 5164, I_VCMPORDPS = 4762, I_VCMPORDSD = 5968, - I_VCMPORDSS = 5566, I_VCMPORD_SPD = 5365, I_VCMPORD_SPS = 4963, I_VCMPORD_SSD = 6169, - I_VCMPORD_SSS = 5767, I_VCMPTRUEPD = 5257, I_VCMPTRUEPS = 4855, I_VCMPTRUESD = 6061, - I_VCMPTRUESS = 5659, I_VCMPTRUE_USPD = 5475, I_VCMPTRUE_USPS = 5073, I_VCMPTRUE_USSD = 6279, - I_VCMPTRUE_USSS = 5877, I_VCMPUNORDPD = 5118, I_VCMPUNORDPS = 4716, I_VCMPUNORDSD = 5922, - I_VCMPUNORDSS = 5520, I_VCMPUNORD_SPD = 5308, I_VCMPUNORD_SPS = 4906, I_VCMPUNORD_SSD = 6112, - I_VCMPUNORD_SSS = 5710, I_VCOMISD = 2796, I_VCOMISS = 2787, I_VCVTDQ2PD = 6819, - I_VCVTDQ2PS = 3338, I_VCVTPD2DQ = 6830, I_VCVTPD2PS = 3274, I_VCVTPS2DQ = 3349, - I_VCVTPS2PD = 3263, I_VCVTSD2SI = 2722, I_VCVTSD2SS = 3296, I_VCVTSI2SD = 2536, - I_VCVTSI2SS = 2525, I_VCVTSS2SD = 3285, I_VCVTSS2SI = 2711, I_VCVTTPD2DQ = 6807, - I_VCVTTPS2DQ = 3360, I_VCVTTSD2SI = 2659, I_VCVTTSS2SI = 2647, I_VDIVPD = 3528, - I_VDIVPS = 3520, I_VDIVSD = 3544, I_VDIVSS = 3536, I_VDPPD = 9621, I_VDPPS = 9608, - I_VERR = 1663, I_VERW = 1669, I_VEXTRACTF128 = 9516, I_VEXTRACTPS = 9491, - I_VFMADD132PD = 8387, I_VFMADD132PS = 8374, I_VFMADD132SD = 8413, I_VFMADD132SS = 8400, - I_VFMADD213PD = 8667, I_VFMADD213PS = 8654, I_VFMADD213SD = 8693, I_VFMADD213SS = 8680, - I_VFMADD231PD = 8947, I_VFMADD231PS = 8934, I_VFMADD231SD = 8973, I_VFMADD231SS = 8960, - I_VFMADDSUB132PD = 8326, I_VFMADDSUB132PS = 8310, I_VFMADDSUB213PD = 8606, - I_VFMADDSUB213PS = 8590, I_VFMADDSUB231PD = 8886, I_VFMADDSUB231PS = 8870, - I_VFMSUB132PD = 8439, I_VFMSUB132PS = 8426, I_VFMSUB132SD = 8465, I_VFMSUB132SS = 8452, - I_VFMSUB213PD = 8719, I_VFMSUB213PS = 8706, I_VFMSUB213SD = 8745, I_VFMSUB213SS = 8732, - I_VFMSUB231PD = 8999, I_VFMSUB231PS = 8986, I_VFMSUB231SD = 9025, I_VFMSUB231SS = 9012, - I_VFMSUBADD132PD = 8358, I_VFMSUBADD132PS = 8342, I_VFMSUBADD213PD = 8638, - I_VFMSUBADD213PS = 8622, I_VFMSUBADD231PD = 8918, I_VFMSUBADD231PS = 8902, - I_VFNMADD132PD = 8492, I_VFNMADD132PS = 8478, I_VFNMADD132SD = 8520, I_VFNMADD132SS = 8506, - I_VFNMADD213PD = 8772, I_VFNMADD213PS = 8758, I_VFNMADD213SD = 8800, I_VFNMADD213SS = 8786, - I_VFNMADD231PD = 9052, I_VFNMADD231PS = 9038, I_VFNMADD231SD = 9080, I_VFNMADD231SS = 9066, - I_VFNMSUB132PD = 8548, I_VFNMSUB132PS = 8534, I_VFNMSUB132SD = 8576, I_VFNMSUB132SS = 8562, - I_VFNMSUB213PD = 8828, I_VFNMSUB213PS = 8814, I_VFNMSUB213SD = 8856, I_VFNMSUB213SS = 8842, - I_VFNMSUB231PD = 9108, I_VFNMSUB231PS = 9094, I_VFNMSUB231SD = 9136, I_VFNMSUB231SS = 9122, - I_VHADDPD = 4197, I_VHADDPS = 4206, I_VHSUBPD = 4231, I_VHSUBPS = 4240, I_VINSERTF128 = 9503, - I_VINSERTPS = 9557, I_VLDDQU = 7001, I_VLDMXCSR = 9941, I_VMASKMOVDQU = 7131, - I_VMASKMOVPD = 7949, I_VMASKMOVPS = 7937, I_VMAXPD = 3588, I_VMAXPS = 3580, - I_VMAXSD = 3604, I_VMAXSS = 3596, I_VMCALL = 1719, I_VMCLEAR = 9997, I_VMFUNC = 1787, - I_VMINPD = 3468, I_VMINPS = 3460, I_VMINSD = 3484, I_VMINSS = 3476, I_VMLAUNCH = 1727, - I_VMLOAD = 1811, I_VMMCALL = 1802, I_VMOVAPD = 2476, I_VMOVAPS = 2467, I_VMOVD = 3932, - I_VMOVDDUP = 2234, I_VMOVDQA = 3962, I_VMOVDQU = 3971, I_VMOVHLPS = 2195, - I_VMOVHPD = 2382, I_VMOVHPS = 2373, I_VMOVLHPS = 2363, I_VMOVLPD = 2214, I_VMOVLPS = 2205, - I_VMOVMSKPD = 2836, I_VMOVMSKPS = 2825, I_VMOVNTDQ = 6858, I_VMOVNTDQA = 7905, - I_VMOVNTPD = 2593, I_VMOVNTPS = 2583, I_VMOVQ = 3939, I_VMOVSD = 2143, I_VMOVSHDUP = 2391, - I_VMOVSLDUP = 2223, I_VMOVSS = 2135, I_VMOVUPD = 2126, I_VMOVUPS = 2117, I_VMPSADBW = 9637, - I_VMPTRLD = 9988, I_VMPTRST = 6385, I_VMREAD = 4128, I_VMRESUME = 1737, I_VMRUN = 1795, - I_VMSAVE = 1819, I_VMULPD = 3199, I_VMULPS = 3191, I_VMULSD = 3215, I_VMULSS = 3207, - I_VMWRITE = 4152, I_VMXOFF = 1747, I_VMXON = 10006, I_VORPD = 3066, I_VORPS = 3059, - I_VPABSB = 7695, I_VPABSD = 7725, I_VPABSW = 7710, I_VPACKSSDW = 3859, I_VPACKSSWB = 3691, - I_VPACKUSDW = 7926, I_VPACKUSWB = 3769, I_VPADDB = 7211, I_VPADDD = 7241, - I_VPADDQ = 6488, I_VPADDSB = 6938, I_VPADDSW = 6955, I_VPADDUSW = 6629, I_VPADDW = 7226, - I_VPALIGNR = 9419, I_VPAND = 6613, I_VPANDN = 6672, I_VPAVGB = 6687, I_VPAVGW = 6732, - I_VPBLENDVB = 9692, I_VPBLENDW = 9400, I_VPCLMULQDQ = 9658, I_VPCMPEQB = 4052, - I_VPCMPEQD = 4090, I_VPCMPEQQ = 7885, I_VPCMPEQW = 4071, I_VPCMPESTRI = 9737, - I_VPCMPESTRM = 9714, I_VPCMPGTB = 3711, I_VPCMPGTD = 3749, I_VPCMPGTQ = 8096, - I_VPCMPGTW = 3730, I_VPCMPISTRI = 9783, I_VPCMPISTRM = 9760, I_VPERM2F128 = 9265, - I_VPERMILPD = 7570, I_VPERMILPS = 7559, I_VPEXTRB = 9437, I_VPEXTRD = 9462, - I_VPEXTRQ = 9471, I_VPEXTRW = 6319, I_VPHADDD = 7383, I_VPHADDSW = 7401, I_VPHADDW = 7366, - I_VPHMINPOSUW = 8271, I_VPHSUBD = 7459, I_VPHSUBSW = 7477, I_VPHSUBW = 7442, - I_VPINSRB = 9538, I_VPINSRD = 9584, I_VPINSRQ = 9593, I_VPINSRW = 6302, I_VPMADDUBSW = 7422, - I_VPMADDWD = 7082, I_VPMAXSB = 8182, I_VPMAXSD = 8199, I_VPMAXSW = 6972, I_VPMAXUB = 6656, - I_VPMAXUD = 8233, I_VPMAXUW = 8216, I_VPMINSB = 8114, I_VPMINSD = 8131, I_VPMINSW = 6910, - I_VPMINUB = 6598, I_VPMINUD = 8165, I_VPMINUW = 8148, I_VPMOVMSKB = 6541, - I_VPMOVSXBD = 7764, I_VPMOVSXBQ = 7785, I_VPMOVSXBW = 7743, I_VPMOVSXDQ = 7848, - I_VPMOVSXWD = 7806, I_VPMOVSXWQ = 7827, I_VPMOVZXBD = 7992, I_VPMOVZXBQ = 8013, - I_VPMOVZXBW = 7971, I_VPMOVZXDQ = 8076, I_VPMOVZXWD = 8034, I_VPMOVZXWQ = 8055, - I_VPMULDQ = 7867, I_VPMULHRSW = 7548, I_VPMULHUW = 6749, I_VPMULHW = 6767, - I_VPMULLD = 8250, I_VPMULLW = 6504, I_VPMULUDQ = 7063, I_VPOR = 6924, I_VPSADBW = 7100, - I_VPSHUFB = 7349, I_VPSHUFD = 4014, I_VPSHUFHW = 4023, I_VPSHUFLW = 4033, - I_VPSIGNB = 7495, I_VPSIGND = 7529, I_VPSIGNW = 7512, I_VPSLLD = 7031, I_VPSLLDQ = 9855, - I_VPSLLQ = 7046, I_VPSLLW = 7016, I_VPSRAD = 6717, I_VPSRAW = 6702, I_VPSRLD = 6458, - I_VPSRLDQ = 9838, I_VPSRLQ = 6473, I_VPSRLW = 6443, I_VPSUBB = 7151, I_VPSUBD = 7181, - I_VPSUBQ = 7196, I_VPSUBSB = 6876, I_VPSUBSW = 6893, I_VPSUBUSB = 6561, I_VPSUBUSW = 6580, - I_VPSUBW = 7166, I_VPTEST = 7636, I_VPUNPCKHBW = 3791, I_VPUNPCKHDQ = 3837, - I_VPUNPCKHQDQ = 3907, I_VPUNPCKHWD = 3814, I_VPUNPCKLBW = 3623, I_VPUNPCKLDQ = 3669, - I_VPUNPCKLQDQ = 3882, I_VPUNPCKLWD = 3646, I_VPXOR = 6987, I_VRCPPS = 2967, - I_VRCPSS = 2975, I_VROUNDPD = 9305, I_VROUNDPS = 9286, I_VROUNDSD = 9343, - I_VROUNDSS = 9324, I_VRSQRTPS = 2933, I_VRSQRTSS = 2943, I_VSHUFPD = 6353, - I_VSHUFPS = 6344, I_VSQRTPD = 2888, I_VSQRTPS = 2879, I_VSQRTSD = 2906, I_VSQRTSS = 2897, - I_VSTMXCSR = 9970, I_VSUBPD = 3408, I_VSUBPS = 3400, I_VSUBSD = 3424, I_VSUBSS = 3416, - I_VTESTPD = 7590, I_VTESTPS = 7581, I_VUCOMISD = 2761, I_VUCOMISS = 2751, - I_VUNPCKHPD = 2317, I_VUNPCKHPS = 2306, I_VUNPCKLPD = 2275, I_VUNPCKLPS = 2264, - I_VXORPD = 3095, I_VXORPS = 3087, I_VZEROALL = 4118, I_VZEROUPPER = 4106, - I_WAIT = 10013, I_WBINVD = 561, I_WRFSBASE = 9931, I_WRGSBASE = 9960, I_WRMSR = 586, - I_XADD = 946, I_XCHG = 212, I_XGETBV = 1771, I_XLAT = 400, I_XOR = 61, I_XORPD = 3080, - I_XORPS = 3073, I_XRSTOR = 4273, I_XRSTOR64 = 4281, I_XSAVE = 4249, I_XSAVE64 = 4256, - I_XSAVEOPT = 4299, I_XSAVEOPT64 = 4309, I_XSETBV = 1779 -} _InstructionType; - -typedef enum { - R_RAX, R_RCX, R_RDX, R_RBX, R_RSP, R_RBP, R_RSI, R_RDI, R_R8, R_R9, R_R10, R_R11, R_R12, R_R13, R_R14, R_R15, - R_EAX, R_ECX, R_EDX, R_EBX, R_ESP, R_EBP, R_ESI, R_EDI, R_R8D, R_R9D, R_R10D, R_R11D, R_R12D, R_R13D, R_R14D, R_R15D, - R_AX, R_CX, R_DX, R_BX, R_SP, R_BP, R_SI, R_DI, R_R8W, R_R9W, R_R10W, R_R11W, R_R12W, R_R13W, R_R14W, R_R15W, - R_AL, R_CL, R_DL, R_BL, R_AH, R_CH, R_DH, R_BH, R_R8B, R_R9B, R_R10B, R_R11B, R_R12B, R_R13B, R_R14B, R_R15B, - R_SPL, R_BPL, R_SIL, R_DIL, - R_ES, R_CS, R_SS, R_DS, R_FS, R_GS, - R_RIP, - R_ST0, R_ST1, R_ST2, R_ST3, R_ST4, R_ST5, R_ST6, R_ST7, - R_MM0, R_MM1, R_MM2, R_MM3, R_MM4, R_MM5, R_MM6, R_MM7, - R_XMM0, R_XMM1, R_XMM2, R_XMM3, R_XMM4, R_XMM5, R_XMM6, R_XMM7, R_XMM8, R_XMM9, R_XMM10, R_XMM11, R_XMM12, R_XMM13, R_XMM14, R_XMM15, - R_YMM0, R_YMM1, R_YMM2, R_YMM3, R_YMM4, R_YMM5, R_YMM6, R_YMM7, R_YMM8, R_YMM9, R_YMM10, R_YMM11, R_YMM12, R_YMM13, R_YMM14, R_YMM15, - R_CR0, R_UNUSED0, R_CR2, R_CR3, R_CR4, R_UNUSED1, R_UNUSED2, R_UNUSED3, R_CR8, - R_DR0, R_DR1, R_DR2, R_DR3, R_UNUSED4, R_UNUSED5, R_DR6, R_DR7 -} _RegisterType; - -#endif /* MNEMONICS_H */ diff --git a/distorm3.2-package/src/insts.c b/distorm3.2-package/src/insts.c deleted file mode 100644 index 4c9179b..0000000 --- a/distorm3.2-package/src/insts.c +++ /dev/null @@ -1,7343 +0,0 @@ -/* -insts.c - -diStorm3 - Powerful disassembler for X86/AMD64 -http://ragestorm.net/distorm/ -distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - - -#include "config.h" -#include "insts.h" -#include "instructions.h" - - -/* - * GENERATED BY disOps at Mon May 07 05:39:59 2012 - */ - -/* See x86defs.c if you get an error here. */ -_iflags FlagsTable[97 + 5] = { -INST_MODRM_REQUIRED, -INST_MODRM_REQUIRED | INST_PRE_REX | INST_64BITS, -INST_FLAGS_NONE, -INST_FLAGS_NONE, -INST_32BITS | INST_MODRM_REQUIRED | INST_3DNOW_FETCH, -0x80000011, -0x80000000, -0x800400, -0x80800400, -0x800080, -0x800100, -0x80800100, -0x800200, -0x80800200, -0x800000, -0x1, -0x0, -0x80800000, -0x1000000, -0x81000000, -0x808000, -0x800001, -0x1000001, -0x80020001, -0x1002000, -0x60, -0x64, -0x80000001, -0x4010000, -0x1008000, -0x80000060, -0x83000064, -0x3000064, -0x83000000, -0x3008000, -0x200, -0xc000, -0x4014000, -0x8, -0x81000009, -0x9, -0x80000009, -0x1000808, -0x81000808, -0x80020009, -0x1001008, -0x81001008, -0x80000019, -0x3000009, -0x83000009, -0x83000008, -0xc0000011, -0x40000001, -0xc0800011, -0x40800001, -0xc0000019, -0xc1000001, -0xc0000001, -0x40000000, -0x40000008, -0x40000009, -0x41000001, -0x43000001, -0xc0000003, -0x40000003, -0x48000000, -0x200009, -0x20000009, -0x60020009, -0x60000009, -0x80090009, -0x200b0009, -0x20020009, -0x80100009, -0x21100009, -0x87000009, -0x20009, -0x20000008, -0x1000009, -0x10020009, -0x160009, -0x100009, -0x47000009, -0x47090009, -0x40090009, -0x80002009, -0xc0000009, -0x2001, -0x80002001, -0x410009, -0x20420009, -0x20060009, -0x120009, -0x21020009, -0xc7000019, -0x20100009, -0x40002009, -0x40002008, -0x4020009, -0x40100009, -0x60120009, -0x41000009 -}; - -_InstNode Table_0F = 256; -_InstNode Table_0F_0F = 1312; -_InstNode Table_0F_38 = 1768; -_InstNode Table_0F_3A = 2024; - -_InstInfo InstInfos[] = { - /*II_00*/ {0x5, 9, 15, 8, 11}, - /*II_01*/ {0x5, 11, 17, 8, 11}, - /*II_02*/ {0x5, 15, 9, 8, 11}, - /*II_03*/ {0x5, 17, 11, 8, 11}, - /*II_04*/ {0x6, 1, 33, 8, 11}, - /*II_05*/ {0x6, 3, 35, 8, 11}, - /*II_06*/ {0x7, 0, 32, 8, 16}, - /*II_07*/ {0x8, 0, 32, 8, 22}, - /*II_08*/ {0x5, 9, 15, 8, 27}, - /*II_09*/ {0x5, 11, 17, 8, 27}, - /*II_0A*/ {0x5, 15, 9, 8, 27}, - /*II_0B*/ {0x5, 17, 11, 8, 27}, - /*II_0C*/ {0x6, 1, 33, 8, 27}, - /*II_0D*/ {0x6, 3, 35, 8, 27}, - /*II_0E*/ {0x9, 0, 32, 8, 16}, - /*II_10*/ {0x5, 9, 15, 8, 31}, - /*II_11*/ {0x5, 11, 17, 8, 31}, - /*II_12*/ {0x5, 15, 9, 8, 31}, - /*II_13*/ {0x5, 17, 11, 8, 31}, - /*II_14*/ {0x6, 1, 33, 8, 31}, - /*II_15*/ {0x6, 3, 35, 8, 31}, - /*II_16*/ {0xa, 0, 32, 8, 16}, - /*II_17*/ {0xb, 0, 32, 8, 22}, - /*II_18*/ {0x5, 9, 15, 8, 36}, - /*II_19*/ {0x5, 11, 17, 8, 36}, - /*II_1A*/ {0x5, 15, 9, 8, 36}, - /*II_1B*/ {0x5, 17, 11, 8, 36}, - /*II_1C*/ {0x6, 1, 33, 8, 36}, - /*II_1D*/ {0x6, 3, 35, 8, 36}, - /*II_1E*/ {0xc, 0, 32, 8, 16}, - /*II_1F*/ {0xd, 0, 32, 8, 22}, - /*II_20*/ {0x5, 9, 15, 8, 41}, - /*II_21*/ {0x5, 11, 17, 8, 41}, - /*II_22*/ {0x5, 15, 9, 8, 41}, - /*II_23*/ {0x5, 17, 11, 8, 41}, - /*II_24*/ {0x6, 1, 33, 8, 41}, - /*II_25*/ {0x6, 3, 35, 8, 41}, - /*II_27*/ {0xe, 0, 0, 8, 46}, - /*II_28*/ {0x5, 9, 15, 8, 51}, - /*II_29*/ {0x5, 11, 17, 8, 51}, - /*II_2A*/ {0x5, 15, 9, 8, 51}, - /*II_2B*/ {0x5, 17, 11, 8, 51}, - /*II_2C*/ {0x6, 1, 33, 8, 51}, - /*II_2D*/ {0x6, 3, 35, 8, 51}, - /*II_2F*/ {0xe, 0, 0, 8, 56}, - /*II_30*/ {0x5, 9, 15, 8, 61}, - /*II_31*/ {0x5, 11, 17, 8, 61}, - /*II_32*/ {0x5, 15, 9, 8, 61}, - /*II_33*/ {0x5, 17, 11, 8, 61}, - /*II_34*/ {0x6, 1, 33, 8, 61}, - /*II_35*/ {0x6, 3, 35, 8, 61}, - /*II_37*/ {0xe, 0, 0, 8, 66}, - /*II_38*/ {0xf, 9, 15, 8, 71}, - /*II_39*/ {0xf, 11, 17, 8, 71}, - /*II_3A*/ {0xf, 15, 9, 8, 71}, - /*II_3B*/ {0xf, 17, 11, 8, 71}, - /*II_3C*/ {0x10, 1, 33, 8, 71}, - /*II_3D*/ {0x10, 3, 35, 8, 71}, - /*II_3F*/ {0xe, 0, 0, 8, 76}, - /*II_40*/ {0x11, 0, 54, 8, 81}, - /*II_40*/ {0x11, 0, 54, 8, 81}, - /*II_40*/ {0x11, 0, 54, 8, 81}, - /*II_40*/ {0x11, 0, 54, 8, 81}, - /*II_40*/ {0x11, 0, 54, 8, 81}, - /*II_40*/ {0x11, 0, 54, 8, 81}, - /*II_40*/ {0x11, 0, 54, 8, 81}, - /*II_40*/ {0x11, 0, 54, 8, 81}, - /*II_48*/ {0x11, 0, 54, 8, 86}, - /*II_48*/ {0x11, 0, 54, 8, 86}, - /*II_48*/ {0x11, 0, 54, 8, 86}, - /*II_48*/ {0x11, 0, 54, 8, 86}, - /*II_48*/ {0x11, 0, 54, 8, 86}, - /*II_48*/ {0x11, 0, 54, 8, 86}, - /*II_48*/ {0x11, 0, 54, 8, 86}, - /*II_48*/ {0x11, 0, 54, 8, 86}, - /*II_50*/ {0x12, 0, 54, 8, 16}, - /*II_50*/ {0x12, 0, 54, 8, 16}, - /*II_50*/ {0x12, 0, 54, 8, 16}, - /*II_50*/ {0x12, 0, 54, 8, 16}, - /*II_50*/ {0x12, 0, 54, 8, 16}, - /*II_50*/ {0x12, 0, 54, 8, 16}, - /*II_50*/ {0x12, 0, 54, 8, 16}, - /*II_50*/ {0x12, 0, 54, 8, 16}, - /*II_58*/ {0x13, 0, 54, 8, 22}, - /*II_58*/ {0x13, 0, 54, 8, 22}, - /*II_58*/ {0x13, 0, 54, 8, 22}, - /*II_58*/ {0x13, 0, 54, 8, 22}, - /*II_58*/ {0x13, 0, 54, 8, 22}, - /*II_58*/ {0x13, 0, 54, 8, 22}, - /*II_58*/ {0x13, 0, 54, 8, 22}, - /*II_58*/ {0x13, 0, 54, 8, 22}, - /*II_60*/ {0x14, 0, 0, 8, 91}, - /*II_61*/ {0x14, 0, 0, 8, 98}, - /*II_62*/ {0x15, 42, 11, 8, 104}, - /*II_63*/ {0x16, 10, 16, 8, 111}, - /*II_68*/ {0x12, 0, 3, 8, 16}, - /*II_6A*/ {0x18, 0, 5, 8, 16}, - /*II_6C*/ {0x19, 59, 56, 8, 123}, - /*II_6D*/ {0x1a, 59, 56, 8, 123}, - /*II_6E*/ {0x19, 55, 59, 8, 128}, - /*II_6F*/ {0x1a, 55, 59, 8, 128}, - /*II_70*/ {0x12, 0, 40, 13, 134}, - /*II_71*/ {0x12, 0, 40, 13, 138}, - /*II_72*/ {0x12, 0, 40, 13, 143}, - /*II_73*/ {0x12, 0, 40, 13, 147}, - /*II_74*/ {0x12, 0, 40, 13, 152}, - /*II_75*/ {0x12, 0, 40, 13, 156}, - /*II_76*/ {0x12, 0, 40, 13, 161}, - /*II_77*/ {0x12, 0, 40, 13, 166}, - /*II_78*/ {0x12, 0, 40, 13, 170}, - /*II_79*/ {0x12, 0, 40, 13, 174}, - /*II_7A*/ {0x12, 0, 40, 13, 179}, - /*II_7B*/ {0x12, 0, 40, 13, 183}, - /*II_7C*/ {0x12, 0, 40, 13, 188}, - /*II_7D*/ {0x12, 0, 40, 13, 192}, - /*II_7E*/ {0x12, 0, 40, 13, 197}, - /*II_7F*/ {0x12, 0, 40, 13, 202}, - /*II_84*/ {0xf, 9, 15, 8, 206}, - /*II_85*/ {0xf, 11, 17, 8, 206}, - /*II_86*/ {0x5, 9, 15, 8, 212}, - /*II_87*/ {0x5, 11, 17, 8, 212}, - /*II_88*/ {0x1b, 9, 15, 8, 218}, - /*II_89*/ {0x1b, 11, 17, 8, 218}, - /*II_8A*/ {0x1b, 15, 9, 8, 218}, - /*II_8B*/ {0x1b, 17, 11, 8, 218}, - /*II_8C*/ {0x1b, 31, 28, 8, 218}, - /*II_8D*/ {0x1b, 42, 11, 8, 223}, - /*II_8E*/ {0x1b, 28, 31, 8, 218}, - /*II_90*/ {0x6, 35, 54, 8, 212}, - /*II_91*/ {0x6, 35, 54, 8, 212}, - /*II_92*/ {0x6, 35, 54, 8, 212}, - /*II_93*/ {0x6, 35, 54, 8, 212}, - /*II_94*/ {0x6, 35, 54, 8, 212}, - /*II_95*/ {0x6, 35, 54, 8, 212}, - /*II_96*/ {0x6, 35, 54, 8, 212}, - /*II_97*/ {0x6, 35, 54, 8, 212}, - /*II_9A*/ {0xe, 0, 38, 9, 260}, - /*II_9C*/ {0x1d, 0, 0, 8, 270}, - /*II_9D*/ {0x1d, 0, 0, 8, 277}, - /*II_9E*/ {0x10, 0, 0, 8, 283}, - /*II_9F*/ {0x10, 0, 0, 8, 289}, - /*II_A0*/ {0x6, 49, 33, 8, 218}, - /*II_A1*/ {0x6, 50, 35, 8, 218}, - /*II_A2*/ {0x6, 33, 49, 8, 218}, - /*II_A3*/ {0x6, 35, 50, 8, 218}, - /*II_A4*/ {0x1e, 55, 56, 8, 295}, - /*II_A5*/ {0x1f, 55, 56, 8, 295}, - /*II_A6*/ {0x19, 56, 55, 8, 301}, - /*II_A7*/ {0x20, 56, 55, 8, 301}, - /*II_A8*/ {0x10, 1, 33, 8, 206}, - /*II_A9*/ {0x10, 3, 35, 8, 206}, - /*II_AA*/ {0x19, 33, 56, 8, 307}, - /*II_AB*/ {0x20, 35, 56, 8, 307}, - /*II_AC*/ {0x19, 55, 33, 8, 313}, - /*II_AD*/ {0x20, 55, 35, 8, 313}, - /*II_AE*/ {0x19, 33, 56, 8, 319}, - /*II_AF*/ {0x20, 35, 56, 8, 319}, - /*II_B0*/ {0x6, 1, 53, 8, 218}, - /*II_B0*/ {0x6, 1, 53, 8, 218}, - /*II_B0*/ {0x6, 1, 53, 8, 218}, - /*II_B0*/ {0x6, 1, 53, 8, 218}, - /*II_B0*/ {0x6, 1, 53, 8, 218}, - /*II_B0*/ {0x6, 1, 53, 8, 218}, - /*II_B0*/ {0x6, 1, 53, 8, 218}, - /*II_B0*/ {0x6, 1, 53, 8, 218}, - /*II_B8*/ {0x21, 3, 54, 8, 218}, - /*II_B8*/ {0x21, 3, 54, 8, 218}, - /*II_B8*/ {0x21, 3, 54, 8, 218}, - /*II_B8*/ {0x21, 3, 54, 8, 218}, - /*II_B8*/ {0x21, 3, 54, 8, 218}, - /*II_B8*/ {0x21, 3, 54, 8, 218}, - /*II_B8*/ {0x21, 3, 54, 8, 218}, - /*II_B8*/ {0x21, 3, 54, 8, 218}, - /*II_C2*/ {0x12, 0, 2, 10, 325}, - /*II_C3*/ {0x12, 0, 0, 10, 325}, - /*II_C4*/ {0x15, 37, 11, 8, 330}, - /*II_C5*/ {0x15, 37, 11, 8, 335}, - /*II_C8*/ {0x12, 8, 6, 8, 340}, - /*II_C9*/ {0x12, 0, 0, 8, 347}, - /*II_CA*/ {0x22, 0, 2, 10, 354}, - /*II_CB*/ {0x22, 0, 0, 10, 354}, - /*II_CC*/ {0x10, 0, 0, 14, 360}, - /*II_CD*/ {0x10, 0, 1, 14, 367}, - /*II_CE*/ {0xe, 0, 0, 14, 372}, - /*II_CF*/ {0x22, 0, 0, 10, 378}, - /*II_D4*/ {0xe, 0, 1, 8, 384}, - /*II_D5*/ {0xe, 0, 1, 8, 389}, - /*II_D6*/ {0xe, 0, 0, 8, 394}, - /*II_D7*/ {0x23, 0, 57, 8, 400}, - /*II_E0*/ {0x24, 0, 40, 13, 406}, - /*II_E1*/ {0x24, 0, 40, 13, 414}, - /*II_E2*/ {0x24, 0, 40, 13, 421}, - /*II_E4*/ {0x6, 1, 33, 8, 447}, - /*II_E5*/ {0x6, 1, 36, 8, 447}, - /*II_E6*/ {0x10, 33, 1, 8, 451}, - /*II_E7*/ {0x10, 36, 1, 8, 451}, - /*II_E8*/ {0x12, 0, 41, 9, 456}, - /*II_E9*/ {0x12, 0, 41, 12, 462}, - /*II_EA*/ {0xe, 0, 38, 12, 467}, - /*II_EB*/ {0x12, 0, 40, 12, 462}, - /*II_EC*/ {0x6, 59, 33, 8, 447}, - /*II_ED*/ {0x6, 59, 36, 8, 447}, - /*II_EE*/ {0x10, 33, 59, 8, 451}, - /*II_EF*/ {0x10, 36, 59, 8, 451}, - /*II_F1*/ {0x10, 0, 0, 14, 476}, - /*II_F4*/ {0x10, 0, 0, 8, 482}, - /*II_F5*/ {0x10, 0, 0, 8, 487}, - /*II_F8*/ {0x10, 0, 0, 8, 492}, - /*II_F9*/ {0x10, 0, 0, 8, 497}, - /*II_FA*/ {0x10, 0, 0, 8, 502}, - /*II_FB*/ {0x10, 0, 0, 8, 507}, - /*II_FC*/ {0x10, 0, 0, 8, 512}, - /*II_FD*/ {0x10, 0, 0, 8, 517}, - /*II_0F_02*/ {0xf, 16, 11, 8, 522}, - /*II_0F_03*/ {0xf, 16, 11, 8, 527}, - /*II_0F_05*/ {0x26, 0, 0, 27, 532}, - /*II_0F_06*/ {0x26, 0, 0, 8, 541}, - /*II_0F_07*/ {0x26, 0, 0, 27, 547}, - /*II_0F_08*/ {0x26, 0, 0, 8, 555}, - /*II_0F_09*/ {0x26, 0, 0, 8, 561}, - /*II_0F_0B*/ {0x26, 0, 0, 14, 569}, - /*II_0F_0E*/ {0x10, 0, 0, 96, 574}, - /*II_0F_1F*/ {0xf, 0, 17, 8, 581}, - /*II_0F_20*/ {0x27, 29, 14, 8, 218}, - /*II_0F_21*/ {0x27, 30, 14, 8, 218}, - /*II_0F_22*/ {0x27, 14, 29, 8, 218}, - /*II_0F_23*/ {0x27, 14, 30, 8, 218}, - /*II_0F_30*/ {0x26, 0, 0, 8, 586}, - /*II_0F_31*/ {0x26, 0, 0, 8, 593}, - /*II_0F_32*/ {0x26, 0, 0, 8, 600}, - /*II_0F_33*/ {0x26, 0, 0, 8, 607}, - /*II_0F_34*/ {0x26, 0, 0, 27, 614}, - /*II_0F_35*/ {0x26, 0, 0, 27, 624}, - /*II_0F_37*/ {0x28, 0, 0, 8, 633}, - /*II_0F_40*/ {0x29, 17, 11, 31, 641}, - /*II_0F_41*/ {0x29, 17, 11, 31, 648}, - /*II_0F_42*/ {0x29, 17, 11, 31, 656}, - /*II_0F_43*/ {0x29, 17, 11, 31, 663}, - /*II_0F_44*/ {0x29, 17, 11, 31, 671}, - /*II_0F_45*/ {0x29, 17, 11, 31, 678}, - /*II_0F_46*/ {0x29, 17, 11, 31, 686}, - /*II_0F_47*/ {0x29, 17, 11, 31, 694}, - /*II_0F_48*/ {0x29, 17, 11, 31, 701}, - /*II_0F_49*/ {0x29, 17, 11, 31, 708}, - /*II_0F_4A*/ {0x29, 17, 11, 31, 716}, - /*II_0F_4B*/ {0x29, 17, 11, 31, 723}, - /*II_0F_4C*/ {0x29, 17, 11, 31, 731}, - /*II_0F_4D*/ {0x29, 17, 11, 31, 738}, - /*II_0F_4E*/ {0x29, 17, 11, 31, 746}, - /*II_0F_4F*/ {0x29, 17, 11, 31, 754}, - /*II_0F_80*/ {0x26, 0, 41, 13, 134}, - /*II_0F_81*/ {0x26, 0, 41, 13, 138}, - /*II_0F_82*/ {0x26, 0, 41, 13, 143}, - /*II_0F_83*/ {0x26, 0, 41, 13, 147}, - /*II_0F_84*/ {0x26, 0, 41, 13, 152}, - /*II_0F_85*/ {0x26, 0, 41, 13, 156}, - /*II_0F_86*/ {0x26, 0, 41, 13, 161}, - /*II_0F_87*/ {0x26, 0, 41, 13, 166}, - /*II_0F_88*/ {0x26, 0, 41, 13, 170}, - /*II_0F_89*/ {0x26, 0, 41, 13, 174}, - /*II_0F_8A*/ {0x26, 0, 41, 13, 179}, - /*II_0F_8B*/ {0x26, 0, 41, 13, 183}, - /*II_0F_8C*/ {0x26, 0, 41, 13, 188}, - /*II_0F_8D*/ {0x26, 0, 41, 13, 192}, - /*II_0F_8E*/ {0x26, 0, 41, 13, 197}, - /*II_0F_8F*/ {0x26, 0, 41, 13, 202}, - /*II_0F_90*/ {0x29, 0, 15, 8, 761}, - /*II_0F_91*/ {0x29, 0, 15, 8, 767}, - /*II_0F_92*/ {0x29, 0, 15, 8, 774}, - /*II_0F_93*/ {0x29, 0, 15, 8, 780}, - /*II_0F_94*/ {0x29, 0, 15, 8, 787}, - /*II_0F_95*/ {0x29, 0, 15, 8, 793}, - /*II_0F_96*/ {0x29, 0, 15, 8, 800}, - /*II_0F_97*/ {0x29, 0, 15, 8, 807}, - /*II_0F_98*/ {0x29, 0, 15, 8, 813}, - /*II_0F_99*/ {0x29, 0, 15, 8, 819}, - /*II_0F_9A*/ {0x29, 0, 15, 8, 826}, - /*II_0F_9B*/ {0x29, 0, 15, 8, 832}, - /*II_0F_9C*/ {0x29, 0, 15, 8, 839}, - /*II_0F_9D*/ {0x29, 0, 15, 8, 845}, - /*II_0F_9E*/ {0x29, 0, 15, 8, 852}, - /*II_0F_9F*/ {0x29, 0, 15, 8, 859}, - /*II_0F_A0*/ {0x2a, 0, 32, 8, 16}, - /*II_0F_A1*/ {0x2b, 0, 32, 8, 22}, - /*II_0F_A2*/ {0x26, 0, 0, 8, 865}, - /*II_0F_A3*/ {0x29, 11, 17, 8, 872}, - /*II_0F_A8*/ {0x2d, 0, 32, 8, 16}, - /*II_0F_A9*/ {0x2e, 0, 32, 8, 22}, - /*II_0F_AA*/ {0x26, 0, 0, 8, 882}, - /*II_0F_AB*/ {0x2f, 11, 17, 8, 887}, - /*II_0F_AF*/ {0x29, 17, 11, 8, 117}, - /*II_0F_B0*/ {0x2f, 9, 15, 8, 898}, - /*II_0F_B1*/ {0x2f, 11, 17, 8, 898}, - /*II_0F_B2*/ {0x30, 37, 11, 8, 907}, - /*II_0F_B3*/ {0x2f, 11, 17, 8, 912}, - /*II_0F_B4*/ {0x30, 37, 11, 8, 917}, - /*II_0F_B5*/ {0x30, 37, 11, 8, 922}, - /*II_0F_B6*/ {0x29, 15, 11, 8, 927}, - /*II_0F_B7*/ {0x31, 16, 11, 8, 927}, - /*II_0F_B9*/ {0x26, 0, 0, 14, 569}, - /*II_0F_BB*/ {0x2f, 11, 17, 8, 934}, - /*II_0F_BE*/ {0x29, 15, 11, 8, 939}, - /*II_0F_BF*/ {0x31, 16, 11, 8, 939}, - /*II_0F_C0*/ {0x2f, 9, 15, 8, 946}, - /*II_0F_C1*/ {0x2f, 11, 17, 8, 946}, - /*II_0F_C3*/ {0x31, 13, 45, 48, 952}, - /*II_0F_C8*/ {0x32, 0, 54, 8, 960}, - /*II_0F_C8*/ {0x32, 0, 54, 8, 960}, - /*II_0F_C8*/ {0x32, 0, 54, 8, 960}, - /*II_0F_C8*/ {0x32, 0, 54, 8, 960}, - /*II_0F_C8*/ {0x32, 0, 54, 8, 960}, - /*II_0F_C8*/ {0x32, 0, 54, 8, 960}, - /*II_0F_C8*/ {0x32, 0, 54, 8, 960}, - /*II_0F_C8*/ {0x32, 0, 54, 8, 960}, - /*II_80_00*/ {0x33, 1, 15, 8, 11}, - /*II_80_01*/ {0x33, 1, 15, 8, 27}, - /*II_80_02*/ {0x33, 1, 15, 8, 31}, - /*II_80_03*/ {0x33, 1, 15, 8, 36}, - /*II_80_04*/ {0x33, 1, 15, 8, 41}, - /*II_80_05*/ {0x33, 1, 15, 8, 51}, - /*II_80_06*/ {0x33, 1, 15, 8, 61}, - /*II_80_07*/ {0x34, 1, 15, 8, 71}, - /*II_81_00*/ {0x33, 3, 17, 8, 11}, - /*II_81_01*/ {0x33, 3, 17, 8, 27}, - /*II_81_02*/ {0x33, 3, 17, 8, 31}, - /*II_81_03*/ {0x33, 3, 17, 8, 36}, - /*II_81_04*/ {0x33, 3, 17, 8, 41}, - /*II_81_05*/ {0x33, 3, 17, 8, 51}, - /*II_81_06*/ {0x33, 3, 17, 8, 61}, - /*II_81_07*/ {0x34, 3, 17, 8, 71}, - /*II_82_00*/ {0x35, 1, 15, 8, 11}, - /*II_82_01*/ {0x35, 1, 15, 8, 27}, - /*II_82_02*/ {0x35, 1, 15, 8, 31}, - /*II_82_03*/ {0x35, 1, 15, 8, 36}, - /*II_82_04*/ {0x35, 1, 15, 8, 41}, - /*II_82_05*/ {0x35, 1, 15, 8, 51}, - /*II_82_06*/ {0x35, 1, 15, 8, 61}, - /*II_82_07*/ {0x36, 1, 15, 8, 71}, - /*II_83_00*/ {0x33, 5, 17, 8, 11}, - /*II_83_01*/ {0x37, 5, 17, 8, 27}, - /*II_83_02*/ {0x33, 5, 17, 8, 31}, - /*II_83_03*/ {0x33, 5, 17, 8, 36}, - /*II_83_04*/ {0x37, 5, 17, 8, 41}, - /*II_83_05*/ {0x33, 5, 17, 8, 51}, - /*II_83_06*/ {0x37, 5, 17, 8, 61}, - /*II_83_07*/ {0x34, 5, 17, 8, 71}, - /*II_8F_00*/ {0x38, 0, 17, 8, 22}, - /*II_C0_00*/ {0x39, 1, 15, 8, 967}, - /*II_C0_01*/ {0x39, 1, 15, 8, 972}, - /*II_C0_02*/ {0x39, 1, 15, 8, 977}, - /*II_C0_03*/ {0x39, 1, 15, 8, 982}, - /*II_C0_04*/ {0x39, 1, 15, 8, 987}, - /*II_C0_05*/ {0x39, 1, 15, 8, 992}, - /*II_C0_06*/ {0x39, 1, 15, 8, 997}, - /*II_C0_07*/ {0x39, 1, 15, 8, 1002}, - /*II_C1_00*/ {0x39, 1, 17, 8, 967}, - /*II_C1_01*/ {0x39, 1, 17, 8, 972}, - /*II_C1_02*/ {0x39, 1, 17, 8, 977}, - /*II_C1_03*/ {0x39, 1, 17, 8, 982}, - /*II_C1_04*/ {0x39, 1, 17, 8, 987}, - /*II_C1_05*/ {0x39, 1, 17, 8, 992}, - /*II_C1_06*/ {0x39, 1, 17, 8, 997}, - /*II_C1_07*/ {0x39, 1, 17, 8, 1002}, - /*II_C6_00*/ {0x39, 1, 15, 8, 218}, - /*II_C7_00*/ {0x39, 3, 17, 8, 218}, - /*II_D0_00*/ {0x39, 51, 15, 8, 967}, - /*II_D0_01*/ {0x39, 51, 15, 8, 972}, - /*II_D0_02*/ {0x39, 51, 15, 8, 977}, - /*II_D0_03*/ {0x39, 51, 15, 8, 982}, - /*II_D0_04*/ {0x39, 51, 15, 8, 987}, - /*II_D0_05*/ {0x39, 51, 15, 8, 992}, - /*II_D0_06*/ {0x39, 51, 15, 8, 997}, - /*II_D0_07*/ {0x39, 51, 15, 8, 1002}, - /*II_D1_00*/ {0x39, 51, 17, 8, 967}, - /*II_D1_01*/ {0x39, 51, 17, 8, 972}, - /*II_D1_02*/ {0x39, 51, 17, 8, 977}, - /*II_D1_03*/ {0x39, 51, 17, 8, 982}, - /*II_D1_04*/ {0x39, 51, 17, 8, 987}, - /*II_D1_05*/ {0x39, 51, 17, 8, 992}, - /*II_D1_06*/ {0x39, 51, 17, 8, 997}, - /*II_D1_07*/ {0x39, 51, 17, 8, 1002}, - /*II_D2_00*/ {0x39, 52, 15, 8, 967}, - /*II_D2_01*/ {0x39, 52, 15, 8, 972}, - /*II_D2_02*/ {0x39, 52, 15, 8, 977}, - /*II_D2_03*/ {0x39, 52, 15, 8, 982}, - /*II_D2_04*/ {0x39, 52, 15, 8, 987}, - /*II_D2_05*/ {0x39, 52, 15, 8, 992}, - /*II_D2_06*/ {0x39, 52, 15, 8, 997}, - /*II_D2_07*/ {0x39, 52, 15, 8, 1002}, - /*II_D3_00*/ {0x39, 52, 17, 8, 967}, - /*II_D3_01*/ {0x39, 52, 17, 8, 972}, - /*II_D3_02*/ {0x39, 52, 17, 8, 977}, - /*II_D3_03*/ {0x39, 52, 17, 8, 982}, - /*II_D3_04*/ {0x39, 52, 17, 8, 987}, - /*II_D3_05*/ {0x39, 52, 17, 8, 992}, - /*II_D3_06*/ {0x39, 52, 17, 8, 997}, - /*II_D3_07*/ {0x39, 52, 17, 8, 1002}, - /*II_D8_00*/ {0x34, 0, 21, 16, 1007}, - /*II_D8_01*/ {0x34, 0, 21, 16, 1013}, - /*II_D8_02*/ {0x34, 0, 21, 16, 1019}, - /*II_D8_03*/ {0x34, 0, 21, 16, 1025}, - /*II_D8_04*/ {0x34, 0, 21, 16, 1032}, - /*II_D8_05*/ {0x34, 0, 21, 16, 1038}, - /*II_D8_06*/ {0x34, 0, 21, 16, 1045}, - /*II_D8_07*/ {0x34, 0, 21, 16, 1051}, - /*II_D8_C0*/ {0x3a, 0, 62, 16, 1007}, - /*II_D8_C0*/ {0x3a, 0, 62, 16, 1007}, - /*II_D8_C0*/ {0x3a, 0, 62, 16, 1007}, - /*II_D8_C0*/ {0x3a, 0, 62, 16, 1007}, - /*II_D8_C0*/ {0x3a, 0, 62, 16, 1007}, - /*II_D8_C0*/ {0x3a, 0, 62, 16, 1007}, - /*II_D8_C0*/ {0x3a, 0, 62, 16, 1007}, - /*II_D8_C0*/ {0x3a, 0, 62, 16, 1007}, - /*II_D8_C8*/ {0x3a, 0, 62, 16, 1013}, - /*II_D8_C8*/ {0x3a, 0, 62, 16, 1013}, - /*II_D8_C8*/ {0x3a, 0, 62, 16, 1013}, - /*II_D8_C8*/ {0x3a, 0, 62, 16, 1013}, - /*II_D8_C8*/ {0x3a, 0, 62, 16, 1013}, - /*II_D8_C8*/ {0x3a, 0, 62, 16, 1013}, - /*II_D8_C8*/ {0x3a, 0, 62, 16, 1013}, - /*II_D8_C8*/ {0x3a, 0, 62, 16, 1013}, - /*II_D8_D0*/ {0x3a, 0, 61, 16, 1019}, - /*II_D8_D0*/ {0x3a, 0, 61, 16, 1019}, - /*II_D8_D0*/ {0x3a, 0, 61, 16, 1019}, - /*II_D8_D0*/ {0x3a, 0, 61, 16, 1019}, - /*II_D8_D0*/ {0x3a, 0, 61, 16, 1019}, - /*II_D8_D0*/ {0x3a, 0, 61, 16, 1019}, - /*II_D8_D0*/ {0x3a, 0, 61, 16, 1019}, - /*II_D8_D0*/ {0x3a, 0, 61, 16, 1019}, - /*II_D8_D8*/ {0x3a, 0, 61, 16, 1025}, - /*II_D8_D9*/ {0x3a, 0, 0, 16, 1025}, - /*II_D8_D8*/ {0x3a, 0, 61, 16, 1025}, - /*II_D8_D8*/ {0x3a, 0, 61, 16, 1025}, - /*II_D8_D8*/ {0x3a, 0, 61, 16, 1025}, - /*II_D8_D8*/ {0x3a, 0, 61, 16, 1025}, - /*II_D8_D8*/ {0x3a, 0, 61, 16, 1025}, - /*II_D8_D8*/ {0x3a, 0, 61, 16, 1025}, - /*II_D8_E0*/ {0x3a, 0, 62, 16, 1032}, - /*II_D8_E0*/ {0x3a, 0, 62, 16, 1032}, - /*II_D8_E0*/ {0x3a, 0, 62, 16, 1032}, - /*II_D8_E0*/ {0x3a, 0, 62, 16, 1032}, - /*II_D8_E0*/ {0x3a, 0, 62, 16, 1032}, - /*II_D8_E0*/ {0x3a, 0, 62, 16, 1032}, - /*II_D8_E0*/ {0x3a, 0, 62, 16, 1032}, - /*II_D8_E0*/ {0x3a, 0, 62, 16, 1032}, - /*II_D8_E8*/ {0x3a, 0, 62, 16, 1038}, - /*II_D8_E8*/ {0x3a, 0, 62, 16, 1038}, - /*II_D8_E8*/ {0x3a, 0, 62, 16, 1038}, - /*II_D8_E8*/ {0x3a, 0, 62, 16, 1038}, - /*II_D8_E8*/ {0x3a, 0, 62, 16, 1038}, - /*II_D8_E8*/ {0x3a, 0, 62, 16, 1038}, - /*II_D8_E8*/ {0x3a, 0, 62, 16, 1038}, - /*II_D8_E8*/ {0x3a, 0, 62, 16, 1038}, - /*II_D8_F0*/ {0x3a, 0, 62, 16, 1045}, - /*II_D8_F0*/ {0x3a, 0, 62, 16, 1045}, - /*II_D8_F0*/ {0x3a, 0, 62, 16, 1045}, - /*II_D8_F0*/ {0x3a, 0, 62, 16, 1045}, - /*II_D8_F0*/ {0x3a, 0, 62, 16, 1045}, - /*II_D8_F0*/ {0x3a, 0, 62, 16, 1045}, - /*II_D8_F0*/ {0x3a, 0, 62, 16, 1045}, - /*II_D8_F0*/ {0x3a, 0, 62, 16, 1045}, - /*II_D8_F8*/ {0x3a, 0, 62, 16, 1051}, - /*II_D8_F8*/ {0x3a, 0, 62, 16, 1051}, - /*II_D8_F8*/ {0x3a, 0, 62, 16, 1051}, - /*II_D8_F8*/ {0x3a, 0, 62, 16, 1051}, - /*II_D8_F8*/ {0x3a, 0, 62, 16, 1051}, - /*II_D8_F8*/ {0x3a, 0, 62, 16, 1051}, - /*II_D8_F8*/ {0x3a, 0, 62, 16, 1051}, - /*II_D8_F8*/ {0x3a, 0, 62, 16, 1051}, - /*II_D9_00*/ {0x34, 0, 21, 16, 1058}, - /*II_D9_02*/ {0x34, 0, 21, 16, 1063}, - /*II_D9_03*/ {0x34, 0, 21, 16, 1068}, - /*II_D9_04*/ {0x34, 0, 42, 16, 1074}, - /*II_D9_05*/ {0x34, 0, 42, 16, 1082}, - /*II_D9_C0*/ {0x3a, 0, 61, 16, 1058}, - /*II_D9_C0*/ {0x3a, 0, 61, 16, 1058}, - /*II_D9_C0*/ {0x3a, 0, 61, 16, 1058}, - /*II_D9_C0*/ {0x3a, 0, 61, 16, 1058}, - /*II_D9_C0*/ {0x3a, 0, 61, 16, 1058}, - /*II_D9_C0*/ {0x3a, 0, 61, 16, 1058}, - /*II_D9_C0*/ {0x3a, 0, 61, 16, 1058}, - /*II_D9_C0*/ {0x3a, 0, 61, 16, 1058}, - /*II_D9_C8*/ {0x3a, 0, 61, 16, 1089}, - /*II_D9_C9*/ {0x3a, 0, 0, 16, 1089}, - /*II_D9_C8*/ {0x3a, 0, 61, 16, 1089}, - /*II_D9_C8*/ {0x3a, 0, 61, 16, 1089}, - /*II_D9_C8*/ {0x3a, 0, 61, 16, 1089}, - /*II_D9_C8*/ {0x3a, 0, 61, 16, 1089}, - /*II_D9_C8*/ {0x3a, 0, 61, 16, 1089}, - /*II_D9_C8*/ {0x3a, 0, 61, 16, 1089}, - /*II_D9_D0*/ {0x3a, 0, 0, 16, 1095}, - /*II_D9_E0*/ {0x3a, 0, 0, 16, 1101}, - /*II_D9_E1*/ {0x3a, 0, 0, 16, 1107}, - /*II_D9_E4*/ {0x3a, 0, 0, 16, 1113}, - /*II_D9_E5*/ {0x3a, 0, 0, 16, 1119}, - /*II_D9_E8*/ {0x3a, 0, 0, 16, 1125}, - /*II_D9_E9*/ {0x3a, 0, 0, 16, 1131}, - /*II_D9_EA*/ {0x3a, 0, 0, 16, 1139}, - /*II_D9_EB*/ {0x3a, 0, 0, 16, 1147}, - /*II_D9_EC*/ {0x3a, 0, 0, 16, 1154}, - /*II_D9_ED*/ {0x3a, 0, 0, 16, 1162}, - /*II_D9_EE*/ {0x3a, 0, 0, 16, 1170}, - /*II_D9_F0*/ {0x3a, 0, 0, 16, 1176}, - /*II_D9_F1*/ {0x3a, 0, 0, 16, 1183}, - /*II_D9_F2*/ {0x3a, 0, 0, 16, 1190}, - /*II_D9_F3*/ {0x3a, 0, 0, 16, 1197}, - /*II_D9_F4*/ {0x3a, 0, 0, 16, 1205}, - /*II_D9_F5*/ {0x3a, 0, 0, 16, 1214}, - /*II_D9_F6*/ {0x3a, 0, 0, 16, 1222}, - /*II_D9_F7*/ {0x3a, 0, 0, 16, 1231}, - /*II_D9_F8*/ {0x3a, 0, 0, 16, 1240}, - /*II_D9_F9*/ {0x3a, 0, 0, 16, 1247}, - /*II_D9_FA*/ {0x3a, 0, 0, 16, 1256}, - /*II_D9_FB*/ {0x3a, 0, 0, 16, 1263}, - /*II_D9_FC*/ {0x3a, 0, 0, 16, 1272}, - /*II_D9_FD*/ {0x3a, 0, 0, 16, 1281}, - /*II_D9_FE*/ {0x3a, 0, 0, 16, 1289}, - /*II_D9_FF*/ {0x3a, 0, 0, 16, 1295}, - /*II_DA_00*/ {0x34, 0, 21, 16, 1301}, - /*II_DA_01*/ {0x34, 0, 21, 16, 1308}, - /*II_DA_02*/ {0x34, 0, 21, 16, 1315}, - /*II_DA_03*/ {0x34, 0, 21, 16, 1322}, - /*II_DA_04*/ {0x34, 0, 21, 16, 1330}, - /*II_DA_05*/ {0x34, 0, 21, 16, 1337}, - /*II_DA_06*/ {0x34, 0, 21, 16, 1345}, - /*II_DA_07*/ {0x34, 0, 21, 16, 1352}, - /*II_DA_C0*/ {0x3b, 0, 62, 24, 1360}, - /*II_DA_C0*/ {0x3b, 0, 62, 24, 1360}, - /*II_DA_C0*/ {0x3b, 0, 62, 24, 1360}, - /*II_DA_C0*/ {0x3b, 0, 62, 24, 1360}, - /*II_DA_C0*/ {0x3b, 0, 62, 24, 1360}, - /*II_DA_C0*/ {0x3b, 0, 62, 24, 1360}, - /*II_DA_C0*/ {0x3b, 0, 62, 24, 1360}, - /*II_DA_C0*/ {0x3b, 0, 62, 24, 1360}, - /*II_DA_C8*/ {0x3b, 0, 62, 24, 1368}, - /*II_DA_C8*/ {0x3b, 0, 62, 24, 1368}, - /*II_DA_C8*/ {0x3b, 0, 62, 24, 1368}, - /*II_DA_C8*/ {0x3b, 0, 62, 24, 1368}, - /*II_DA_C8*/ {0x3b, 0, 62, 24, 1368}, - /*II_DA_C8*/ {0x3b, 0, 62, 24, 1368}, - /*II_DA_C8*/ {0x3b, 0, 62, 24, 1368}, - /*II_DA_C8*/ {0x3b, 0, 62, 24, 1368}, - /*II_DA_D0*/ {0x3b, 0, 62, 24, 1376}, - /*II_DA_D0*/ {0x3b, 0, 62, 24, 1376}, - /*II_DA_D0*/ {0x3b, 0, 62, 24, 1376}, - /*II_DA_D0*/ {0x3b, 0, 62, 24, 1376}, - /*II_DA_D0*/ {0x3b, 0, 62, 24, 1376}, - /*II_DA_D0*/ {0x3b, 0, 62, 24, 1376}, - /*II_DA_D0*/ {0x3b, 0, 62, 24, 1376}, - /*II_DA_D0*/ {0x3b, 0, 62, 24, 1376}, - /*II_DA_D8*/ {0x3b, 0, 62, 24, 1385}, - /*II_DA_D8*/ {0x3b, 0, 62, 24, 1385}, - /*II_DA_D8*/ {0x3b, 0, 62, 24, 1385}, - /*II_DA_D8*/ {0x3b, 0, 62, 24, 1385}, - /*II_DA_D8*/ {0x3b, 0, 62, 24, 1385}, - /*II_DA_D8*/ {0x3b, 0, 62, 24, 1385}, - /*II_DA_D8*/ {0x3b, 0, 62, 24, 1385}, - /*II_DA_D8*/ {0x3b, 0, 62, 24, 1385}, - /*II_DA_E9*/ {0x3a, 0, 0, 16, 1393}, - /*II_DB_00*/ {0x34, 0, 21, 16, 1402}, - /*II_DB_01*/ {0x3c, 0, 21, 56, 1408}, - /*II_DB_02*/ {0x34, 0, 21, 16, 1416}, - /*II_DB_03*/ {0x34, 0, 21, 16, 1422}, - /*II_DB_05*/ {0x34, 0, 23, 16, 1058}, - /*II_DB_07*/ {0x34, 0, 23, 16, 1068}, - /*II_DB_C0*/ {0x3b, 0, 62, 24, 1429}, - /*II_DB_C0*/ {0x3b, 0, 62, 24, 1429}, - /*II_DB_C0*/ {0x3b, 0, 62, 24, 1429}, - /*II_DB_C0*/ {0x3b, 0, 62, 24, 1429}, - /*II_DB_C0*/ {0x3b, 0, 62, 24, 1429}, - /*II_DB_C0*/ {0x3b, 0, 62, 24, 1429}, - /*II_DB_C0*/ {0x3b, 0, 62, 24, 1429}, - /*II_DB_C0*/ {0x3b, 0, 62, 24, 1429}, - /*II_DB_C8*/ {0x3b, 0, 62, 24, 1438}, - /*II_DB_C8*/ {0x3b, 0, 62, 24, 1438}, - /*II_DB_C8*/ {0x3b, 0, 62, 24, 1438}, - /*II_DB_C8*/ {0x3b, 0, 62, 24, 1438}, - /*II_DB_C8*/ {0x3b, 0, 62, 24, 1438}, - /*II_DB_C8*/ {0x3b, 0, 62, 24, 1438}, - /*II_DB_C8*/ {0x3b, 0, 62, 24, 1438}, - /*II_DB_C8*/ {0x3b, 0, 62, 24, 1438}, - /*II_DB_D0*/ {0x3b, 0, 62, 24, 1447}, - /*II_DB_D0*/ {0x3b, 0, 62, 24, 1447}, - /*II_DB_D0*/ {0x3b, 0, 62, 24, 1447}, - /*II_DB_D0*/ {0x3b, 0, 62, 24, 1447}, - /*II_DB_D0*/ {0x3b, 0, 62, 24, 1447}, - /*II_DB_D0*/ {0x3b, 0, 62, 24, 1447}, - /*II_DB_D0*/ {0x3b, 0, 62, 24, 1447}, - /*II_DB_D0*/ {0x3b, 0, 62, 24, 1447}, - /*II_DB_D8*/ {0x3b, 0, 62, 24, 1457}, - /*II_DB_D8*/ {0x3b, 0, 62, 24, 1457}, - /*II_DB_D8*/ {0x3b, 0, 62, 24, 1457}, - /*II_DB_D8*/ {0x3b, 0, 62, 24, 1457}, - /*II_DB_D8*/ {0x3b, 0, 62, 24, 1457}, - /*II_DB_D8*/ {0x3b, 0, 62, 24, 1457}, - /*II_DB_D8*/ {0x3b, 0, 62, 24, 1457}, - /*II_DB_D8*/ {0x3b, 0, 62, 24, 1457}, - /*II_DB_E0*/ {0x3a, 0, 0, 16, 1466}, - /*II_DB_E1*/ {0x3a, 0, 0, 16, 1472}, - /*II_DB_E4*/ {0x3a, 0, 0, 16, 1480}, - /*II_DB_E8*/ {0x3b, 0, 62, 16, 1488}, - /*II_DB_E8*/ {0x3b, 0, 62, 16, 1488}, - /*II_DB_E8*/ {0x3b, 0, 62, 16, 1488}, - /*II_DB_E8*/ {0x3b, 0, 62, 16, 1488}, - /*II_DB_E8*/ {0x3b, 0, 62, 16, 1488}, - /*II_DB_E8*/ {0x3b, 0, 62, 16, 1488}, - /*II_DB_E8*/ {0x3b, 0, 62, 16, 1488}, - /*II_DB_E8*/ {0x3b, 0, 62, 16, 1488}, - /*II_DB_F0*/ {0x3b, 0, 62, 24, 1496}, - /*II_DB_F0*/ {0x3b, 0, 62, 24, 1496}, - /*II_DB_F0*/ {0x3b, 0, 62, 24, 1496}, - /*II_DB_F0*/ {0x3b, 0, 62, 24, 1496}, - /*II_DB_F0*/ {0x3b, 0, 62, 24, 1496}, - /*II_DB_F0*/ {0x3b, 0, 62, 24, 1496}, - /*II_DB_F0*/ {0x3b, 0, 62, 24, 1496}, - /*II_DB_F0*/ {0x3b, 0, 62, 24, 1496}, - /*II_DC_00*/ {0x34, 0, 22, 16, 1007}, - /*II_DC_01*/ {0x34, 0, 22, 16, 1013}, - /*II_DC_02*/ {0x34, 0, 22, 16, 1019}, - /*II_DC_03*/ {0x34, 0, 22, 16, 1025}, - /*II_DC_04*/ {0x34, 0, 22, 16, 1032}, - /*II_DC_05*/ {0x34, 0, 22, 16, 1038}, - /*II_DC_06*/ {0x34, 0, 22, 16, 1045}, - /*II_DC_07*/ {0x34, 0, 22, 16, 1051}, - /*II_DC_C0*/ {0x3a, 0, 63, 16, 1007}, - /*II_DC_C0*/ {0x3a, 0, 63, 16, 1007}, - /*II_DC_C0*/ {0x3a, 0, 63, 16, 1007}, - /*II_DC_C0*/ {0x3a, 0, 63, 16, 1007}, - /*II_DC_C0*/ {0x3a, 0, 63, 16, 1007}, - /*II_DC_C0*/ {0x3a, 0, 63, 16, 1007}, - /*II_DC_C0*/ {0x3a, 0, 63, 16, 1007}, - /*II_DC_C0*/ {0x3a, 0, 63, 16, 1007}, - /*II_DC_C8*/ {0x3a, 0, 63, 16, 1013}, - /*II_DC_C8*/ {0x3a, 0, 63, 16, 1013}, - /*II_DC_C8*/ {0x3a, 0, 63, 16, 1013}, - /*II_DC_C8*/ {0x3a, 0, 63, 16, 1013}, - /*II_DC_C8*/ {0x3a, 0, 63, 16, 1013}, - /*II_DC_C8*/ {0x3a, 0, 63, 16, 1013}, - /*II_DC_C8*/ {0x3a, 0, 63, 16, 1013}, - /*II_DC_C8*/ {0x3a, 0, 63, 16, 1013}, - /*II_DC_E0*/ {0x3a, 0, 63, 16, 1038}, - /*II_DC_E0*/ {0x3a, 0, 63, 16, 1038}, - /*II_DC_E0*/ {0x3a, 0, 63, 16, 1038}, - /*II_DC_E0*/ {0x3a, 0, 63, 16, 1038}, - /*II_DC_E0*/ {0x3a, 0, 63, 16, 1038}, - /*II_DC_E0*/ {0x3a, 0, 63, 16, 1038}, - /*II_DC_E0*/ {0x3a, 0, 63, 16, 1038}, - /*II_DC_E0*/ {0x3a, 0, 63, 16, 1038}, - /*II_DC_E8*/ {0x3a, 0, 63, 16, 1032}, - /*II_DC_E8*/ {0x3a, 0, 63, 16, 1032}, - /*II_DC_E8*/ {0x3a, 0, 63, 16, 1032}, - /*II_DC_E8*/ {0x3a, 0, 63, 16, 1032}, - /*II_DC_E8*/ {0x3a, 0, 63, 16, 1032}, - /*II_DC_E8*/ {0x3a, 0, 63, 16, 1032}, - /*II_DC_E8*/ {0x3a, 0, 63, 16, 1032}, - /*II_DC_E8*/ {0x3a, 0, 63, 16, 1032}, - /*II_DC_F0*/ {0x3a, 0, 63, 16, 1051}, - /*II_DC_F0*/ {0x3a, 0, 63, 16, 1051}, - /*II_DC_F0*/ {0x3a, 0, 63, 16, 1051}, - /*II_DC_F0*/ {0x3a, 0, 63, 16, 1051}, - /*II_DC_F0*/ {0x3a, 0, 63, 16, 1051}, - /*II_DC_F0*/ {0x3a, 0, 63, 16, 1051}, - /*II_DC_F0*/ {0x3a, 0, 63, 16, 1051}, - /*II_DC_F0*/ {0x3a, 0, 63, 16, 1051}, - /*II_DC_F8*/ {0x3a, 0, 63, 16, 1045}, - /*II_DC_F8*/ {0x3a, 0, 63, 16, 1045}, - /*II_DC_F8*/ {0x3a, 0, 63, 16, 1045}, - /*II_DC_F8*/ {0x3a, 0, 63, 16, 1045}, - /*II_DC_F8*/ {0x3a, 0, 63, 16, 1045}, - /*II_DC_F8*/ {0x3a, 0, 63, 16, 1045}, - /*II_DC_F8*/ {0x3a, 0, 63, 16, 1045}, - /*II_DC_F8*/ {0x3a, 0, 63, 16, 1045}, - /*II_DD_00*/ {0x34, 0, 22, 16, 1058}, - /*II_DD_01*/ {0x3c, 0, 22, 56, 1408}, - /*II_DD_02*/ {0x34, 0, 22, 16, 1063}, - /*II_DD_03*/ {0x34, 0, 22, 16, 1068}, - /*II_DD_04*/ {0x34, 0, 42, 16, 1503}, - /*II_DD_C0*/ {0x3a, 0, 61, 16, 1511}, - /*II_DD_C0*/ {0x3a, 0, 61, 16, 1511}, - /*II_DD_C0*/ {0x3a, 0, 61, 16, 1511}, - /*II_DD_C0*/ {0x3a, 0, 61, 16, 1511}, - /*II_DD_C0*/ {0x3a, 0, 61, 16, 1511}, - /*II_DD_C0*/ {0x3a, 0, 61, 16, 1511}, - /*II_DD_C0*/ {0x3a, 0, 61, 16, 1511}, - /*II_DD_C0*/ {0x3a, 0, 61, 16, 1511}, - /*II_DD_D0*/ {0x3a, 0, 61, 16, 1063}, - /*II_DD_D0*/ {0x3a, 0, 61, 16, 1063}, - /*II_DD_D0*/ {0x3a, 0, 61, 16, 1063}, - /*II_DD_D0*/ {0x3a, 0, 61, 16, 1063}, - /*II_DD_D0*/ {0x3a, 0, 61, 16, 1063}, - /*II_DD_D0*/ {0x3a, 0, 61, 16, 1063}, - /*II_DD_D0*/ {0x3a, 0, 61, 16, 1063}, - /*II_DD_D0*/ {0x3a, 0, 61, 16, 1063}, - /*II_DD_D8*/ {0x3a, 0, 61, 16, 1068}, - /*II_DD_D8*/ {0x3a, 0, 61, 16, 1068}, - /*II_DD_D8*/ {0x3a, 0, 61, 16, 1068}, - /*II_DD_D8*/ {0x3a, 0, 61, 16, 1068}, - /*II_DD_D8*/ {0x3a, 0, 61, 16, 1068}, - /*II_DD_D8*/ {0x3a, 0, 61, 16, 1068}, - /*II_DD_D8*/ {0x3a, 0, 61, 16, 1068}, - /*II_DD_D8*/ {0x3a, 0, 61, 16, 1068}, - /*II_DD_E0*/ {0x3a, 0, 63, 16, 1518}, - /*II_DD_E1*/ {0x3a, 0, 0, 16, 1518}, - /*II_DD_E0*/ {0x3a, 0, 63, 16, 1518}, - /*II_DD_E0*/ {0x3a, 0, 63, 16, 1518}, - /*II_DD_E0*/ {0x3a, 0, 63, 16, 1518}, - /*II_DD_E0*/ {0x3a, 0, 63, 16, 1518}, - /*II_DD_E0*/ {0x3a, 0, 63, 16, 1518}, - /*II_DD_E0*/ {0x3a, 0, 63, 16, 1518}, - /*II_DD_E8*/ {0x3a, 0, 61, 16, 1525}, - /*II_DD_E9*/ {0x3a, 0, 0, 16, 1525}, - /*II_DD_E8*/ {0x3a, 0, 61, 16, 1525}, - /*II_DD_E8*/ {0x3a, 0, 61, 16, 1525}, - /*II_DD_E8*/ {0x3a, 0, 61, 16, 1525}, - /*II_DD_E8*/ {0x3a, 0, 61, 16, 1525}, - /*II_DD_E8*/ {0x3a, 0, 61, 16, 1525}, - /*II_DD_E8*/ {0x3a, 0, 61, 16, 1525}, - /*II_DE_00*/ {0x34, 0, 20, 16, 1301}, - /*II_DE_01*/ {0x34, 0, 20, 16, 1308}, - /*II_DE_02*/ {0x34, 0, 20, 16, 1315}, - /*II_DE_03*/ {0x34, 0, 20, 16, 1322}, - /*II_DE_04*/ {0x34, 0, 20, 16, 1330}, - /*II_DE_05*/ {0x34, 0, 20, 16, 1337}, - /*II_DE_06*/ {0x34, 0, 20, 16, 1345}, - /*II_DE_07*/ {0x34, 0, 20, 16, 1352}, - /*II_DE_C0*/ {0x3a, 0, 63, 16, 1533}, - /*II_DE_C1*/ {0x3a, 0, 0, 16, 1533}, - /*II_DE_C0*/ {0x3a, 0, 63, 16, 1533}, - /*II_DE_C0*/ {0x3a, 0, 63, 16, 1533}, - /*II_DE_C0*/ {0x3a, 0, 63, 16, 1533}, - /*II_DE_C0*/ {0x3a, 0, 63, 16, 1533}, - /*II_DE_C0*/ {0x3a, 0, 63, 16, 1533}, - /*II_DE_C0*/ {0x3a, 0, 63, 16, 1533}, - /*II_DE_C8*/ {0x3a, 0, 63, 16, 1540}, - /*II_DE_C9*/ {0x3a, 0, 0, 16, 1540}, - /*II_DE_C8*/ {0x3a, 0, 63, 16, 1540}, - /*II_DE_C8*/ {0x3a, 0, 63, 16, 1540}, - /*II_DE_C8*/ {0x3a, 0, 63, 16, 1540}, - /*II_DE_C8*/ {0x3a, 0, 63, 16, 1540}, - /*II_DE_C8*/ {0x3a, 0, 63, 16, 1540}, - /*II_DE_C8*/ {0x3a, 0, 63, 16, 1540}, - /*II_DE_D9*/ {0x3a, 0, 0, 16, 1547}, - /*II_DE_E0*/ {0x3a, 0, 63, 16, 1555}, - /*II_DE_E1*/ {0x3a, 0, 0, 16, 1555}, - /*II_DE_E0*/ {0x3a, 0, 63, 16, 1555}, - /*II_DE_E0*/ {0x3a, 0, 63, 16, 1555}, - /*II_DE_E0*/ {0x3a, 0, 63, 16, 1555}, - /*II_DE_E0*/ {0x3a, 0, 63, 16, 1555}, - /*II_DE_E0*/ {0x3a, 0, 63, 16, 1555}, - /*II_DE_E0*/ {0x3a, 0, 63, 16, 1555}, - /*II_DE_E8*/ {0x3a, 0, 63, 16, 1563}, - /*II_DE_E9*/ {0x3a, 0, 0, 16, 1563}, - /*II_DE_E8*/ {0x3a, 0, 63, 16, 1563}, - /*II_DE_E8*/ {0x3a, 0, 63, 16, 1563}, - /*II_DE_E8*/ {0x3a, 0, 63, 16, 1563}, - /*II_DE_E8*/ {0x3a, 0, 63, 16, 1563}, - /*II_DE_E8*/ {0x3a, 0, 63, 16, 1563}, - /*II_DE_E8*/ {0x3a, 0, 63, 16, 1563}, - /*II_DE_F0*/ {0x3a, 0, 63, 16, 1570}, - /*II_DE_F1*/ {0x3a, 0, 0, 16, 1570}, - /*II_DE_F0*/ {0x3a, 0, 63, 16, 1570}, - /*II_DE_F0*/ {0x3a, 0, 63, 16, 1570}, - /*II_DE_F0*/ {0x3a, 0, 63, 16, 1570}, - /*II_DE_F0*/ {0x3a, 0, 63, 16, 1570}, - /*II_DE_F0*/ {0x3a, 0, 63, 16, 1570}, - /*II_DE_F0*/ {0x3a, 0, 63, 16, 1570}, - /*II_DE_F8*/ {0x3a, 0, 63, 16, 1578}, - /*II_DE_F9*/ {0x3a, 0, 0, 16, 1578}, - /*II_DE_F8*/ {0x3a, 0, 63, 16, 1578}, - /*II_DE_F8*/ {0x3a, 0, 63, 16, 1578}, - /*II_DE_F8*/ {0x3a, 0, 63, 16, 1578}, - /*II_DE_F8*/ {0x3a, 0, 63, 16, 1578}, - /*II_DE_F8*/ {0x3a, 0, 63, 16, 1578}, - /*II_DE_F8*/ {0x3a, 0, 63, 16, 1578}, - /*II_DF_00*/ {0x34, 0, 20, 16, 1402}, - /*II_DF_01*/ {0x3c, 0, 20, 56, 1408}, - /*II_DF_02*/ {0x34, 0, 20, 16, 1416}, - /*II_DF_03*/ {0x34, 0, 20, 16, 1422}, - /*II_DF_04*/ {0x34, 0, 23, 16, 1585}, - /*II_DF_05*/ {0x34, 0, 22, 16, 1402}, - /*II_DF_06*/ {0x34, 0, 23, 16, 1591}, - /*II_DF_07*/ {0x34, 0, 22, 16, 1422}, - /*II_DF_E8*/ {0x3b, 0, 62, 16, 1598}, - /*II_DF_E8*/ {0x3b, 0, 62, 16, 1598}, - /*II_DF_E8*/ {0x3b, 0, 62, 16, 1598}, - /*II_DF_E8*/ {0x3b, 0, 62, 16, 1598}, - /*II_DF_E8*/ {0x3b, 0, 62, 16, 1598}, - /*II_DF_E8*/ {0x3b, 0, 62, 16, 1598}, - /*II_DF_E8*/ {0x3b, 0, 62, 16, 1598}, - /*II_DF_E8*/ {0x3b, 0, 62, 16, 1598}, - /*II_DF_F0*/ {0x3b, 0, 62, 16, 1607}, - /*II_DF_F0*/ {0x3b, 0, 62, 16, 1607}, - /*II_DF_F0*/ {0x3b, 0, 62, 16, 1607}, - /*II_DF_F0*/ {0x3b, 0, 62, 16, 1607}, - /*II_DF_F0*/ {0x3b, 0, 62, 16, 1607}, - /*II_DF_F0*/ {0x3b, 0, 62, 16, 1607}, - /*II_DF_F0*/ {0x3b, 0, 62, 16, 1607}, - /*II_DF_F0*/ {0x3b, 0, 62, 16, 1607}, - /*II_F6_00*/ {0x34, 1, 15, 8, 206}, - /*II_F6_02*/ {0x33, 0, 15, 8, 1615}, - /*II_F6_03*/ {0x33, 0, 15, 8, 1620}, - /*II_F6_04*/ {0x39, 0, 15, 8, 1625}, - /*II_F6_05*/ {0x39, 0, 15, 8, 117}, - /*II_F6_06*/ {0x39, 0, 15, 8, 1630}, - /*II_F6_07*/ {0x39, 0, 15, 8, 1635}, - /*II_F7_00*/ {0x34, 3, 17, 8, 206}, - /*II_F7_02*/ {0x33, 0, 17, 8, 1615}, - /*II_F7_03*/ {0x33, 0, 17, 8, 1620}, - /*II_F7_04*/ {0x39, 0, 17, 8, 1625}, - /*II_F7_05*/ {0x39, 0, 17, 8, 117}, - /*II_F7_06*/ {0x39, 0, 17, 8, 1630}, - /*II_F7_07*/ {0x39, 0, 17, 8, 1635}, - /*II_FE_00*/ {0x33, 0, 15, 8, 81}, - /*II_FE_01*/ {0x33, 0, 15, 8, 86}, - /*II_FF_00*/ {0x33, 0, 17, 8, 81}, - /*II_FF_01*/ {0x33, 0, 17, 8, 86}, - /*II_FF_02*/ {0x3d, 0, 17, 9, 456}, - /*II_FF_03*/ {0x3e, 0, 37, 9, 260}, - /*II_FF_04*/ {0x3d, 0, 17, 12, 462}, - /*II_FF_05*/ {0x3e, 0, 37, 12, 467}, - /*II_FF_06*/ {0x3d, 0, 17, 8, 16}, - /*II_0F_00_00*/ {0x34, 0, 17, 8, 1641}, - /*II_0F_00_01*/ {0x34, 0, 16, 8, 1647}, - /*II_0F_00_02*/ {0x34, 0, 16, 8, 1652}, - /*II_0F_00_03*/ {0x3c, 0, 16, 8, 1658}, - /*II_0F_00_04*/ {0x34, 0, 16, 8, 1663}, - /*II_0F_00_05*/ {0x34, 0, 16, 8, 1669}, - /*II_0F_01_00*/ {0x3d, 0, 39, 8, 1675}, - /*II_0F_01_01*/ {0x3d, 0, 39, 8, 1681}, - /*II_0F_01_02*/ {0x3d, 0, 39, 8, 1687}, - /*II_0F_01_03*/ {0x3d, 0, 39, 8, 1693}, - /*II_0F_01_04*/ {0x3f, 0, 28, 8, 1699}, - /*II_0F_01_06*/ {0x40, 0, 16, 8, 1705}, - /*II_0F_01_07*/ {0x3c, 0, 42, 8, 1711}, - /*II_0F_01_C1*/ {0x3b, 0, 0, 112, 1719}, - /*II_0F_01_C2*/ {0x3b, 0, 0, 112, 1727}, - /*II_0F_01_C3*/ {0x3b, 0, 0, 112, 1737}, - /*II_0F_01_C4*/ {0x3b, 0, 0, 112, 1747}, - /*II_0F_01_C8*/ {0x3b, 0, 0, 8, 1755}, - /*II_0F_01_C9*/ {0x3b, 0, 0, 8, 1764}, - /*II_0F_01_D0*/ {0x26, 0, 0, 8, 1771}, - /*II_0F_01_D1*/ {0x26, 0, 0, 8, 1779}, - /*II_0F_01_D4*/ {0x3b, 0, 0, 112, 1787}, - /*II_0F_01_D8*/ {0x3c, 0, 58, 120, 1795}, - /*II_0F_01_D9*/ {0x3b, 0, 0, 120, 1802}, - /*II_0F_01_DA*/ {0x3b, 0, 58, 120, 1811}, - /*II_0F_01_DB*/ {0x3b, 0, 58, 120, 1819}, - /*II_0F_01_DC*/ {0x3b, 0, 0, 120, 1827}, - /*II_0F_01_DD*/ {0x3b, 0, 0, 120, 1833}, - /*II_0F_01_DE*/ {0x3b, 0, 58, 120, 1839}, - /*II_0F_01_DF*/ {0x3b, 60, 58, 120, 1847}, - /*II_0F_01_F8*/ {0x41, 0, 0, 8, 1856}, - /*II_0F_01_F9*/ {0x41, 0, 0, 8, 1864}, - /*II_0F_0D_00*/ {0x3c, 0, 42, 96, 1872}, - /*II_0F_0D_01*/ {0x3c, 0, 42, 96, 1882}, - /*II_0F_0F_0C*/ {0x42, 67, 64, 104, 1893}, - /*II_0F_0F_0D*/ {0x42, 67, 64, 96, 1900}, - /*II_0F_0F_1C*/ {0x42, 67, 64, 104, 1907}, - /*II_0F_0F_1D*/ {0x42, 67, 64, 96, 1914}, - /*II_0F_0F_8A*/ {0x42, 67, 64, 104, 1921}, - /*II_0F_0F_8E*/ {0x42, 67, 64, 104, 1929}, - /*II_0F_0F_90*/ {0x42, 67, 64, 96, 1938}, - /*II_0F_0F_94*/ {0x42, 67, 64, 96, 1947}, - /*II_0F_0F_96*/ {0x42, 67, 64, 96, 1954}, - /*II_0F_0F_97*/ {0x42, 67, 64, 96, 1961}, - /*II_0F_0F_9A*/ {0x42, 67, 64, 96, 1970}, - /*II_0F_0F_9E*/ {0x42, 67, 64, 96, 1977}, - /*II_0F_0F_A0*/ {0x42, 67, 64, 96, 1984}, - /*II_0F_0F_A4*/ {0x42, 67, 64, 96, 1993}, - /*II_0F_0F_A6*/ {0x42, 67, 64, 96, 2000}, - /*II_0F_0F_A7*/ {0x42, 67, 64, 96, 2010}, - /*II_0F_0F_AA*/ {0x42, 67, 64, 96, 2020}, - /*II_0F_0F_AE*/ {0x42, 67, 64, 96, 2028}, - /*II_0F_0F_B0*/ {0x42, 67, 64, 96, 2035}, - /*II_0F_0F_B4*/ {0x42, 67, 64, 96, 2044}, - /*II_0F_0F_B6*/ {0x42, 67, 64, 96, 2051}, - /*II_0F_0F_B7*/ {0x42, 67, 64, 96, 2061}, - /*II_0F_0F_BB*/ {0x42, 67, 64, 104, 2070}, - /*II_0F_0F_BF*/ {0x42, 67, 64, 96, 2078}, - /*II_0F_10*/ {0x29, 73, 68, 40, 2087}, - /*II_66_0F_10*/ {0x29, 73, 68, 48, 2095}, - /*II_F3_0F_10*/ {0x29, 71, 68, 40, 2103}, - /*II_F2_0F_10*/ {0x29, 72, 68, 48, 2110}, - /*II_0F_11*/ {0x29, 68, 73, 40, 2087}, - /*II_66_0F_11*/ {0x29, 68, 73, 48, 2095}, - /*II_F3_0F_11*/ {0x29, 68, 71, 40, 2103}, - /*II_F2_0F_11*/ {0x29, 68, 72, 48, 2110}, - /*II_66_0F_12*/ {0x29, 46, 68, 48, 2168}, - /*II_F3_0F_12*/ {0x29, 72, 68, 56, 2176}, - /*II_F2_0F_12*/ {0x29, 72, 68, 56, 2186}, - /*II_0F_13*/ {0x29, 68, 46, 40, 2160}, - /*II_66_0F_13*/ {0x29, 68, 46, 48, 2168}, - /*II_0F_14*/ {0x28, 73, 68, 40, 2244}, - /*II_66_0F_14*/ {0x28, 73, 68, 48, 2254}, - /*II_0F_15*/ {0x28, 73, 68, 40, 2286}, - /*II_66_0F_15*/ {0x28, 73, 68, 48, 2296}, - /*II_66_0F_16*/ {0x29, 46, 68, 48, 2345}, - /*II_F3_0F_16*/ {0x29, 73, 68, 56, 2353}, - /*II_0F_17*/ {0x29, 68, 46, 40, 2337}, - /*II_66_0F_17*/ {0x29, 68, 46, 48, 2345}, - /*II_0F_18_00*/ {0x3c, 0, 42, 40, 2402}, - /*II_0F_18_01*/ {0x3c, 0, 42, 40, 2415}, - /*II_0F_18_02*/ {0x3c, 0, 42, 40, 2427}, - /*II_0F_18_03*/ {0x3c, 0, 42, 40, 2439}, - /*II_0F_28*/ {0x29, 73, 68, 40, 2451}, - /*II_66_0F_28*/ {0x29, 73, 68, 48, 2459}, - /*II_0F_29*/ {0x29, 68, 73, 40, 2451}, - /*II_66_0F_29*/ {0x29, 68, 73, 48, 2459}, - /*II_0F_2A*/ {0x28, 67, 68, 40, 2485}, - /*II_66_0F_2A*/ {0x28, 67, 68, 48, 2495}, - /*II_F3_0F_2A*/ {0x30, 18, 68, 40, 2505}, - /*II_F2_0F_2A*/ {0x30, 18, 68, 48, 2515}, - /*II_0F_2B*/ {0x29, 68, 47, 40, 2547}, - /*II_66_0F_2B*/ {0x29, 68, 47, 48, 2556}, - /*II_F3_0F_2B*/ {0x29, 68, 44, 88, 2565}, - /*II_F2_0F_2B*/ {0x29, 68, 46, 88, 2574}, - /*II_0F_2C*/ {0x28, 72, 64, 40, 2603}, - /*II_66_0F_2C*/ {0x28, 73, 64, 48, 2614}, - /*II_F3_0F_2C*/ {0x30, 71, 13, 40, 2625}, - /*II_F2_0F_2C*/ {0x30, 72, 13, 48, 2636}, - /*II_0F_2D*/ {0x28, 72, 64, 40, 2671}, - /*II_66_0F_2D*/ {0x28, 73, 68, 48, 2681}, - /*II_F3_0F_2D*/ {0x30, 71, 13, 40, 2691}, - /*II_F2_0F_2D*/ {0x30, 72, 13, 48, 2701}, - /*II_0F_2E*/ {0x28, 71, 68, 40, 2733}, - /*II_66_0F_2E*/ {0x28, 72, 68, 48, 2742}, - /*II_0F_2F*/ {0x28, 71, 68, 40, 2771}, - /*II_66_0F_2F*/ {0x28, 72, 68, 48, 2779}, - /*II_0F_50*/ {0x49, 69, 12, 40, 2805}, - /*II_66_0F_50*/ {0x49, 69, 12, 48, 2815}, - /*II_0F_51*/ {0x28, 73, 68, 40, 2847}, - /*II_66_0F_51*/ {0x28, 73, 68, 48, 2855}, - /*II_F3_0F_51*/ {0x28, 71, 68, 40, 2863}, - /*II_F2_0F_51*/ {0x28, 72, 68, 48, 2871}, - /*II_0F_52*/ {0x28, 73, 68, 40, 2915}, - /*II_F3_0F_52*/ {0x28, 71, 68, 40, 2924}, - /*II_0F_53*/ {0x28, 73, 68, 40, 2953}, - /*II_F3_0F_53*/ {0x28, 71, 68, 40, 2960}, - /*II_0F_54*/ {0x28, 73, 68, 40, 2983}, - /*II_66_0F_54*/ {0x28, 73, 68, 48, 2990}, - /*II_0F_55*/ {0x28, 73, 68, 40, 3013}, - /*II_66_0F_55*/ {0x28, 73, 68, 48, 3021}, - /*II_0F_56*/ {0x28, 73, 68, 40, 3047}, - /*II_66_0F_56*/ {0x28, 73, 68, 48, 3053}, - /*II_0F_57*/ {0x28, 73, 68, 40, 3073}, - /*II_66_0F_57*/ {0x28, 73, 68, 48, 3080}, - /*II_0F_58*/ {0x28, 73, 68, 40, 3103}, - /*II_66_0F_58*/ {0x28, 73, 68, 48, 3110}, - /*II_F3_0F_58*/ {0x28, 71, 68, 40, 3117}, - /*II_F2_0F_58*/ {0x28, 72, 68, 48, 3124}, - /*II_0F_59*/ {0x28, 73, 68, 40, 3163}, - /*II_66_0F_59*/ {0x28, 73, 68, 48, 3170}, - /*II_F3_0F_59*/ {0x28, 71, 68, 40, 3177}, - /*II_F2_0F_59*/ {0x28, 72, 68, 48, 3184}, - /*II_0F_5A*/ {0x28, 72, 68, 48, 3223}, - /*II_66_0F_5A*/ {0x28, 73, 68, 48, 3233}, - /*II_F3_0F_5A*/ {0x28, 71, 68, 48, 3243}, - /*II_F2_0F_5A*/ {0x28, 72, 68, 48, 3253}, - /*II_0F_5B*/ {0x28, 73, 68, 48, 3307}, - /*II_66_0F_5B*/ {0x28, 73, 68, 48, 3317}, - /*II_F3_0F_5B*/ {0x28, 73, 68, 48, 3327}, - /*II_0F_5C*/ {0x28, 73, 68, 40, 3372}, - /*II_66_0F_5C*/ {0x28, 73, 68, 48, 3379}, - /*II_F3_0F_5C*/ {0x28, 71, 68, 40, 3386}, - /*II_F2_0F_5C*/ {0x28, 72, 68, 48, 3393}, - /*II_0F_5D*/ {0x28, 73, 68, 40, 3432}, - /*II_66_0F_5D*/ {0x28, 73, 68, 48, 3439}, - /*II_F3_0F_5D*/ {0x28, 71, 68, 40, 3446}, - /*II_F2_0F_5D*/ {0x28, 72, 68, 48, 3453}, - /*II_0F_5E*/ {0x28, 73, 68, 40, 3492}, - /*II_66_0F_5E*/ {0x28, 73, 68, 48, 3499}, - /*II_F3_0F_5E*/ {0x28, 71, 68, 40, 3506}, - /*II_F2_0F_5E*/ {0x28, 72, 68, 48, 3513}, - /*II_0F_5F*/ {0x28, 73, 68, 40, 3552}, - /*II_66_0F_5F*/ {0x28, 73, 68, 48, 3559}, - /*II_F3_0F_5F*/ {0x28, 71, 68, 40, 3566}, - /*II_F2_0F_5F*/ {0x28, 72, 68, 48, 3573}, - /*II_0F_60*/ {0x28, 66, 64, 32, 3612}, - /*II_66_0F_60*/ {0x28, 73, 68, 48, 3612}, - /*II_0F_61*/ {0x28, 66, 64, 32, 3635}, - /*II_66_0F_61*/ {0x28, 73, 68, 48, 3635}, - /*II_0F_62*/ {0x28, 66, 64, 32, 3658}, - /*II_66_0F_62*/ {0x28, 73, 68, 48, 3658}, - /*II_0F_63*/ {0x28, 67, 64, 32, 3681}, - /*II_66_0F_63*/ {0x28, 73, 68, 48, 3681}, - /*II_0F_64*/ {0x28, 67, 64, 32, 3702}, - /*II_66_0F_64*/ {0x28, 73, 68, 48, 3702}, - /*II_0F_65*/ {0x28, 67, 64, 32, 3721}, - /*II_66_0F_65*/ {0x28, 73, 68, 48, 3721}, - /*II_0F_66*/ {0x28, 67, 64, 32, 3740}, - /*II_66_0F_66*/ {0x28, 73, 68, 48, 3740}, - /*II_0F_67*/ {0x28, 67, 64, 32, 3759}, - /*II_66_0F_67*/ {0x28, 73, 68, 48, 3759}, - /*II_0F_68*/ {0x28, 67, 64, 32, 3780}, - /*II_66_0F_68*/ {0x28, 73, 68, 48, 3780}, - /*II_0F_69*/ {0x28, 67, 64, 32, 3803}, - /*II_66_0F_69*/ {0x28, 73, 68, 48, 3803}, - /*II_0F_6A*/ {0x28, 67, 64, 32, 3826}, - /*II_66_0F_6A*/ {0x28, 73, 68, 48, 3826}, - /*II_0F_6B*/ {0x28, 67, 64, 32, 3849}, - /*II_66_0F_6B*/ {0x28, 73, 68, 48, 3849}, - /*II_66_0F_6C*/ {0x28, 73, 68, 48, 3870}, - /*II_66_0F_6D*/ {0x28, 73, 68, 48, 3895}, - /*II_0F_6F*/ {0x29, 67, 64, 32, 3926}, - /*II_66_0F_6F*/ {0x29, 73, 68, 48, 3946}, - /*II_F3_0F_6F*/ {0x29, 73, 68, 48, 3954}, - /*II_0F_74*/ {0x28, 67, 64, 32, 4043}, - /*II_66_0F_74*/ {0x28, 73, 68, 48, 4043}, - /*II_0F_75*/ {0x28, 67, 64, 32, 4062}, - /*II_66_0F_75*/ {0x28, 73, 68, 48, 4062}, - /*II_0F_76*/ {0x28, 67, 64, 32, 4081}, - /*II_66_0F_76*/ {0x28, 73, 68, 48, 4081}, - /*II_0F_77*/ {0x26, 0, 0, 32, 4100}, - /*II_0F_78*/ {0x4e, 13, 18, 112, 4128}, - /*II_0F_79*/ {0x4e, 18, 13, 112, 4152}, - /*II_66_0F_79*/ {0x28, 69, 68, 88, 4136}, - /*II_F2_0F_79*/ {0x51, 69, 68, 88, 4143}, - /*II_0F_7A_30*/ {0x26, 72, 68, 112, 4161}, - /*II_0F_7A_31*/ {0x26, 68, 72, 112, 4171}, - /*II_66_0F_7C*/ {0x28, 73, 68, 56, 4181}, - /*II_F2_0F_7C*/ {0x28, 73, 68, 56, 4189}, - /*II_66_0F_7D*/ {0x28, 73, 68, 56, 4215}, - /*II_F2_0F_7D*/ {0x28, 73, 68, 56, 4223}, - /*II_F3_0F_7E*/ {0x29, 72, 68, 48, 3926}, - /*II_0F_7F*/ {0x29, 64, 67, 32, 3926}, - /*II_66_0F_7F*/ {0x29, 68, 73, 48, 3946}, - /*II_F3_0F_7F*/ {0x29, 68, 73, 48, 3954}, - /*II_F3_0F_B8*/ {0x55, 17, 11, 80, 4338}, - /*II_0F_BA_04*/ {0x56, 1, 17, 8, 872}, - /*II_0F_BA_05*/ {0x37, 1, 17, 8, 887}, - /*II_0F_BA_06*/ {0x37, 1, 17, 8, 912}, - /*II_0F_BA_07*/ {0x37, 1, 17, 8, 934}, - /*II_0F_BC*/ {0x28, 17, 11, 8, 4346}, - /*II_F3_0F_BC*/ {0x57, 17, 11, 112, 4351}, - /*II_0F_BD*/ {0x28, 17, 11, 8, 4358}, - /*II_F3_0F_BD*/ {0x58, 17, 11, 8, 4363}, - /*II_0F_C7_07*/ {0x3c, 0, 46, 112, 6385}, - /*II_66_0F_D0*/ {0x28, 73, 68, 56, 6394}, - /*II_F2_0F_D0*/ {0x28, 73, 68, 56, 6404}, - /*II_0F_D1*/ {0x28, 67, 64, 32, 6436}, - /*II_66_0F_D1*/ {0x28, 73, 68, 48, 6436}, - /*II_0F_D2*/ {0x28, 67, 64, 32, 6451}, - /*II_66_0F_D2*/ {0x28, 73, 68, 48, 6451}, - /*II_0F_D3*/ {0x28, 67, 64, 32, 6466}, - /*II_66_0F_D3*/ {0x28, 73, 68, 48, 6466}, - /*II_0F_D4*/ {0x28, 72, 68, 48, 6481}, - /*II_66_0F_D4*/ {0x28, 73, 68, 48, 6481}, - /*II_0F_D5*/ {0x28, 67, 64, 32, 6496}, - /*II_66_0F_D5*/ {0x28, 73, 68, 48, 6496}, - /*II_66_0F_D6*/ {0x29, 68, 72, 48, 3926}, - /*II_F3_0F_D6*/ {0x49, 65, 68, 48, 6513}, - /*II_F2_0F_D6*/ {0x49, 69, 64, 48, 6522}, - /*II_0F_D7*/ {0x51, 65, 12, 40, 6531}, - /*II_66_0F_D7*/ {0x51, 69, 12, 48, 6531}, - /*II_0F_D8*/ {0x28, 67, 64, 32, 6552}, - /*II_66_0F_D8*/ {0x28, 73, 68, 48, 6552}, - /*II_0F_D9*/ {0x28, 67, 64, 32, 6571}, - /*II_66_0F_D9*/ {0x28, 73, 68, 48, 6571}, - /*II_0F_DA*/ {0x28, 67, 64, 40, 6590}, - /*II_66_0F_DA*/ {0x28, 73, 68, 48, 6590}, - /*II_0F_DB*/ {0x28, 67, 64, 32, 6607}, - /*II_66_0F_DB*/ {0x28, 73, 68, 48, 6607}, - /*II_0F_DC*/ {0x28, 67, 64, 32, 6620}, - /*II_66_0F_DC*/ {0x28, 73, 68, 48, 6620}, - /*II_0F_DD*/ {0x28, 67, 64, 32, 6639}, - /*II_66_0F_DD*/ {0x28, 73, 68, 48, 6639}, - /*II_0F_DE*/ {0x28, 67, 64, 40, 6648}, - /*II_66_0F_DE*/ {0x28, 73, 68, 48, 6648}, - /*II_0F_DF*/ {0x28, 67, 64, 32, 6665}, - /*II_66_0F_DF*/ {0x28, 73, 68, 48, 6665}, - /*II_0F_E0*/ {0x28, 67, 64, 40, 6680}, - /*II_66_0F_E0*/ {0x28, 73, 68, 48, 6680}, - /*II_0F_E1*/ {0x28, 67, 64, 32, 6695}, - /*II_66_0F_E1*/ {0x28, 73, 68, 48, 6695}, - /*II_0F_E2*/ {0x28, 67, 64, 32, 6710}, - /*II_66_0F_E2*/ {0x28, 73, 68, 48, 6710}, - /*II_0F_E3*/ {0x28, 67, 64, 40, 6725}, - /*II_66_0F_E3*/ {0x28, 73, 68, 48, 6725}, - /*II_0F_E4*/ {0x28, 67, 64, 40, 6740}, - /*II_66_0F_E4*/ {0x28, 73, 68, 48, 6740}, - /*II_0F_E5*/ {0x28, 67, 64, 32, 6759}, - /*II_66_0F_E5*/ {0x28, 73, 68, 48, 6759}, - /*II_66_0F_E6*/ {0x28, 73, 68, 48, 6776}, - /*II_F3_0F_E6*/ {0x28, 72, 68, 48, 6787}, - /*II_F2_0F_E6*/ {0x28, 73, 68, 48, 6797}, - /*II_0F_E7*/ {0x29, 64, 46, 40, 6841}, - /*II_66_0F_E7*/ {0x29, 68, 47, 48, 6849}, - /*II_0F_E8*/ {0x28, 67, 64, 32, 6868}, - /*II_66_0F_E8*/ {0x28, 73, 68, 48, 6868}, - /*II_0F_E9*/ {0x28, 67, 64, 32, 6885}, - /*II_66_0F_E9*/ {0x28, 73, 68, 48, 6885}, - /*II_0F_EA*/ {0x28, 67, 64, 40, 6902}, - /*II_66_0F_EA*/ {0x28, 73, 68, 48, 6902}, - /*II_0F_EB*/ {0x28, 67, 64, 32, 6919}, - /*II_66_0F_EB*/ {0x28, 73, 68, 48, 6919}, - /*II_0F_EC*/ {0x28, 67, 64, 32, 6930}, - /*II_66_0F_EC*/ {0x28, 73, 68, 48, 6930}, - /*II_0F_ED*/ {0x28, 67, 64, 32, 6947}, - /*II_66_0F_ED*/ {0x28, 73, 68, 48, 6947}, - /*II_0F_EE*/ {0x28, 67, 64, 40, 6964}, - /*II_66_0F_EE*/ {0x28, 73, 68, 48, 6964}, - /*II_0F_EF*/ {0x28, 67, 64, 32, 6981}, - /*II_66_0F_EF*/ {0x28, 73, 68, 48, 6981}, - /*II_F2_0F_F0*/ {0x28, 42, 68, 56, 6994}, - /*II_0F_F1*/ {0x28, 67, 64, 32, 7009}, - /*II_66_0F_F1*/ {0x28, 73, 68, 48, 7009}, - /*II_0F_F2*/ {0x28, 67, 64, 32, 7024}, - /*II_66_0F_F2*/ {0x28, 73, 68, 48, 7024}, - /*II_0F_F3*/ {0x28, 67, 64, 32, 7039}, - /*II_66_0F_F3*/ {0x28, 73, 68, 48, 7039}, - /*II_0F_F4*/ {0x28, 67, 64, 48, 7054}, - /*II_66_0F_F4*/ {0x28, 73, 68, 48, 7054}, - /*II_0F_F5*/ {0x28, 67, 64, 32, 7073}, - /*II_66_0F_F5*/ {0x28, 73, 68, 48, 7073}, - /*II_0F_F6*/ {0x28, 67, 64, 40, 7092}, - /*II_66_0F_F6*/ {0x28, 73, 68, 48, 7092}, - /*II_0F_F7*/ {0x51, 65, 64, 40, 7109}, - /*II_66_0F_F7*/ {0x51, 69, 68, 48, 7119}, - /*II_0F_F8*/ {0x28, 67, 64, 32, 7144}, - /*II_66_0F_F8*/ {0x28, 73, 68, 48, 7144}, - /*II_0F_F9*/ {0x28, 67, 64, 32, 7159}, - /*II_66_0F_F9*/ {0x28, 73, 68, 48, 7159}, - /*II_0F_FA*/ {0x28, 67, 64, 32, 7174}, - /*II_66_0F_FA*/ {0x28, 73, 68, 48, 7174}, - /*II_0F_FB*/ {0x28, 67, 64, 48, 7189}, - /*II_66_0F_FB*/ {0x28, 73, 68, 48, 7189}, - /*II_0F_FC*/ {0x28, 67, 64, 32, 7204}, - /*II_66_0F_FC*/ {0x28, 73, 68, 48, 7204}, - /*II_0F_FD*/ {0x28, 67, 64, 32, 7219}, - /*II_66_0F_FD*/ {0x28, 73, 68, 48, 7219}, - /*II_0F_FE*/ {0x28, 67, 64, 32, 7234}, - /*II_66_0F_FE*/ {0x28, 73, 68, 48, 7234}, - /*II_D9_06*/ {0x34, 0, 42, 16, 7249}, - /*II_9B_D9_06*/ {0x60, 0, 42, 16, 7258}, - /*II_D9_07*/ {0x34, 0, 42, 16, 7266}, - /*II_9B_D9_07*/ {0x60, 0, 42, 16, 7274}, - /*II_DB_E2*/ {0x3a, 0, 0, 16, 7281}, - /*II_9B_DB_E2*/ {0x61, 0, 0, 16, 7289}, - /*II_DB_E3*/ {0x3a, 0, 0, 16, 7296}, - /*II_9B_DB_E3*/ {0x61, 0, 0, 16, 7304}, - /*II_DD_06*/ {0x34, 0, 42, 16, 7311}, - /*II_9B_DD_06*/ {0x60, 0, 42, 16, 7319}, - /*II_DD_07*/ {0x34, 0, 42, 16, 7326}, - /*II_9B_DD_07*/ {0x60, 0, 42, 16, 7334}, - /*II_DF_E0*/ {0x3a, 0, 34, 16, 7326}, - /*II_9B_DF_E0*/ {0x61, 0, 34, 16, 7334}, - /*II_0F_38_00*/ {0x28, 67, 64, 64, 7341}, - /*II_66_0F_38_00*/ {0x28, 73, 68, 64, 7341}, - /*II_0F_38_01*/ {0x28, 67, 64, 64, 7358}, - /*II_66_0F_38_01*/ {0x28, 73, 68, 64, 7358}, - /*II_0F_38_02*/ {0x28, 67, 64, 64, 7375}, - /*II_66_0F_38_02*/ {0x28, 73, 68, 64, 7375}, - /*II_0F_38_03*/ {0x28, 67, 64, 64, 7392}, - /*II_66_0F_38_03*/ {0x28, 73, 68, 64, 7392}, - /*II_0F_38_04*/ {0x28, 67, 64, 64, 7411}, - /*II_66_0F_38_04*/ {0x28, 73, 68, 64, 7411}, - /*II_0F_38_05*/ {0x28, 67, 64, 64, 7434}, - /*II_66_0F_38_05*/ {0x28, 73, 68, 64, 7434}, - /*II_0F_38_06*/ {0x28, 67, 64, 64, 7451}, - /*II_66_0F_38_06*/ {0x28, 73, 68, 64, 7451}, - /*II_0F_38_07*/ {0x28, 67, 64, 64, 7468}, - /*II_66_0F_38_07*/ {0x28, 73, 68, 64, 7468}, - /*II_0F_38_08*/ {0x28, 67, 64, 64, 7487}, - /*II_66_0F_38_08*/ {0x28, 73, 68, 64, 7487}, - /*II_0F_38_09*/ {0x28, 67, 64, 64, 7504}, - /*II_66_0F_38_09*/ {0x28, 73, 68, 64, 7504}, - /*II_0F_38_0A*/ {0x28, 67, 64, 64, 7521}, - /*II_66_0F_38_0A*/ {0x28, 73, 68, 64, 7521}, - /*II_0F_38_0B*/ {0x28, 67, 64, 64, 7538}, - /*II_66_0F_38_0B*/ {0x28, 73, 68, 64, 7538}, - /*II_66_0F_38_17*/ {0x28, 73, 68, 80, 7629}, - /*II_0F_38_1C*/ {0x28, 67, 64, 64, 7688}, - /*II_66_0F_38_1C*/ {0x28, 73, 68, 64, 7688}, - /*II_0F_38_1D*/ {0x28, 67, 64, 64, 7703}, - /*II_66_0F_38_1D*/ {0x28, 73, 68, 64, 7703}, - /*II_0F_38_1E*/ {0x28, 67, 64, 64, 7718}, - /*II_66_0F_38_1E*/ {0x28, 73, 68, 64, 7718}, - /*II_66_0F_38_20*/ {0x28, 72, 68, 72, 7733}, - /*II_66_0F_38_21*/ {0x28, 71, 68, 72, 7754}, - /*II_66_0F_38_22*/ {0x28, 70, 68, 72, 7775}, - /*II_66_0F_38_23*/ {0x28, 72, 68, 72, 7796}, - /*II_66_0F_38_24*/ {0x28, 71, 68, 72, 7817}, - /*II_66_0F_38_25*/ {0x28, 72, 68, 72, 7838}, - /*II_66_0F_38_28*/ {0x28, 73, 68, 72, 7859}, - /*II_66_0F_38_29*/ {0x28, 73, 68, 72, 7876}, - /*II_66_0F_38_2A*/ {0x29, 47, 68, 72, 7895}, - /*II_66_0F_38_2B*/ {0x28, 73, 68, 72, 7916}, - /*II_66_0F_38_30*/ {0x28, 72, 68, 72, 7961}, - /*II_66_0F_38_31*/ {0x28, 71, 68, 72, 7982}, - /*II_66_0F_38_32*/ {0x28, 70, 68, 72, 8003}, - /*II_66_0F_38_33*/ {0x28, 72, 68, 72, 8024}, - /*II_66_0F_38_34*/ {0x28, 71, 68, 72, 8045}, - /*II_66_0F_38_35*/ {0x28, 72, 68, 72, 8066}, - /*II_66_0F_38_37*/ {0x28, 73, 68, 80, 8087}, - /*II_66_0F_38_38*/ {0x28, 73, 68, 72, 8106}, - /*II_66_0F_38_39*/ {0x28, 73, 68, 72, 8123}, - /*II_66_0F_38_3A*/ {0x28, 73, 68, 72, 8140}, - /*II_66_0F_38_3B*/ {0x28, 73, 68, 72, 8157}, - /*II_66_0F_38_3C*/ {0x28, 73, 68, 72, 8174}, - /*II_66_0F_38_3D*/ {0x28, 73, 68, 72, 8191}, - /*II_66_0F_38_3E*/ {0x28, 73, 68, 72, 8208}, - /*II_66_0F_38_3F*/ {0x28, 73, 68, 72, 8225}, - /*II_66_0F_38_40*/ {0x28, 73, 68, 72, 8242}, - /*II_66_0F_38_41*/ {0x28, 73, 68, 72, 8259}, - /*II_66_0F_38_80*/ {0x4e, 47, 13, 112, 8284}, - /*II_66_0F_38_81*/ {0x4e, 47, 13, 112, 8292}, - /*II_66_0F_38_82*/ {0x4e, 47, 13, 112, 8301}, - /*II_66_0F_38_DB*/ {0x28, 73, 68, 152, 9150}, - /*II_66_0F_38_DC*/ {0x28, 73, 68, 152, 9167}, - /*II_66_0F_38_DD*/ {0x28, 73, 68, 152, 9184}, - /*II_66_0F_38_DE*/ {0x28, 73, 68, 152, 9209}, - /*II_66_0F_38_DF*/ {0x28, 73, 68, 152, 9226}, - /*II_0F_38_F0*/ {0x29, 17, 11, 8, 9251}, - /*II_F2_0F_38_F0*/ {0x29, 15, 13, 80, 9258}, - /*II_0F_38_F1*/ {0x29, 11, 17, 8, 9251}, - /*II_F2_0F_38_F1*/ {0x29, 17, 13, 80, 9258}, - /*II_0F_71_02*/ {0x63, 1, 65, 32, 6436}, - /*II_66_0F_71_02*/ {0x3c, 1, 69, 48, 6436}, - /*II_0F_71_04*/ {0x63, 1, 65, 32, 6695}, - /*II_66_0F_71_04*/ {0x3c, 1, 69, 48, 6695}, - /*II_0F_71_06*/ {0x63, 1, 65, 32, 7009}, - /*II_66_0F_71_06*/ {0x3c, 1, 69, 48, 7009}, - /*II_0F_72_02*/ {0x63, 1, 65, 32, 6451}, - /*II_66_0F_72_02*/ {0x3c, 1, 69, 48, 6451}, - /*II_0F_72_04*/ {0x63, 1, 65, 32, 6710}, - /*II_66_0F_72_04*/ {0x3c, 1, 69, 48, 6710}, - /*II_0F_72_06*/ {0x63, 1, 65, 32, 7024}, - /*II_66_0F_72_06*/ {0x3c, 1, 69, 48, 7024}, - /*II_0F_73_02*/ {0x63, 1, 65, 32, 6466}, - /*II_66_0F_73_02*/ {0x3c, 1, 69, 48, 6466}, - /*II_66_0F_73_03*/ {0x3c, 1, 69, 48, 9830}, - /*II_0F_73_06*/ {0x63, 1, 65, 32, 7039}, - /*II_66_0F_73_06*/ {0x3c, 1, 69, 48, 7039}, - /*II_66_0F_73_07*/ {0x3c, 1, 69, 48, 9847}, - /*II_F3_0F_AE_00*/ {0x65, 0, 13, 112, 9882}, - /*II_F3_0F_AE_01*/ {0x65, 0, 13, 112, 9912}, - /*II_0F_AE_02*/ {0x3c, 0, 42, 8, 9922}, - /*II_F3_0F_AE_02*/ {0x65, 0, 13, 112, 9931}, - /*II_0F_AE_03*/ {0x3c, 0, 42, 8, 9951}, - /*II_F3_0F_AE_03*/ {0x65, 0, 13, 112, 9960}, - /*II_66_0F_C7_06*/ {0x3c, 0, 46, 112, 9997}, - /*II_F3_0F_C7_06*/ {0x3c, 0, 46, 112, 10006} -}; - -_InstInfoEx InstInfosEx[] = { - /*II_69*/ {{0x17, 17, 11, 8, 117}, 0x0, 3, 0, 0, 0}, - /*II_6B*/ {{0x17, 17, 11, 8, 117}, 0x0, 5, 0, 0, 0}, - /*II_98*/ {{0x1c, 0, 0, 8, 228}, 0x0, 0, 0, 233, 239}, - /*II_99*/ {{0x1c, 0, 0, 8, 245}, 0x0, 0, 0, 250, 255}, - /*II_E3*/ {{0x25, 0, 40, 13, 427}, 0x0, 0, 0, 433, 440}, - /*II_0F_A4*/ {{0x2c, 11, 17, 8, 876}, 0x0, 1, 0, 0, 0}, - /*II_0F_A5*/ {{0x2c, 11, 17, 8, 876}, 0x0, 52, 0, 0, 0}, - /*II_0F_AC*/ {{0x2c, 11, 17, 8, 892}, 0x0, 1, 0, 0, 0}, - /*II_0F_AD*/ {{0x2c, 11, 17, 8, 892}, 0x0, 52, 0, 0, 0}, - /*II_V_0F_10*/ {{0x43, 90, 83, 128, 2117}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_10*/ {{0x43, 90, 83, 128, 2126}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_10*/ {{0x44, 81, 68, 128, 2135}, 0x20, 69, 0, 0, 0}, - /*II_V_F2_0F_10*/ {{0x44, 81, 68, 128, 2143}, 0x20, 69, 0, 0, 0}, - /*II_VRR_F3_0F_10*/ {{0x45, 44, 68, 128, 2135}, 0x60, 0, 0, 0, 0}, - /*II_VRR_F2_0F_10*/ {{0x45, 46, 68, 128, 2143}, 0x60, 0, 0, 0, 0}, - /*II_V_0F_11*/ {{0x43, 83, 90, 128, 2117}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_11*/ {{0x43, 83, 90, 128, 2126}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_11*/ {{0x44, 81, 68, 128, 2135}, 0x20, 69, 0, 0, 0}, - /*II_V_F2_0F_11*/ {{0x44, 81, 68, 128, 2143}, 0x20, 69, 0, 0, 0}, - /*II_VRR_F3_0F_11*/ {{0x45, 68, 44, 128, 2135}, 0x60, 0, 0, 0, 0}, - /*II_VRR_F2_0F_11*/ {{0x45, 68, 46, 128, 2143}, 0x60, 0, 0, 0, 0}, - /*II_0F_12*/ {{0x46, 72, 68, 40, 2151}, 0x0, 0, 0, 2160, 0}, - /*II_V_0F_12*/ {{0x47, 81, 68, 128, 2195}, 0x0, 72, 0, 2205, 0}, - /*II_V_66_0F_12*/ {{0x48, 81, 68, 128, 2214}, 0x0, 46, 0, 0, 0}, - /*II_V_F3_0F_12*/ {{0x43, 90, 83, 128, 2223}, 0x41, 0, 0, 0, 0}, - /*II_V_F2_0F_12*/ {{0x43, 89, 83, 128, 2234}, 0x41, 0, 0, 0, 0}, - /*II_V_0F_13*/ {{0x43, 68, 46, 128, 2205}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_13*/ {{0x43, 68, 46, 128, 2214}, 0x40, 0, 0, 0, 0}, - /*II_V_0F_14*/ {{0x48, 88, 83, 128, 2264}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_14*/ {{0x48, 88, 83, 128, 2275}, 0x1, 90, 0, 0, 0}, - /*II_V_0F_15*/ {{0x48, 88, 83, 128, 2306}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_15*/ {{0x48, 88, 83, 128, 2317}, 0x1, 90, 0, 0, 0}, - /*II_0F_16*/ {{0x46, 72, 68, 40, 2328}, 0x0, 0, 0, 2337, 0}, - /*II_V_0F_16*/ {{0x47, 81, 68, 128, 2363}, 0x0, 72, 0, 2373, 0}, - /*II_V_66_0F_16*/ {{0x48, 81, 68, 128, 2382}, 0x0, 46, 0, 0, 0}, - /*II_V_F3_0F_16*/ {{0x43, 90, 83, 128, 2391}, 0x41, 0, 0, 0, 0}, - /*II_V_0F_17*/ {{0x43, 68, 46, 128, 2373}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_17*/ {{0x43, 68, 46, 128, 2382}, 0x40, 0, 0, 0, 0}, - /*II_V_0F_28*/ {{0x43, 90, 83, 128, 2467}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_28*/ {{0x43, 90, 83, 128, 2476}, 0x41, 0, 0, 0, 0}, - /*II_V_0F_29*/ {{0x43, 83, 90, 128, 2467}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_29*/ {{0x43, 83, 90, 128, 2476}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_2A*/ {{0x48, 81, 68, 128, 2525}, 0x2, 79, 0, 0, 0}, - /*II_V_F2_0F_2A*/ {{0x48, 81, 68, 128, 2536}, 0x2, 79, 0, 0, 0}, - /*II_V_0F_2B*/ {{0x43, 83, 92, 128, 2583}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_2B*/ {{0x43, 83, 92, 128, 2593}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_2C*/ {{0x43, 80, 78, 128, 2647}, 0x42, 0, 0, 0, 0}, - /*II_V_F2_0F_2C*/ {{0x43, 80, 78, 128, 2659}, 0x42, 0, 0, 0, 0}, - /*II_V_F3_0F_2D*/ {{0x43, 80, 78, 128, 2711}, 0x42, 0, 0, 0, 0}, - /*II_V_F2_0F_2D*/ {{0x43, 80, 78, 128, 2722}, 0x42, 0, 0, 0, 0}, - /*II_V_0F_2E*/ {{0x43, 71, 68, 128, 2751}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_2E*/ {{0x43, 72, 68, 128, 2761}, 0x40, 0, 0, 0, 0}, - /*II_V_0F_2F*/ {{0x43, 71, 68, 128, 2787}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_2F*/ {{0x43, 72, 68, 128, 2796}, 0x40, 0, 0, 0, 0}, - /*II_V_0F_50*/ {{0x4a, 83, 13, 128, 2825}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_50*/ {{0x4a, 83, 13, 128, 2836}, 0x41, 0, 0, 0, 0}, - /*II_V_0F_51*/ {{0x43, 90, 83, 128, 2879}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_51*/ {{0x43, 90, 83, 128, 2888}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_51*/ {{0x48, 81, 68, 128, 2897}, 0x0, 71, 0, 0, 0}, - /*II_V_F2_0F_51*/ {{0x48, 81, 68, 128, 2906}, 0x0, 72, 0, 0, 0}, - /*II_V_0F_52*/ {{0x43, 90, 83, 128, 2933}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_52*/ {{0x48, 81, 68, 128, 2943}, 0x0, 71, 0, 0, 0}, - /*II_V_0F_53*/ {{0x43, 90, 83, 128, 2967}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_53*/ {{0x48, 81, 68, 128, 2975}, 0x0, 71, 0, 0, 0}, - /*II_V_0F_54*/ {{0x48, 88, 83, 128, 2997}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_54*/ {{0x48, 88, 83, 128, 3005}, 0x1, 90, 0, 0, 0}, - /*II_V_0F_55*/ {{0x48, 88, 83, 128, 3029}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_55*/ {{0x48, 88, 83, 128, 3038}, 0x1, 90, 0, 0, 0}, - /*II_V_0F_56*/ {{0x48, 88, 83, 128, 3059}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_56*/ {{0x48, 88, 83, 128, 3066}, 0x1, 90, 0, 0, 0}, - /*II_V_0F_57*/ {{0x48, 88, 83, 128, 3087}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_57*/ {{0x48, 88, 83, 128, 3095}, 0x1, 90, 0, 0, 0}, - /*II_V_0F_58*/ {{0x48, 88, 83, 128, 3131}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_58*/ {{0x48, 88, 83, 128, 3139}, 0x1, 90, 0, 0, 0}, - /*II_V_F3_0F_58*/ {{0x48, 81, 68, 128, 3147}, 0x0, 71, 0, 0, 0}, - /*II_V_F2_0F_58*/ {{0x48, 81, 68, 128, 3155}, 0x0, 72, 0, 0, 0}, - /*II_V_0F_59*/ {{0x48, 88, 83, 128, 3191}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_59*/ {{0x48, 88, 83, 128, 3199}, 0x1, 90, 0, 0, 0}, - /*II_V_F3_0F_59*/ {{0x48, 81, 68, 128, 3207}, 0x0, 71, 0, 0, 0}, - /*II_V_F2_0F_59*/ {{0x48, 81, 68, 128, 3215}, 0x0, 72, 0, 0, 0}, - /*II_V_0F_5A*/ {{0x43, 91, 83, 128, 3263}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_5A*/ {{0x43, 90, 68, 128, 3274}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_5A*/ {{0x48, 81, 68, 128, 3285}, 0x0, 71, 0, 0, 0}, - /*II_V_F2_0F_5A*/ {{0x48, 81, 68, 128, 3296}, 0x0, 72, 0, 0, 0}, - /*II_V_0F_5B*/ {{0x43, 90, 83, 128, 3338}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_5B*/ {{0x43, 90, 83, 128, 3349}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_5B*/ {{0x43, 90, 83, 128, 3360}, 0x41, 0, 0, 0, 0}, - /*II_V_0F_5C*/ {{0x48, 88, 83, 128, 3400}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_5C*/ {{0x48, 88, 83, 128, 3408}, 0x1, 90, 0, 0, 0}, - /*II_V_F3_0F_5C*/ {{0x48, 81, 68, 128, 3416}, 0x0, 71, 0, 0, 0}, - /*II_V_F2_0F_5C*/ {{0x48, 81, 68, 128, 3424}, 0x0, 72, 0, 0, 0}, - /*II_V_0F_5D*/ {{0x48, 88, 83, 128, 3460}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_5D*/ {{0x48, 88, 83, 128, 3468}, 0x1, 90, 0, 0, 0}, - /*II_V_F3_0F_5D*/ {{0x48, 81, 68, 128, 3476}, 0x0, 71, 0, 0, 0}, - /*II_V_F2_0F_5D*/ {{0x48, 81, 68, 128, 3484}, 0x0, 72, 0, 0, 0}, - /*II_V_0F_5E*/ {{0x48, 88, 83, 128, 3520}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_5E*/ {{0x48, 88, 83, 128, 3528}, 0x1, 90, 0, 0, 0}, - /*II_V_F3_0F_5E*/ {{0x48, 81, 68, 128, 3536}, 0x0, 71, 0, 0, 0}, - /*II_V_F2_0F_5E*/ {{0x48, 81, 68, 128, 3544}, 0x0, 72, 0, 0, 0}, - /*II_V_0F_5F*/ {{0x48, 88, 83, 128, 3580}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_5F*/ {{0x48, 88, 83, 128, 3588}, 0x1, 90, 0, 0, 0}, - /*II_V_F3_0F_5F*/ {{0x48, 81, 68, 128, 3596}, 0x0, 71, 0, 0, 0}, - /*II_V_F2_0F_5F*/ {{0x48, 81, 68, 128, 3604}, 0x0, 72, 0, 0, 0}, - /*II_V_66_0F_60*/ {{0x48, 81, 68, 128, 3623}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_61*/ {{0x48, 81, 68, 128, 3646}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_62*/ {{0x48, 81, 68, 128, 3669}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_63*/ {{0x48, 81, 68, 128, 3691}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_64*/ {{0x48, 81, 68, 128, 3711}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_65*/ {{0x48, 81, 68, 128, 3730}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_66*/ {{0x48, 81, 68, 128, 3749}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_67*/ {{0x48, 81, 68, 128, 3769}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_68*/ {{0x48, 81, 68, 128, 3791}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_69*/ {{0x48, 81, 68, 128, 3814}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_6A*/ {{0x48, 81, 68, 128, 3837}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_6B*/ {{0x48, 81, 68, 128, 3859}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_6C*/ {{0x48, 81, 68, 128, 3882}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_6D*/ {{0x48, 81, 68, 128, 3907}, 0x0, 73, 0, 0, 0}, - /*II_0F_6E*/ {{0x4b, 18, 64, 32, 3920}, 0x0, 0, 0, 0, 3926}, - /*II_66_0F_6E*/ {{0x4b, 18, 68, 48, 3920}, 0x0, 0, 0, 0, 3926}, - /*II_V_66_0F_6E*/ {{0x43, 79, 68, 128, 3932}, 0x46, 0, 0, 3939, 0}, - /*II_V_66_0F_6F*/ {{0x43, 90, 83, 128, 3962}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_6F*/ {{0x43, 90, 83, 128, 3971}, 0x41, 0, 0, 0, 0}, - /*II_0F_70*/ {{0x4c, 67, 64, 40, 3980}, 0x0, 1, 0, 0, 0}, - /*II_66_0F_70*/ {{0x4c, 73, 68, 48, 3988}, 0x0, 1, 0, 0, 0}, - /*II_F3_0F_70*/ {{0x4c, 73, 68, 48, 3996}, 0x0, 1, 0, 0, 0}, - /*II_F2_0F_70*/ {{0x4c, 73, 68, 48, 4005}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_70*/ {{0x48, 73, 68, 128, 4014}, 0x40, 1, 0, 0, 0}, - /*II_V_F3_0F_70*/ {{0x48, 73, 68, 128, 4023}, 0x40, 1, 0, 0, 0}, - /*II_V_F2_0F_70*/ {{0x48, 73, 68, 128, 4033}, 0x40, 1, 0, 0, 0}, - /*II_V_66_0F_74*/ {{0x48, 81, 68, 128, 4052}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_75*/ {{0x48, 81, 68, 128, 4071}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_76*/ {{0x48, 81, 68, 128, 4090}, 0x0, 73, 0, 0, 0}, - /*II_V_0F_77*/ {{0x4d, 0, 0, 128, 4106}, 0x49, 0, 0, 4118, 0}, - /*II_66_0F_78*/ {{0x4f, 7, 69, 88, 4136}, 0x0, 8, 0, 0, 0}, - /*II_F2_0F_78*/ {{0x50, 69, 68, 88, 4143}, 0x0, 7, 8, 0, 0}, - /*II_V_66_0F_7C*/ {{0x48, 88, 83, 128, 4197}, 0x1, 90, 0, 0, 0}, - /*II_V_F2_0F_7C*/ {{0x48, 88, 83, 128, 4206}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_7D*/ {{0x48, 88, 83, 128, 4231}, 0x1, 90, 0, 0, 0}, - /*II_V_F2_0F_7D*/ {{0x48, 88, 83, 128, 4240}, 0x1, 90, 0, 0, 0}, - /*II_0F_7E*/ {{0x4b, 64, 18, 32, 3920}, 0x0, 0, 0, 0, 3926}, - /*II_66_0F_7E*/ {{0x4b, 68, 18, 48, 3920}, 0x0, 0, 0, 0, 3926}, - /*II_V_66_0F_7E*/ {{0x43, 68, 79, 128, 3932}, 0x46, 0, 0, 3939, 0}, - /*II_V_F3_0F_7E*/ {{0x43, 72, 68, 128, 3939}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_7F*/ {{0x43, 83, 90, 128, 3962}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_7F*/ {{0x43, 83, 90, 128, 3971}, 0x41, 0, 0, 0, 0}, - /*II_0F_AE_04*/ {{0x52, 0, 42, 8, 4249}, 0x0, 0, 0, 0, 4256}, - /*II_0F_AE_05*/ {{0x53, 0, 43, 8, 4265}, 0x0, 0, 0, 4273, 4281}, - /*II_0F_AE_06*/ {{0x53, 0, 43, 8, 4291}, 0x0, 0, 0, 4299, 4309}, - /*II_0F_AE_07*/ {{0x54, 0, 43, 8, 4321}, 0x0, 0, 0, 4329, 0}, - /*II_0F_C2*/ {{0x59, 73, 68, 40, 4370}, 0x0, 0, 0, 4379, 4388}, - /*II_66_0F_C2*/ {{0x59, 73, 68, 48, 4449}, 0x0, 0, 0, 4458, 4467}, - /*II_F3_0F_C2*/ {{0x59, 71, 68, 40, 4528}, 0x0, 0, 0, 4537, 4546}, - /*II_F2_0F_C2*/ {{0x59, 72, 68, 48, 4607}, 0x0, 0, 0, 4616, 4625}, - /*II_V_0F_C2*/ {{0x5a, 88, 83, 128, 4686}, 0x1, 90, 0, 4696, 4706}, - /*II_V_66_0F_C2*/ {{0x5a, 88, 83, 128, 5088}, 0x1, 90, 0, 5098, 5108}, - /*II_V_F3_0F_C2*/ {{0x5a, 81, 68, 128, 5490}, 0x0, 71, 0, 5500, 5510}, - /*II_V_F2_0F_C2*/ {{0x5a, 81, 68, 128, 5892}, 0x0, 72, 0, 5902, 5912}, - /*II_0F_C4*/ {{0x4c, 25, 64, 40, 6294}, 0x0, 1, 0, 0, 0}, - /*II_66_0F_C4*/ {{0x4c, 25, 68, 48, 6294}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_C4*/ {{0x5b, 81, 68, 128, 6302}, 0x0, 25, 1, 0, 0}, - /*II_0F_C5*/ {{0x5c, 65, 12, 40, 6311}, 0x0, 1, 0, 0, 0}, - /*II_66_0F_C5*/ {{0x4c, 69, 12, 48, 6311}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_C5*/ {{0x5d, 68, 13, 128, 6319}, 0x40, 1, 0, 0, 0}, - /*II_0F_C6*/ {{0x4c, 73, 68, 40, 6328}, 0x0, 1, 0, 0, 0}, - /*II_66_0F_C6*/ {{0x4c, 73, 68, 48, 6336}, 0x0, 1, 0, 0, 0}, - /*II_V_0F_C6*/ {{0x5b, 88, 83, 128, 6344}, 0x1, 90, 1, 0, 0}, - /*II_V_66_0F_C6*/ {{0x5b, 88, 83, 128, 6353}, 0x1, 90, 1, 0, 0}, - /*II_0F_C7_01*/ {{0x5e, 0, 48, 8, 6362}, 0x0, 0, 0, 0, 6373}, - /*II_V_66_0F_D0*/ {{0x48, 88, 83, 128, 6414}, 0x1, 90, 0, 0, 0}, - /*II_V_F2_0F_D0*/ {{0x48, 88, 83, 128, 6425}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_D1*/ {{0x48, 81, 68, 128, 6443}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_D2*/ {{0x48, 81, 68, 128, 6458}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_D3*/ {{0x48, 81, 68, 128, 6473}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_D4*/ {{0x48, 81, 68, 128, 6488}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_D5*/ {{0x48, 81, 68, 128, 6504}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_D6*/ {{0x43, 68, 72, 128, 3939}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_D7*/ {{0x4a, 68, 13, 128, 6541}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_D8*/ {{0x48, 81, 68, 128, 6561}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_D9*/ {{0x48, 81, 68, 128, 6580}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_DA*/ {{0x48, 81, 68, 128, 6598}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_DB*/ {{0x48, 81, 68, 128, 6613}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_DC*/ {{0x48, 81, 68, 128, 6629}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_DD*/ {{0x48, 81, 68, 128, 6629}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_DE*/ {{0x48, 81, 68, 128, 6656}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_DF*/ {{0x48, 81, 68, 128, 6672}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_E0*/ {{0x48, 81, 68, 128, 6687}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_E1*/ {{0x48, 81, 68, 128, 6702}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_E2*/ {{0x48, 81, 68, 128, 6717}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_E3*/ {{0x48, 81, 68, 128, 6732}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_E4*/ {{0x48, 81, 68, 128, 6749}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_E5*/ {{0x48, 81, 68, 128, 6767}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_E6*/ {{0x43, 90, 68, 128, 6807}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_E6*/ {{0x43, 91, 83, 128, 6819}, 0x41, 0, 0, 0, 0}, - /*II_V_F2_0F_E6*/ {{0x43, 90, 68, 128, 6830}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_E7*/ {{0x43, 83, 92, 128, 6858}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_E8*/ {{0x48, 81, 68, 128, 6876}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_E9*/ {{0x48, 81, 68, 128, 6893}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_EA*/ {{0x48, 81, 68, 128, 6910}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_EB*/ {{0x48, 81, 68, 128, 6924}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_EC*/ {{0x48, 81, 68, 128, 6938}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_ED*/ {{0x48, 81, 68, 128, 6955}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_EE*/ {{0x48, 81, 68, 128, 6972}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_EF*/ {{0x48, 81, 68, 128, 6987}, 0x0, 73, 0, 0, 0}, - /*II_V_F2_0F_F0*/ {{0x43, 92, 83, 128, 7001}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_F1*/ {{0x48, 81, 68, 128, 7016}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_F2*/ {{0x48, 81, 68, 128, 7031}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_F3*/ {{0x48, 81, 68, 128, 7046}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_F4*/ {{0x48, 81, 68, 128, 7063}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_F5*/ {{0x48, 81, 68, 128, 7082}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_F6*/ {{0x48, 81, 68, 128, 7100}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_F7*/ {{0x5f, 69, 68, 128, 7131}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_F8*/ {{0x48, 81, 68, 128, 7151}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_F9*/ {{0x48, 81, 68, 128, 7166}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_FA*/ {{0x48, 81, 68, 128, 7181}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_FB*/ {{0x48, 81, 68, 128, 7196}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_FC*/ {{0x48, 81, 68, 128, 7211}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_FD*/ {{0x48, 81, 68, 128, 7226}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_FE*/ {{0x48, 81, 68, 128, 7241}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_00*/ {{0x48, 81, 68, 128, 7349}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_01*/ {{0x48, 81, 68, 128, 7366}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_02*/ {{0x48, 81, 68, 128, 7383}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_03*/ {{0x48, 81, 68, 128, 7401}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_04*/ {{0x48, 81, 68, 128, 7422}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_05*/ {{0x48, 81, 68, 128, 7442}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_06*/ {{0x48, 81, 68, 128, 7459}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_07*/ {{0x48, 81, 68, 128, 7477}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_08*/ {{0x48, 81, 68, 128, 7495}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_09*/ {{0x48, 81, 68, 128, 7512}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_0A*/ {{0x48, 81, 68, 128, 7529}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_0B*/ {{0x48, 81, 68, 128, 7548}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_0C*/ {{0x48, 88, 83, 128, 7559}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_38_0D*/ {{0x48, 88, 83, 128, 7570}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_38_0E*/ {{0x43, 90, 83, 128, 7581}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_38_0F*/ {{0x43, 90, 83, 128, 7590}, 0x41, 0, 0, 0, 0}, - /*II_66_0F_38_10*/ {{0x4c, 73, 68, 72, 7599}, 0x0, 74, 0, 0, 0}, - /*II_66_0F_38_14*/ {{0x4c, 73, 68, 72, 7609}, 0x0, 74, 0, 0, 0}, - /*II_66_0F_38_15*/ {{0x4c, 73, 68, 72, 7619}, 0x0, 74, 0, 0, 0}, - /*II_V_66_0F_38_17*/ {{0x43, 90, 83, 128, 7636}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_38_18*/ {{0x43, 44, 83, 128, 7644}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_38_19*/ {{0x43, 46, 85, 128, 7658}, 0x50, 0, 0, 0, 0}, - /*II_V_66_0F_38_1A*/ {{0x43, 47, 85, 128, 7672}, 0x50, 0, 0, 0, 0}, - /*II_V_66_0F_38_1C*/ {{0x43, 73, 68, 128, 7695}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_1D*/ {{0x43, 73, 68, 128, 7710}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_1E*/ {{0x43, 73, 68, 128, 7725}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_20*/ {{0x43, 72, 68, 128, 7743}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_21*/ {{0x43, 71, 68, 128, 7764}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_22*/ {{0x43, 70, 68, 128, 7785}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_23*/ {{0x43, 72, 68, 128, 7806}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_24*/ {{0x43, 71, 68, 128, 7827}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_25*/ {{0x43, 72, 68, 128, 7848}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_28*/ {{0x48, 81, 68, 128, 7867}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_29*/ {{0x48, 81, 68, 128, 7885}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_2A*/ {{0x43, 47, 68, 128, 7905}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_2B*/ {{0x48, 81, 68, 128, 7926}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_2C*/ {{0x48, 88, 83, 128, 7937}, 0x1, 92, 0, 0, 0}, - /*II_V_66_0F_38_2D*/ {{0x48, 88, 83, 128, 7949}, 0x1, 92, 0, 0, 0}, - /*II_V_66_0F_38_2E*/ {{0x48, 88, 92, 128, 7937}, 0x1, 83, 0, 0, 0}, - /*II_V_66_0F_38_2F*/ {{0x48, 88, 92, 128, 7949}, 0x1, 83, 0, 0, 0}, - /*II_V_66_0F_38_30*/ {{0x43, 72, 68, 128, 7971}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_31*/ {{0x43, 71, 68, 128, 7992}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_32*/ {{0x43, 70, 68, 128, 8013}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_33*/ {{0x43, 72, 68, 128, 8034}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_34*/ {{0x43, 71, 68, 128, 8055}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_35*/ {{0x43, 72, 68, 128, 8076}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_37*/ {{0x48, 81, 68, 128, 8096}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_38*/ {{0x48, 81, 68, 128, 8114}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_39*/ {{0x48, 81, 68, 128, 8131}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_3A*/ {{0x48, 81, 68, 128, 8148}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_3B*/ {{0x48, 81, 68, 128, 8165}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_3C*/ {{0x48, 81, 68, 128, 8182}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_3D*/ {{0x48, 81, 68, 128, 8199}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_3E*/ {{0x48, 81, 68, 128, 8216}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_3F*/ {{0x48, 81, 68, 128, 8233}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_40*/ {{0x48, 81, 68, 128, 8250}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_41*/ {{0x43, 73, 68, 128, 8271}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_96*/ {{0x48, 88, 83, 136, 8310}, 0x7, 90, 0, 8326, 0}, - /*II_V_66_0F_38_97*/ {{0x48, 88, 83, 136, 8342}, 0x7, 90, 0, 8358, 0}, - /*II_V_66_0F_38_98*/ {{0x48, 88, 83, 136, 8374}, 0x7, 90, 0, 8387, 0}, - /*II_V_66_0F_38_99*/ {{0x48, 81, 68, 136, 8400}, 0x6, 80, 0, 8413, 0}, - /*II_V_66_0F_38_9A*/ {{0x48, 88, 83, 136, 8426}, 0x7, 90, 0, 8439, 0}, - /*II_V_66_0F_38_9B*/ {{0x48, 81, 68, 136, 8452}, 0x6, 80, 0, 8465, 0}, - /*II_V_66_0F_38_9C*/ {{0x48, 88, 83, 136, 8478}, 0x7, 90, 0, 8492, 0}, - /*II_V_66_0F_38_9D*/ {{0x48, 81, 68, 136, 8506}, 0x6, 80, 0, 8520, 0}, - /*II_V_66_0F_38_9E*/ {{0x48, 88, 83, 136, 8534}, 0x7, 90, 0, 8548, 0}, - /*II_V_66_0F_38_9F*/ {{0x48, 81, 68, 136, 8562}, 0x6, 80, 0, 8576, 0}, - /*II_V_66_0F_38_A6*/ {{0x48, 88, 83, 136, 8590}, 0x7, 90, 0, 8606, 0}, - /*II_V_66_0F_38_A7*/ {{0x48, 88, 83, 136, 8622}, 0x7, 90, 0, 8638, 0}, - /*II_V_66_0F_38_A8*/ {{0x48, 88, 83, 136, 8654}, 0x7, 90, 0, 8667, 0}, - /*II_V_66_0F_38_A9*/ {{0x48, 81, 68, 136, 8680}, 0x6, 80, 0, 8693, 0}, - /*II_V_66_0F_38_AA*/ {{0x48, 88, 83, 136, 8706}, 0x7, 90, 0, 8719, 0}, - /*II_V_66_0F_38_AB*/ {{0x48, 81, 68, 136, 8732}, 0x6, 80, 0, 8745, 0}, - /*II_V_66_0F_38_AC*/ {{0x48, 88, 83, 136, 8758}, 0x7, 90, 0, 8772, 0}, - /*II_V_66_0F_38_AD*/ {{0x48, 81, 68, 136, 8786}, 0x6, 80, 0, 8800, 0}, - /*II_V_66_0F_38_AE*/ {{0x48, 88, 83, 136, 8814}, 0x7, 90, 0, 8828, 0}, - /*II_V_66_0F_38_AF*/ {{0x48, 81, 68, 136, 8842}, 0x6, 80, 0, 8856, 0}, - /*II_V_66_0F_38_B6*/ {{0x48, 88, 83, 136, 8870}, 0x7, 90, 0, 8886, 0}, - /*II_V_66_0F_38_B7*/ {{0x48, 88, 83, 136, 8902}, 0x7, 90, 0, 8918, 0}, - /*II_V_66_0F_38_B8*/ {{0x48, 88, 83, 136, 8934}, 0x7, 90, 0, 8947, 0}, - /*II_V_66_0F_38_B9*/ {{0x48, 81, 68, 136, 8960}, 0x6, 80, 0, 8973, 0}, - /*II_V_66_0F_38_BA*/ {{0x48, 88, 83, 136, 8986}, 0x7, 90, 0, 8999, 0}, - /*II_V_66_0F_38_BB*/ {{0x48, 81, 68, 136, 9012}, 0x6, 80, 0, 9025, 0}, - /*II_V_66_0F_38_BC*/ {{0x48, 88, 83, 136, 9038}, 0x7, 90, 0, 9052, 0}, - /*II_V_66_0F_38_BD*/ {{0x48, 81, 68, 136, 9066}, 0x6, 80, 0, 9080, 0}, - /*II_V_66_0F_38_BE*/ {{0x48, 88, 83, 136, 9094}, 0x7, 90, 0, 9108, 0}, - /*II_V_66_0F_38_BF*/ {{0x48, 81, 68, 136, 9122}, 0x6, 80, 0, 9136, 0}, - /*II_V_66_0F_38_DB*/ {{0x43, 73, 68, 152, 9158}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_DC*/ {{0x48, 81, 68, 152, 9175}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_DD*/ {{0x48, 81, 68, 152, 9196}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_DE*/ {{0x48, 81, 68, 152, 9217}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_DF*/ {{0x48, 81, 68, 152, 9238}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_3A_04*/ {{0x48, 90, 83, 128, 7559}, 0x41, 1, 0, 0, 0}, - /*II_V_66_0F_3A_05*/ {{0x48, 90, 83, 128, 7570}, 0x41, 1, 0, 0, 0}, - /*II_V_66_0F_3A_06*/ {{0x5b, 87, 85, 128, 9265}, 0x10, 86, 1, 0, 0}, - /*II_66_0F_3A_08*/ {{0x4c, 73, 68, 72, 9277}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_08*/ {{0x48, 90, 83, 128, 9286}, 0x41, 1, 0, 0, 0}, - /*II_66_0F_3A_09*/ {{0x4c, 73, 68, 72, 9296}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_09*/ {{0x48, 90, 83, 128, 9305}, 0x41, 1, 0, 0, 0}, - /*II_66_0F_3A_0A*/ {{0x4c, 71, 68, 72, 9315}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_0A*/ {{0x5b, 81, 68, 128, 9324}, 0x0, 71, 1, 0, 0}, - /*II_66_0F_3A_0B*/ {{0x4c, 72, 68, 72, 9334}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_0B*/ {{0x5b, 81, 68, 128, 9343}, 0x0, 72, 1, 0, 0}, - /*II_66_0F_3A_0C*/ {{0x4c, 73, 68, 72, 9353}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_0C*/ {{0x5b, 88, 83, 128, 9362}, 0x1, 90, 1, 0, 0}, - /*II_66_0F_3A_0D*/ {{0x4c, 73, 68, 72, 9372}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_0D*/ {{0x5b, 88, 83, 128, 9381}, 0x1, 90, 1, 0, 0}, - /*II_66_0F_3A_0E*/ {{0x4c, 73, 68, 72, 9391}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_0E*/ {{0x5b, 81, 68, 128, 9400}, 0x0, 73, 1, 0, 0}, - /*II_0F_3A_0F*/ {{0x4c, 67, 64, 64, 9410}, 0x0, 1, 0, 0, 0}, - /*II_66_0F_3A_0F*/ {{0x4c, 73, 68, 64, 9410}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_0F*/ {{0x5b, 81, 68, 128, 9419}, 0x0, 73, 1, 0, 0}, - /*II_66_0F_3A_14*/ {{0x4c, 68, 26, 72, 9429}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_14*/ {{0x5d, 68, 76, 128, 9437}, 0x40, 1, 0, 0, 0}, - /*II_66_0F_3A_15*/ {{0x4c, 68, 27, 72, 6311}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_15*/ {{0x5d, 68, 77, 128, 6319}, 0x40, 1, 0, 0, 0}, - /*II_66_0F_3A_16*/ {{0x62, 68, 18, 72, 9446}, 0x0, 1, 0, 0, 9454}, - /*II_V_66_0F_3A_16*/ {{0x48, 68, 79, 128, 9462}, 0x46, 1, 0, 9471, 0}, - /*II_66_0F_3A_17*/ {{0x4c, 68, 18, 72, 9480}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_17*/ {{0x48, 68, 75, 128, 9491}, 0x40, 1, 0, 0, 0}, - /*II_V_66_0F_3A_18*/ {{0x5b, 87, 85, 128, 9503}, 0x10, 73, 1, 0, 0}, - /*II_V_66_0F_3A_19*/ {{0x48, 85, 73, 128, 9516}, 0x50, 1, 0, 0, 0}, - /*II_66_0F_3A_20*/ {{0x4c, 24, 68, 72, 9530}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_20*/ {{0x5b, 81, 68, 128, 9538}, 0x0, 76, 1, 0, 0}, - /*II_66_0F_3A_21*/ {{0x4c, 71, 68, 72, 9547}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_21*/ {{0x5b, 81, 68, 128, 9557}, 0x0, 71, 1, 0, 0}, - /*II_66_0F_3A_22*/ {{0x62, 18, 68, 72, 9568}, 0x0, 1, 0, 0, 9576}, - /*II_V_66_0F_3A_22*/ {{0x5b, 81, 68, 128, 9584}, 0x6, 79, 1, 9593, 0}, - /*II_66_0F_3A_40*/ {{0x4c, 73, 68, 72, 9602}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_40*/ {{0x5b, 88, 83, 128, 9608}, 0x1, 90, 1, 0, 0}, - /*II_66_0F_3A_41*/ {{0x4c, 73, 68, 72, 9615}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_41*/ {{0x5b, 81, 68, 128, 9621}, 0x0, 73, 1, 0, 0}, - /*II_66_0F_3A_42*/ {{0x4c, 73, 68, 72, 9628}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_42*/ {{0x5b, 81, 68, 128, 9637}, 0x0, 73, 1, 0, 0}, - /*II_66_0F_3A_44*/ {{0x4c, 73, 68, 144, 9647}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_44*/ {{0x5b, 81, 68, 144, 9658}, 0x0, 73, 1, 0, 0}, - /*II_V_66_0F_3A_4A*/ {{0x5b, 88, 83, 128, 9670}, 0x1, 90, 84, 0, 0}, - /*II_V_66_0F_3A_4B*/ {{0x5b, 88, 83, 128, 9681}, 0x1, 90, 84, 0, 0}, - /*II_V_66_0F_3A_4C*/ {{0x5b, 81, 68, 128, 9692}, 0x0, 73, 82, 0, 0}, - /*II_66_0F_3A_60*/ {{0x4c, 73, 68, 80, 9703}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_60*/ {{0x48, 73, 68, 128, 9714}, 0x40, 1, 0, 0, 0}, - /*II_66_0F_3A_61*/ {{0x4c, 73, 68, 80, 9726}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_61*/ {{0x48, 73, 68, 128, 9737}, 0x40, 1, 0, 0, 0}, - /*II_66_0F_3A_62*/ {{0x4c, 73, 68, 80, 9749}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_62*/ {{0x48, 73, 68, 128, 9760}, 0x40, 1, 0, 0, 0}, - /*II_66_0F_3A_63*/ {{0x4c, 73, 68, 80, 9772}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_63*/ {{0x48, 73, 68, 128, 9783}, 0x40, 1, 0, 0, 0}, - /*II_66_0F_3A_DF*/ {{0x4c, 73, 68, 152, 9795}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_DF*/ {{0x48, 73, 68, 152, 9812}, 0x40, 1, 0, 0, 0}, - /*II_V_66_0F_71_02*/ {{0x64, 69, 81, 128, 6443}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_71_04*/ {{0x64, 69, 81, 128, 6702}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_71_06*/ {{0x64, 69, 81, 128, 7016}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_72_02*/ {{0x64, 69, 81, 128, 6458}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_72_04*/ {{0x64, 69, 81, 128, 6717}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_72_06*/ {{0x64, 69, 81, 128, 7031}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_73_02*/ {{0x64, 69, 81, 128, 6473}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_73_03*/ {{0x64, 69, 81, 128, 9838}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_73_06*/ {{0x64, 69, 81, 128, 7046}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_73_07*/ {{0x64, 69, 81, 128, 9855}, 0x0, 1, 0, 0, 0}, - /*II_0F_AE_00*/ {{0x52, 0, 42, 8, 9864}, 0x0, 0, 0, 0, 9872}, - /*II_0F_AE_01*/ {{0x52, 0, 42, 8, 9892}, 0x0, 0, 0, 0, 9901}, - /*II_V_0F_AE_02*/ {{0x45, 0, 44, 128, 9941}, 0x40, 0, 0, 0, 0}, - /*II_V_0F_AE_03*/ {{0x45, 0, 44, 128, 9970}, 0x40, 0, 0, 0, 0}, - /*II_0F_C7_06*/ {{0x54, 0, 43, 112, 9980}, 0x0, 0, 0, 9988, 0} -}; - -_InstNode InstructionsTree[] = { -/* 0 - _00 */ 0x2000, -/* 1 - _01 */ 0x2001, -/* 2 - _02 */ 0x2002, -/* 3 - _03 */ 0x2003, -/* 4 - _04 */ 0x2004, -/* 5 - _05 */ 0x2005, -/* 6 - _06 */ 0x2006, -/* 7 - _07 */ 0x2007, -/* 8 - _08 */ 0x2008, -/* 9 - _09 */ 0x2009, -/* a - _0A */ 0x200a, -/* b - _0B */ 0x200b, -/* c - _0C */ 0x200c, -/* d - _0D */ 0x200d, -/* e - _0E */ 0x200e, -/* f - _0F */ 0x8100, -/* 10 - _10 */ 0x200f, -/* 11 - _11 */ 0x2010, -/* 12 - _12 */ 0x2011, -/* 13 - _13 */ 0x2012, -/* 14 - _14 */ 0x2013, -/* 15 - _15 */ 0x2014, -/* 16 - _16 */ 0x2015, -/* 17 - _17 */ 0x2016, -/* 18 - _18 */ 0x2017, -/* 19 - _19 */ 0x2018, -/* 1a - _1A */ 0x2019, -/* 1b - _1B */ 0x201a, -/* 1c - _1C */ 0x201b, -/* 1d - _1D */ 0x201c, -/* 1e - _1E */ 0x201d, -/* 1f - _1F */ 0x201e, -/* 20 - _20 */ 0x201f, -/* 21 - _21 */ 0x2020, -/* 22 - _22 */ 0x2021, -/* 23 - _23 */ 0x2022, -/* 24 - _24 */ 0x2023, -/* 25 - _25 */ 0x2024, -/* 26 - */ 0, -/* 27 - _27 */ 0x2025, -/* 28 - _28 */ 0x2026, -/* 29 - _29 */ 0x2027, -/* 2a - _2A */ 0x2028, -/* 2b - _2B */ 0x2029, -/* 2c - _2C */ 0x202a, -/* 2d - _2D */ 0x202b, -/* 2e - */ 0, -/* 2f - _2F */ 0x202c, -/* 30 - _30 */ 0x202d, -/* 31 - _31 */ 0x202e, -/* 32 - _32 */ 0x202f, -/* 33 - _33 */ 0x2030, -/* 34 - _34 */ 0x2031, -/* 35 - _35 */ 0x2032, -/* 36 - */ 0, -/* 37 - _37 */ 0x2033, -/* 38 - _38 */ 0x2034, -/* 39 - _39 */ 0x2035, -/* 3a - _3A */ 0x2036, -/* 3b - _3B */ 0x2037, -/* 3c - _3C */ 0x2038, -/* 3d - _3D */ 0x2039, -/* 3e - */ 0, -/* 3f - _3F */ 0x203a, -/* 40 - _40 */ 0x203b, -/* 41 - _40 */ 0x203c, -/* 42 - _40 */ 0x203d, -/* 43 - _40 */ 0x203e, -/* 44 - _40 */ 0x203f, -/* 45 - _40 */ 0x2040, -/* 46 - _40 */ 0x2041, -/* 47 - _40 */ 0x2042, -/* 48 - _48 */ 0x2043, -/* 49 - _48 */ 0x2044, -/* 4a - _48 */ 0x2045, -/* 4b - _48 */ 0x2046, -/* 4c - _48 */ 0x2047, -/* 4d - _48 */ 0x2048, -/* 4e - _48 */ 0x2049, -/* 4f - _48 */ 0x204a, -/* 50 - _50 */ 0x204b, -/* 51 - _50 */ 0x204c, -/* 52 - _50 */ 0x204d, -/* 53 - _50 */ 0x204e, -/* 54 - _50 */ 0x204f, -/* 55 - _50 */ 0x2050, -/* 56 - _50 */ 0x2051, -/* 57 - _50 */ 0x2052, -/* 58 - _58 */ 0x2053, -/* 59 - _58 */ 0x2054, -/* 5a - _58 */ 0x2055, -/* 5b - _58 */ 0x2056, -/* 5c - _58 */ 0x2057, -/* 5d - _58 */ 0x2058, -/* 5e - _58 */ 0x2059, -/* 5f - _58 */ 0x205a, -/* 60 - _60 */ 0x205b, -/* 61 - _61 */ 0x205c, -/* 62 - _62 */ 0x205d, -/* 63 - _63 */ 0x205e, -/* 64 - */ 0, -/* 65 - */ 0, -/* 66 - */ 0, -/* 67 - */ 0, -/* 68 - _68 */ 0x205f, -/* 69 - _69 */ 0x4000, -/* 6a - _6A */ 0x2060, -/* 6b - _6B */ 0x4001, -/* 6c - _6C */ 0x2061, -/* 6d - _6D */ 0x2062, -/* 6e - _6E */ 0x2063, -/* 6f - _6F */ 0x2064, -/* 70 - _70 */ 0x2065, -/* 71 - _71 */ 0x2066, -/* 72 - _72 */ 0x2067, -/* 73 - _73 */ 0x2068, -/* 74 - _74 */ 0x2069, -/* 75 - _75 */ 0x206a, -/* 76 - _76 */ 0x206b, -/* 77 - _77 */ 0x206c, -/* 78 - _78 */ 0x206d, -/* 79 - _79 */ 0x206e, -/* 7a - _7A */ 0x206f, -/* 7b - _7B */ 0x2070, -/* 7c - _7C */ 0x2071, -/* 7d - _7D */ 0x2072, -/* 7e - _7E */ 0x2073, -/* 7f - _7F */ 0x2074, -/* 80 - _80 */ 0x6200, -/* 81 - _81 */ 0x6208, -/* 82 - _82 */ 0x6210, -/* 83 - _83 */ 0x6218, -/* 84 - _84 */ 0x2075, -/* 85 - _85 */ 0x2076, -/* 86 - _86 */ 0x2077, -/* 87 - _87 */ 0x2078, -/* 88 - _88 */ 0x2079, -/* 89 - _89 */ 0x207a, -/* 8a - _8A */ 0x207b, -/* 8b - _8B */ 0x207c, -/* 8c - _8C */ 0x207d, -/* 8d - _8D */ 0x207e, -/* 8e - _8E */ 0x207f, -/* 8f - _8F */ 0x6220, -/* 90 - _90 */ 0x2080, -/* 91 - _91 */ 0x2081, -/* 92 - _92 */ 0x2082, -/* 93 - _93 */ 0x2083, -/* 94 - _94 */ 0x2084, -/* 95 - _95 */ 0x2085, -/* 96 - _96 */ 0x2086, -/* 97 - _97 */ 0x2087, -/* 98 - _98 */ 0x4002, -/* 99 - _99 */ 0x4003, -/* 9a - _9A */ 0x2088, -/* 9b - */ 0, -/* 9c - _9C */ 0x2089, -/* 9d - _9D */ 0x208a, -/* 9e - _9E */ 0x208b, -/* 9f - _9F */ 0x208c, -/* a0 - _A0 */ 0x208d, -/* a1 - _A1 */ 0x208e, -/* a2 - _A2 */ 0x208f, -/* a3 - _A3 */ 0x2090, -/* a4 - _A4 */ 0x2091, -/* a5 - _A5 */ 0x2092, -/* a6 - _A6 */ 0x2093, -/* a7 - _A7 */ 0x2094, -/* a8 - _A8 */ 0x2095, -/* a9 - _A9 */ 0x2096, -/* aa - _AA */ 0x2097, -/* ab - _AB */ 0x2098, -/* ac - _AC */ 0x2099, -/* ad - _AD */ 0x209a, -/* ae - _AE */ 0x209b, -/* af - _AF */ 0x209c, -/* b0 - _B0 */ 0x209d, -/* b1 - _B0 */ 0x209e, -/* b2 - _B0 */ 0x209f, -/* b3 - _B0 */ 0x20a0, -/* b4 - _B0 */ 0x20a1, -/* b5 - _B0 */ 0x20a2, -/* b6 - _B0 */ 0x20a3, -/* b7 - _B0 */ 0x20a4, -/* b8 - _B8 */ 0x20a5, -/* b9 - _B8 */ 0x20a6, -/* ba - _B8 */ 0x20a7, -/* bb - _B8 */ 0x20a8, -/* bc - _B8 */ 0x20a9, -/* bd - _B8 */ 0x20aa, -/* be - _B8 */ 0x20ab, -/* bf - _B8 */ 0x20ac, -/* c0 - _C0 */ 0x6228, -/* c1 - _C1 */ 0x6230, -/* c2 - _C2 */ 0x20ad, -/* c3 - _C3 */ 0x20ae, -/* c4 - _C4 */ 0x20af, -/* c5 - _C5 */ 0x20b0, -/* c6 - _C6 */ 0x6238, -/* c7 - _C7 */ 0x6240, -/* c8 - _C8 */ 0x20b1, -/* c9 - _C9 */ 0x20b2, -/* ca - _CA */ 0x20b3, -/* cb - _CB */ 0x20b4, -/* cc - _CC */ 0x20b5, -/* cd - _CD */ 0x20b6, -/* ce - _CE */ 0x20b7, -/* cf - _CF */ 0x20b8, -/* d0 - _D0 */ 0x6248, -/* d1 - _D1 */ 0x6250, -/* d2 - _D2 */ 0x6258, -/* d3 - _D3 */ 0x6260, -/* d4 - _D4 */ 0x20b9, -/* d5 - _D5 */ 0x20ba, -/* d6 - _D6 */ 0x20bb, -/* d7 - _D7 */ 0x20bc, -/* d8 - _D8 */ 0xa268, -/* d9 - _D9 */ 0xa2b0, -/* da - _DA */ 0xa2f8, -/* db - _DB */ 0xa340, -/* dc - _DC */ 0xa388, -/* dd - _DD */ 0xa3d0, -/* de - _DE */ 0xa418, -/* df - _DF */ 0xa460, -/* e0 - _E0 */ 0x20bd, -/* e1 - _E1 */ 0x20be, -/* e2 - _E2 */ 0x20bf, -/* e3 - _E3 */ 0x4004, -/* e4 - _E4 */ 0x20c0, -/* e5 - _E5 */ 0x20c1, -/* e6 - _E6 */ 0x20c2, -/* e7 - _E7 */ 0x20c3, -/* e8 - _E8 */ 0x20c4, -/* e9 - _E9 */ 0x20c5, -/* ea - _EA */ 0x20c6, -/* eb - _EB */ 0x20c7, -/* ec - _EC */ 0x20c8, -/* ed - _ED */ 0x20c9, -/* ee - _EE */ 0x20ca, -/* ef - _EF */ 0x20cb, -/* f0 - */ 0, -/* f1 - _F1 */ 0x20cc, -/* f2 - */ 0, -/* f3 - */ 0, -/* f4 - _F4 */ 0x20cd, -/* f5 - _F5 */ 0x20ce, -/* f6 - _F6 */ 0x64a8, -/* f7 - _F7 */ 0x64b0, -/* f8 - _F8 */ 0x20cf, -/* f9 - _F9 */ 0x20d0, -/* fa - _FA */ 0x20d1, -/* fb - _FB */ 0x20d2, -/* fc - _FC */ 0x20d3, -/* fd - _FD */ 0x20d4, -/* fe - _FE */ 0x64b8, -/* ff - _FF */ 0x64c0, -/* 100 - _0F_00 */ 0x64c8, -/* 101 - _0F_01 */ 0xa4d0, -/* 102 - _0F_02 */ 0x20d5, -/* 103 - _0F_03 */ 0x20d6, -/* 104 - */ 0, -/* 105 - _0F_05 */ 0x20d7, -/* 106 - _0F_06 */ 0x20d8, -/* 107 - _0F_07 */ 0x20d9, -/* 108 - _0F_08 */ 0x20da, -/* 109 - _0F_09 */ 0x20db, -/* 10a - */ 0, -/* 10b - _0F_0B */ 0x20dc, -/* 10c - */ 0, -/* 10d - _0F_0D */ 0x6518, -/* 10e - _0F_0E */ 0x20dd, -/* 10f - _0F_0F */ 0x8520, -/* 110 - _0F_10 */ 0xc620, -/* 111 - _0F_11 */ 0xc62c, -/* 112 - _0F_12 */ 0xc638, -/* 113 - _0F_13 */ 0xc644, -/* 114 - _0F_14 */ 0xc650, -/* 115 - _0F_15 */ 0xc65c, -/* 116 - _0F_16 */ 0xc668, -/* 117 - _0F_17 */ 0xc674, -/* 118 - _0F_18 */ 0x6680, -/* 119 - */ 0, -/* 11a - */ 0, -/* 11b - */ 0, -/* 11c - */ 0, -/* 11d - */ 0, -/* 11e - */ 0, -/* 11f - _0F_1F */ 0x20de, -/* 120 - _0F_20 */ 0x20df, -/* 121 - _0F_21 */ 0x20e0, -/* 122 - _0F_22 */ 0x20e1, -/* 123 - _0F_23 */ 0x20e2, -/* 124 - */ 0, -/* 125 - */ 0, -/* 126 - */ 0, -/* 127 - */ 0, -/* 128 - _0F_28 */ 0xc688, -/* 129 - _0F_29 */ 0xc694, -/* 12a - _0F_2A */ 0xc6a0, -/* 12b - _0F_2B */ 0xc6ac, -/* 12c - _0F_2C */ 0xc6b8, -/* 12d - _0F_2D */ 0xc6c4, -/* 12e - _0F_2E */ 0xc6d0, -/* 12f - _0F_2F */ 0xc6dc, -/* 130 - _0F_30 */ 0x20e3, -/* 131 - _0F_31 */ 0x20e4, -/* 132 - _0F_32 */ 0x20e5, -/* 133 - _0F_33 */ 0x20e6, -/* 134 - _0F_34 */ 0x20e7, -/* 135 - _0F_35 */ 0x20e8, -/* 136 - */ 0, -/* 137 - _0F_37 */ 0x20e9, -/* 138 - _0F_38 */ 0x86e8, -/* 139 - */ 0, -/* 13a - _0F_3A */ 0x87e8, -/* 13b - */ 0, -/* 13c - */ 0, -/* 13d - */ 0, -/* 13e - */ 0, -/* 13f - */ 0, -/* 140 - _0F_40 */ 0x20ea, -/* 141 - _0F_41 */ 0x20eb, -/* 142 - _0F_42 */ 0x20ec, -/* 143 - _0F_43 */ 0x20ed, -/* 144 - _0F_44 */ 0x20ee, -/* 145 - _0F_45 */ 0x20ef, -/* 146 - _0F_46 */ 0x20f0, -/* 147 - _0F_47 */ 0x20f1, -/* 148 - _0F_48 */ 0x20f2, -/* 149 - _0F_49 */ 0x20f3, -/* 14a - _0F_4A */ 0x20f4, -/* 14b - _0F_4B */ 0x20f5, -/* 14c - _0F_4C */ 0x20f6, -/* 14d - _0F_4D */ 0x20f7, -/* 14e - _0F_4E */ 0x20f8, -/* 14f - _0F_4F */ 0x20f9, -/* 150 - _0F_50 */ 0xc8e8, -/* 151 - _0F_51 */ 0xc8f4, -/* 152 - _0F_52 */ 0xc900, -/* 153 - _0F_53 */ 0xc90c, -/* 154 - _0F_54 */ 0xc918, -/* 155 - _0F_55 */ 0xc924, -/* 156 - _0F_56 */ 0xc930, -/* 157 - _0F_57 */ 0xc93c, -/* 158 - _0F_58 */ 0xc948, -/* 159 - _0F_59 */ 0xc954, -/* 15a - _0F_5A */ 0xc960, -/* 15b - _0F_5B */ 0xc96c, -/* 15c - _0F_5C */ 0xc978, -/* 15d - _0F_5D */ 0xc984, -/* 15e - _0F_5E */ 0xc990, -/* 15f - _0F_5F */ 0xc99c, -/* 160 - _0F_60 */ 0xc9a8, -/* 161 - _0F_61 */ 0xc9b4, -/* 162 - _0F_62 */ 0xc9c0, -/* 163 - _0F_63 */ 0xc9cc, -/* 164 - _0F_64 */ 0xc9d8, -/* 165 - _0F_65 */ 0xc9e4, -/* 166 - _0F_66 */ 0xc9f0, -/* 167 - _0F_67 */ 0xc9fc, -/* 168 - _0F_68 */ 0xca08, -/* 169 - _0F_69 */ 0xca14, -/* 16a - _0F_6A */ 0xca20, -/* 16b - _0F_6B */ 0xca2c, -/* 16c - _0F_6C */ 0xca38, -/* 16d - _0F_6D */ 0xca44, -/* 16e - _0F_6E */ 0xca50, -/* 16f - _0F_6F */ 0xca5c, -/* 170 - _0F_70 */ 0xca68, -/* 171 - _0F_71 */ 0x6a74, -/* 172 - _0F_72 */ 0x6a7c, -/* 173 - _0F_73 */ 0x6a84, -/* 174 - _0F_74 */ 0xca8c, -/* 175 - _0F_75 */ 0xca98, -/* 176 - _0F_76 */ 0xcaa4, -/* 177 - _0F_77 */ 0xcab0, -/* 178 - _0F_78 */ 0xcabc, -/* 179 - _0F_79 */ 0xcac8, -/* 17a - _0F_7A */ 0x8ad4, -/* 17b - */ 0, -/* 17c - _0F_7C */ 0xcbd4, -/* 17d - _0F_7D */ 0xcbe0, -/* 17e - _0F_7E */ 0xcbec, -/* 17f - _0F_7F */ 0xcbf8, -/* 180 - _0F_80 */ 0x20fa, -/* 181 - _0F_81 */ 0x20fb, -/* 182 - _0F_82 */ 0x20fc, -/* 183 - _0F_83 */ 0x20fd, -/* 184 - _0F_84 */ 0x20fe, -/* 185 - _0F_85 */ 0x20ff, -/* 186 - _0F_86 */ 0x2100, -/* 187 - _0F_87 */ 0x2101, -/* 188 - _0F_88 */ 0x2102, -/* 189 - _0F_89 */ 0x2103, -/* 18a - _0F_8A */ 0x2104, -/* 18b - _0F_8B */ 0x2105, -/* 18c - _0F_8C */ 0x2106, -/* 18d - _0F_8D */ 0x2107, -/* 18e - _0F_8E */ 0x2108, -/* 18f - _0F_8F */ 0x2109, -/* 190 - _0F_90 */ 0x210a, -/* 191 - _0F_91 */ 0x210b, -/* 192 - _0F_92 */ 0x210c, -/* 193 - _0F_93 */ 0x210d, -/* 194 - _0F_94 */ 0x210e, -/* 195 - _0F_95 */ 0x210f, -/* 196 - _0F_96 */ 0x2110, -/* 197 - _0F_97 */ 0x2111, -/* 198 - _0F_98 */ 0x2112, -/* 199 - _0F_99 */ 0x2113, -/* 19a - _0F_9A */ 0x2114, -/* 19b - _0F_9B */ 0x2115, -/* 19c - _0F_9C */ 0x2116, -/* 19d - _0F_9D */ 0x2117, -/* 19e - _0F_9E */ 0x2118, -/* 19f - _0F_9F */ 0x2119, -/* 1a0 - _0F_A0 */ 0x211a, -/* 1a1 - _0F_A1 */ 0x211b, -/* 1a2 - _0F_A2 */ 0x211c, -/* 1a3 - _0F_A3 */ 0x211d, -/* 1a4 - _0F_A4 */ 0x4005, -/* 1a5 - _0F_A5 */ 0x4006, -/* 1a6 - */ 0, -/* 1a7 - */ 0, -/* 1a8 - _0F_A8 */ 0x211e, -/* 1a9 - _0F_A9 */ 0x211f, -/* 1aa - _0F_AA */ 0x2120, -/* 1ab - _0F_AB */ 0x2121, -/* 1ac - _0F_AC */ 0x4007, -/* 1ad - _0F_AD */ 0x4008, -/* 1ae - _0F_AE */ 0x6c04, -/* 1af - _0F_AF */ 0x2122, -/* 1b0 - _0F_B0 */ 0x2123, -/* 1b1 - _0F_B1 */ 0x2124, -/* 1b2 - _0F_B2 */ 0x2125, -/* 1b3 - _0F_B3 */ 0x2126, -/* 1b4 - _0F_B4 */ 0x2127, -/* 1b5 - _0F_B5 */ 0x2128, -/* 1b6 - _0F_B6 */ 0x2129, -/* 1b7 - _0F_B7 */ 0x212a, -/* 1b8 - _0F_B8 */ 0xcc0c, -/* 1b9 - _0F_B9 */ 0x212b, -/* 1ba - _0F_BA */ 0x6c18, -/* 1bb - _0F_BB */ 0x212c, -/* 1bc - _0F_BC */ 0xcc20, -/* 1bd - _0F_BD */ 0xcc2c, -/* 1be - _0F_BE */ 0x212d, -/* 1bf - _0F_BF */ 0x212e, -/* 1c0 - _0F_C0 */ 0x212f, -/* 1c1 - _0F_C1 */ 0x2130, -/* 1c2 - _0F_C2 */ 0xcc38, -/* 1c3 - _0F_C3 */ 0x2131, -/* 1c4 - _0F_C4 */ 0xcc44, -/* 1c5 - _0F_C5 */ 0xcc50, -/* 1c6 - _0F_C6 */ 0xcc5c, -/* 1c7 - _0F_C7 */ 0x6c68, -/* 1c8 - _0F_C8 */ 0x2132, -/* 1c9 - _0F_C8 */ 0x2133, -/* 1ca - _0F_C8 */ 0x2134, -/* 1cb - _0F_C8 */ 0x2135, -/* 1cc - _0F_C8 */ 0x2136, -/* 1cd - _0F_C8 */ 0x2137, -/* 1ce - _0F_C8 */ 0x2138, -/* 1cf - _0F_C8 */ 0x2139, -/* 1d0 - _0F_D0 */ 0xcc70, -/* 1d1 - _0F_D1 */ 0xcc7c, -/* 1d2 - _0F_D2 */ 0xcc88, -/* 1d3 - _0F_D3 */ 0xcc94, -/* 1d4 - _0F_D4 */ 0xcca0, -/* 1d5 - _0F_D5 */ 0xccac, -/* 1d6 - _0F_D6 */ 0xccb8, -/* 1d7 - _0F_D7 */ 0xccc4, -/* 1d8 - _0F_D8 */ 0xccd0, -/* 1d9 - _0F_D9 */ 0xccdc, -/* 1da - _0F_DA */ 0xcce8, -/* 1db - _0F_DB */ 0xccf4, -/* 1dc - _0F_DC */ 0xcd00, -/* 1dd - _0F_DD */ 0xcd0c, -/* 1de - _0F_DE */ 0xcd18, -/* 1df - _0F_DF */ 0xcd24, -/* 1e0 - _0F_E0 */ 0xcd30, -/* 1e1 - _0F_E1 */ 0xcd3c, -/* 1e2 - _0F_E2 */ 0xcd48, -/* 1e3 - _0F_E3 */ 0xcd54, -/* 1e4 - _0F_E4 */ 0xcd60, -/* 1e5 - _0F_E5 */ 0xcd6c, -/* 1e6 - _0F_E6 */ 0xcd78, -/* 1e7 - _0F_E7 */ 0xcd84, -/* 1e8 - _0F_E8 */ 0xcd90, -/* 1e9 - _0F_E9 */ 0xcd9c, -/* 1ea - _0F_EA */ 0xcda8, -/* 1eb - _0F_EB */ 0xcdb4, -/* 1ec - _0F_EC */ 0xcdc0, -/* 1ed - _0F_ED */ 0xcdcc, -/* 1ee - _0F_EE */ 0xcdd8, -/* 1ef - _0F_EF */ 0xcde4, -/* 1f0 - _0F_F0 */ 0xcdf0, -/* 1f1 - _0F_F1 */ 0xcdfc, -/* 1f2 - _0F_F2 */ 0xce08, -/* 1f3 - _0F_F3 */ 0xce14, -/* 1f4 - _0F_F4 */ 0xce20, -/* 1f5 - _0F_F5 */ 0xce2c, -/* 1f6 - _0F_F6 */ 0xce38, -/* 1f7 - _0F_F7 */ 0xce44, -/* 1f8 - _0F_F8 */ 0xce50, -/* 1f9 - _0F_F9 */ 0xce5c, -/* 1fa - _0F_FA */ 0xce68, -/* 1fb - _0F_FB */ 0xce74, -/* 1fc - _0F_FC */ 0xce80, -/* 1fd - _0F_FD */ 0xce8c, -/* 1fe - _0F_FE */ 0xce98, -/* 1ff - */ 0, -/* 200 - _80_00 */ 0x213a, -/* 201 - _80_01 */ 0x213b, -/* 202 - _80_02 */ 0x213c, -/* 203 - _80_03 */ 0x213d, -/* 204 - _80_04 */ 0x213e, -/* 205 - _80_05 */ 0x213f, -/* 206 - _80_06 */ 0x2140, -/* 207 - _80_07 */ 0x2141, -/* 208 - _81_00 */ 0x2142, -/* 209 - _81_01 */ 0x2143, -/* 20a - _81_02 */ 0x2144, -/* 20b - _81_03 */ 0x2145, -/* 20c - _81_04 */ 0x2146, -/* 20d - _81_05 */ 0x2147, -/* 20e - _81_06 */ 0x2148, -/* 20f - _81_07 */ 0x2149, -/* 210 - _82_00 */ 0x214a, -/* 211 - _82_01 */ 0x214b, -/* 212 - _82_02 */ 0x214c, -/* 213 - _82_03 */ 0x214d, -/* 214 - _82_04 */ 0x214e, -/* 215 - _82_05 */ 0x214f, -/* 216 - _82_06 */ 0x2150, -/* 217 - _82_07 */ 0x2151, -/* 218 - _83_00 */ 0x2152, -/* 219 - _83_01 */ 0x2153, -/* 21a - _83_02 */ 0x2154, -/* 21b - _83_03 */ 0x2155, -/* 21c - _83_04 */ 0x2156, -/* 21d - _83_05 */ 0x2157, -/* 21e - _83_06 */ 0x2158, -/* 21f - _83_07 */ 0x2159, -/* 220 - _8F_00 */ 0x215a, -/* 221 - */ 0, -/* 222 - */ 0, -/* 223 - */ 0, -/* 224 - */ 0, -/* 225 - */ 0, -/* 226 - */ 0, -/* 227 - */ 0, -/* 228 - _C0_00 */ 0x215b, -/* 229 - _C0_01 */ 0x215c, -/* 22a - _C0_02 */ 0x215d, -/* 22b - _C0_03 */ 0x215e, -/* 22c - _C0_04 */ 0x215f, -/* 22d - _C0_05 */ 0x2160, -/* 22e - _C0_06 */ 0x2161, -/* 22f - _C0_07 */ 0x2162, -/* 230 - _C1_00 */ 0x2163, -/* 231 - _C1_01 */ 0x2164, -/* 232 - _C1_02 */ 0x2165, -/* 233 - _C1_03 */ 0x2166, -/* 234 - _C1_04 */ 0x2167, -/* 235 - _C1_05 */ 0x2168, -/* 236 - _C1_06 */ 0x2169, -/* 237 - _C1_07 */ 0x216a, -/* 238 - _C6_00 */ 0x216b, -/* 239 - */ 0, -/* 23a - */ 0, -/* 23b - */ 0, -/* 23c - */ 0, -/* 23d - */ 0, -/* 23e - */ 0, -/* 23f - */ 0, -/* 240 - _C7_00 */ 0x216c, -/* 241 - */ 0, -/* 242 - */ 0, -/* 243 - */ 0, -/* 244 - */ 0, -/* 245 - */ 0, -/* 246 - */ 0, -/* 247 - */ 0, -/* 248 - _D0_00 */ 0x216d, -/* 249 - _D0_01 */ 0x216e, -/* 24a - _D0_02 */ 0x216f, -/* 24b - _D0_03 */ 0x2170, -/* 24c - _D0_04 */ 0x2171, -/* 24d - _D0_05 */ 0x2172, -/* 24e - _D0_06 */ 0x2173, -/* 24f - _D0_07 */ 0x2174, -/* 250 - _D1_00 */ 0x2175, -/* 251 - _D1_01 */ 0x2176, -/* 252 - _D1_02 */ 0x2177, -/* 253 - _D1_03 */ 0x2178, -/* 254 - _D1_04 */ 0x2179, -/* 255 - _D1_05 */ 0x217a, -/* 256 - _D1_06 */ 0x217b, -/* 257 - _D1_07 */ 0x217c, -/* 258 - _D2_00 */ 0x217d, -/* 259 - _D2_01 */ 0x217e, -/* 25a - _D2_02 */ 0x217f, -/* 25b - _D2_03 */ 0x2180, -/* 25c - _D2_04 */ 0x2181, -/* 25d - _D2_05 */ 0x2182, -/* 25e - _D2_06 */ 0x2183, -/* 25f - _D2_07 */ 0x2184, -/* 260 - _D3_00 */ 0x2185, -/* 261 - _D3_01 */ 0x2186, -/* 262 - _D3_02 */ 0x2187, -/* 263 - _D3_03 */ 0x2188, -/* 264 - _D3_04 */ 0x2189, -/* 265 - _D3_05 */ 0x218a, -/* 266 - _D3_06 */ 0x218b, -/* 267 - _D3_07 */ 0x218c, -/* 268 - _D8_00 */ 0x218d, -/* 269 - _D8_01 */ 0x218e, -/* 26a - _D8_02 */ 0x218f, -/* 26b - _D8_03 */ 0x2190, -/* 26c - _D8_04 */ 0x2191, -/* 26d - _D8_05 */ 0x2192, -/* 26e - _D8_06 */ 0x2193, -/* 26f - _D8_07 */ 0x2194, -/* 270 - _D8_C0 */ 0x2195, -/* 271 - _D8_C0 */ 0x2196, -/* 272 - _D8_C0 */ 0x2197, -/* 273 - _D8_C0 */ 0x2198, -/* 274 - _D8_C0 */ 0x2199, -/* 275 - _D8_C0 */ 0x219a, -/* 276 - _D8_C0 */ 0x219b, -/* 277 - _D8_C0 */ 0x219c, -/* 278 - _D8_C8 */ 0x219d, -/* 279 - _D8_C8 */ 0x219e, -/* 27a - _D8_C8 */ 0x219f, -/* 27b - _D8_C8 */ 0x21a0, -/* 27c - _D8_C8 */ 0x21a1, -/* 27d - _D8_C8 */ 0x21a2, -/* 27e - _D8_C8 */ 0x21a3, -/* 27f - _D8_C8 */ 0x21a4, -/* 280 - _D8_D0 */ 0x21a5, -/* 281 - _D8_D0 */ 0x21a6, -/* 282 - _D8_D0 */ 0x21a7, -/* 283 - _D8_D0 */ 0x21a8, -/* 284 - _D8_D0 */ 0x21a9, -/* 285 - _D8_D0 */ 0x21aa, -/* 286 - _D8_D0 */ 0x21ab, -/* 287 - _D8_D0 */ 0x21ac, -/* 288 - _D8_D8 */ 0x21ad, -/* 289 - _D8_D9 */ 0x21ae, -/* 28a - _D8_D8 */ 0x21af, -/* 28b - _D8_D8 */ 0x21b0, -/* 28c - _D8_D8 */ 0x21b1, -/* 28d - _D8_D8 */ 0x21b2, -/* 28e - _D8_D8 */ 0x21b3, -/* 28f - _D8_D8 */ 0x21b4, -/* 290 - _D8_E0 */ 0x21b5, -/* 291 - _D8_E0 */ 0x21b6, -/* 292 - _D8_E0 */ 0x21b7, -/* 293 - _D8_E0 */ 0x21b8, -/* 294 - _D8_E0 */ 0x21b9, -/* 295 - _D8_E0 */ 0x21ba, -/* 296 - _D8_E0 */ 0x21bb, -/* 297 - _D8_E0 */ 0x21bc, -/* 298 - _D8_E8 */ 0x21bd, -/* 299 - _D8_E8 */ 0x21be, -/* 29a - _D8_E8 */ 0x21bf, -/* 29b - _D8_E8 */ 0x21c0, -/* 29c - _D8_E8 */ 0x21c1, -/* 29d - _D8_E8 */ 0x21c2, -/* 29e - _D8_E8 */ 0x21c3, -/* 29f - _D8_E8 */ 0x21c4, -/* 2a0 - _D8_F0 */ 0x21c5, -/* 2a1 - _D8_F0 */ 0x21c6, -/* 2a2 - _D8_F0 */ 0x21c7, -/* 2a3 - _D8_F0 */ 0x21c8, -/* 2a4 - _D8_F0 */ 0x21c9, -/* 2a5 - _D8_F0 */ 0x21ca, -/* 2a6 - _D8_F0 */ 0x21cb, -/* 2a7 - _D8_F0 */ 0x21cc, -/* 2a8 - _D8_F8 */ 0x21cd, -/* 2a9 - _D8_F8 */ 0x21ce, -/* 2aa - _D8_F8 */ 0x21cf, -/* 2ab - _D8_F8 */ 0x21d0, -/* 2ac - _D8_F8 */ 0x21d1, -/* 2ad - _D8_F8 */ 0x21d2, -/* 2ae - _D8_F8 */ 0x21d3, -/* 2af - _D8_F8 */ 0x21d4, -/* 2b0 - _D9_00 */ 0x21d5, -/* 2b1 - */ 0, -/* 2b2 - _D9_02 */ 0x21d6, -/* 2b3 - _D9_03 */ 0x21d7, -/* 2b4 - _D9_04 */ 0x21d8, -/* 2b5 - _D9_05 */ 0x21d9, -/* 2b6 - _D9_06 */ 0xcea4, -/* 2b7 - _D9_07 */ 0xceb0, -/* 2b8 - _D9_C0 */ 0x21da, -/* 2b9 - _D9_C0 */ 0x21db, -/* 2ba - _D9_C0 */ 0x21dc, -/* 2bb - _D9_C0 */ 0x21dd, -/* 2bc - _D9_C0 */ 0x21de, -/* 2bd - _D9_C0 */ 0x21df, -/* 2be - _D9_C0 */ 0x21e0, -/* 2bf - _D9_C0 */ 0x21e1, -/* 2c0 - _D9_C8 */ 0x21e2, -/* 2c1 - _D9_C9 */ 0x21e3, -/* 2c2 - _D9_C8 */ 0x21e4, -/* 2c3 - _D9_C8 */ 0x21e5, -/* 2c4 - _D9_C8 */ 0x21e6, -/* 2c5 - _D9_C8 */ 0x21e7, -/* 2c6 - _D9_C8 */ 0x21e8, -/* 2c7 - _D9_C8 */ 0x21e9, -/* 2c8 - _D9_D0 */ 0x21ea, -/* 2c9 - */ 0, -/* 2ca - */ 0, -/* 2cb - */ 0, -/* 2cc - */ 0, -/* 2cd - */ 0, -/* 2ce - */ 0, -/* 2cf - */ 0, -/* 2d0 - */ 0, -/* 2d1 - */ 0, -/* 2d2 - */ 0, -/* 2d3 - */ 0, -/* 2d4 - */ 0, -/* 2d5 - */ 0, -/* 2d6 - */ 0, -/* 2d7 - */ 0, -/* 2d8 - _D9_E0 */ 0x21eb, -/* 2d9 - _D9_E1 */ 0x21ec, -/* 2da - */ 0, -/* 2db - */ 0, -/* 2dc - _D9_E4 */ 0x21ed, -/* 2dd - _D9_E5 */ 0x21ee, -/* 2de - */ 0, -/* 2df - */ 0, -/* 2e0 - _D9_E8 */ 0x21ef, -/* 2e1 - _D9_E9 */ 0x21f0, -/* 2e2 - _D9_EA */ 0x21f1, -/* 2e3 - _D9_EB */ 0x21f2, -/* 2e4 - _D9_EC */ 0x21f3, -/* 2e5 - _D9_ED */ 0x21f4, -/* 2e6 - _D9_EE */ 0x21f5, -/* 2e7 - */ 0, -/* 2e8 - _D9_F0 */ 0x21f6, -/* 2e9 - _D9_F1 */ 0x21f7, -/* 2ea - _D9_F2 */ 0x21f8, -/* 2eb - _D9_F3 */ 0x21f9, -/* 2ec - _D9_F4 */ 0x21fa, -/* 2ed - _D9_F5 */ 0x21fb, -/* 2ee - _D9_F6 */ 0x21fc, -/* 2ef - _D9_F7 */ 0x21fd, -/* 2f0 - _D9_F8 */ 0x21fe, -/* 2f1 - _D9_F9 */ 0x21ff, -/* 2f2 - _D9_FA */ 0x2200, -/* 2f3 - _D9_FB */ 0x2201, -/* 2f4 - _D9_FC */ 0x2202, -/* 2f5 - _D9_FD */ 0x2203, -/* 2f6 - _D9_FE */ 0x2204, -/* 2f7 - _D9_FF */ 0x2205, -/* 2f8 - _DA_00 */ 0x2206, -/* 2f9 - _DA_01 */ 0x2207, -/* 2fa - _DA_02 */ 0x2208, -/* 2fb - _DA_03 */ 0x2209, -/* 2fc - _DA_04 */ 0x220a, -/* 2fd - _DA_05 */ 0x220b, -/* 2fe - _DA_06 */ 0x220c, -/* 2ff - _DA_07 */ 0x220d, -/* 300 - _DA_C0 */ 0x220e, -/* 301 - _DA_C0 */ 0x220f, -/* 302 - _DA_C0 */ 0x2210, -/* 303 - _DA_C0 */ 0x2211, -/* 304 - _DA_C0 */ 0x2212, -/* 305 - _DA_C0 */ 0x2213, -/* 306 - _DA_C0 */ 0x2214, -/* 307 - _DA_C0 */ 0x2215, -/* 308 - _DA_C8 */ 0x2216, -/* 309 - _DA_C8 */ 0x2217, -/* 30a - _DA_C8 */ 0x2218, -/* 30b - _DA_C8 */ 0x2219, -/* 30c - _DA_C8 */ 0x221a, -/* 30d - _DA_C8 */ 0x221b, -/* 30e - _DA_C8 */ 0x221c, -/* 30f - _DA_C8 */ 0x221d, -/* 310 - _DA_D0 */ 0x221e, -/* 311 - _DA_D0 */ 0x221f, -/* 312 - _DA_D0 */ 0x2220, -/* 313 - _DA_D0 */ 0x2221, -/* 314 - _DA_D0 */ 0x2222, -/* 315 - _DA_D0 */ 0x2223, -/* 316 - _DA_D0 */ 0x2224, -/* 317 - _DA_D0 */ 0x2225, -/* 318 - _DA_D8 */ 0x2226, -/* 319 - _DA_D8 */ 0x2227, -/* 31a - _DA_D8 */ 0x2228, -/* 31b - _DA_D8 */ 0x2229, -/* 31c - _DA_D8 */ 0x222a, -/* 31d - _DA_D8 */ 0x222b, -/* 31e - _DA_D8 */ 0x222c, -/* 31f - _DA_D8 */ 0x222d, -/* 320 - */ 0, -/* 321 - */ 0, -/* 322 - */ 0, -/* 323 - */ 0, -/* 324 - */ 0, -/* 325 - */ 0, -/* 326 - */ 0, -/* 327 - */ 0, -/* 328 - */ 0, -/* 329 - _DA_E9 */ 0x222e, -/* 32a - */ 0, -/* 32b - */ 0, -/* 32c - */ 0, -/* 32d - */ 0, -/* 32e - */ 0, -/* 32f - */ 0, -/* 330 - */ 0, -/* 331 - */ 0, -/* 332 - */ 0, -/* 333 - */ 0, -/* 334 - */ 0, -/* 335 - */ 0, -/* 336 - */ 0, -/* 337 - */ 0, -/* 338 - */ 0, -/* 339 - */ 0, -/* 33a - */ 0, -/* 33b - */ 0, -/* 33c - */ 0, -/* 33d - */ 0, -/* 33e - */ 0, -/* 33f - */ 0, -/* 340 - _DB_00 */ 0x222f, -/* 341 - _DB_01 */ 0x2230, -/* 342 - _DB_02 */ 0x2231, -/* 343 - _DB_03 */ 0x2232, -/* 344 - */ 0, -/* 345 - _DB_05 */ 0x2233, -/* 346 - */ 0, -/* 347 - _DB_07 */ 0x2234, -/* 348 - _DB_C0 */ 0x2235, -/* 349 - _DB_C0 */ 0x2236, -/* 34a - _DB_C0 */ 0x2237, -/* 34b - _DB_C0 */ 0x2238, -/* 34c - _DB_C0 */ 0x2239, -/* 34d - _DB_C0 */ 0x223a, -/* 34e - _DB_C0 */ 0x223b, -/* 34f - _DB_C0 */ 0x223c, -/* 350 - _DB_C8 */ 0x223d, -/* 351 - _DB_C8 */ 0x223e, -/* 352 - _DB_C8 */ 0x223f, -/* 353 - _DB_C8 */ 0x2240, -/* 354 - _DB_C8 */ 0x2241, -/* 355 - _DB_C8 */ 0x2242, -/* 356 - _DB_C8 */ 0x2243, -/* 357 - _DB_C8 */ 0x2244, -/* 358 - _DB_D0 */ 0x2245, -/* 359 - _DB_D0 */ 0x2246, -/* 35a - _DB_D0 */ 0x2247, -/* 35b - _DB_D0 */ 0x2248, -/* 35c - _DB_D0 */ 0x2249, -/* 35d - _DB_D0 */ 0x224a, -/* 35e - _DB_D0 */ 0x224b, -/* 35f - _DB_D0 */ 0x224c, -/* 360 - _DB_D8 */ 0x224d, -/* 361 - _DB_D8 */ 0x224e, -/* 362 - _DB_D8 */ 0x224f, -/* 363 - _DB_D8 */ 0x2250, -/* 364 - _DB_D8 */ 0x2251, -/* 365 - _DB_D8 */ 0x2252, -/* 366 - _DB_D8 */ 0x2253, -/* 367 - _DB_D8 */ 0x2254, -/* 368 - _DB_E0 */ 0x2255, -/* 369 - _DB_E1 */ 0x2256, -/* 36a - _DB_E2 */ 0xcebc, -/* 36b - _DB_E3 */ 0xcec8, -/* 36c - _DB_E4 */ 0x2257, -/* 36d - */ 0, -/* 36e - */ 0, -/* 36f - */ 0, -/* 370 - _DB_E8 */ 0x2258, -/* 371 - _DB_E8 */ 0x2259, -/* 372 - _DB_E8 */ 0x225a, -/* 373 - _DB_E8 */ 0x225b, -/* 374 - _DB_E8 */ 0x225c, -/* 375 - _DB_E8 */ 0x225d, -/* 376 - _DB_E8 */ 0x225e, -/* 377 - _DB_E8 */ 0x225f, -/* 378 - _DB_F0 */ 0x2260, -/* 379 - _DB_F0 */ 0x2261, -/* 37a - _DB_F0 */ 0x2262, -/* 37b - _DB_F0 */ 0x2263, -/* 37c - _DB_F0 */ 0x2264, -/* 37d - _DB_F0 */ 0x2265, -/* 37e - _DB_F0 */ 0x2266, -/* 37f - _DB_F0 */ 0x2267, -/* 380 - */ 0, -/* 381 - */ 0, -/* 382 - */ 0, -/* 383 - */ 0, -/* 384 - */ 0, -/* 385 - */ 0, -/* 386 - */ 0, -/* 387 - */ 0, -/* 388 - _DC_00 */ 0x2268, -/* 389 - _DC_01 */ 0x2269, -/* 38a - _DC_02 */ 0x226a, -/* 38b - _DC_03 */ 0x226b, -/* 38c - _DC_04 */ 0x226c, -/* 38d - _DC_05 */ 0x226d, -/* 38e - _DC_06 */ 0x226e, -/* 38f - _DC_07 */ 0x226f, -/* 390 - _DC_C0 */ 0x2270, -/* 391 - _DC_C0 */ 0x2271, -/* 392 - _DC_C0 */ 0x2272, -/* 393 - _DC_C0 */ 0x2273, -/* 394 - _DC_C0 */ 0x2274, -/* 395 - _DC_C0 */ 0x2275, -/* 396 - _DC_C0 */ 0x2276, -/* 397 - _DC_C0 */ 0x2277, -/* 398 - _DC_C8 */ 0x2278, -/* 399 - _DC_C8 */ 0x2279, -/* 39a - _DC_C8 */ 0x227a, -/* 39b - _DC_C8 */ 0x227b, -/* 39c - _DC_C8 */ 0x227c, -/* 39d - _DC_C8 */ 0x227d, -/* 39e - _DC_C8 */ 0x227e, -/* 39f - _DC_C8 */ 0x227f, -/* 3a0 - */ 0, -/* 3a1 - */ 0, -/* 3a2 - */ 0, -/* 3a3 - */ 0, -/* 3a4 - */ 0, -/* 3a5 - */ 0, -/* 3a6 - */ 0, -/* 3a7 - */ 0, -/* 3a8 - */ 0, -/* 3a9 - */ 0, -/* 3aa - */ 0, -/* 3ab - */ 0, -/* 3ac - */ 0, -/* 3ad - */ 0, -/* 3ae - */ 0, -/* 3af - */ 0, -/* 3b0 - _DC_E0 */ 0x2280, -/* 3b1 - _DC_E0 */ 0x2281, -/* 3b2 - _DC_E0 */ 0x2282, -/* 3b3 - _DC_E0 */ 0x2283, -/* 3b4 - _DC_E0 */ 0x2284, -/* 3b5 - _DC_E0 */ 0x2285, -/* 3b6 - _DC_E0 */ 0x2286, -/* 3b7 - _DC_E0 */ 0x2287, -/* 3b8 - _DC_E8 */ 0x2288, -/* 3b9 - _DC_E8 */ 0x2289, -/* 3ba - _DC_E8 */ 0x228a, -/* 3bb - _DC_E8 */ 0x228b, -/* 3bc - _DC_E8 */ 0x228c, -/* 3bd - _DC_E8 */ 0x228d, -/* 3be - _DC_E8 */ 0x228e, -/* 3bf - _DC_E8 */ 0x228f, -/* 3c0 - _DC_F0 */ 0x2290, -/* 3c1 - _DC_F0 */ 0x2291, -/* 3c2 - _DC_F0 */ 0x2292, -/* 3c3 - _DC_F0 */ 0x2293, -/* 3c4 - _DC_F0 */ 0x2294, -/* 3c5 - _DC_F0 */ 0x2295, -/* 3c6 - _DC_F0 */ 0x2296, -/* 3c7 - _DC_F0 */ 0x2297, -/* 3c8 - _DC_F8 */ 0x2298, -/* 3c9 - _DC_F8 */ 0x2299, -/* 3ca - _DC_F8 */ 0x229a, -/* 3cb - _DC_F8 */ 0x229b, -/* 3cc - _DC_F8 */ 0x229c, -/* 3cd - _DC_F8 */ 0x229d, -/* 3ce - _DC_F8 */ 0x229e, -/* 3cf - _DC_F8 */ 0x229f, -/* 3d0 - _DD_00 */ 0x22a0, -/* 3d1 - _DD_01 */ 0x22a1, -/* 3d2 - _DD_02 */ 0x22a2, -/* 3d3 - _DD_03 */ 0x22a3, -/* 3d4 - _DD_04 */ 0x22a4, -/* 3d5 - */ 0, -/* 3d6 - _DD_06 */ 0xced4, -/* 3d7 - _DD_07 */ 0xcee0, -/* 3d8 - _DD_C0 */ 0x22a5, -/* 3d9 - _DD_C0 */ 0x22a6, -/* 3da - _DD_C0 */ 0x22a7, -/* 3db - _DD_C0 */ 0x22a8, -/* 3dc - _DD_C0 */ 0x22a9, -/* 3dd - _DD_C0 */ 0x22aa, -/* 3de - _DD_C0 */ 0x22ab, -/* 3df - _DD_C0 */ 0x22ac, -/* 3e0 - */ 0, -/* 3e1 - */ 0, -/* 3e2 - */ 0, -/* 3e3 - */ 0, -/* 3e4 - */ 0, -/* 3e5 - */ 0, -/* 3e6 - */ 0, -/* 3e7 - */ 0, -/* 3e8 - _DD_D0 */ 0x22ad, -/* 3e9 - _DD_D0 */ 0x22ae, -/* 3ea - _DD_D0 */ 0x22af, -/* 3eb - _DD_D0 */ 0x22b0, -/* 3ec - _DD_D0 */ 0x22b1, -/* 3ed - _DD_D0 */ 0x22b2, -/* 3ee - _DD_D0 */ 0x22b3, -/* 3ef - _DD_D0 */ 0x22b4, -/* 3f0 - _DD_D8 */ 0x22b5, -/* 3f1 - _DD_D8 */ 0x22b6, -/* 3f2 - _DD_D8 */ 0x22b7, -/* 3f3 - _DD_D8 */ 0x22b8, -/* 3f4 - _DD_D8 */ 0x22b9, -/* 3f5 - _DD_D8 */ 0x22ba, -/* 3f6 - _DD_D8 */ 0x22bb, -/* 3f7 - _DD_D8 */ 0x22bc, -/* 3f8 - _DD_E0 */ 0x22bd, -/* 3f9 - _DD_E1 */ 0x22be, -/* 3fa - _DD_E0 */ 0x22bf, -/* 3fb - _DD_E0 */ 0x22c0, -/* 3fc - _DD_E0 */ 0x22c1, -/* 3fd - _DD_E0 */ 0x22c2, -/* 3fe - _DD_E0 */ 0x22c3, -/* 3ff - _DD_E0 */ 0x22c4, -/* 400 - _DD_E8 */ 0x22c5, -/* 401 - _DD_E9 */ 0x22c6, -/* 402 - _DD_E8 */ 0x22c7, -/* 403 - _DD_E8 */ 0x22c8, -/* 404 - _DD_E8 */ 0x22c9, -/* 405 - _DD_E8 */ 0x22ca, -/* 406 - _DD_E8 */ 0x22cb, -/* 407 - _DD_E8 */ 0x22cc, -/* 408 - */ 0, -/* 409 - */ 0, -/* 40a - */ 0, -/* 40b - */ 0, -/* 40c - */ 0, -/* 40d - */ 0, -/* 40e - */ 0, -/* 40f - */ 0, -/* 410 - */ 0, -/* 411 - */ 0, -/* 412 - */ 0, -/* 413 - */ 0, -/* 414 - */ 0, -/* 415 - */ 0, -/* 416 - */ 0, -/* 417 - */ 0, -/* 418 - _DE_00 */ 0x22cd, -/* 419 - _DE_01 */ 0x22ce, -/* 41a - _DE_02 */ 0x22cf, -/* 41b - _DE_03 */ 0x22d0, -/* 41c - _DE_04 */ 0x22d1, -/* 41d - _DE_05 */ 0x22d2, -/* 41e - _DE_06 */ 0x22d3, -/* 41f - _DE_07 */ 0x22d4, -/* 420 - _DE_C0 */ 0x22d5, -/* 421 - _DE_C1 */ 0x22d6, -/* 422 - _DE_C0 */ 0x22d7, -/* 423 - _DE_C0 */ 0x22d8, -/* 424 - _DE_C0 */ 0x22d9, -/* 425 - _DE_C0 */ 0x22da, -/* 426 - _DE_C0 */ 0x22db, -/* 427 - _DE_C0 */ 0x22dc, -/* 428 - _DE_C8 */ 0x22dd, -/* 429 - _DE_C9 */ 0x22de, -/* 42a - _DE_C8 */ 0x22df, -/* 42b - _DE_C8 */ 0x22e0, -/* 42c - _DE_C8 */ 0x22e1, -/* 42d - _DE_C8 */ 0x22e2, -/* 42e - _DE_C8 */ 0x22e3, -/* 42f - _DE_C8 */ 0x22e4, -/* 430 - */ 0, -/* 431 - */ 0, -/* 432 - */ 0, -/* 433 - */ 0, -/* 434 - */ 0, -/* 435 - */ 0, -/* 436 - */ 0, -/* 437 - */ 0, -/* 438 - */ 0, -/* 439 - _DE_D9 */ 0x22e5, -/* 43a - */ 0, -/* 43b - */ 0, -/* 43c - */ 0, -/* 43d - */ 0, -/* 43e - */ 0, -/* 43f - */ 0, -/* 440 - _DE_E0 */ 0x22e6, -/* 441 - _DE_E1 */ 0x22e7, -/* 442 - _DE_E0 */ 0x22e8, -/* 443 - _DE_E0 */ 0x22e9, -/* 444 - _DE_E0 */ 0x22ea, -/* 445 - _DE_E0 */ 0x22eb, -/* 446 - _DE_E0 */ 0x22ec, -/* 447 - _DE_E0 */ 0x22ed, -/* 448 - _DE_E8 */ 0x22ee, -/* 449 - _DE_E9 */ 0x22ef, -/* 44a - _DE_E8 */ 0x22f0, -/* 44b - _DE_E8 */ 0x22f1, -/* 44c - _DE_E8 */ 0x22f2, -/* 44d - _DE_E8 */ 0x22f3, -/* 44e - _DE_E8 */ 0x22f4, -/* 44f - _DE_E8 */ 0x22f5, -/* 450 - _DE_F0 */ 0x22f6, -/* 451 - _DE_F1 */ 0x22f7, -/* 452 - _DE_F0 */ 0x22f8, -/* 453 - _DE_F0 */ 0x22f9, -/* 454 - _DE_F0 */ 0x22fa, -/* 455 - _DE_F0 */ 0x22fb, -/* 456 - _DE_F0 */ 0x22fc, -/* 457 - _DE_F0 */ 0x22fd, -/* 458 - _DE_F8 */ 0x22fe, -/* 459 - _DE_F9 */ 0x22ff, -/* 45a - _DE_F8 */ 0x2300, -/* 45b - _DE_F8 */ 0x2301, -/* 45c - _DE_F8 */ 0x2302, -/* 45d - _DE_F8 */ 0x2303, -/* 45e - _DE_F8 */ 0x2304, -/* 45f - _DE_F8 */ 0x2305, -/* 460 - _DF_00 */ 0x2306, -/* 461 - _DF_01 */ 0x2307, -/* 462 - _DF_02 */ 0x2308, -/* 463 - _DF_03 */ 0x2309, -/* 464 - _DF_04 */ 0x230a, -/* 465 - _DF_05 */ 0x230b, -/* 466 - _DF_06 */ 0x230c, -/* 467 - _DF_07 */ 0x230d, -/* 468 - */ 0, -/* 469 - */ 0, -/* 46a - */ 0, -/* 46b - */ 0, -/* 46c - */ 0, -/* 46d - */ 0, -/* 46e - */ 0, -/* 46f - */ 0, -/* 470 - */ 0, -/* 471 - */ 0, -/* 472 - */ 0, -/* 473 - */ 0, -/* 474 - */ 0, -/* 475 - */ 0, -/* 476 - */ 0, -/* 477 - */ 0, -/* 478 - */ 0, -/* 479 - */ 0, -/* 47a - */ 0, -/* 47b - */ 0, -/* 47c - */ 0, -/* 47d - */ 0, -/* 47e - */ 0, -/* 47f - */ 0, -/* 480 - */ 0, -/* 481 - */ 0, -/* 482 - */ 0, -/* 483 - */ 0, -/* 484 - */ 0, -/* 485 - */ 0, -/* 486 - */ 0, -/* 487 - */ 0, -/* 488 - _DF_E0 */ 0xceec, -/* 489 - */ 0, -/* 48a - */ 0, -/* 48b - */ 0, -/* 48c - */ 0, -/* 48d - */ 0, -/* 48e - */ 0, -/* 48f - */ 0, -/* 490 - _DF_E8 */ 0x230e, -/* 491 - _DF_E8 */ 0x230f, -/* 492 - _DF_E8 */ 0x2310, -/* 493 - _DF_E8 */ 0x2311, -/* 494 - _DF_E8 */ 0x2312, -/* 495 - _DF_E8 */ 0x2313, -/* 496 - _DF_E8 */ 0x2314, -/* 497 - _DF_E8 */ 0x2315, -/* 498 - _DF_F0 */ 0x2316, -/* 499 - _DF_F0 */ 0x2317, -/* 49a - _DF_F0 */ 0x2318, -/* 49b - _DF_F0 */ 0x2319, -/* 49c - _DF_F0 */ 0x231a, -/* 49d - _DF_F0 */ 0x231b, -/* 49e - _DF_F0 */ 0x231c, -/* 49f - _DF_F0 */ 0x231d, -/* 4a0 - */ 0, -/* 4a1 - */ 0, -/* 4a2 - */ 0, -/* 4a3 - */ 0, -/* 4a4 - */ 0, -/* 4a5 - */ 0, -/* 4a6 - */ 0, -/* 4a7 - */ 0, -/* 4a8 - _F6_00 */ 0x231e, -/* 4a9 - */ 0, -/* 4aa - _F6_02 */ 0x231f, -/* 4ab - _F6_03 */ 0x2320, -/* 4ac - _F6_04 */ 0x2321, -/* 4ad - _F6_05 */ 0x2322, -/* 4ae - _F6_06 */ 0x2323, -/* 4af - _F6_07 */ 0x2324, -/* 4b0 - _F7_00 */ 0x2325, -/* 4b1 - */ 0, -/* 4b2 - _F7_02 */ 0x2326, -/* 4b3 - _F7_03 */ 0x2327, -/* 4b4 - _F7_04 */ 0x2328, -/* 4b5 - _F7_05 */ 0x2329, -/* 4b6 - _F7_06 */ 0x232a, -/* 4b7 - _F7_07 */ 0x232b, -/* 4b8 - _FE_00 */ 0x232c, -/* 4b9 - _FE_01 */ 0x232d, -/* 4ba - */ 0, -/* 4bb - */ 0, -/* 4bc - */ 0, -/* 4bd - */ 0, -/* 4be - */ 0, -/* 4bf - */ 0, -/* 4c0 - _FF_00 */ 0x232e, -/* 4c1 - _FF_01 */ 0x232f, -/* 4c2 - _FF_02 */ 0x2330, -/* 4c3 - _FF_03 */ 0x2331, -/* 4c4 - _FF_04 */ 0x2332, -/* 4c5 - _FF_05 */ 0x2333, -/* 4c6 - _FF_06 */ 0x2334, -/* 4c7 - */ 0, -/* 4c8 - _0F_00_00 */ 0x2335, -/* 4c9 - _0F_00_01 */ 0x2336, -/* 4ca - _0F_00_02 */ 0x2337, -/* 4cb - _0F_00_03 */ 0x2338, -/* 4cc - _0F_00_04 */ 0x2339, -/* 4cd - _0F_00_05 */ 0x233a, -/* 4ce - */ 0, -/* 4cf - */ 0, -/* 4d0 - _0F_01_00 */ 0x233b, -/* 4d1 - _0F_01_01 */ 0x233c, -/* 4d2 - _0F_01_02 */ 0x233d, -/* 4d3 - _0F_01_03 */ 0x233e, -/* 4d4 - _0F_01_04 */ 0x233f, -/* 4d5 - */ 0, -/* 4d6 - _0F_01_06 */ 0x2340, -/* 4d7 - _0F_01_07 */ 0x2341, -/* 4d8 - */ 0, -/* 4d9 - _0F_01_C1 */ 0x2342, -/* 4da - _0F_01_C2 */ 0x2343, -/* 4db - _0F_01_C3 */ 0x2344, -/* 4dc - _0F_01_C4 */ 0x2345, -/* 4dd - */ 0, -/* 4de - */ 0, -/* 4df - */ 0, -/* 4e0 - _0F_01_C8 */ 0x2346, -/* 4e1 - _0F_01_C9 */ 0x2347, -/* 4e2 - */ 0, -/* 4e3 - */ 0, -/* 4e4 - */ 0, -/* 4e5 - */ 0, -/* 4e6 - */ 0, -/* 4e7 - */ 0, -/* 4e8 - _0F_01_D0 */ 0x2348, -/* 4e9 - _0F_01_D1 */ 0x2349, -/* 4ea - */ 0, -/* 4eb - */ 0, -/* 4ec - _0F_01_D4 */ 0x234a, -/* 4ed - */ 0, -/* 4ee - */ 0, -/* 4ef - */ 0, -/* 4f0 - _0F_01_D8 */ 0x234b, -/* 4f1 - _0F_01_D9 */ 0x234c, -/* 4f2 - _0F_01_DA */ 0x234d, -/* 4f3 - _0F_01_DB */ 0x234e, -/* 4f4 - _0F_01_DC */ 0x234f, -/* 4f5 - _0F_01_DD */ 0x2350, -/* 4f6 - _0F_01_DE */ 0x2351, -/* 4f7 - _0F_01_DF */ 0x2352, -/* 4f8 - */ 0, -/* 4f9 - */ 0, -/* 4fa - */ 0, -/* 4fb - */ 0, -/* 4fc - */ 0, -/* 4fd - */ 0, -/* 4fe - */ 0, -/* 4ff - */ 0, -/* 500 - */ 0, -/* 501 - */ 0, -/* 502 - */ 0, -/* 503 - */ 0, -/* 504 - */ 0, -/* 505 - */ 0, -/* 506 - */ 0, -/* 507 - */ 0, -/* 508 - */ 0, -/* 509 - */ 0, -/* 50a - */ 0, -/* 50b - */ 0, -/* 50c - */ 0, -/* 50d - */ 0, -/* 50e - */ 0, -/* 50f - */ 0, -/* 510 - _0F_01_F8 */ 0x2353, -/* 511 - _0F_01_F9 */ 0x2354, -/* 512 - */ 0, -/* 513 - */ 0, -/* 514 - */ 0, -/* 515 - */ 0, -/* 516 - */ 0, -/* 517 - */ 0, -/* 518 - _0F_0D_00 */ 0x2355, -/* 519 - _0F_0D_01 */ 0x2356, -/* 51a - */ 0, -/* 51b - */ 0, -/* 51c - */ 0, -/* 51d - */ 0, -/* 51e - */ 0, -/* 51f - */ 0, -/* 520 - */ 0, -/* 521 - */ 0, -/* 522 - */ 0, -/* 523 - */ 0, -/* 524 - */ 0, -/* 525 - */ 0, -/* 526 - */ 0, -/* 527 - */ 0, -/* 528 - */ 0, -/* 529 - */ 0, -/* 52a - */ 0, -/* 52b - */ 0, -/* 52c - _0F_0F_0C */ 0x2357, -/* 52d - _0F_0F_0D */ 0x2358, -/* 52e - */ 0, -/* 52f - */ 0, -/* 530 - */ 0, -/* 531 - */ 0, -/* 532 - */ 0, -/* 533 - */ 0, -/* 534 - */ 0, -/* 535 - */ 0, -/* 536 - */ 0, -/* 537 - */ 0, -/* 538 - */ 0, -/* 539 - */ 0, -/* 53a - */ 0, -/* 53b - */ 0, -/* 53c - _0F_0F_1C */ 0x2359, -/* 53d - _0F_0F_1D */ 0x235a, -/* 53e - */ 0, -/* 53f - */ 0, -/* 540 - */ 0, -/* 541 - */ 0, -/* 542 - */ 0, -/* 543 - */ 0, -/* 544 - */ 0, -/* 545 - */ 0, -/* 546 - */ 0, -/* 547 - */ 0, -/* 548 - */ 0, -/* 549 - */ 0, -/* 54a - */ 0, -/* 54b - */ 0, -/* 54c - */ 0, -/* 54d - */ 0, -/* 54e - */ 0, -/* 54f - */ 0, -/* 550 - */ 0, -/* 551 - */ 0, -/* 552 - */ 0, -/* 553 - */ 0, -/* 554 - */ 0, -/* 555 - */ 0, -/* 556 - */ 0, -/* 557 - */ 0, -/* 558 - */ 0, -/* 559 - */ 0, -/* 55a - */ 0, -/* 55b - */ 0, -/* 55c - */ 0, -/* 55d - */ 0, -/* 55e - */ 0, -/* 55f - */ 0, -/* 560 - */ 0, -/* 561 - */ 0, -/* 562 - */ 0, -/* 563 - */ 0, -/* 564 - */ 0, -/* 565 - */ 0, -/* 566 - */ 0, -/* 567 - */ 0, -/* 568 - */ 0, -/* 569 - */ 0, -/* 56a - */ 0, -/* 56b - */ 0, -/* 56c - */ 0, -/* 56d - */ 0, -/* 56e - */ 0, -/* 56f - */ 0, -/* 570 - */ 0, -/* 571 - */ 0, -/* 572 - */ 0, -/* 573 - */ 0, -/* 574 - */ 0, -/* 575 - */ 0, -/* 576 - */ 0, -/* 577 - */ 0, -/* 578 - */ 0, -/* 579 - */ 0, -/* 57a - */ 0, -/* 57b - */ 0, -/* 57c - */ 0, -/* 57d - */ 0, -/* 57e - */ 0, -/* 57f - */ 0, -/* 580 - */ 0, -/* 581 - */ 0, -/* 582 - */ 0, -/* 583 - */ 0, -/* 584 - */ 0, -/* 585 - */ 0, -/* 586 - */ 0, -/* 587 - */ 0, -/* 588 - */ 0, -/* 589 - */ 0, -/* 58a - */ 0, -/* 58b - */ 0, -/* 58c - */ 0, -/* 58d - */ 0, -/* 58e - */ 0, -/* 58f - */ 0, -/* 590 - */ 0, -/* 591 - */ 0, -/* 592 - */ 0, -/* 593 - */ 0, -/* 594 - */ 0, -/* 595 - */ 0, -/* 596 - */ 0, -/* 597 - */ 0, -/* 598 - */ 0, -/* 599 - */ 0, -/* 59a - */ 0, -/* 59b - */ 0, -/* 59c - */ 0, -/* 59d - */ 0, -/* 59e - */ 0, -/* 59f - */ 0, -/* 5a0 - */ 0, -/* 5a1 - */ 0, -/* 5a2 - */ 0, -/* 5a3 - */ 0, -/* 5a4 - */ 0, -/* 5a5 - */ 0, -/* 5a6 - */ 0, -/* 5a7 - */ 0, -/* 5a8 - */ 0, -/* 5a9 - */ 0, -/* 5aa - _0F_0F_8A */ 0x235b, -/* 5ab - */ 0, -/* 5ac - */ 0, -/* 5ad - */ 0, -/* 5ae - _0F_0F_8E */ 0x235c, -/* 5af - */ 0, -/* 5b0 - _0F_0F_90 */ 0x235d, -/* 5b1 - */ 0, -/* 5b2 - */ 0, -/* 5b3 - */ 0, -/* 5b4 - _0F_0F_94 */ 0x235e, -/* 5b5 - */ 0, -/* 5b6 - _0F_0F_96 */ 0x235f, -/* 5b7 - _0F_0F_97 */ 0x2360, -/* 5b8 - */ 0, -/* 5b9 - */ 0, -/* 5ba - _0F_0F_9A */ 0x2361, -/* 5bb - */ 0, -/* 5bc - */ 0, -/* 5bd - */ 0, -/* 5be - _0F_0F_9E */ 0x2362, -/* 5bf - */ 0, -/* 5c0 - _0F_0F_A0 */ 0x2363, -/* 5c1 - */ 0, -/* 5c2 - */ 0, -/* 5c3 - */ 0, -/* 5c4 - _0F_0F_A4 */ 0x2364, -/* 5c5 - */ 0, -/* 5c6 - _0F_0F_A6 */ 0x2365, -/* 5c7 - _0F_0F_A7 */ 0x2366, -/* 5c8 - */ 0, -/* 5c9 - */ 0, -/* 5ca - _0F_0F_AA */ 0x2367, -/* 5cb - */ 0, -/* 5cc - */ 0, -/* 5cd - */ 0, -/* 5ce - _0F_0F_AE */ 0x2368, -/* 5cf - */ 0, -/* 5d0 - _0F_0F_B0 */ 0x2369, -/* 5d1 - */ 0, -/* 5d2 - */ 0, -/* 5d3 - */ 0, -/* 5d4 - _0F_0F_B4 */ 0x236a, -/* 5d5 - */ 0, -/* 5d6 - _0F_0F_B6 */ 0x236b, -/* 5d7 - _0F_0F_B7 */ 0x236c, -/* 5d8 - */ 0, -/* 5d9 - */ 0, -/* 5da - */ 0, -/* 5db - _0F_0F_BB */ 0x236d, -/* 5dc - */ 0, -/* 5dd - */ 0, -/* 5de - */ 0, -/* 5df - _0F_0F_BF */ 0x236e, -/* 5e0 - */ 0, -/* 5e1 - */ 0, -/* 5e2 - */ 0, -/* 5e3 - */ 0, -/* 5e4 - */ 0, -/* 5e5 - */ 0, -/* 5e6 - */ 0, -/* 5e7 - */ 0, -/* 5e8 - */ 0, -/* 5e9 - */ 0, -/* 5ea - */ 0, -/* 5eb - */ 0, -/* 5ec - */ 0, -/* 5ed - */ 0, -/* 5ee - */ 0, -/* 5ef - */ 0, -/* 5f0 - */ 0, -/* 5f1 - */ 0, -/* 5f2 - */ 0, -/* 5f3 - */ 0, -/* 5f4 - */ 0, -/* 5f5 - */ 0, -/* 5f6 - */ 0, -/* 5f7 - */ 0, -/* 5f8 - */ 0, -/* 5f9 - */ 0, -/* 5fa - */ 0, -/* 5fb - */ 0, -/* 5fc - */ 0, -/* 5fd - */ 0, -/* 5fe - */ 0, -/* 5ff - */ 0, -/* 600 - */ 0, -/* 601 - */ 0, -/* 602 - */ 0, -/* 603 - */ 0, -/* 604 - */ 0, -/* 605 - */ 0, -/* 606 - */ 0, -/* 607 - */ 0, -/* 608 - */ 0, -/* 609 - */ 0, -/* 60a - */ 0, -/* 60b - */ 0, -/* 60c - */ 0, -/* 60d - */ 0, -/* 60e - */ 0, -/* 60f - */ 0, -/* 610 - */ 0, -/* 611 - */ 0, -/* 612 - */ 0, -/* 613 - */ 0, -/* 614 - */ 0, -/* 615 - */ 0, -/* 616 - */ 0, -/* 617 - */ 0, -/* 618 - */ 0, -/* 619 - */ 0, -/* 61a - */ 0, -/* 61b - */ 0, -/* 61c - */ 0, -/* 61d - */ 0, -/* 61e - */ 0, -/* 61f - */ 0, -/* 620 - _0F_10 */ 0x236f, -/* 621 - _66_0F_10 */ 0x2370, -/* 622 - _F3_0F_10 */ 0x2371, -/* 623 - _F2_0F_10 */ 0x2372, -/* 624 - _V_0F_10 */ 0x4009, -/* 625 - _V_66_0F_10 */ 0x400a, -/* 626 - _V_F3_0F_10 */ 0x400b, -/* 627 - _V_F2_0F_10 */ 0x400c, -/* 628 - */ 0, -/* 629 - */ 0, -/* 62a - _VRR_F3_0F_10 */ 0x400d, -/* 62b - _VRR_F2_0F_10 */ 0x400e, -/* 62c - _0F_11 */ 0x2373, -/* 62d - _66_0F_11 */ 0x2374, -/* 62e - _F3_0F_11 */ 0x2375, -/* 62f - _F2_0F_11 */ 0x2376, -/* 630 - _V_0F_11 */ 0x400f, -/* 631 - _V_66_0F_11 */ 0x4010, -/* 632 - _V_F3_0F_11 */ 0x4011, -/* 633 - _V_F2_0F_11 */ 0x4012, -/* 634 - */ 0, -/* 635 - */ 0, -/* 636 - _VRR_F3_0F_11 */ 0x4013, -/* 637 - _VRR_F2_0F_11 */ 0x4014, -/* 638 - _0F_12 */ 0x4015, -/* 639 - _66_0F_12 */ 0x2377, -/* 63a - _F3_0F_12 */ 0x2378, -/* 63b - _F2_0F_12 */ 0x2379, -/* 63c - _V_0F_12 */ 0x4016, -/* 63d - _V_66_0F_12 */ 0x4017, -/* 63e - _V_F3_0F_12 */ 0x4018, -/* 63f - _V_F2_0F_12 */ 0x4019, -/* 640 - */ 0, -/* 641 - */ 0, -/* 642 - */ 0, -/* 643 - */ 0, -/* 644 - _0F_13 */ 0x237a, -/* 645 - _66_0F_13 */ 0x237b, -/* 646 - */ 0, -/* 647 - */ 0, -/* 648 - _V_0F_13 */ 0x401a, -/* 649 - _V_66_0F_13 */ 0x401b, -/* 64a - */ 0, -/* 64b - */ 0, -/* 64c - */ 0, -/* 64d - */ 0, -/* 64e - */ 0, -/* 64f - */ 0, -/* 650 - _0F_14 */ 0x237c, -/* 651 - _66_0F_14 */ 0x237d, -/* 652 - */ 0, -/* 653 - */ 0, -/* 654 - _V_0F_14 */ 0x401c, -/* 655 - _V_66_0F_14 */ 0x401d, -/* 656 - */ 0, -/* 657 - */ 0, -/* 658 - */ 0, -/* 659 - */ 0, -/* 65a - */ 0, -/* 65b - */ 0, -/* 65c - _0F_15 */ 0x237e, -/* 65d - _66_0F_15 */ 0x237f, -/* 65e - */ 0, -/* 65f - */ 0, -/* 660 - _V_0F_15 */ 0x401e, -/* 661 - _V_66_0F_15 */ 0x401f, -/* 662 - */ 0, -/* 663 - */ 0, -/* 664 - */ 0, -/* 665 - */ 0, -/* 666 - */ 0, -/* 667 - */ 0, -/* 668 - _0F_16 */ 0x4020, -/* 669 - _66_0F_16 */ 0x2380, -/* 66a - _F3_0F_16 */ 0x2381, -/* 66b - */ 0, -/* 66c - _V_0F_16 */ 0x4021, -/* 66d - _V_66_0F_16 */ 0x4022, -/* 66e - _V_F3_0F_16 */ 0x4023, -/* 66f - */ 0, -/* 670 - */ 0, -/* 671 - */ 0, -/* 672 - */ 0, -/* 673 - */ 0, -/* 674 - _0F_17 */ 0x2382, -/* 675 - _66_0F_17 */ 0x2383, -/* 676 - */ 0, -/* 677 - */ 0, -/* 678 - _V_0F_17 */ 0x4024, -/* 679 - _V_66_0F_17 */ 0x4025, -/* 67a - */ 0, -/* 67b - */ 0, -/* 67c - */ 0, -/* 67d - */ 0, -/* 67e - */ 0, -/* 67f - */ 0, -/* 680 - _0F_18_00 */ 0x2384, -/* 681 - _0F_18_01 */ 0x2385, -/* 682 - _0F_18_02 */ 0x2386, -/* 683 - _0F_18_03 */ 0x2387, -/* 684 - */ 0, -/* 685 - */ 0, -/* 686 - */ 0, -/* 687 - */ 0, -/* 688 - _0F_28 */ 0x2388, -/* 689 - _66_0F_28 */ 0x2389, -/* 68a - */ 0, -/* 68b - */ 0, -/* 68c - _V_0F_28 */ 0x4026, -/* 68d - _V_66_0F_28 */ 0x4027, -/* 68e - */ 0, -/* 68f - */ 0, -/* 690 - */ 0, -/* 691 - */ 0, -/* 692 - */ 0, -/* 693 - */ 0, -/* 694 - _0F_29 */ 0x238a, -/* 695 - _66_0F_29 */ 0x238b, -/* 696 - */ 0, -/* 697 - */ 0, -/* 698 - _V_0F_29 */ 0x4028, -/* 699 - _V_66_0F_29 */ 0x4029, -/* 69a - */ 0, -/* 69b - */ 0, -/* 69c - */ 0, -/* 69d - */ 0, -/* 69e - */ 0, -/* 69f - */ 0, -/* 6a0 - _0F_2A */ 0x238c, -/* 6a1 - _66_0F_2A */ 0x238d, -/* 6a2 - _F3_0F_2A */ 0x238e, -/* 6a3 - _F2_0F_2A */ 0x238f, -/* 6a4 - */ 0, -/* 6a5 - */ 0, -/* 6a6 - _V_F3_0F_2A */ 0x402a, -/* 6a7 - _V_F2_0F_2A */ 0x402b, -/* 6a8 - */ 0, -/* 6a9 - */ 0, -/* 6aa - */ 0, -/* 6ab - */ 0, -/* 6ac - _0F_2B */ 0x2390, -/* 6ad - _66_0F_2B */ 0x2391, -/* 6ae - _F3_0F_2B */ 0x2392, -/* 6af - _F2_0F_2B */ 0x2393, -/* 6b0 - _V_0F_2B */ 0x402c, -/* 6b1 - _V_66_0F_2B */ 0x402d, -/* 6b2 - */ 0, -/* 6b3 - */ 0, -/* 6b4 - */ 0, -/* 6b5 - */ 0, -/* 6b6 - */ 0, -/* 6b7 - */ 0, -/* 6b8 - _0F_2C */ 0x2394, -/* 6b9 - _66_0F_2C */ 0x2395, -/* 6ba - _F3_0F_2C */ 0x2396, -/* 6bb - _F2_0F_2C */ 0x2397, -/* 6bc - */ 0, -/* 6bd - */ 0, -/* 6be - _V_F3_0F_2C */ 0x402e, -/* 6bf - _V_F2_0F_2C */ 0x402f, -/* 6c0 - */ 0, -/* 6c1 - */ 0, -/* 6c2 - */ 0, -/* 6c3 - */ 0, -/* 6c4 - _0F_2D */ 0x2398, -/* 6c5 - _66_0F_2D */ 0x2399, -/* 6c6 - _F3_0F_2D */ 0x239a, -/* 6c7 - _F2_0F_2D */ 0x239b, -/* 6c8 - */ 0, -/* 6c9 - */ 0, -/* 6ca - _V_F3_0F_2D */ 0x4030, -/* 6cb - _V_F2_0F_2D */ 0x4031, -/* 6cc - */ 0, -/* 6cd - */ 0, -/* 6ce - */ 0, -/* 6cf - */ 0, -/* 6d0 - _0F_2E */ 0x239c, -/* 6d1 - _66_0F_2E */ 0x239d, -/* 6d2 - */ 0, -/* 6d3 - */ 0, -/* 6d4 - _V_0F_2E */ 0x4032, -/* 6d5 - _V_66_0F_2E */ 0x4033, -/* 6d6 - */ 0, -/* 6d7 - */ 0, -/* 6d8 - */ 0, -/* 6d9 - */ 0, -/* 6da - */ 0, -/* 6db - */ 0, -/* 6dc - _0F_2F */ 0x239e, -/* 6dd - _66_0F_2F */ 0x239f, -/* 6de - */ 0, -/* 6df - */ 0, -/* 6e0 - _V_0F_2F */ 0x4034, -/* 6e1 - _V_66_0F_2F */ 0x4035, -/* 6e2 - */ 0, -/* 6e3 - */ 0, -/* 6e4 - */ 0, -/* 6e5 - */ 0, -/* 6e6 - */ 0, -/* 6e7 - */ 0, -/* 6e8 - _0F_38_00 */ 0xcef8, -/* 6e9 - _0F_38_01 */ 0xcf04, -/* 6ea - _0F_38_02 */ 0xcf10, -/* 6eb - _0F_38_03 */ 0xcf1c, -/* 6ec - _0F_38_04 */ 0xcf28, -/* 6ed - _0F_38_05 */ 0xcf34, -/* 6ee - _0F_38_06 */ 0xcf40, -/* 6ef - _0F_38_07 */ 0xcf4c, -/* 6f0 - _0F_38_08 */ 0xcf58, -/* 6f1 - _0F_38_09 */ 0xcf64, -/* 6f2 - _0F_38_0A */ 0xcf70, -/* 6f3 - _0F_38_0B */ 0xcf7c, -/* 6f4 - _0F_38_0C */ 0xcf88, -/* 6f5 - _0F_38_0D */ 0xcf94, -/* 6f6 - _0F_38_0E */ 0xcfa0, -/* 6f7 - _0F_38_0F */ 0xcfac, -/* 6f8 - _0F_38_10 */ 0xcfb8, -/* 6f9 - */ 0, -/* 6fa - */ 0, -/* 6fb - */ 0, -/* 6fc - _0F_38_14 */ 0xcfc4, -/* 6fd - _0F_38_15 */ 0xcfd0, -/* 6fe - */ 0, -/* 6ff - _0F_38_17 */ 0xcfdc, -/* 700 - _0F_38_18 */ 0xcfe8, -/* 701 - _0F_38_19 */ 0xcff4, -/* 702 - _0F_38_1A */ 0xd000, -/* 703 - */ 0, -/* 704 - _0F_38_1C */ 0xd00c, -/* 705 - _0F_38_1D */ 0xd018, -/* 706 - _0F_38_1E */ 0xd024, -/* 707 - */ 0, -/* 708 - _0F_38_20 */ 0xd030, -/* 709 - _0F_38_21 */ 0xd03c, -/* 70a - _0F_38_22 */ 0xd048, -/* 70b - _0F_38_23 */ 0xd054, -/* 70c - _0F_38_24 */ 0xd060, -/* 70d - _0F_38_25 */ 0xd06c, -/* 70e - */ 0, -/* 70f - */ 0, -/* 710 - _0F_38_28 */ 0xd078, -/* 711 - _0F_38_29 */ 0xd084, -/* 712 - _0F_38_2A */ 0xd090, -/* 713 - _0F_38_2B */ 0xd09c, -/* 714 - _0F_38_2C */ 0xd0a8, -/* 715 - _0F_38_2D */ 0xd0b4, -/* 716 - _0F_38_2E */ 0xd0c0, -/* 717 - _0F_38_2F */ 0xd0cc, -/* 718 - _0F_38_30 */ 0xd0d8, -/* 719 - _0F_38_31 */ 0xd0e4, -/* 71a - _0F_38_32 */ 0xd0f0, -/* 71b - _0F_38_33 */ 0xd0fc, -/* 71c - _0F_38_34 */ 0xd108, -/* 71d - _0F_38_35 */ 0xd114, -/* 71e - */ 0, -/* 71f - _0F_38_37 */ 0xd120, -/* 720 - _0F_38_38 */ 0xd12c, -/* 721 - _0F_38_39 */ 0xd138, -/* 722 - _0F_38_3A */ 0xd144, -/* 723 - _0F_38_3B */ 0xd150, -/* 724 - _0F_38_3C */ 0xd15c, -/* 725 - _0F_38_3D */ 0xd168, -/* 726 - _0F_38_3E */ 0xd174, -/* 727 - _0F_38_3F */ 0xd180, -/* 728 - _0F_38_40 */ 0xd18c, -/* 729 - _0F_38_41 */ 0xd198, -/* 72a - */ 0, -/* 72b - */ 0, -/* 72c - */ 0, -/* 72d - */ 0, -/* 72e - */ 0, -/* 72f - */ 0, -/* 730 - */ 0, -/* 731 - */ 0, -/* 732 - */ 0, -/* 733 - */ 0, -/* 734 - */ 0, -/* 735 - */ 0, -/* 736 - */ 0, -/* 737 - */ 0, -/* 738 - */ 0, -/* 739 - */ 0, -/* 73a - */ 0, -/* 73b - */ 0, -/* 73c - */ 0, -/* 73d - */ 0, -/* 73e - */ 0, -/* 73f - */ 0, -/* 740 - */ 0, -/* 741 - */ 0, -/* 742 - */ 0, -/* 743 - */ 0, -/* 744 - */ 0, -/* 745 - */ 0, -/* 746 - */ 0, -/* 747 - */ 0, -/* 748 - */ 0, -/* 749 - */ 0, -/* 74a - */ 0, -/* 74b - */ 0, -/* 74c - */ 0, -/* 74d - */ 0, -/* 74e - */ 0, -/* 74f - */ 0, -/* 750 - */ 0, -/* 751 - */ 0, -/* 752 - */ 0, -/* 753 - */ 0, -/* 754 - */ 0, -/* 755 - */ 0, -/* 756 - */ 0, -/* 757 - */ 0, -/* 758 - */ 0, -/* 759 - */ 0, -/* 75a - */ 0, -/* 75b - */ 0, -/* 75c - */ 0, -/* 75d - */ 0, -/* 75e - */ 0, -/* 75f - */ 0, -/* 760 - */ 0, -/* 761 - */ 0, -/* 762 - */ 0, -/* 763 - */ 0, -/* 764 - */ 0, -/* 765 - */ 0, -/* 766 - */ 0, -/* 767 - */ 0, -/* 768 - _0F_38_80 */ 0xd1a4, -/* 769 - _0F_38_81 */ 0xd1b0, -/* 76a - _0F_38_82 */ 0xd1bc, -/* 76b - */ 0, -/* 76c - */ 0, -/* 76d - */ 0, -/* 76e - */ 0, -/* 76f - */ 0, -/* 770 - */ 0, -/* 771 - */ 0, -/* 772 - */ 0, -/* 773 - */ 0, -/* 774 - */ 0, -/* 775 - */ 0, -/* 776 - */ 0, -/* 777 - */ 0, -/* 778 - */ 0, -/* 779 - */ 0, -/* 77a - */ 0, -/* 77b - */ 0, -/* 77c - */ 0, -/* 77d - */ 0, -/* 77e - _0F_38_96 */ 0xd1c8, -/* 77f - _0F_38_97 */ 0xd1d4, -/* 780 - _0F_38_98 */ 0xd1e0, -/* 781 - _0F_38_99 */ 0xd1ec, -/* 782 - _0F_38_9A */ 0xd1f8, -/* 783 - _0F_38_9B */ 0xd204, -/* 784 - _0F_38_9C */ 0xd210, -/* 785 - _0F_38_9D */ 0xd21c, -/* 786 - _0F_38_9E */ 0xd228, -/* 787 - _0F_38_9F */ 0xd234, -/* 788 - */ 0, -/* 789 - */ 0, -/* 78a - */ 0, -/* 78b - */ 0, -/* 78c - */ 0, -/* 78d - */ 0, -/* 78e - _0F_38_A6 */ 0xd240, -/* 78f - _0F_38_A7 */ 0xd24c, -/* 790 - _0F_38_A8 */ 0xd258, -/* 791 - _0F_38_A9 */ 0xd264, -/* 792 - _0F_38_AA */ 0xd270, -/* 793 - _0F_38_AB */ 0xd27c, -/* 794 - _0F_38_AC */ 0xd288, -/* 795 - _0F_38_AD */ 0xd294, -/* 796 - _0F_38_AE */ 0xd2a0, -/* 797 - _0F_38_AF */ 0xd2ac, -/* 798 - */ 0, -/* 799 - */ 0, -/* 79a - */ 0, -/* 79b - */ 0, -/* 79c - */ 0, -/* 79d - */ 0, -/* 79e - _0F_38_B6 */ 0xd2b8, -/* 79f - _0F_38_B7 */ 0xd2c4, -/* 7a0 - _0F_38_B8 */ 0xd2d0, -/* 7a1 - _0F_38_B9 */ 0xd2dc, -/* 7a2 - _0F_38_BA */ 0xd2e8, -/* 7a3 - _0F_38_BB */ 0xd2f4, -/* 7a4 - _0F_38_BC */ 0xd300, -/* 7a5 - _0F_38_BD */ 0xd30c, -/* 7a6 - _0F_38_BE */ 0xd318, -/* 7a7 - _0F_38_BF */ 0xd324, -/* 7a8 - */ 0, -/* 7a9 - */ 0, -/* 7aa - */ 0, -/* 7ab - */ 0, -/* 7ac - */ 0, -/* 7ad - */ 0, -/* 7ae - */ 0, -/* 7af - */ 0, -/* 7b0 - */ 0, -/* 7b1 - */ 0, -/* 7b2 - */ 0, -/* 7b3 - */ 0, -/* 7b4 - */ 0, -/* 7b5 - */ 0, -/* 7b6 - */ 0, -/* 7b7 - */ 0, -/* 7b8 - */ 0, -/* 7b9 - */ 0, -/* 7ba - */ 0, -/* 7bb - */ 0, -/* 7bc - */ 0, -/* 7bd - */ 0, -/* 7be - */ 0, -/* 7bf - */ 0, -/* 7c0 - */ 0, -/* 7c1 - */ 0, -/* 7c2 - */ 0, -/* 7c3 - _0F_38_DB */ 0xd330, -/* 7c4 - _0F_38_DC */ 0xd33c, -/* 7c5 - _0F_38_DD */ 0xd348, -/* 7c6 - _0F_38_DE */ 0xd354, -/* 7c7 - _0F_38_DF */ 0xd360, -/* 7c8 - */ 0, -/* 7c9 - */ 0, -/* 7ca - */ 0, -/* 7cb - */ 0, -/* 7cc - */ 0, -/* 7cd - */ 0, -/* 7ce - */ 0, -/* 7cf - */ 0, -/* 7d0 - */ 0, -/* 7d1 - */ 0, -/* 7d2 - */ 0, -/* 7d3 - */ 0, -/* 7d4 - */ 0, -/* 7d5 - */ 0, -/* 7d6 - */ 0, -/* 7d7 - */ 0, -/* 7d8 - _0F_38_F0 */ 0xd36c, -/* 7d9 - _0F_38_F1 */ 0xd378, -/* 7da - */ 0, -/* 7db - */ 0, -/* 7dc - */ 0, -/* 7dd - */ 0, -/* 7de - */ 0, -/* 7df - */ 0, -/* 7e0 - */ 0, -/* 7e1 - */ 0, -/* 7e2 - */ 0, -/* 7e3 - */ 0, -/* 7e4 - */ 0, -/* 7e5 - */ 0, -/* 7e6 - */ 0, -/* 7e7 - */ 0, -/* 7e8 - */ 0, -/* 7e9 - */ 0, -/* 7ea - */ 0, -/* 7eb - */ 0, -/* 7ec - _0F_3A_04 */ 0xd384, -/* 7ed - _0F_3A_05 */ 0xd390, -/* 7ee - _0F_3A_06 */ 0xd39c, -/* 7ef - */ 0, -/* 7f0 - _0F_3A_08 */ 0xd3a8, -/* 7f1 - _0F_3A_09 */ 0xd3b4, -/* 7f2 - _0F_3A_0A */ 0xd3c0, -/* 7f3 - _0F_3A_0B */ 0xd3cc, -/* 7f4 - _0F_3A_0C */ 0xd3d8, -/* 7f5 - _0F_3A_0D */ 0xd3e4, -/* 7f6 - _0F_3A_0E */ 0xd3f0, -/* 7f7 - _0F_3A_0F */ 0xd3fc, -/* 7f8 - */ 0, -/* 7f9 - */ 0, -/* 7fa - */ 0, -/* 7fb - */ 0, -/* 7fc - _0F_3A_14 */ 0xd408, -/* 7fd - _0F_3A_15 */ 0xd414, -/* 7fe - _0F_3A_16 */ 0xd420, -/* 7ff - _0F_3A_17 */ 0xd42c, -/* 800 - _0F_3A_18 */ 0xd438, -/* 801 - _0F_3A_19 */ 0xd444, -/* 802 - */ 0, -/* 803 - */ 0, -/* 804 - */ 0, -/* 805 - */ 0, -/* 806 - */ 0, -/* 807 - */ 0, -/* 808 - _0F_3A_20 */ 0xd450, -/* 809 - _0F_3A_21 */ 0xd45c, -/* 80a - _0F_3A_22 */ 0xd468, -/* 80b - */ 0, -/* 80c - */ 0, -/* 80d - */ 0, -/* 80e - */ 0, -/* 80f - */ 0, -/* 810 - */ 0, -/* 811 - */ 0, -/* 812 - */ 0, -/* 813 - */ 0, -/* 814 - */ 0, -/* 815 - */ 0, -/* 816 - */ 0, -/* 817 - */ 0, -/* 818 - */ 0, -/* 819 - */ 0, -/* 81a - */ 0, -/* 81b - */ 0, -/* 81c - */ 0, -/* 81d - */ 0, -/* 81e - */ 0, -/* 81f - */ 0, -/* 820 - */ 0, -/* 821 - */ 0, -/* 822 - */ 0, -/* 823 - */ 0, -/* 824 - */ 0, -/* 825 - */ 0, -/* 826 - */ 0, -/* 827 - */ 0, -/* 828 - _0F_3A_40 */ 0xd474, -/* 829 - _0F_3A_41 */ 0xd480, -/* 82a - _0F_3A_42 */ 0xd48c, -/* 82b - */ 0, -/* 82c - _0F_3A_44 */ 0xd498, -/* 82d - */ 0, -/* 82e - */ 0, -/* 82f - */ 0, -/* 830 - */ 0, -/* 831 - */ 0, -/* 832 - _0F_3A_4A */ 0xd4a4, -/* 833 - _0F_3A_4B */ 0xd4b0, -/* 834 - _0F_3A_4C */ 0xd4bc, -/* 835 - */ 0, -/* 836 - */ 0, -/* 837 - */ 0, -/* 838 - */ 0, -/* 839 - */ 0, -/* 83a - */ 0, -/* 83b - */ 0, -/* 83c - */ 0, -/* 83d - */ 0, -/* 83e - */ 0, -/* 83f - */ 0, -/* 840 - */ 0, -/* 841 - */ 0, -/* 842 - */ 0, -/* 843 - */ 0, -/* 844 - */ 0, -/* 845 - */ 0, -/* 846 - */ 0, -/* 847 - */ 0, -/* 848 - _0F_3A_60 */ 0xd4c8, -/* 849 - _0F_3A_61 */ 0xd4d4, -/* 84a - _0F_3A_62 */ 0xd4e0, -/* 84b - _0F_3A_63 */ 0xd4ec, -/* 84c - */ 0, -/* 84d - */ 0, -/* 84e - */ 0, -/* 84f - */ 0, -/* 850 - */ 0, -/* 851 - */ 0, -/* 852 - */ 0, -/* 853 - */ 0, -/* 854 - */ 0, -/* 855 - */ 0, -/* 856 - */ 0, -/* 857 - */ 0, -/* 858 - */ 0, -/* 859 - */ 0, -/* 85a - */ 0, -/* 85b - */ 0, -/* 85c - */ 0, -/* 85d - */ 0, -/* 85e - */ 0, -/* 85f - */ 0, -/* 860 - */ 0, -/* 861 - */ 0, -/* 862 - */ 0, -/* 863 - */ 0, -/* 864 - */ 0, -/* 865 - */ 0, -/* 866 - */ 0, -/* 867 - */ 0, -/* 868 - */ 0, -/* 869 - */ 0, -/* 86a - */ 0, -/* 86b - */ 0, -/* 86c - */ 0, -/* 86d - */ 0, -/* 86e - */ 0, -/* 86f - */ 0, -/* 870 - */ 0, -/* 871 - */ 0, -/* 872 - */ 0, -/* 873 - */ 0, -/* 874 - */ 0, -/* 875 - */ 0, -/* 876 - */ 0, -/* 877 - */ 0, -/* 878 - */ 0, -/* 879 - */ 0, -/* 87a - */ 0, -/* 87b - */ 0, -/* 87c - */ 0, -/* 87d - */ 0, -/* 87e - */ 0, -/* 87f - */ 0, -/* 880 - */ 0, -/* 881 - */ 0, -/* 882 - */ 0, -/* 883 - */ 0, -/* 884 - */ 0, -/* 885 - */ 0, -/* 886 - */ 0, -/* 887 - */ 0, -/* 888 - */ 0, -/* 889 - */ 0, -/* 88a - */ 0, -/* 88b - */ 0, -/* 88c - */ 0, -/* 88d - */ 0, -/* 88e - */ 0, -/* 88f - */ 0, -/* 890 - */ 0, -/* 891 - */ 0, -/* 892 - */ 0, -/* 893 - */ 0, -/* 894 - */ 0, -/* 895 - */ 0, -/* 896 - */ 0, -/* 897 - */ 0, -/* 898 - */ 0, -/* 899 - */ 0, -/* 89a - */ 0, -/* 89b - */ 0, -/* 89c - */ 0, -/* 89d - */ 0, -/* 89e - */ 0, -/* 89f - */ 0, -/* 8a0 - */ 0, -/* 8a1 - */ 0, -/* 8a2 - */ 0, -/* 8a3 - */ 0, -/* 8a4 - */ 0, -/* 8a5 - */ 0, -/* 8a6 - */ 0, -/* 8a7 - */ 0, -/* 8a8 - */ 0, -/* 8a9 - */ 0, -/* 8aa - */ 0, -/* 8ab - */ 0, -/* 8ac - */ 0, -/* 8ad - */ 0, -/* 8ae - */ 0, -/* 8af - */ 0, -/* 8b0 - */ 0, -/* 8b1 - */ 0, -/* 8b2 - */ 0, -/* 8b3 - */ 0, -/* 8b4 - */ 0, -/* 8b5 - */ 0, -/* 8b6 - */ 0, -/* 8b7 - */ 0, -/* 8b8 - */ 0, -/* 8b9 - */ 0, -/* 8ba - */ 0, -/* 8bb - */ 0, -/* 8bc - */ 0, -/* 8bd - */ 0, -/* 8be - */ 0, -/* 8bf - */ 0, -/* 8c0 - */ 0, -/* 8c1 - */ 0, -/* 8c2 - */ 0, -/* 8c3 - */ 0, -/* 8c4 - */ 0, -/* 8c5 - */ 0, -/* 8c6 - */ 0, -/* 8c7 - _0F_3A_DF */ 0xd4f8, -/* 8c8 - */ 0, -/* 8c9 - */ 0, -/* 8ca - */ 0, -/* 8cb - */ 0, -/* 8cc - */ 0, -/* 8cd - */ 0, -/* 8ce - */ 0, -/* 8cf - */ 0, -/* 8d0 - */ 0, -/* 8d1 - */ 0, -/* 8d2 - */ 0, -/* 8d3 - */ 0, -/* 8d4 - */ 0, -/* 8d5 - */ 0, -/* 8d6 - */ 0, -/* 8d7 - */ 0, -/* 8d8 - */ 0, -/* 8d9 - */ 0, -/* 8da - */ 0, -/* 8db - */ 0, -/* 8dc - */ 0, -/* 8dd - */ 0, -/* 8de - */ 0, -/* 8df - */ 0, -/* 8e0 - */ 0, -/* 8e1 - */ 0, -/* 8e2 - */ 0, -/* 8e3 - */ 0, -/* 8e4 - */ 0, -/* 8e5 - */ 0, -/* 8e6 - */ 0, -/* 8e7 - */ 0, -/* 8e8 - _0F_50 */ 0x23a0, -/* 8e9 - _66_0F_50 */ 0x23a1, -/* 8ea - */ 0, -/* 8eb - */ 0, -/* 8ec - _V_0F_50 */ 0x4036, -/* 8ed - _V_66_0F_50 */ 0x4037, -/* 8ee - */ 0, -/* 8ef - */ 0, -/* 8f0 - */ 0, -/* 8f1 - */ 0, -/* 8f2 - */ 0, -/* 8f3 - */ 0, -/* 8f4 - _0F_51 */ 0x23a2, -/* 8f5 - _66_0F_51 */ 0x23a3, -/* 8f6 - _F3_0F_51 */ 0x23a4, -/* 8f7 - _F2_0F_51 */ 0x23a5, -/* 8f8 - _V_0F_51 */ 0x4038, -/* 8f9 - _V_66_0F_51 */ 0x4039, -/* 8fa - _V_F3_0F_51 */ 0x403a, -/* 8fb - _V_F2_0F_51 */ 0x403b, -/* 8fc - */ 0, -/* 8fd - */ 0, -/* 8fe - */ 0, -/* 8ff - */ 0, -/* 900 - _0F_52 */ 0x23a6, -/* 901 - */ 0, -/* 902 - _F3_0F_52 */ 0x23a7, -/* 903 - */ 0, -/* 904 - _V_0F_52 */ 0x403c, -/* 905 - */ 0, -/* 906 - _V_F3_0F_52 */ 0x403d, -/* 907 - */ 0, -/* 908 - */ 0, -/* 909 - */ 0, -/* 90a - */ 0, -/* 90b - */ 0, -/* 90c - _0F_53 */ 0x23a8, -/* 90d - */ 0, -/* 90e - _F3_0F_53 */ 0x23a9, -/* 90f - */ 0, -/* 910 - _V_0F_53 */ 0x403e, -/* 911 - */ 0, -/* 912 - _V_F3_0F_53 */ 0x403f, -/* 913 - */ 0, -/* 914 - */ 0, -/* 915 - */ 0, -/* 916 - */ 0, -/* 917 - */ 0, -/* 918 - _0F_54 */ 0x23aa, -/* 919 - _66_0F_54 */ 0x23ab, -/* 91a - */ 0, -/* 91b - */ 0, -/* 91c - _V_0F_54 */ 0x4040, -/* 91d - _V_66_0F_54 */ 0x4041, -/* 91e - */ 0, -/* 91f - */ 0, -/* 920 - */ 0, -/* 921 - */ 0, -/* 922 - */ 0, -/* 923 - */ 0, -/* 924 - _0F_55 */ 0x23ac, -/* 925 - _66_0F_55 */ 0x23ad, -/* 926 - */ 0, -/* 927 - */ 0, -/* 928 - _V_0F_55 */ 0x4042, -/* 929 - _V_66_0F_55 */ 0x4043, -/* 92a - */ 0, -/* 92b - */ 0, -/* 92c - */ 0, -/* 92d - */ 0, -/* 92e - */ 0, -/* 92f - */ 0, -/* 930 - _0F_56 */ 0x23ae, -/* 931 - _66_0F_56 */ 0x23af, -/* 932 - */ 0, -/* 933 - */ 0, -/* 934 - _V_0F_56 */ 0x4044, -/* 935 - _V_66_0F_56 */ 0x4045, -/* 936 - */ 0, -/* 937 - */ 0, -/* 938 - */ 0, -/* 939 - */ 0, -/* 93a - */ 0, -/* 93b - */ 0, -/* 93c - _0F_57 */ 0x23b0, -/* 93d - _66_0F_57 */ 0x23b1, -/* 93e - */ 0, -/* 93f - */ 0, -/* 940 - _V_0F_57 */ 0x4046, -/* 941 - _V_66_0F_57 */ 0x4047, -/* 942 - */ 0, -/* 943 - */ 0, -/* 944 - */ 0, -/* 945 - */ 0, -/* 946 - */ 0, -/* 947 - */ 0, -/* 948 - _0F_58 */ 0x23b2, -/* 949 - _66_0F_58 */ 0x23b3, -/* 94a - _F3_0F_58 */ 0x23b4, -/* 94b - _F2_0F_58 */ 0x23b5, -/* 94c - _V_0F_58 */ 0x4048, -/* 94d - _V_66_0F_58 */ 0x4049, -/* 94e - _V_F3_0F_58 */ 0x404a, -/* 94f - _V_F2_0F_58 */ 0x404b, -/* 950 - */ 0, -/* 951 - */ 0, -/* 952 - */ 0, -/* 953 - */ 0, -/* 954 - _0F_59 */ 0x23b6, -/* 955 - _66_0F_59 */ 0x23b7, -/* 956 - _F3_0F_59 */ 0x23b8, -/* 957 - _F2_0F_59 */ 0x23b9, -/* 958 - _V_0F_59 */ 0x404c, -/* 959 - _V_66_0F_59 */ 0x404d, -/* 95a - _V_F3_0F_59 */ 0x404e, -/* 95b - _V_F2_0F_59 */ 0x404f, -/* 95c - */ 0, -/* 95d - */ 0, -/* 95e - */ 0, -/* 95f - */ 0, -/* 960 - _0F_5A */ 0x23ba, -/* 961 - _66_0F_5A */ 0x23bb, -/* 962 - _F3_0F_5A */ 0x23bc, -/* 963 - _F2_0F_5A */ 0x23bd, -/* 964 - _V_0F_5A */ 0x4050, -/* 965 - _V_66_0F_5A */ 0x4051, -/* 966 - _V_F3_0F_5A */ 0x4052, -/* 967 - _V_F2_0F_5A */ 0x4053, -/* 968 - */ 0, -/* 969 - */ 0, -/* 96a - */ 0, -/* 96b - */ 0, -/* 96c - _0F_5B */ 0x23be, -/* 96d - _66_0F_5B */ 0x23bf, -/* 96e - _F3_0F_5B */ 0x23c0, -/* 96f - */ 0, -/* 970 - _V_0F_5B */ 0x4054, -/* 971 - _V_66_0F_5B */ 0x4055, -/* 972 - _V_F3_0F_5B */ 0x4056, -/* 973 - */ 0, -/* 974 - */ 0, -/* 975 - */ 0, -/* 976 - */ 0, -/* 977 - */ 0, -/* 978 - _0F_5C */ 0x23c1, -/* 979 - _66_0F_5C */ 0x23c2, -/* 97a - _F3_0F_5C */ 0x23c3, -/* 97b - _F2_0F_5C */ 0x23c4, -/* 97c - _V_0F_5C */ 0x4057, -/* 97d - _V_66_0F_5C */ 0x4058, -/* 97e - _V_F3_0F_5C */ 0x4059, -/* 97f - _V_F2_0F_5C */ 0x405a, -/* 980 - */ 0, -/* 981 - */ 0, -/* 982 - */ 0, -/* 983 - */ 0, -/* 984 - _0F_5D */ 0x23c5, -/* 985 - _66_0F_5D */ 0x23c6, -/* 986 - _F3_0F_5D */ 0x23c7, -/* 987 - _F2_0F_5D */ 0x23c8, -/* 988 - _V_0F_5D */ 0x405b, -/* 989 - _V_66_0F_5D */ 0x405c, -/* 98a - _V_F3_0F_5D */ 0x405d, -/* 98b - _V_F2_0F_5D */ 0x405e, -/* 98c - */ 0, -/* 98d - */ 0, -/* 98e - */ 0, -/* 98f - */ 0, -/* 990 - _0F_5E */ 0x23c9, -/* 991 - _66_0F_5E */ 0x23ca, -/* 992 - _F3_0F_5E */ 0x23cb, -/* 993 - _F2_0F_5E */ 0x23cc, -/* 994 - _V_0F_5E */ 0x405f, -/* 995 - _V_66_0F_5E */ 0x4060, -/* 996 - _V_F3_0F_5E */ 0x4061, -/* 997 - _V_F2_0F_5E */ 0x4062, -/* 998 - */ 0, -/* 999 - */ 0, -/* 99a - */ 0, -/* 99b - */ 0, -/* 99c - _0F_5F */ 0x23cd, -/* 99d - _66_0F_5F */ 0x23ce, -/* 99e - _F3_0F_5F */ 0x23cf, -/* 99f - _F2_0F_5F */ 0x23d0, -/* 9a0 - _V_0F_5F */ 0x4063, -/* 9a1 - _V_66_0F_5F */ 0x4064, -/* 9a2 - _V_F3_0F_5F */ 0x4065, -/* 9a3 - _V_F2_0F_5F */ 0x4066, -/* 9a4 - */ 0, -/* 9a5 - */ 0, -/* 9a6 - */ 0, -/* 9a7 - */ 0, -/* 9a8 - _0F_60 */ 0x23d1, -/* 9a9 - _66_0F_60 */ 0x23d2, -/* 9aa - */ 0, -/* 9ab - */ 0, -/* 9ac - */ 0, -/* 9ad - _V_66_0F_60 */ 0x4067, -/* 9ae - */ 0, -/* 9af - */ 0, -/* 9b0 - */ 0, -/* 9b1 - */ 0, -/* 9b2 - */ 0, -/* 9b3 - */ 0, -/* 9b4 - _0F_61 */ 0x23d3, -/* 9b5 - _66_0F_61 */ 0x23d4, -/* 9b6 - */ 0, -/* 9b7 - */ 0, -/* 9b8 - */ 0, -/* 9b9 - _V_66_0F_61 */ 0x4068, -/* 9ba - */ 0, -/* 9bb - */ 0, -/* 9bc - */ 0, -/* 9bd - */ 0, -/* 9be - */ 0, -/* 9bf - */ 0, -/* 9c0 - _0F_62 */ 0x23d5, -/* 9c1 - _66_0F_62 */ 0x23d6, -/* 9c2 - */ 0, -/* 9c3 - */ 0, -/* 9c4 - */ 0, -/* 9c5 - _V_66_0F_62 */ 0x4069, -/* 9c6 - */ 0, -/* 9c7 - */ 0, -/* 9c8 - */ 0, -/* 9c9 - */ 0, -/* 9ca - */ 0, -/* 9cb - */ 0, -/* 9cc - _0F_63 */ 0x23d7, -/* 9cd - _66_0F_63 */ 0x23d8, -/* 9ce - */ 0, -/* 9cf - */ 0, -/* 9d0 - */ 0, -/* 9d1 - _V_66_0F_63 */ 0x406a, -/* 9d2 - */ 0, -/* 9d3 - */ 0, -/* 9d4 - */ 0, -/* 9d5 - */ 0, -/* 9d6 - */ 0, -/* 9d7 - */ 0, -/* 9d8 - _0F_64 */ 0x23d9, -/* 9d9 - _66_0F_64 */ 0x23da, -/* 9da - */ 0, -/* 9db - */ 0, -/* 9dc - */ 0, -/* 9dd - _V_66_0F_64 */ 0x406b, -/* 9de - */ 0, -/* 9df - */ 0, -/* 9e0 - */ 0, -/* 9e1 - */ 0, -/* 9e2 - */ 0, -/* 9e3 - */ 0, -/* 9e4 - _0F_65 */ 0x23db, -/* 9e5 - _66_0F_65 */ 0x23dc, -/* 9e6 - */ 0, -/* 9e7 - */ 0, -/* 9e8 - */ 0, -/* 9e9 - _V_66_0F_65 */ 0x406c, -/* 9ea - */ 0, -/* 9eb - */ 0, -/* 9ec - */ 0, -/* 9ed - */ 0, -/* 9ee - */ 0, -/* 9ef - */ 0, -/* 9f0 - _0F_66 */ 0x23dd, -/* 9f1 - _66_0F_66 */ 0x23de, -/* 9f2 - */ 0, -/* 9f3 - */ 0, -/* 9f4 - */ 0, -/* 9f5 - _V_66_0F_66 */ 0x406d, -/* 9f6 - */ 0, -/* 9f7 - */ 0, -/* 9f8 - */ 0, -/* 9f9 - */ 0, -/* 9fa - */ 0, -/* 9fb - */ 0, -/* 9fc - _0F_67 */ 0x23df, -/* 9fd - _66_0F_67 */ 0x23e0, -/* 9fe - */ 0, -/* 9ff - */ 0, -/* a00 - */ 0, -/* a01 - _V_66_0F_67 */ 0x406e, -/* a02 - */ 0, -/* a03 - */ 0, -/* a04 - */ 0, -/* a05 - */ 0, -/* a06 - */ 0, -/* a07 - */ 0, -/* a08 - _0F_68 */ 0x23e1, -/* a09 - _66_0F_68 */ 0x23e2, -/* a0a - */ 0, -/* a0b - */ 0, -/* a0c - */ 0, -/* a0d - _V_66_0F_68 */ 0x406f, -/* a0e - */ 0, -/* a0f - */ 0, -/* a10 - */ 0, -/* a11 - */ 0, -/* a12 - */ 0, -/* a13 - */ 0, -/* a14 - _0F_69 */ 0x23e3, -/* a15 - _66_0F_69 */ 0x23e4, -/* a16 - */ 0, -/* a17 - */ 0, -/* a18 - */ 0, -/* a19 - _V_66_0F_69 */ 0x4070, -/* a1a - */ 0, -/* a1b - */ 0, -/* a1c - */ 0, -/* a1d - */ 0, -/* a1e - */ 0, -/* a1f - */ 0, -/* a20 - _0F_6A */ 0x23e5, -/* a21 - _66_0F_6A */ 0x23e6, -/* a22 - */ 0, -/* a23 - */ 0, -/* a24 - */ 0, -/* a25 - _V_66_0F_6A */ 0x4071, -/* a26 - */ 0, -/* a27 - */ 0, -/* a28 - */ 0, -/* a29 - */ 0, -/* a2a - */ 0, -/* a2b - */ 0, -/* a2c - _0F_6B */ 0x23e7, -/* a2d - _66_0F_6B */ 0x23e8, -/* a2e - */ 0, -/* a2f - */ 0, -/* a30 - */ 0, -/* a31 - _V_66_0F_6B */ 0x4072, -/* a32 - */ 0, -/* a33 - */ 0, -/* a34 - */ 0, -/* a35 - */ 0, -/* a36 - */ 0, -/* a37 - */ 0, -/* a38 - */ 0, -/* a39 - _66_0F_6C */ 0x23e9, -/* a3a - */ 0, -/* a3b - */ 0, -/* a3c - */ 0, -/* a3d - _V_66_0F_6C */ 0x4073, -/* a3e - */ 0, -/* a3f - */ 0, -/* a40 - */ 0, -/* a41 - */ 0, -/* a42 - */ 0, -/* a43 - */ 0, -/* a44 - */ 0, -/* a45 - _66_0F_6D */ 0x23ea, -/* a46 - */ 0, -/* a47 - */ 0, -/* a48 - */ 0, -/* a49 - _V_66_0F_6D */ 0x4074, -/* a4a - */ 0, -/* a4b - */ 0, -/* a4c - */ 0, -/* a4d - */ 0, -/* a4e - */ 0, -/* a4f - */ 0, -/* a50 - _0F_6E */ 0x4075, -/* a51 - _66_0F_6E */ 0x4076, -/* a52 - */ 0, -/* a53 - */ 0, -/* a54 - */ 0, -/* a55 - _V_66_0F_6E */ 0x4077, -/* a56 - */ 0, -/* a57 - */ 0, -/* a58 - */ 0, -/* a59 - */ 0, -/* a5a - */ 0, -/* a5b - */ 0, -/* a5c - _0F_6F */ 0x23eb, -/* a5d - _66_0F_6F */ 0x23ec, -/* a5e - _F3_0F_6F */ 0x23ed, -/* a5f - */ 0, -/* a60 - */ 0, -/* a61 - _V_66_0F_6F */ 0x4078, -/* a62 - _V_F3_0F_6F */ 0x4079, -/* a63 - */ 0, -/* a64 - */ 0, -/* a65 - */ 0, -/* a66 - */ 0, -/* a67 - */ 0, -/* a68 - _0F_70 */ 0x407a, -/* a69 - _66_0F_70 */ 0x407b, -/* a6a - _F3_0F_70 */ 0x407c, -/* a6b - _F2_0F_70 */ 0x407d, -/* a6c - */ 0, -/* a6d - _V_66_0F_70 */ 0x407e, -/* a6e - _V_F3_0F_70 */ 0x407f, -/* a6f - _V_F2_0F_70 */ 0x4080, -/* a70 - */ 0, -/* a71 - */ 0, -/* a72 - */ 0, -/* a73 - */ 0, -/* a74 - */ 0, -/* a75 - */ 0, -/* a76 - _0F_71_02 */ 0xd504, -/* a77 - */ 0, -/* a78 - _0F_71_04 */ 0xd510, -/* a79 - */ 0, -/* a7a - _0F_71_06 */ 0xd51c, -/* a7b - */ 0, -/* a7c - */ 0, -/* a7d - */ 0, -/* a7e - _0F_72_02 */ 0xd528, -/* a7f - */ 0, -/* a80 - _0F_72_04 */ 0xd534, -/* a81 - */ 0, -/* a82 - _0F_72_06 */ 0xd540, -/* a83 - */ 0, -/* a84 - */ 0, -/* a85 - */ 0, -/* a86 - _0F_73_02 */ 0xd54c, -/* a87 - _0F_73_03 */ 0xd558, -/* a88 - */ 0, -/* a89 - */ 0, -/* a8a - _0F_73_06 */ 0xd564, -/* a8b - _0F_73_07 */ 0xd570, -/* a8c - _0F_74 */ 0x23ee, -/* a8d - _66_0F_74 */ 0x23ef, -/* a8e - */ 0, -/* a8f - */ 0, -/* a90 - */ 0, -/* a91 - _V_66_0F_74 */ 0x4081, -/* a92 - */ 0, -/* a93 - */ 0, -/* a94 - */ 0, -/* a95 - */ 0, -/* a96 - */ 0, -/* a97 - */ 0, -/* a98 - _0F_75 */ 0x23f0, -/* a99 - _66_0F_75 */ 0x23f1, -/* a9a - */ 0, -/* a9b - */ 0, -/* a9c - */ 0, -/* a9d - _V_66_0F_75 */ 0x4082, -/* a9e - */ 0, -/* a9f - */ 0, -/* aa0 - */ 0, -/* aa1 - */ 0, -/* aa2 - */ 0, -/* aa3 - */ 0, -/* aa4 - _0F_76 */ 0x23f2, -/* aa5 - _66_0F_76 */ 0x23f3, -/* aa6 - */ 0, -/* aa7 - */ 0, -/* aa8 - */ 0, -/* aa9 - _V_66_0F_76 */ 0x4083, -/* aaa - */ 0, -/* aab - */ 0, -/* aac - */ 0, -/* aad - */ 0, -/* aae - */ 0, -/* aaf - */ 0, -/* ab0 - _0F_77 */ 0x23f4, -/* ab1 - */ 0, -/* ab2 - */ 0, -/* ab3 - */ 0, -/* ab4 - _V_0F_77 */ 0x4084, -/* ab5 - */ 0, -/* ab6 - */ 0, -/* ab7 - */ 0, -/* ab8 - */ 0, -/* ab9 - */ 0, -/* aba - */ 0, -/* abb - */ 0, -/* abc - _0F_78 */ 0x23f5, -/* abd - _66_0F_78 */ 0x4085, -/* abe - */ 0, -/* abf - _F2_0F_78 */ 0x4086, -/* ac0 - */ 0, -/* ac1 - */ 0, -/* ac2 - */ 0, -/* ac3 - */ 0, -/* ac4 - */ 0, -/* ac5 - */ 0, -/* ac6 - */ 0, -/* ac7 - */ 0, -/* ac8 - _0F_79 */ 0x23f6, -/* ac9 - _66_0F_79 */ 0x23f7, -/* aca - */ 0, -/* acb - _F2_0F_79 */ 0x23f8, -/* acc - */ 0, -/* acd - */ 0, -/* ace - */ 0, -/* acf - */ 0, -/* ad0 - */ 0, -/* ad1 - */ 0, -/* ad2 - */ 0, -/* ad3 - */ 0, -/* ad4 - */ 0, -/* ad5 - */ 0, -/* ad6 - */ 0, -/* ad7 - */ 0, -/* ad8 - */ 0, -/* ad9 - */ 0, -/* ada - */ 0, -/* adb - */ 0, -/* adc - */ 0, -/* add - */ 0, -/* ade - */ 0, -/* adf - */ 0, -/* ae0 - */ 0, -/* ae1 - */ 0, -/* ae2 - */ 0, -/* ae3 - */ 0, -/* ae4 - */ 0, -/* ae5 - */ 0, -/* ae6 - */ 0, -/* ae7 - */ 0, -/* ae8 - */ 0, -/* ae9 - */ 0, -/* aea - */ 0, -/* aeb - */ 0, -/* aec - */ 0, -/* aed - */ 0, -/* aee - */ 0, -/* aef - */ 0, -/* af0 - */ 0, -/* af1 - */ 0, -/* af2 - */ 0, -/* af3 - */ 0, -/* af4 - */ 0, -/* af5 - */ 0, -/* af6 - */ 0, -/* af7 - */ 0, -/* af8 - */ 0, -/* af9 - */ 0, -/* afa - */ 0, -/* afb - */ 0, -/* afc - */ 0, -/* afd - */ 0, -/* afe - */ 0, -/* aff - */ 0, -/* b00 - */ 0, -/* b01 - */ 0, -/* b02 - */ 0, -/* b03 - */ 0, -/* b04 - _0F_7A_30 */ 0x23f9, -/* b05 - _0F_7A_31 */ 0x23fa, -/* b06 - */ 0, -/* b07 - */ 0, -/* b08 - */ 0, -/* b09 - */ 0, -/* b0a - */ 0, -/* b0b - */ 0, -/* b0c - */ 0, -/* b0d - */ 0, -/* b0e - */ 0, -/* b0f - */ 0, -/* b10 - */ 0, -/* b11 - */ 0, -/* b12 - */ 0, -/* b13 - */ 0, -/* b14 - */ 0, -/* b15 - */ 0, -/* b16 - */ 0, -/* b17 - */ 0, -/* b18 - */ 0, -/* b19 - */ 0, -/* b1a - */ 0, -/* b1b - */ 0, -/* b1c - */ 0, -/* b1d - */ 0, -/* b1e - */ 0, -/* b1f - */ 0, -/* b20 - */ 0, -/* b21 - */ 0, -/* b22 - */ 0, -/* b23 - */ 0, -/* b24 - */ 0, -/* b25 - */ 0, -/* b26 - */ 0, -/* b27 - */ 0, -/* b28 - */ 0, -/* b29 - */ 0, -/* b2a - */ 0, -/* b2b - */ 0, -/* b2c - */ 0, -/* b2d - */ 0, -/* b2e - */ 0, -/* b2f - */ 0, -/* b30 - */ 0, -/* b31 - */ 0, -/* b32 - */ 0, -/* b33 - */ 0, -/* b34 - */ 0, -/* b35 - */ 0, -/* b36 - */ 0, -/* b37 - */ 0, -/* b38 - */ 0, -/* b39 - */ 0, -/* b3a - */ 0, -/* b3b - */ 0, -/* b3c - */ 0, -/* b3d - */ 0, -/* b3e - */ 0, -/* b3f - */ 0, -/* b40 - */ 0, -/* b41 - */ 0, -/* b42 - */ 0, -/* b43 - */ 0, -/* b44 - */ 0, -/* b45 - */ 0, -/* b46 - */ 0, -/* b47 - */ 0, -/* b48 - */ 0, -/* b49 - */ 0, -/* b4a - */ 0, -/* b4b - */ 0, -/* b4c - */ 0, -/* b4d - */ 0, -/* b4e - */ 0, -/* b4f - */ 0, -/* b50 - */ 0, -/* b51 - */ 0, -/* b52 - */ 0, -/* b53 - */ 0, -/* b54 - */ 0, -/* b55 - */ 0, -/* b56 - */ 0, -/* b57 - */ 0, -/* b58 - */ 0, -/* b59 - */ 0, -/* b5a - */ 0, -/* b5b - */ 0, -/* b5c - */ 0, -/* b5d - */ 0, -/* b5e - */ 0, -/* b5f - */ 0, -/* b60 - */ 0, -/* b61 - */ 0, -/* b62 - */ 0, -/* b63 - */ 0, -/* b64 - */ 0, -/* b65 - */ 0, -/* b66 - */ 0, -/* b67 - */ 0, -/* b68 - */ 0, -/* b69 - */ 0, -/* b6a - */ 0, -/* b6b - */ 0, -/* b6c - */ 0, -/* b6d - */ 0, -/* b6e - */ 0, -/* b6f - */ 0, -/* b70 - */ 0, -/* b71 - */ 0, -/* b72 - */ 0, -/* b73 - */ 0, -/* b74 - */ 0, -/* b75 - */ 0, -/* b76 - */ 0, -/* b77 - */ 0, -/* b78 - */ 0, -/* b79 - */ 0, -/* b7a - */ 0, -/* b7b - */ 0, -/* b7c - */ 0, -/* b7d - */ 0, -/* b7e - */ 0, -/* b7f - */ 0, -/* b80 - */ 0, -/* b81 - */ 0, -/* b82 - */ 0, -/* b83 - */ 0, -/* b84 - */ 0, -/* b85 - */ 0, -/* b86 - */ 0, -/* b87 - */ 0, -/* b88 - */ 0, -/* b89 - */ 0, -/* b8a - */ 0, -/* b8b - */ 0, -/* b8c - */ 0, -/* b8d - */ 0, -/* b8e - */ 0, -/* b8f - */ 0, -/* b90 - */ 0, -/* b91 - */ 0, -/* b92 - */ 0, -/* b93 - */ 0, -/* b94 - */ 0, -/* b95 - */ 0, -/* b96 - */ 0, -/* b97 - */ 0, -/* b98 - */ 0, -/* b99 - */ 0, -/* b9a - */ 0, -/* b9b - */ 0, -/* b9c - */ 0, -/* b9d - */ 0, -/* b9e - */ 0, -/* b9f - */ 0, -/* ba0 - */ 0, -/* ba1 - */ 0, -/* ba2 - */ 0, -/* ba3 - */ 0, -/* ba4 - */ 0, -/* ba5 - */ 0, -/* ba6 - */ 0, -/* ba7 - */ 0, -/* ba8 - */ 0, -/* ba9 - */ 0, -/* baa - */ 0, -/* bab - */ 0, -/* bac - */ 0, -/* bad - */ 0, -/* bae - */ 0, -/* baf - */ 0, -/* bb0 - */ 0, -/* bb1 - */ 0, -/* bb2 - */ 0, -/* bb3 - */ 0, -/* bb4 - */ 0, -/* bb5 - */ 0, -/* bb6 - */ 0, -/* bb7 - */ 0, -/* bb8 - */ 0, -/* bb9 - */ 0, -/* bba - */ 0, -/* bbb - */ 0, -/* bbc - */ 0, -/* bbd - */ 0, -/* bbe - */ 0, -/* bbf - */ 0, -/* bc0 - */ 0, -/* bc1 - */ 0, -/* bc2 - */ 0, -/* bc3 - */ 0, -/* bc4 - */ 0, -/* bc5 - */ 0, -/* bc6 - */ 0, -/* bc7 - */ 0, -/* bc8 - */ 0, -/* bc9 - */ 0, -/* bca - */ 0, -/* bcb - */ 0, -/* bcc - */ 0, -/* bcd - */ 0, -/* bce - */ 0, -/* bcf - */ 0, -/* bd0 - */ 0, -/* bd1 - */ 0, -/* bd2 - */ 0, -/* bd3 - */ 0, -/* bd4 - */ 0, -/* bd5 - _66_0F_7C */ 0x23fb, -/* bd6 - */ 0, -/* bd7 - _F2_0F_7C */ 0x23fc, -/* bd8 - */ 0, -/* bd9 - _V_66_0F_7C */ 0x4087, -/* bda - */ 0, -/* bdb - _V_F2_0F_7C */ 0x4088, -/* bdc - */ 0, -/* bdd - */ 0, -/* bde - */ 0, -/* bdf - */ 0, -/* be0 - */ 0, -/* be1 - _66_0F_7D */ 0x23fd, -/* be2 - */ 0, -/* be3 - _F2_0F_7D */ 0x23fe, -/* be4 - */ 0, -/* be5 - _V_66_0F_7D */ 0x4089, -/* be6 - */ 0, -/* be7 - _V_F2_0F_7D */ 0x408a, -/* be8 - */ 0, -/* be9 - */ 0, -/* bea - */ 0, -/* beb - */ 0, -/* bec - _0F_7E */ 0x408b, -/* bed - _66_0F_7E */ 0x408c, -/* bee - _F3_0F_7E */ 0x23ff, -/* bef - */ 0, -/* bf0 - */ 0, -/* bf1 - _V_66_0F_7E */ 0x408d, -/* bf2 - _V_F3_0F_7E */ 0x408e, -/* bf3 - */ 0, -/* bf4 - */ 0, -/* bf5 - */ 0, -/* bf6 - */ 0, -/* bf7 - */ 0, -/* bf8 - _0F_7F */ 0x2400, -/* bf9 - _66_0F_7F */ 0x2401, -/* bfa - _F3_0F_7F */ 0x2402, -/* bfb - */ 0, -/* bfc - */ 0, -/* bfd - _V_66_0F_7F */ 0x408f, -/* bfe - _V_F3_0F_7F */ 0x4090, -/* bff - */ 0, -/* c00 - */ 0, -/* c01 - */ 0, -/* c02 - */ 0, -/* c03 - */ 0, -/* c04 - _0F_AE_00 */ 0xd57c, -/* c05 - _0F_AE_01 */ 0xd588, -/* c06 - _0F_AE_02 */ 0xd594, -/* c07 - _0F_AE_03 */ 0xd5a0, -/* c08 - _0F_AE_04 */ 0x4091, -/* c09 - _0F_AE_05 */ 0x4092, -/* c0a - _0F_AE_06 */ 0x4093, -/* c0b - _0F_AE_07 */ 0x4094, -/* c0c - */ 0, -/* c0d - */ 0, -/* c0e - _F3_0F_B8 */ 0x2403, -/* c0f - */ 0, -/* c10 - */ 0, -/* c11 - */ 0, -/* c12 - */ 0, -/* c13 - */ 0, -/* c14 - */ 0, -/* c15 - */ 0, -/* c16 - */ 0, -/* c17 - */ 0, -/* c18 - */ 0, -/* c19 - */ 0, -/* c1a - */ 0, -/* c1b - */ 0, -/* c1c - _0F_BA_04 */ 0x2404, -/* c1d - _0F_BA_05 */ 0x2405, -/* c1e - _0F_BA_06 */ 0x2406, -/* c1f - _0F_BA_07 */ 0x2407, -/* c20 - _0F_BC */ 0x2408, -/* c21 - */ 0, -/* c22 - _F3_0F_BC */ 0x2409, -/* c23 - */ 0, -/* c24 - */ 0, -/* c25 - */ 0, -/* c26 - */ 0, -/* c27 - */ 0, -/* c28 - */ 0, -/* c29 - */ 0, -/* c2a - */ 0, -/* c2b - */ 0, -/* c2c - _0F_BD */ 0x240a, -/* c2d - */ 0, -/* c2e - _F3_0F_BD */ 0x240b, -/* c2f - */ 0, -/* c30 - */ 0, -/* c31 - */ 0, -/* c32 - */ 0, -/* c33 - */ 0, -/* c34 - */ 0, -/* c35 - */ 0, -/* c36 - */ 0, -/* c37 - */ 0, -/* c38 - _0F_C2 */ 0x4095, -/* c39 - _66_0F_C2 */ 0x4096, -/* c3a - _F3_0F_C2 */ 0x4097, -/* c3b - _F2_0F_C2 */ 0x4098, -/* c3c - _V_0F_C2 */ 0x4099, -/* c3d - _V_66_0F_C2 */ 0x409a, -/* c3e - _V_F3_0F_C2 */ 0x409b, -/* c3f - _V_F2_0F_C2 */ 0x409c, -/* c40 - */ 0, -/* c41 - */ 0, -/* c42 - */ 0, -/* c43 - */ 0, -/* c44 - _0F_C4 */ 0x409d, -/* c45 - _66_0F_C4 */ 0x409e, -/* c46 - */ 0, -/* c47 - */ 0, -/* c48 - */ 0, -/* c49 - _V_66_0F_C4 */ 0x409f, -/* c4a - */ 0, -/* c4b - */ 0, -/* c4c - */ 0, -/* c4d - */ 0, -/* c4e - */ 0, -/* c4f - */ 0, -/* c50 - _0F_C5 */ 0x40a0, -/* c51 - _66_0F_C5 */ 0x40a1, -/* c52 - */ 0, -/* c53 - */ 0, -/* c54 - */ 0, -/* c55 - _V_66_0F_C5 */ 0x40a2, -/* c56 - */ 0, -/* c57 - */ 0, -/* c58 - */ 0, -/* c59 - */ 0, -/* c5a - */ 0, -/* c5b - */ 0, -/* c5c - _0F_C6 */ 0x40a3, -/* c5d - _66_0F_C6 */ 0x40a4, -/* c5e - */ 0, -/* c5f - */ 0, -/* c60 - _V_0F_C6 */ 0x40a5, -/* c61 - _V_66_0F_C6 */ 0x40a6, -/* c62 - */ 0, -/* c63 - */ 0, -/* c64 - */ 0, -/* c65 - */ 0, -/* c66 - */ 0, -/* c67 - */ 0, -/* c68 - */ 0, -/* c69 - _0F_C7_01 */ 0x40a7, -/* c6a - */ 0, -/* c6b - */ 0, -/* c6c - */ 0, -/* c6d - */ 0, -/* c6e - _0F_C7_06 */ 0xd5ac, -/* c6f - _0F_C7_07 */ 0x240c, -/* c70 - */ 0, -/* c71 - _66_0F_D0 */ 0x240d, -/* c72 - */ 0, -/* c73 - _F2_0F_D0 */ 0x240e, -/* c74 - */ 0, -/* c75 - _V_66_0F_D0 */ 0x40a8, -/* c76 - */ 0, -/* c77 - _V_F2_0F_D0 */ 0x40a9, -/* c78 - */ 0, -/* c79 - */ 0, -/* c7a - */ 0, -/* c7b - */ 0, -/* c7c - _0F_D1 */ 0x240f, -/* c7d - _66_0F_D1 */ 0x2410, -/* c7e - */ 0, -/* c7f - */ 0, -/* c80 - */ 0, -/* c81 - _V_66_0F_D1 */ 0x40aa, -/* c82 - */ 0, -/* c83 - */ 0, -/* c84 - */ 0, -/* c85 - */ 0, -/* c86 - */ 0, -/* c87 - */ 0, -/* c88 - _0F_D2 */ 0x2411, -/* c89 - _66_0F_D2 */ 0x2412, -/* c8a - */ 0, -/* c8b - */ 0, -/* c8c - */ 0, -/* c8d - _V_66_0F_D2 */ 0x40ab, -/* c8e - */ 0, -/* c8f - */ 0, -/* c90 - */ 0, -/* c91 - */ 0, -/* c92 - */ 0, -/* c93 - */ 0, -/* c94 - _0F_D3 */ 0x2413, -/* c95 - _66_0F_D3 */ 0x2414, -/* c96 - */ 0, -/* c97 - */ 0, -/* c98 - */ 0, -/* c99 - _V_66_0F_D3 */ 0x40ac, -/* c9a - */ 0, -/* c9b - */ 0, -/* c9c - */ 0, -/* c9d - */ 0, -/* c9e - */ 0, -/* c9f - */ 0, -/* ca0 - _0F_D4 */ 0x2415, -/* ca1 - _66_0F_D4 */ 0x2416, -/* ca2 - */ 0, -/* ca3 - */ 0, -/* ca4 - */ 0, -/* ca5 - _V_66_0F_D4 */ 0x40ad, -/* ca6 - */ 0, -/* ca7 - */ 0, -/* ca8 - */ 0, -/* ca9 - */ 0, -/* caa - */ 0, -/* cab - */ 0, -/* cac - _0F_D5 */ 0x2417, -/* cad - _66_0F_D5 */ 0x2418, -/* cae - */ 0, -/* caf - */ 0, -/* cb0 - */ 0, -/* cb1 - _V_66_0F_D5 */ 0x40ae, -/* cb2 - */ 0, -/* cb3 - */ 0, -/* cb4 - */ 0, -/* cb5 - */ 0, -/* cb6 - */ 0, -/* cb7 - */ 0, -/* cb8 - */ 0, -/* cb9 - _66_0F_D6 */ 0x2419, -/* cba - _F3_0F_D6 */ 0x241a, -/* cbb - _F2_0F_D6 */ 0x241b, -/* cbc - */ 0, -/* cbd - _V_66_0F_D6 */ 0x40af, -/* cbe - */ 0, -/* cbf - */ 0, -/* cc0 - */ 0, -/* cc1 - */ 0, -/* cc2 - */ 0, -/* cc3 - */ 0, -/* cc4 - _0F_D7 */ 0x241c, -/* cc5 - _66_0F_D7 */ 0x241d, -/* cc6 - */ 0, -/* cc7 - */ 0, -/* cc8 - */ 0, -/* cc9 - _V_66_0F_D7 */ 0x40b0, -/* cca - */ 0, -/* ccb - */ 0, -/* ccc - */ 0, -/* ccd - */ 0, -/* cce - */ 0, -/* ccf - */ 0, -/* cd0 - _0F_D8 */ 0x241e, -/* cd1 - _66_0F_D8 */ 0x241f, -/* cd2 - */ 0, -/* cd3 - */ 0, -/* cd4 - */ 0, -/* cd5 - _V_66_0F_D8 */ 0x40b1, -/* cd6 - */ 0, -/* cd7 - */ 0, -/* cd8 - */ 0, -/* cd9 - */ 0, -/* cda - */ 0, -/* cdb - */ 0, -/* cdc - _0F_D9 */ 0x2420, -/* cdd - _66_0F_D9 */ 0x2421, -/* cde - */ 0, -/* cdf - */ 0, -/* ce0 - */ 0, -/* ce1 - _V_66_0F_D9 */ 0x40b2, -/* ce2 - */ 0, -/* ce3 - */ 0, -/* ce4 - */ 0, -/* ce5 - */ 0, -/* ce6 - */ 0, -/* ce7 - */ 0, -/* ce8 - _0F_DA */ 0x2422, -/* ce9 - _66_0F_DA */ 0x2423, -/* cea - */ 0, -/* ceb - */ 0, -/* cec - */ 0, -/* ced - _V_66_0F_DA */ 0x40b3, -/* cee - */ 0, -/* cef - */ 0, -/* cf0 - */ 0, -/* cf1 - */ 0, -/* cf2 - */ 0, -/* cf3 - */ 0, -/* cf4 - _0F_DB */ 0x2424, -/* cf5 - _66_0F_DB */ 0x2425, -/* cf6 - */ 0, -/* cf7 - */ 0, -/* cf8 - */ 0, -/* cf9 - _V_66_0F_DB */ 0x40b4, -/* cfa - */ 0, -/* cfb - */ 0, -/* cfc - */ 0, -/* cfd - */ 0, -/* cfe - */ 0, -/* cff - */ 0, -/* d00 - _0F_DC */ 0x2426, -/* d01 - _66_0F_DC */ 0x2427, -/* d02 - */ 0, -/* d03 - */ 0, -/* d04 - */ 0, -/* d05 - _V_66_0F_DC */ 0x40b5, -/* d06 - */ 0, -/* d07 - */ 0, -/* d08 - */ 0, -/* d09 - */ 0, -/* d0a - */ 0, -/* d0b - */ 0, -/* d0c - _0F_DD */ 0x2428, -/* d0d - _66_0F_DD */ 0x2429, -/* d0e - */ 0, -/* d0f - */ 0, -/* d10 - */ 0, -/* d11 - _V_66_0F_DD */ 0x40b6, -/* d12 - */ 0, -/* d13 - */ 0, -/* d14 - */ 0, -/* d15 - */ 0, -/* d16 - */ 0, -/* d17 - */ 0, -/* d18 - _0F_DE */ 0x242a, -/* d19 - _66_0F_DE */ 0x242b, -/* d1a - */ 0, -/* d1b - */ 0, -/* d1c - */ 0, -/* d1d - _V_66_0F_DE */ 0x40b7, -/* d1e - */ 0, -/* d1f - */ 0, -/* d20 - */ 0, -/* d21 - */ 0, -/* d22 - */ 0, -/* d23 - */ 0, -/* d24 - _0F_DF */ 0x242c, -/* d25 - _66_0F_DF */ 0x242d, -/* d26 - */ 0, -/* d27 - */ 0, -/* d28 - */ 0, -/* d29 - _V_66_0F_DF */ 0x40b8, -/* d2a - */ 0, -/* d2b - */ 0, -/* d2c - */ 0, -/* d2d - */ 0, -/* d2e - */ 0, -/* d2f - */ 0, -/* d30 - _0F_E0 */ 0x242e, -/* d31 - _66_0F_E0 */ 0x242f, -/* d32 - */ 0, -/* d33 - */ 0, -/* d34 - */ 0, -/* d35 - _V_66_0F_E0 */ 0x40b9, -/* d36 - */ 0, -/* d37 - */ 0, -/* d38 - */ 0, -/* d39 - */ 0, -/* d3a - */ 0, -/* d3b - */ 0, -/* d3c - _0F_E1 */ 0x2430, -/* d3d - _66_0F_E1 */ 0x2431, -/* d3e - */ 0, -/* d3f - */ 0, -/* d40 - */ 0, -/* d41 - _V_66_0F_E1 */ 0x40ba, -/* d42 - */ 0, -/* d43 - */ 0, -/* d44 - */ 0, -/* d45 - */ 0, -/* d46 - */ 0, -/* d47 - */ 0, -/* d48 - _0F_E2 */ 0x2432, -/* d49 - _66_0F_E2 */ 0x2433, -/* d4a - */ 0, -/* d4b - */ 0, -/* d4c - */ 0, -/* d4d - _V_66_0F_E2 */ 0x40bb, -/* d4e - */ 0, -/* d4f - */ 0, -/* d50 - */ 0, -/* d51 - */ 0, -/* d52 - */ 0, -/* d53 - */ 0, -/* d54 - _0F_E3 */ 0x2434, -/* d55 - _66_0F_E3 */ 0x2435, -/* d56 - */ 0, -/* d57 - */ 0, -/* d58 - */ 0, -/* d59 - _V_66_0F_E3 */ 0x40bc, -/* d5a - */ 0, -/* d5b - */ 0, -/* d5c - */ 0, -/* d5d - */ 0, -/* d5e - */ 0, -/* d5f - */ 0, -/* d60 - _0F_E4 */ 0x2436, -/* d61 - _66_0F_E4 */ 0x2437, -/* d62 - */ 0, -/* d63 - */ 0, -/* d64 - */ 0, -/* d65 - _V_66_0F_E4 */ 0x40bd, -/* d66 - */ 0, -/* d67 - */ 0, -/* d68 - */ 0, -/* d69 - */ 0, -/* d6a - */ 0, -/* d6b - */ 0, -/* d6c - _0F_E5 */ 0x2438, -/* d6d - _66_0F_E5 */ 0x2439, -/* d6e - */ 0, -/* d6f - */ 0, -/* d70 - */ 0, -/* d71 - _V_66_0F_E5 */ 0x40be, -/* d72 - */ 0, -/* d73 - */ 0, -/* d74 - */ 0, -/* d75 - */ 0, -/* d76 - */ 0, -/* d77 - */ 0, -/* d78 - */ 0, -/* d79 - _66_0F_E6 */ 0x243a, -/* d7a - _F3_0F_E6 */ 0x243b, -/* d7b - _F2_0F_E6 */ 0x243c, -/* d7c - */ 0, -/* d7d - _V_66_0F_E6 */ 0x40bf, -/* d7e - _V_F3_0F_E6 */ 0x40c0, -/* d7f - _V_F2_0F_E6 */ 0x40c1, -/* d80 - */ 0, -/* d81 - */ 0, -/* d82 - */ 0, -/* d83 - */ 0, -/* d84 - _0F_E7 */ 0x243d, -/* d85 - _66_0F_E7 */ 0x243e, -/* d86 - */ 0, -/* d87 - */ 0, -/* d88 - */ 0, -/* d89 - _V_66_0F_E7 */ 0x40c2, -/* d8a - */ 0, -/* d8b - */ 0, -/* d8c - */ 0, -/* d8d - */ 0, -/* d8e - */ 0, -/* d8f - */ 0, -/* d90 - _0F_E8 */ 0x243f, -/* d91 - _66_0F_E8 */ 0x2440, -/* d92 - */ 0, -/* d93 - */ 0, -/* d94 - */ 0, -/* d95 - _V_66_0F_E8 */ 0x40c3, -/* d96 - */ 0, -/* d97 - */ 0, -/* d98 - */ 0, -/* d99 - */ 0, -/* d9a - */ 0, -/* d9b - */ 0, -/* d9c - _0F_E9 */ 0x2441, -/* d9d - _66_0F_E9 */ 0x2442, -/* d9e - */ 0, -/* d9f - */ 0, -/* da0 - */ 0, -/* da1 - _V_66_0F_E9 */ 0x40c4, -/* da2 - */ 0, -/* da3 - */ 0, -/* da4 - */ 0, -/* da5 - */ 0, -/* da6 - */ 0, -/* da7 - */ 0, -/* da8 - _0F_EA */ 0x2443, -/* da9 - _66_0F_EA */ 0x2444, -/* daa - */ 0, -/* dab - */ 0, -/* dac - */ 0, -/* dad - _V_66_0F_EA */ 0x40c5, -/* dae - */ 0, -/* daf - */ 0, -/* db0 - */ 0, -/* db1 - */ 0, -/* db2 - */ 0, -/* db3 - */ 0, -/* db4 - _0F_EB */ 0x2445, -/* db5 - _66_0F_EB */ 0x2446, -/* db6 - */ 0, -/* db7 - */ 0, -/* db8 - */ 0, -/* db9 - _V_66_0F_EB */ 0x40c6, -/* dba - */ 0, -/* dbb - */ 0, -/* dbc - */ 0, -/* dbd - */ 0, -/* dbe - */ 0, -/* dbf - */ 0, -/* dc0 - _0F_EC */ 0x2447, -/* dc1 - _66_0F_EC */ 0x2448, -/* dc2 - */ 0, -/* dc3 - */ 0, -/* dc4 - */ 0, -/* dc5 - _V_66_0F_EC */ 0x40c7, -/* dc6 - */ 0, -/* dc7 - */ 0, -/* dc8 - */ 0, -/* dc9 - */ 0, -/* dca - */ 0, -/* dcb - */ 0, -/* dcc - _0F_ED */ 0x2449, -/* dcd - _66_0F_ED */ 0x244a, -/* dce - */ 0, -/* dcf - */ 0, -/* dd0 - */ 0, -/* dd1 - _V_66_0F_ED */ 0x40c8, -/* dd2 - */ 0, -/* dd3 - */ 0, -/* dd4 - */ 0, -/* dd5 - */ 0, -/* dd6 - */ 0, -/* dd7 - */ 0, -/* dd8 - _0F_EE */ 0x244b, -/* dd9 - _66_0F_EE */ 0x244c, -/* dda - */ 0, -/* ddb - */ 0, -/* ddc - */ 0, -/* ddd - _V_66_0F_EE */ 0x40c9, -/* dde - */ 0, -/* ddf - */ 0, -/* de0 - */ 0, -/* de1 - */ 0, -/* de2 - */ 0, -/* de3 - */ 0, -/* de4 - _0F_EF */ 0x244d, -/* de5 - _66_0F_EF */ 0x244e, -/* de6 - */ 0, -/* de7 - */ 0, -/* de8 - */ 0, -/* de9 - _V_66_0F_EF */ 0x40ca, -/* dea - */ 0, -/* deb - */ 0, -/* dec - */ 0, -/* ded - */ 0, -/* dee - */ 0, -/* def - */ 0, -/* df0 - */ 0, -/* df1 - */ 0, -/* df2 - */ 0, -/* df3 - _F2_0F_F0 */ 0x244f, -/* df4 - */ 0, -/* df5 - */ 0, -/* df6 - */ 0, -/* df7 - _V_F2_0F_F0 */ 0x40cb, -/* df8 - */ 0, -/* df9 - */ 0, -/* dfa - */ 0, -/* dfb - */ 0, -/* dfc - _0F_F1 */ 0x2450, -/* dfd - _66_0F_F1 */ 0x2451, -/* dfe - */ 0, -/* dff - */ 0, -/* e00 - */ 0, -/* e01 - _V_66_0F_F1 */ 0x40cc, -/* e02 - */ 0, -/* e03 - */ 0, -/* e04 - */ 0, -/* e05 - */ 0, -/* e06 - */ 0, -/* e07 - */ 0, -/* e08 - _0F_F2 */ 0x2452, -/* e09 - _66_0F_F2 */ 0x2453, -/* e0a - */ 0, -/* e0b - */ 0, -/* e0c - */ 0, -/* e0d - _V_66_0F_F2 */ 0x40cd, -/* e0e - */ 0, -/* e0f - */ 0, -/* e10 - */ 0, -/* e11 - */ 0, -/* e12 - */ 0, -/* e13 - */ 0, -/* e14 - _0F_F3 */ 0x2454, -/* e15 - _66_0F_F3 */ 0x2455, -/* e16 - */ 0, -/* e17 - */ 0, -/* e18 - */ 0, -/* e19 - _V_66_0F_F3 */ 0x40ce, -/* e1a - */ 0, -/* e1b - */ 0, -/* e1c - */ 0, -/* e1d - */ 0, -/* e1e - */ 0, -/* e1f - */ 0, -/* e20 - _0F_F4 */ 0x2456, -/* e21 - _66_0F_F4 */ 0x2457, -/* e22 - */ 0, -/* e23 - */ 0, -/* e24 - */ 0, -/* e25 - _V_66_0F_F4 */ 0x40cf, -/* e26 - */ 0, -/* e27 - */ 0, -/* e28 - */ 0, -/* e29 - */ 0, -/* e2a - */ 0, -/* e2b - */ 0, -/* e2c - _0F_F5 */ 0x2458, -/* e2d - _66_0F_F5 */ 0x2459, -/* e2e - */ 0, -/* e2f - */ 0, -/* e30 - */ 0, -/* e31 - _V_66_0F_F5 */ 0x40d0, -/* e32 - */ 0, -/* e33 - */ 0, -/* e34 - */ 0, -/* e35 - */ 0, -/* e36 - */ 0, -/* e37 - */ 0, -/* e38 - _0F_F6 */ 0x245a, -/* e39 - _66_0F_F6 */ 0x245b, -/* e3a - */ 0, -/* e3b - */ 0, -/* e3c - */ 0, -/* e3d - _V_66_0F_F6 */ 0x40d1, -/* e3e - */ 0, -/* e3f - */ 0, -/* e40 - */ 0, -/* e41 - */ 0, -/* e42 - */ 0, -/* e43 - */ 0, -/* e44 - _0F_F7 */ 0x245c, -/* e45 - _66_0F_F7 */ 0x245d, -/* e46 - */ 0, -/* e47 - */ 0, -/* e48 - */ 0, -/* e49 - _V_66_0F_F7 */ 0x40d2, -/* e4a - */ 0, -/* e4b - */ 0, -/* e4c - */ 0, -/* e4d - */ 0, -/* e4e - */ 0, -/* e4f - */ 0, -/* e50 - _0F_F8 */ 0x245e, -/* e51 - _66_0F_F8 */ 0x245f, -/* e52 - */ 0, -/* e53 - */ 0, -/* e54 - */ 0, -/* e55 - _V_66_0F_F8 */ 0x40d3, -/* e56 - */ 0, -/* e57 - */ 0, -/* e58 - */ 0, -/* e59 - */ 0, -/* e5a - */ 0, -/* e5b - */ 0, -/* e5c - _0F_F9 */ 0x2460, -/* e5d - _66_0F_F9 */ 0x2461, -/* e5e - */ 0, -/* e5f - */ 0, -/* e60 - */ 0, -/* e61 - _V_66_0F_F9 */ 0x40d4, -/* e62 - */ 0, -/* e63 - */ 0, -/* e64 - */ 0, -/* e65 - */ 0, -/* e66 - */ 0, -/* e67 - */ 0, -/* e68 - _0F_FA */ 0x2462, -/* e69 - _66_0F_FA */ 0x2463, -/* e6a - */ 0, -/* e6b - */ 0, -/* e6c - */ 0, -/* e6d - _V_66_0F_FA */ 0x40d5, -/* e6e - */ 0, -/* e6f - */ 0, -/* e70 - */ 0, -/* e71 - */ 0, -/* e72 - */ 0, -/* e73 - */ 0, -/* e74 - _0F_FB */ 0x2464, -/* e75 - _66_0F_FB */ 0x2465, -/* e76 - */ 0, -/* e77 - */ 0, -/* e78 - */ 0, -/* e79 - _V_66_0F_FB */ 0x40d6, -/* e7a - */ 0, -/* e7b - */ 0, -/* e7c - */ 0, -/* e7d - */ 0, -/* e7e - */ 0, -/* e7f - */ 0, -/* e80 - _0F_FC */ 0x2466, -/* e81 - _66_0F_FC */ 0x2467, -/* e82 - */ 0, -/* e83 - */ 0, -/* e84 - */ 0, -/* e85 - _V_66_0F_FC */ 0x40d7, -/* e86 - */ 0, -/* e87 - */ 0, -/* e88 - */ 0, -/* e89 - */ 0, -/* e8a - */ 0, -/* e8b - */ 0, -/* e8c - _0F_FD */ 0x2468, -/* e8d - _66_0F_FD */ 0x2469, -/* e8e - */ 0, -/* e8f - */ 0, -/* e90 - */ 0, -/* e91 - _V_66_0F_FD */ 0x40d8, -/* e92 - */ 0, -/* e93 - */ 0, -/* e94 - */ 0, -/* e95 - */ 0, -/* e96 - */ 0, -/* e97 - */ 0, -/* e98 - _0F_FE */ 0x246a, -/* e99 - _66_0F_FE */ 0x246b, -/* e9a - */ 0, -/* e9b - */ 0, -/* e9c - */ 0, -/* e9d - _V_66_0F_FE */ 0x40d9, -/* e9e - */ 0, -/* e9f - */ 0, -/* ea0 - */ 0, -/* ea1 - */ 0, -/* ea2 - */ 0, -/* ea3 - */ 0, -/* ea4 - _D9_06 */ 0x246c, -/* ea5 - _9B_D9_06 */ 0x246d, -/* ea6 - */ 0, -/* ea7 - */ 0, -/* ea8 - */ 0, -/* ea9 - */ 0, -/* eaa - */ 0, -/* eab - */ 0, -/* eac - */ 0, -/* ead - */ 0, -/* eae - */ 0, -/* eaf - */ 0, -/* eb0 - _D9_07 */ 0x246e, -/* eb1 - _9B_D9_07 */ 0x246f, -/* eb2 - */ 0, -/* eb3 - */ 0, -/* eb4 - */ 0, -/* eb5 - */ 0, -/* eb6 - */ 0, -/* eb7 - */ 0, -/* eb8 - */ 0, -/* eb9 - */ 0, -/* eba - */ 0, -/* ebb - */ 0, -/* ebc - _DB_E2 */ 0x2470, -/* ebd - _9B_DB_E2 */ 0x2471, -/* ebe - */ 0, -/* ebf - */ 0, -/* ec0 - */ 0, -/* ec1 - */ 0, -/* ec2 - */ 0, -/* ec3 - */ 0, -/* ec4 - */ 0, -/* ec5 - */ 0, -/* ec6 - */ 0, -/* ec7 - */ 0, -/* ec8 - _DB_E3 */ 0x2472, -/* ec9 - _9B_DB_E3 */ 0x2473, -/* eca - */ 0, -/* ecb - */ 0, -/* ecc - */ 0, -/* ecd - */ 0, -/* ece - */ 0, -/* ecf - */ 0, -/* ed0 - */ 0, -/* ed1 - */ 0, -/* ed2 - */ 0, -/* ed3 - */ 0, -/* ed4 - _DD_06 */ 0x2474, -/* ed5 - _9B_DD_06 */ 0x2475, -/* ed6 - */ 0, -/* ed7 - */ 0, -/* ed8 - */ 0, -/* ed9 - */ 0, -/* eda - */ 0, -/* edb - */ 0, -/* edc - */ 0, -/* edd - */ 0, -/* ede - */ 0, -/* edf - */ 0, -/* ee0 - _DD_07 */ 0x2476, -/* ee1 - _9B_DD_07 */ 0x2477, -/* ee2 - */ 0, -/* ee3 - */ 0, -/* ee4 - */ 0, -/* ee5 - */ 0, -/* ee6 - */ 0, -/* ee7 - */ 0, -/* ee8 - */ 0, -/* ee9 - */ 0, -/* eea - */ 0, -/* eeb - */ 0, -/* eec - _DF_E0 */ 0x2478, -/* eed - _9B_DF_E0 */ 0x2479, -/* eee - */ 0, -/* eef - */ 0, -/* ef0 - */ 0, -/* ef1 - */ 0, -/* ef2 - */ 0, -/* ef3 - */ 0, -/* ef4 - */ 0, -/* ef5 - */ 0, -/* ef6 - */ 0, -/* ef7 - */ 0, -/* ef8 - _0F_38_00 */ 0x247a, -/* ef9 - _66_0F_38_00 */ 0x247b, -/* efa - */ 0, -/* efb - */ 0, -/* efc - */ 0, -/* efd - _V_66_0F_38_00 */ 0x40da, -/* efe - */ 0, -/* eff - */ 0, -/* f00 - */ 0, -/* f01 - */ 0, -/* f02 - */ 0, -/* f03 - */ 0, -/* f04 - _0F_38_01 */ 0x247c, -/* f05 - _66_0F_38_01 */ 0x247d, -/* f06 - */ 0, -/* f07 - */ 0, -/* f08 - */ 0, -/* f09 - _V_66_0F_38_01 */ 0x40db, -/* f0a - */ 0, -/* f0b - */ 0, -/* f0c - */ 0, -/* f0d - */ 0, -/* f0e - */ 0, -/* f0f - */ 0, -/* f10 - _0F_38_02 */ 0x247e, -/* f11 - _66_0F_38_02 */ 0x247f, -/* f12 - */ 0, -/* f13 - */ 0, -/* f14 - */ 0, -/* f15 - _V_66_0F_38_02 */ 0x40dc, -/* f16 - */ 0, -/* f17 - */ 0, -/* f18 - */ 0, -/* f19 - */ 0, -/* f1a - */ 0, -/* f1b - */ 0, -/* f1c - _0F_38_03 */ 0x2480, -/* f1d - _66_0F_38_03 */ 0x2481, -/* f1e - */ 0, -/* f1f - */ 0, -/* f20 - */ 0, -/* f21 - _V_66_0F_38_03 */ 0x40dd, -/* f22 - */ 0, -/* f23 - */ 0, -/* f24 - */ 0, -/* f25 - */ 0, -/* f26 - */ 0, -/* f27 - */ 0, -/* f28 - _0F_38_04 */ 0x2482, -/* f29 - _66_0F_38_04 */ 0x2483, -/* f2a - */ 0, -/* f2b - */ 0, -/* f2c - */ 0, -/* f2d - _V_66_0F_38_04 */ 0x40de, -/* f2e - */ 0, -/* f2f - */ 0, -/* f30 - */ 0, -/* f31 - */ 0, -/* f32 - */ 0, -/* f33 - */ 0, -/* f34 - _0F_38_05 */ 0x2484, -/* f35 - _66_0F_38_05 */ 0x2485, -/* f36 - */ 0, -/* f37 - */ 0, -/* f38 - */ 0, -/* f39 - _V_66_0F_38_05 */ 0x40df, -/* f3a - */ 0, -/* f3b - */ 0, -/* f3c - */ 0, -/* f3d - */ 0, -/* f3e - */ 0, -/* f3f - */ 0, -/* f40 - _0F_38_06 */ 0x2486, -/* f41 - _66_0F_38_06 */ 0x2487, -/* f42 - */ 0, -/* f43 - */ 0, -/* f44 - */ 0, -/* f45 - _V_66_0F_38_06 */ 0x40e0, -/* f46 - */ 0, -/* f47 - */ 0, -/* f48 - */ 0, -/* f49 - */ 0, -/* f4a - */ 0, -/* f4b - */ 0, -/* f4c - _0F_38_07 */ 0x2488, -/* f4d - _66_0F_38_07 */ 0x2489, -/* f4e - */ 0, -/* f4f - */ 0, -/* f50 - */ 0, -/* f51 - _V_66_0F_38_07 */ 0x40e1, -/* f52 - */ 0, -/* f53 - */ 0, -/* f54 - */ 0, -/* f55 - */ 0, -/* f56 - */ 0, -/* f57 - */ 0, -/* f58 - _0F_38_08 */ 0x248a, -/* f59 - _66_0F_38_08 */ 0x248b, -/* f5a - */ 0, -/* f5b - */ 0, -/* f5c - */ 0, -/* f5d - _V_66_0F_38_08 */ 0x40e2, -/* f5e - */ 0, -/* f5f - */ 0, -/* f60 - */ 0, -/* f61 - */ 0, -/* f62 - */ 0, -/* f63 - */ 0, -/* f64 - _0F_38_09 */ 0x248c, -/* f65 - _66_0F_38_09 */ 0x248d, -/* f66 - */ 0, -/* f67 - */ 0, -/* f68 - */ 0, -/* f69 - _V_66_0F_38_09 */ 0x40e3, -/* f6a - */ 0, -/* f6b - */ 0, -/* f6c - */ 0, -/* f6d - */ 0, -/* f6e - */ 0, -/* f6f - */ 0, -/* f70 - _0F_38_0A */ 0x248e, -/* f71 - _66_0F_38_0A */ 0x248f, -/* f72 - */ 0, -/* f73 - */ 0, -/* f74 - */ 0, -/* f75 - _V_66_0F_38_0A */ 0x40e4, -/* f76 - */ 0, -/* f77 - */ 0, -/* f78 - */ 0, -/* f79 - */ 0, -/* f7a - */ 0, -/* f7b - */ 0, -/* f7c - _0F_38_0B */ 0x2490, -/* f7d - _66_0F_38_0B */ 0x2491, -/* f7e - */ 0, -/* f7f - */ 0, -/* f80 - */ 0, -/* f81 - _V_66_0F_38_0B */ 0x40e5, -/* f82 - */ 0, -/* f83 - */ 0, -/* f84 - */ 0, -/* f85 - */ 0, -/* f86 - */ 0, -/* f87 - */ 0, -/* f88 - */ 0, -/* f89 - */ 0, -/* f8a - */ 0, -/* f8b - */ 0, -/* f8c - */ 0, -/* f8d - _V_66_0F_38_0C */ 0x40e6, -/* f8e - */ 0, -/* f8f - */ 0, -/* f90 - */ 0, -/* f91 - */ 0, -/* f92 - */ 0, -/* f93 - */ 0, -/* f94 - */ 0, -/* f95 - */ 0, -/* f96 - */ 0, -/* f97 - */ 0, -/* f98 - */ 0, -/* f99 - _V_66_0F_38_0D */ 0x40e7, -/* f9a - */ 0, -/* f9b - */ 0, -/* f9c - */ 0, -/* f9d - */ 0, -/* f9e - */ 0, -/* f9f - */ 0, -/* fa0 - */ 0, -/* fa1 - */ 0, -/* fa2 - */ 0, -/* fa3 - */ 0, -/* fa4 - */ 0, -/* fa5 - _V_66_0F_38_0E */ 0x40e8, -/* fa6 - */ 0, -/* fa7 - */ 0, -/* fa8 - */ 0, -/* fa9 - */ 0, -/* faa - */ 0, -/* fab - */ 0, -/* fac - */ 0, -/* fad - */ 0, -/* fae - */ 0, -/* faf - */ 0, -/* fb0 - */ 0, -/* fb1 - _V_66_0F_38_0F */ 0x40e9, -/* fb2 - */ 0, -/* fb3 - */ 0, -/* fb4 - */ 0, -/* fb5 - */ 0, -/* fb6 - */ 0, -/* fb7 - */ 0, -/* fb8 - */ 0, -/* fb9 - _66_0F_38_10 */ 0x40ea, -/* fba - */ 0, -/* fbb - */ 0, -/* fbc - */ 0, -/* fbd - */ 0, -/* fbe - */ 0, -/* fbf - */ 0, -/* fc0 - */ 0, -/* fc1 - */ 0, -/* fc2 - */ 0, -/* fc3 - */ 0, -/* fc4 - */ 0, -/* fc5 - _66_0F_38_14 */ 0x40eb, -/* fc6 - */ 0, -/* fc7 - */ 0, -/* fc8 - */ 0, -/* fc9 - */ 0, -/* fca - */ 0, -/* fcb - */ 0, -/* fcc - */ 0, -/* fcd - */ 0, -/* fce - */ 0, -/* fcf - */ 0, -/* fd0 - */ 0, -/* fd1 - _66_0F_38_15 */ 0x40ec, -/* fd2 - */ 0, -/* fd3 - */ 0, -/* fd4 - */ 0, -/* fd5 - */ 0, -/* fd6 - */ 0, -/* fd7 - */ 0, -/* fd8 - */ 0, -/* fd9 - */ 0, -/* fda - */ 0, -/* fdb - */ 0, -/* fdc - */ 0, -/* fdd - _66_0F_38_17 */ 0x2492, -/* fde - */ 0, -/* fdf - */ 0, -/* fe0 - */ 0, -/* fe1 - _V_66_0F_38_17 */ 0x40ed, -/* fe2 - */ 0, -/* fe3 - */ 0, -/* fe4 - */ 0, -/* fe5 - */ 0, -/* fe6 - */ 0, -/* fe7 - */ 0, -/* fe8 - */ 0, -/* fe9 - */ 0, -/* fea - */ 0, -/* feb - */ 0, -/* fec - */ 0, -/* fed - _V_66_0F_38_18 */ 0x40ee, -/* fee - */ 0, -/* fef - */ 0, -/* ff0 - */ 0, -/* ff1 - */ 0, -/* ff2 - */ 0, -/* ff3 - */ 0, -/* ff4 - */ 0, -/* ff5 - */ 0, -/* ff6 - */ 0, -/* ff7 - */ 0, -/* ff8 - */ 0, -/* ff9 - _V_66_0F_38_19 */ 0x40ef, -/* ffa - */ 0, -/* ffb - */ 0, -/* ffc - */ 0, -/* ffd - */ 0, -/* ffe - */ 0, -/* fff - */ 0, -/* 1000 - */ 0, -/* 1001 - */ 0, -/* 1002 - */ 0, -/* 1003 - */ 0, -/* 1004 - */ 0, -/* 1005 - _V_66_0F_38_1A */ 0x40f0, -/* 1006 - */ 0, -/* 1007 - */ 0, -/* 1008 - */ 0, -/* 1009 - */ 0, -/* 100a - */ 0, -/* 100b - */ 0, -/* 100c - _0F_38_1C */ 0x2493, -/* 100d - _66_0F_38_1C */ 0x2494, -/* 100e - */ 0, -/* 100f - */ 0, -/* 1010 - */ 0, -/* 1011 - _V_66_0F_38_1C */ 0x40f1, -/* 1012 - */ 0, -/* 1013 - */ 0, -/* 1014 - */ 0, -/* 1015 - */ 0, -/* 1016 - */ 0, -/* 1017 - */ 0, -/* 1018 - _0F_38_1D */ 0x2495, -/* 1019 - _66_0F_38_1D */ 0x2496, -/* 101a - */ 0, -/* 101b - */ 0, -/* 101c - */ 0, -/* 101d - _V_66_0F_38_1D */ 0x40f2, -/* 101e - */ 0, -/* 101f - */ 0, -/* 1020 - */ 0, -/* 1021 - */ 0, -/* 1022 - */ 0, -/* 1023 - */ 0, -/* 1024 - _0F_38_1E */ 0x2497, -/* 1025 - _66_0F_38_1E */ 0x2498, -/* 1026 - */ 0, -/* 1027 - */ 0, -/* 1028 - */ 0, -/* 1029 - _V_66_0F_38_1E */ 0x40f3, -/* 102a - */ 0, -/* 102b - */ 0, -/* 102c - */ 0, -/* 102d - */ 0, -/* 102e - */ 0, -/* 102f - */ 0, -/* 1030 - */ 0, -/* 1031 - _66_0F_38_20 */ 0x2499, -/* 1032 - */ 0, -/* 1033 - */ 0, -/* 1034 - */ 0, -/* 1035 - _V_66_0F_38_20 */ 0x40f4, -/* 1036 - */ 0, -/* 1037 - */ 0, -/* 1038 - */ 0, -/* 1039 - */ 0, -/* 103a - */ 0, -/* 103b - */ 0, -/* 103c - */ 0, -/* 103d - _66_0F_38_21 */ 0x249a, -/* 103e - */ 0, -/* 103f - */ 0, -/* 1040 - */ 0, -/* 1041 - _V_66_0F_38_21 */ 0x40f5, -/* 1042 - */ 0, -/* 1043 - */ 0, -/* 1044 - */ 0, -/* 1045 - */ 0, -/* 1046 - */ 0, -/* 1047 - */ 0, -/* 1048 - */ 0, -/* 1049 - _66_0F_38_22 */ 0x249b, -/* 104a - */ 0, -/* 104b - */ 0, -/* 104c - */ 0, -/* 104d - _V_66_0F_38_22 */ 0x40f6, -/* 104e - */ 0, -/* 104f - */ 0, -/* 1050 - */ 0, -/* 1051 - */ 0, -/* 1052 - */ 0, -/* 1053 - */ 0, -/* 1054 - */ 0, -/* 1055 - _66_0F_38_23 */ 0x249c, -/* 1056 - */ 0, -/* 1057 - */ 0, -/* 1058 - */ 0, -/* 1059 - _V_66_0F_38_23 */ 0x40f7, -/* 105a - */ 0, -/* 105b - */ 0, -/* 105c - */ 0, -/* 105d - */ 0, -/* 105e - */ 0, -/* 105f - */ 0, -/* 1060 - */ 0, -/* 1061 - _66_0F_38_24 */ 0x249d, -/* 1062 - */ 0, -/* 1063 - */ 0, -/* 1064 - */ 0, -/* 1065 - _V_66_0F_38_24 */ 0x40f8, -/* 1066 - */ 0, -/* 1067 - */ 0, -/* 1068 - */ 0, -/* 1069 - */ 0, -/* 106a - */ 0, -/* 106b - */ 0, -/* 106c - */ 0, -/* 106d - _66_0F_38_25 */ 0x249e, -/* 106e - */ 0, -/* 106f - */ 0, -/* 1070 - */ 0, -/* 1071 - _V_66_0F_38_25 */ 0x40f9, -/* 1072 - */ 0, -/* 1073 - */ 0, -/* 1074 - */ 0, -/* 1075 - */ 0, -/* 1076 - */ 0, -/* 1077 - */ 0, -/* 1078 - */ 0, -/* 1079 - _66_0F_38_28 */ 0x249f, -/* 107a - */ 0, -/* 107b - */ 0, -/* 107c - */ 0, -/* 107d - _V_66_0F_38_28 */ 0x40fa, -/* 107e - */ 0, -/* 107f - */ 0, -/* 1080 - */ 0, -/* 1081 - */ 0, -/* 1082 - */ 0, -/* 1083 - */ 0, -/* 1084 - */ 0, -/* 1085 - _66_0F_38_29 */ 0x24a0, -/* 1086 - */ 0, -/* 1087 - */ 0, -/* 1088 - */ 0, -/* 1089 - _V_66_0F_38_29 */ 0x40fb, -/* 108a - */ 0, -/* 108b - */ 0, -/* 108c - */ 0, -/* 108d - */ 0, -/* 108e - */ 0, -/* 108f - */ 0, -/* 1090 - */ 0, -/* 1091 - _66_0F_38_2A */ 0x24a1, -/* 1092 - */ 0, -/* 1093 - */ 0, -/* 1094 - */ 0, -/* 1095 - _V_66_0F_38_2A */ 0x40fc, -/* 1096 - */ 0, -/* 1097 - */ 0, -/* 1098 - */ 0, -/* 1099 - */ 0, -/* 109a - */ 0, -/* 109b - */ 0, -/* 109c - */ 0, -/* 109d - _66_0F_38_2B */ 0x24a2, -/* 109e - */ 0, -/* 109f - */ 0, -/* 10a0 - */ 0, -/* 10a1 - _V_66_0F_38_2B */ 0x40fd, -/* 10a2 - */ 0, -/* 10a3 - */ 0, -/* 10a4 - */ 0, -/* 10a5 - */ 0, -/* 10a6 - */ 0, -/* 10a7 - */ 0, -/* 10a8 - */ 0, -/* 10a9 - */ 0, -/* 10aa - */ 0, -/* 10ab - */ 0, -/* 10ac - */ 0, -/* 10ad - _V_66_0F_38_2C */ 0x40fe, -/* 10ae - */ 0, -/* 10af - */ 0, -/* 10b0 - */ 0, -/* 10b1 - */ 0, -/* 10b2 - */ 0, -/* 10b3 - */ 0, -/* 10b4 - */ 0, -/* 10b5 - */ 0, -/* 10b6 - */ 0, -/* 10b7 - */ 0, -/* 10b8 - */ 0, -/* 10b9 - _V_66_0F_38_2D */ 0x40ff, -/* 10ba - */ 0, -/* 10bb - */ 0, -/* 10bc - */ 0, -/* 10bd - */ 0, -/* 10be - */ 0, -/* 10bf - */ 0, -/* 10c0 - */ 0, -/* 10c1 - */ 0, -/* 10c2 - */ 0, -/* 10c3 - */ 0, -/* 10c4 - */ 0, -/* 10c5 - _V_66_0F_38_2E */ 0x4100, -/* 10c6 - */ 0, -/* 10c7 - */ 0, -/* 10c8 - */ 0, -/* 10c9 - */ 0, -/* 10ca - */ 0, -/* 10cb - */ 0, -/* 10cc - */ 0, -/* 10cd - */ 0, -/* 10ce - */ 0, -/* 10cf - */ 0, -/* 10d0 - */ 0, -/* 10d1 - _V_66_0F_38_2F */ 0x4101, -/* 10d2 - */ 0, -/* 10d3 - */ 0, -/* 10d4 - */ 0, -/* 10d5 - */ 0, -/* 10d6 - */ 0, -/* 10d7 - */ 0, -/* 10d8 - */ 0, -/* 10d9 - _66_0F_38_30 */ 0x24a3, -/* 10da - */ 0, -/* 10db - */ 0, -/* 10dc - */ 0, -/* 10dd - _V_66_0F_38_30 */ 0x4102, -/* 10de - */ 0, -/* 10df - */ 0, -/* 10e0 - */ 0, -/* 10e1 - */ 0, -/* 10e2 - */ 0, -/* 10e3 - */ 0, -/* 10e4 - */ 0, -/* 10e5 - _66_0F_38_31 */ 0x24a4, -/* 10e6 - */ 0, -/* 10e7 - */ 0, -/* 10e8 - */ 0, -/* 10e9 - _V_66_0F_38_31 */ 0x4103, -/* 10ea - */ 0, -/* 10eb - */ 0, -/* 10ec - */ 0, -/* 10ed - */ 0, -/* 10ee - */ 0, -/* 10ef - */ 0, -/* 10f0 - */ 0, -/* 10f1 - _66_0F_38_32 */ 0x24a5, -/* 10f2 - */ 0, -/* 10f3 - */ 0, -/* 10f4 - */ 0, -/* 10f5 - _V_66_0F_38_32 */ 0x4104, -/* 10f6 - */ 0, -/* 10f7 - */ 0, -/* 10f8 - */ 0, -/* 10f9 - */ 0, -/* 10fa - */ 0, -/* 10fb - */ 0, -/* 10fc - */ 0, -/* 10fd - _66_0F_38_33 */ 0x24a6, -/* 10fe - */ 0, -/* 10ff - */ 0, -/* 1100 - */ 0, -/* 1101 - _V_66_0F_38_33 */ 0x4105, -/* 1102 - */ 0, -/* 1103 - */ 0, -/* 1104 - */ 0, -/* 1105 - */ 0, -/* 1106 - */ 0, -/* 1107 - */ 0, -/* 1108 - */ 0, -/* 1109 - _66_0F_38_34 */ 0x24a7, -/* 110a - */ 0, -/* 110b - */ 0, -/* 110c - */ 0, -/* 110d - _V_66_0F_38_34 */ 0x4106, -/* 110e - */ 0, -/* 110f - */ 0, -/* 1110 - */ 0, -/* 1111 - */ 0, -/* 1112 - */ 0, -/* 1113 - */ 0, -/* 1114 - */ 0, -/* 1115 - _66_0F_38_35 */ 0x24a8, -/* 1116 - */ 0, -/* 1117 - */ 0, -/* 1118 - */ 0, -/* 1119 - _V_66_0F_38_35 */ 0x4107, -/* 111a - */ 0, -/* 111b - */ 0, -/* 111c - */ 0, -/* 111d - */ 0, -/* 111e - */ 0, -/* 111f - */ 0, -/* 1120 - */ 0, -/* 1121 - _66_0F_38_37 */ 0x24a9, -/* 1122 - */ 0, -/* 1123 - */ 0, -/* 1124 - */ 0, -/* 1125 - _V_66_0F_38_37 */ 0x4108, -/* 1126 - */ 0, -/* 1127 - */ 0, -/* 1128 - */ 0, -/* 1129 - */ 0, -/* 112a - */ 0, -/* 112b - */ 0, -/* 112c - */ 0, -/* 112d - _66_0F_38_38 */ 0x24aa, -/* 112e - */ 0, -/* 112f - */ 0, -/* 1130 - */ 0, -/* 1131 - _V_66_0F_38_38 */ 0x4109, -/* 1132 - */ 0, -/* 1133 - */ 0, -/* 1134 - */ 0, -/* 1135 - */ 0, -/* 1136 - */ 0, -/* 1137 - */ 0, -/* 1138 - */ 0, -/* 1139 - _66_0F_38_39 */ 0x24ab, -/* 113a - */ 0, -/* 113b - */ 0, -/* 113c - */ 0, -/* 113d - _V_66_0F_38_39 */ 0x410a, -/* 113e - */ 0, -/* 113f - */ 0, -/* 1140 - */ 0, -/* 1141 - */ 0, -/* 1142 - */ 0, -/* 1143 - */ 0, -/* 1144 - */ 0, -/* 1145 - _66_0F_38_3A */ 0x24ac, -/* 1146 - */ 0, -/* 1147 - */ 0, -/* 1148 - */ 0, -/* 1149 - _V_66_0F_38_3A */ 0x410b, -/* 114a - */ 0, -/* 114b - */ 0, -/* 114c - */ 0, -/* 114d - */ 0, -/* 114e - */ 0, -/* 114f - */ 0, -/* 1150 - */ 0, -/* 1151 - _66_0F_38_3B */ 0x24ad, -/* 1152 - */ 0, -/* 1153 - */ 0, -/* 1154 - */ 0, -/* 1155 - _V_66_0F_38_3B */ 0x410c, -/* 1156 - */ 0, -/* 1157 - */ 0, -/* 1158 - */ 0, -/* 1159 - */ 0, -/* 115a - */ 0, -/* 115b - */ 0, -/* 115c - */ 0, -/* 115d - _66_0F_38_3C */ 0x24ae, -/* 115e - */ 0, -/* 115f - */ 0, -/* 1160 - */ 0, -/* 1161 - _V_66_0F_38_3C */ 0x410d, -/* 1162 - */ 0, -/* 1163 - */ 0, -/* 1164 - */ 0, -/* 1165 - */ 0, -/* 1166 - */ 0, -/* 1167 - */ 0, -/* 1168 - */ 0, -/* 1169 - _66_0F_38_3D */ 0x24af, -/* 116a - */ 0, -/* 116b - */ 0, -/* 116c - */ 0, -/* 116d - _V_66_0F_38_3D */ 0x410e, -/* 116e - */ 0, -/* 116f - */ 0, -/* 1170 - */ 0, -/* 1171 - */ 0, -/* 1172 - */ 0, -/* 1173 - */ 0, -/* 1174 - */ 0, -/* 1175 - _66_0F_38_3E */ 0x24b0, -/* 1176 - */ 0, -/* 1177 - */ 0, -/* 1178 - */ 0, -/* 1179 - _V_66_0F_38_3E */ 0x410f, -/* 117a - */ 0, -/* 117b - */ 0, -/* 117c - */ 0, -/* 117d - */ 0, -/* 117e - */ 0, -/* 117f - */ 0, -/* 1180 - */ 0, -/* 1181 - _66_0F_38_3F */ 0x24b1, -/* 1182 - */ 0, -/* 1183 - */ 0, -/* 1184 - */ 0, -/* 1185 - _V_66_0F_38_3F */ 0x4110, -/* 1186 - */ 0, -/* 1187 - */ 0, -/* 1188 - */ 0, -/* 1189 - */ 0, -/* 118a - */ 0, -/* 118b - */ 0, -/* 118c - */ 0, -/* 118d - _66_0F_38_40 */ 0x24b2, -/* 118e - */ 0, -/* 118f - */ 0, -/* 1190 - */ 0, -/* 1191 - _V_66_0F_38_40 */ 0x4111, -/* 1192 - */ 0, -/* 1193 - */ 0, -/* 1194 - */ 0, -/* 1195 - */ 0, -/* 1196 - */ 0, -/* 1197 - */ 0, -/* 1198 - */ 0, -/* 1199 - _66_0F_38_41 */ 0x24b3, -/* 119a - */ 0, -/* 119b - */ 0, -/* 119c - */ 0, -/* 119d - _V_66_0F_38_41 */ 0x4112, -/* 119e - */ 0, -/* 119f - */ 0, -/* 11a0 - */ 0, -/* 11a1 - */ 0, -/* 11a2 - */ 0, -/* 11a3 - */ 0, -/* 11a4 - */ 0, -/* 11a5 - _66_0F_38_80 */ 0x24b4, -/* 11a6 - */ 0, -/* 11a7 - */ 0, -/* 11a8 - */ 0, -/* 11a9 - */ 0, -/* 11aa - */ 0, -/* 11ab - */ 0, -/* 11ac - */ 0, -/* 11ad - */ 0, -/* 11ae - */ 0, -/* 11af - */ 0, -/* 11b0 - */ 0, -/* 11b1 - _66_0F_38_81 */ 0x24b5, -/* 11b2 - */ 0, -/* 11b3 - */ 0, -/* 11b4 - */ 0, -/* 11b5 - */ 0, -/* 11b6 - */ 0, -/* 11b7 - */ 0, -/* 11b8 - */ 0, -/* 11b9 - */ 0, -/* 11ba - */ 0, -/* 11bb - */ 0, -/* 11bc - */ 0, -/* 11bd - _66_0F_38_82 */ 0x24b6, -/* 11be - */ 0, -/* 11bf - */ 0, -/* 11c0 - */ 0, -/* 11c1 - */ 0, -/* 11c2 - */ 0, -/* 11c3 - */ 0, -/* 11c4 - */ 0, -/* 11c5 - */ 0, -/* 11c6 - */ 0, -/* 11c7 - */ 0, -/* 11c8 - */ 0, -/* 11c9 - */ 0, -/* 11ca - */ 0, -/* 11cb - */ 0, -/* 11cc - */ 0, -/* 11cd - _V_66_0F_38_96 */ 0x4113, -/* 11ce - */ 0, -/* 11cf - */ 0, -/* 11d0 - */ 0, -/* 11d1 - */ 0, -/* 11d2 - */ 0, -/* 11d3 - */ 0, -/* 11d4 - */ 0, -/* 11d5 - */ 0, -/* 11d6 - */ 0, -/* 11d7 - */ 0, -/* 11d8 - */ 0, -/* 11d9 - _V_66_0F_38_97 */ 0x4114, -/* 11da - */ 0, -/* 11db - */ 0, -/* 11dc - */ 0, -/* 11dd - */ 0, -/* 11de - */ 0, -/* 11df - */ 0, -/* 11e0 - */ 0, -/* 11e1 - */ 0, -/* 11e2 - */ 0, -/* 11e3 - */ 0, -/* 11e4 - */ 0, -/* 11e5 - _V_66_0F_38_98 */ 0x4115, -/* 11e6 - */ 0, -/* 11e7 - */ 0, -/* 11e8 - */ 0, -/* 11e9 - */ 0, -/* 11ea - */ 0, -/* 11eb - */ 0, -/* 11ec - */ 0, -/* 11ed - */ 0, -/* 11ee - */ 0, -/* 11ef - */ 0, -/* 11f0 - */ 0, -/* 11f1 - _V_66_0F_38_99 */ 0x4116, -/* 11f2 - */ 0, -/* 11f3 - */ 0, -/* 11f4 - */ 0, -/* 11f5 - */ 0, -/* 11f6 - */ 0, -/* 11f7 - */ 0, -/* 11f8 - */ 0, -/* 11f9 - */ 0, -/* 11fa - */ 0, -/* 11fb - */ 0, -/* 11fc - */ 0, -/* 11fd - _V_66_0F_38_9A */ 0x4117, -/* 11fe - */ 0, -/* 11ff - */ 0, -/* 1200 - */ 0, -/* 1201 - */ 0, -/* 1202 - */ 0, -/* 1203 - */ 0, -/* 1204 - */ 0, -/* 1205 - */ 0, -/* 1206 - */ 0, -/* 1207 - */ 0, -/* 1208 - */ 0, -/* 1209 - _V_66_0F_38_9B */ 0x4118, -/* 120a - */ 0, -/* 120b - */ 0, -/* 120c - */ 0, -/* 120d - */ 0, -/* 120e - */ 0, -/* 120f - */ 0, -/* 1210 - */ 0, -/* 1211 - */ 0, -/* 1212 - */ 0, -/* 1213 - */ 0, -/* 1214 - */ 0, -/* 1215 - _V_66_0F_38_9C */ 0x4119, -/* 1216 - */ 0, -/* 1217 - */ 0, -/* 1218 - */ 0, -/* 1219 - */ 0, -/* 121a - */ 0, -/* 121b - */ 0, -/* 121c - */ 0, -/* 121d - */ 0, -/* 121e - */ 0, -/* 121f - */ 0, -/* 1220 - */ 0, -/* 1221 - _V_66_0F_38_9D */ 0x411a, -/* 1222 - */ 0, -/* 1223 - */ 0, -/* 1224 - */ 0, -/* 1225 - */ 0, -/* 1226 - */ 0, -/* 1227 - */ 0, -/* 1228 - */ 0, -/* 1229 - */ 0, -/* 122a - */ 0, -/* 122b - */ 0, -/* 122c - */ 0, -/* 122d - _V_66_0F_38_9E */ 0x411b, -/* 122e - */ 0, -/* 122f - */ 0, -/* 1230 - */ 0, -/* 1231 - */ 0, -/* 1232 - */ 0, -/* 1233 - */ 0, -/* 1234 - */ 0, -/* 1235 - */ 0, -/* 1236 - */ 0, -/* 1237 - */ 0, -/* 1238 - */ 0, -/* 1239 - _V_66_0F_38_9F */ 0x411c, -/* 123a - */ 0, -/* 123b - */ 0, -/* 123c - */ 0, -/* 123d - */ 0, -/* 123e - */ 0, -/* 123f - */ 0, -/* 1240 - */ 0, -/* 1241 - */ 0, -/* 1242 - */ 0, -/* 1243 - */ 0, -/* 1244 - */ 0, -/* 1245 - _V_66_0F_38_A6 */ 0x411d, -/* 1246 - */ 0, -/* 1247 - */ 0, -/* 1248 - */ 0, -/* 1249 - */ 0, -/* 124a - */ 0, -/* 124b - */ 0, -/* 124c - */ 0, -/* 124d - */ 0, -/* 124e - */ 0, -/* 124f - */ 0, -/* 1250 - */ 0, -/* 1251 - _V_66_0F_38_A7 */ 0x411e, -/* 1252 - */ 0, -/* 1253 - */ 0, -/* 1254 - */ 0, -/* 1255 - */ 0, -/* 1256 - */ 0, -/* 1257 - */ 0, -/* 1258 - */ 0, -/* 1259 - */ 0, -/* 125a - */ 0, -/* 125b - */ 0, -/* 125c - */ 0, -/* 125d - _V_66_0F_38_A8 */ 0x411f, -/* 125e - */ 0, -/* 125f - */ 0, -/* 1260 - */ 0, -/* 1261 - */ 0, -/* 1262 - */ 0, -/* 1263 - */ 0, -/* 1264 - */ 0, -/* 1265 - */ 0, -/* 1266 - */ 0, -/* 1267 - */ 0, -/* 1268 - */ 0, -/* 1269 - _V_66_0F_38_A9 */ 0x4120, -/* 126a - */ 0, -/* 126b - */ 0, -/* 126c - */ 0, -/* 126d - */ 0, -/* 126e - */ 0, -/* 126f - */ 0, -/* 1270 - */ 0, -/* 1271 - */ 0, -/* 1272 - */ 0, -/* 1273 - */ 0, -/* 1274 - */ 0, -/* 1275 - _V_66_0F_38_AA */ 0x4121, -/* 1276 - */ 0, -/* 1277 - */ 0, -/* 1278 - */ 0, -/* 1279 - */ 0, -/* 127a - */ 0, -/* 127b - */ 0, -/* 127c - */ 0, -/* 127d - */ 0, -/* 127e - */ 0, -/* 127f - */ 0, -/* 1280 - */ 0, -/* 1281 - _V_66_0F_38_AB */ 0x4122, -/* 1282 - */ 0, -/* 1283 - */ 0, -/* 1284 - */ 0, -/* 1285 - */ 0, -/* 1286 - */ 0, -/* 1287 - */ 0, -/* 1288 - */ 0, -/* 1289 - */ 0, -/* 128a - */ 0, -/* 128b - */ 0, -/* 128c - */ 0, -/* 128d - _V_66_0F_38_AC */ 0x4123, -/* 128e - */ 0, -/* 128f - */ 0, -/* 1290 - */ 0, -/* 1291 - */ 0, -/* 1292 - */ 0, -/* 1293 - */ 0, -/* 1294 - */ 0, -/* 1295 - */ 0, -/* 1296 - */ 0, -/* 1297 - */ 0, -/* 1298 - */ 0, -/* 1299 - _V_66_0F_38_AD */ 0x4124, -/* 129a - */ 0, -/* 129b - */ 0, -/* 129c - */ 0, -/* 129d - */ 0, -/* 129e - */ 0, -/* 129f - */ 0, -/* 12a0 - */ 0, -/* 12a1 - */ 0, -/* 12a2 - */ 0, -/* 12a3 - */ 0, -/* 12a4 - */ 0, -/* 12a5 - _V_66_0F_38_AE */ 0x4125, -/* 12a6 - */ 0, -/* 12a7 - */ 0, -/* 12a8 - */ 0, -/* 12a9 - */ 0, -/* 12aa - */ 0, -/* 12ab - */ 0, -/* 12ac - */ 0, -/* 12ad - */ 0, -/* 12ae - */ 0, -/* 12af - */ 0, -/* 12b0 - */ 0, -/* 12b1 - _V_66_0F_38_AF */ 0x4126, -/* 12b2 - */ 0, -/* 12b3 - */ 0, -/* 12b4 - */ 0, -/* 12b5 - */ 0, -/* 12b6 - */ 0, -/* 12b7 - */ 0, -/* 12b8 - */ 0, -/* 12b9 - */ 0, -/* 12ba - */ 0, -/* 12bb - */ 0, -/* 12bc - */ 0, -/* 12bd - _V_66_0F_38_B6 */ 0x4127, -/* 12be - */ 0, -/* 12bf - */ 0, -/* 12c0 - */ 0, -/* 12c1 - */ 0, -/* 12c2 - */ 0, -/* 12c3 - */ 0, -/* 12c4 - */ 0, -/* 12c5 - */ 0, -/* 12c6 - */ 0, -/* 12c7 - */ 0, -/* 12c8 - */ 0, -/* 12c9 - _V_66_0F_38_B7 */ 0x4128, -/* 12ca - */ 0, -/* 12cb - */ 0, -/* 12cc - */ 0, -/* 12cd - */ 0, -/* 12ce - */ 0, -/* 12cf - */ 0, -/* 12d0 - */ 0, -/* 12d1 - */ 0, -/* 12d2 - */ 0, -/* 12d3 - */ 0, -/* 12d4 - */ 0, -/* 12d5 - _V_66_0F_38_B8 */ 0x4129, -/* 12d6 - */ 0, -/* 12d7 - */ 0, -/* 12d8 - */ 0, -/* 12d9 - */ 0, -/* 12da - */ 0, -/* 12db - */ 0, -/* 12dc - */ 0, -/* 12dd - */ 0, -/* 12de - */ 0, -/* 12df - */ 0, -/* 12e0 - */ 0, -/* 12e1 - _V_66_0F_38_B9 */ 0x412a, -/* 12e2 - */ 0, -/* 12e3 - */ 0, -/* 12e4 - */ 0, -/* 12e5 - */ 0, -/* 12e6 - */ 0, -/* 12e7 - */ 0, -/* 12e8 - */ 0, -/* 12e9 - */ 0, -/* 12ea - */ 0, -/* 12eb - */ 0, -/* 12ec - */ 0, -/* 12ed - _V_66_0F_38_BA */ 0x412b, -/* 12ee - */ 0, -/* 12ef - */ 0, -/* 12f0 - */ 0, -/* 12f1 - */ 0, -/* 12f2 - */ 0, -/* 12f3 - */ 0, -/* 12f4 - */ 0, -/* 12f5 - */ 0, -/* 12f6 - */ 0, -/* 12f7 - */ 0, -/* 12f8 - */ 0, -/* 12f9 - _V_66_0F_38_BB */ 0x412c, -/* 12fa - */ 0, -/* 12fb - */ 0, -/* 12fc - */ 0, -/* 12fd - */ 0, -/* 12fe - */ 0, -/* 12ff - */ 0, -/* 1300 - */ 0, -/* 1301 - */ 0, -/* 1302 - */ 0, -/* 1303 - */ 0, -/* 1304 - */ 0, -/* 1305 - _V_66_0F_38_BC */ 0x412d, -/* 1306 - */ 0, -/* 1307 - */ 0, -/* 1308 - */ 0, -/* 1309 - */ 0, -/* 130a - */ 0, -/* 130b - */ 0, -/* 130c - */ 0, -/* 130d - */ 0, -/* 130e - */ 0, -/* 130f - */ 0, -/* 1310 - */ 0, -/* 1311 - _V_66_0F_38_BD */ 0x412e, -/* 1312 - */ 0, -/* 1313 - */ 0, -/* 1314 - */ 0, -/* 1315 - */ 0, -/* 1316 - */ 0, -/* 1317 - */ 0, -/* 1318 - */ 0, -/* 1319 - */ 0, -/* 131a - */ 0, -/* 131b - */ 0, -/* 131c - */ 0, -/* 131d - _V_66_0F_38_BE */ 0x412f, -/* 131e - */ 0, -/* 131f - */ 0, -/* 1320 - */ 0, -/* 1321 - */ 0, -/* 1322 - */ 0, -/* 1323 - */ 0, -/* 1324 - */ 0, -/* 1325 - */ 0, -/* 1326 - */ 0, -/* 1327 - */ 0, -/* 1328 - */ 0, -/* 1329 - _V_66_0F_38_BF */ 0x4130, -/* 132a - */ 0, -/* 132b - */ 0, -/* 132c - */ 0, -/* 132d - */ 0, -/* 132e - */ 0, -/* 132f - */ 0, -/* 1330 - */ 0, -/* 1331 - _66_0F_38_DB */ 0x24b7, -/* 1332 - */ 0, -/* 1333 - */ 0, -/* 1334 - */ 0, -/* 1335 - _V_66_0F_38_DB */ 0x4131, -/* 1336 - */ 0, -/* 1337 - */ 0, -/* 1338 - */ 0, -/* 1339 - */ 0, -/* 133a - */ 0, -/* 133b - */ 0, -/* 133c - */ 0, -/* 133d - _66_0F_38_DC */ 0x24b8, -/* 133e - */ 0, -/* 133f - */ 0, -/* 1340 - */ 0, -/* 1341 - _V_66_0F_38_DC */ 0x4132, -/* 1342 - */ 0, -/* 1343 - */ 0, -/* 1344 - */ 0, -/* 1345 - */ 0, -/* 1346 - */ 0, -/* 1347 - */ 0, -/* 1348 - */ 0, -/* 1349 - _66_0F_38_DD */ 0x24b9, -/* 134a - */ 0, -/* 134b - */ 0, -/* 134c - */ 0, -/* 134d - _V_66_0F_38_DD */ 0x4133, -/* 134e - */ 0, -/* 134f - */ 0, -/* 1350 - */ 0, -/* 1351 - */ 0, -/* 1352 - */ 0, -/* 1353 - */ 0, -/* 1354 - */ 0, -/* 1355 - _66_0F_38_DE */ 0x24ba, -/* 1356 - */ 0, -/* 1357 - */ 0, -/* 1358 - */ 0, -/* 1359 - _V_66_0F_38_DE */ 0x4134, -/* 135a - */ 0, -/* 135b - */ 0, -/* 135c - */ 0, -/* 135d - */ 0, -/* 135e - */ 0, -/* 135f - */ 0, -/* 1360 - */ 0, -/* 1361 - _66_0F_38_DF */ 0x24bb, -/* 1362 - */ 0, -/* 1363 - */ 0, -/* 1364 - */ 0, -/* 1365 - _V_66_0F_38_DF */ 0x4135, -/* 1366 - */ 0, -/* 1367 - */ 0, -/* 1368 - */ 0, -/* 1369 - */ 0, -/* 136a - */ 0, -/* 136b - */ 0, -/* 136c - _0F_38_F0 */ 0x24bc, -/* 136d - */ 0, -/* 136e - */ 0, -/* 136f - _F2_0F_38_F0 */ 0x24bd, -/* 1370 - */ 0, -/* 1371 - */ 0, -/* 1372 - */ 0, -/* 1373 - */ 0, -/* 1374 - */ 0, -/* 1375 - */ 0, -/* 1376 - */ 0, -/* 1377 - */ 0, -/* 1378 - _0F_38_F1 */ 0x24be, -/* 1379 - */ 0, -/* 137a - */ 0, -/* 137b - _F2_0F_38_F1 */ 0x24bf, -/* 137c - */ 0, -/* 137d - */ 0, -/* 137e - */ 0, -/* 137f - */ 0, -/* 1380 - */ 0, -/* 1381 - */ 0, -/* 1382 - */ 0, -/* 1383 - */ 0, -/* 1384 - */ 0, -/* 1385 - */ 0, -/* 1386 - */ 0, -/* 1387 - */ 0, -/* 1388 - */ 0, -/* 1389 - _V_66_0F_3A_04 */ 0x4136, -/* 138a - */ 0, -/* 138b - */ 0, -/* 138c - */ 0, -/* 138d - */ 0, -/* 138e - */ 0, -/* 138f - */ 0, -/* 1390 - */ 0, -/* 1391 - */ 0, -/* 1392 - */ 0, -/* 1393 - */ 0, -/* 1394 - */ 0, -/* 1395 - _V_66_0F_3A_05 */ 0x4137, -/* 1396 - */ 0, -/* 1397 - */ 0, -/* 1398 - */ 0, -/* 1399 - */ 0, -/* 139a - */ 0, -/* 139b - */ 0, -/* 139c - */ 0, -/* 139d - */ 0, -/* 139e - */ 0, -/* 139f - */ 0, -/* 13a0 - */ 0, -/* 13a1 - _V_66_0F_3A_06 */ 0x4138, -/* 13a2 - */ 0, -/* 13a3 - */ 0, -/* 13a4 - */ 0, -/* 13a5 - */ 0, -/* 13a6 - */ 0, -/* 13a7 - */ 0, -/* 13a8 - */ 0, -/* 13a9 - _66_0F_3A_08 */ 0x4139, -/* 13aa - */ 0, -/* 13ab - */ 0, -/* 13ac - */ 0, -/* 13ad - _V_66_0F_3A_08 */ 0x413a, -/* 13ae - */ 0, -/* 13af - */ 0, -/* 13b0 - */ 0, -/* 13b1 - */ 0, -/* 13b2 - */ 0, -/* 13b3 - */ 0, -/* 13b4 - */ 0, -/* 13b5 - _66_0F_3A_09 */ 0x413b, -/* 13b6 - */ 0, -/* 13b7 - */ 0, -/* 13b8 - */ 0, -/* 13b9 - _V_66_0F_3A_09 */ 0x413c, -/* 13ba - */ 0, -/* 13bb - */ 0, -/* 13bc - */ 0, -/* 13bd - */ 0, -/* 13be - */ 0, -/* 13bf - */ 0, -/* 13c0 - */ 0, -/* 13c1 - _66_0F_3A_0A */ 0x413d, -/* 13c2 - */ 0, -/* 13c3 - */ 0, -/* 13c4 - */ 0, -/* 13c5 - _V_66_0F_3A_0A */ 0x413e, -/* 13c6 - */ 0, -/* 13c7 - */ 0, -/* 13c8 - */ 0, -/* 13c9 - */ 0, -/* 13ca - */ 0, -/* 13cb - */ 0, -/* 13cc - */ 0, -/* 13cd - _66_0F_3A_0B */ 0x413f, -/* 13ce - */ 0, -/* 13cf - */ 0, -/* 13d0 - */ 0, -/* 13d1 - _V_66_0F_3A_0B */ 0x4140, -/* 13d2 - */ 0, -/* 13d3 - */ 0, -/* 13d4 - */ 0, -/* 13d5 - */ 0, -/* 13d6 - */ 0, -/* 13d7 - */ 0, -/* 13d8 - */ 0, -/* 13d9 - _66_0F_3A_0C */ 0x4141, -/* 13da - */ 0, -/* 13db - */ 0, -/* 13dc - */ 0, -/* 13dd - _V_66_0F_3A_0C */ 0x4142, -/* 13de - */ 0, -/* 13df - */ 0, -/* 13e0 - */ 0, -/* 13e1 - */ 0, -/* 13e2 - */ 0, -/* 13e3 - */ 0, -/* 13e4 - */ 0, -/* 13e5 - _66_0F_3A_0D */ 0x4143, -/* 13e6 - */ 0, -/* 13e7 - */ 0, -/* 13e8 - */ 0, -/* 13e9 - _V_66_0F_3A_0D */ 0x4144, -/* 13ea - */ 0, -/* 13eb - */ 0, -/* 13ec - */ 0, -/* 13ed - */ 0, -/* 13ee - */ 0, -/* 13ef - */ 0, -/* 13f0 - */ 0, -/* 13f1 - _66_0F_3A_0E */ 0x4145, -/* 13f2 - */ 0, -/* 13f3 - */ 0, -/* 13f4 - */ 0, -/* 13f5 - _V_66_0F_3A_0E */ 0x4146, -/* 13f6 - */ 0, -/* 13f7 - */ 0, -/* 13f8 - */ 0, -/* 13f9 - */ 0, -/* 13fa - */ 0, -/* 13fb - */ 0, -/* 13fc - _0F_3A_0F */ 0x4147, -/* 13fd - _66_0F_3A_0F */ 0x4148, -/* 13fe - */ 0, -/* 13ff - */ 0, -/* 1400 - */ 0, -/* 1401 - _V_66_0F_3A_0F */ 0x4149, -/* 1402 - */ 0, -/* 1403 - */ 0, -/* 1404 - */ 0, -/* 1405 - */ 0, -/* 1406 - */ 0, -/* 1407 - */ 0, -/* 1408 - */ 0, -/* 1409 - _66_0F_3A_14 */ 0x414a, -/* 140a - */ 0, -/* 140b - */ 0, -/* 140c - */ 0, -/* 140d - _V_66_0F_3A_14 */ 0x414b, -/* 140e - */ 0, -/* 140f - */ 0, -/* 1410 - */ 0, -/* 1411 - */ 0, -/* 1412 - */ 0, -/* 1413 - */ 0, -/* 1414 - */ 0, -/* 1415 - _66_0F_3A_15 */ 0x414c, -/* 1416 - */ 0, -/* 1417 - */ 0, -/* 1418 - */ 0, -/* 1419 - _V_66_0F_3A_15 */ 0x414d, -/* 141a - */ 0, -/* 141b - */ 0, -/* 141c - */ 0, -/* 141d - */ 0, -/* 141e - */ 0, -/* 141f - */ 0, -/* 1420 - */ 0, -/* 1421 - _66_0F_3A_16 */ 0x414e, -/* 1422 - */ 0, -/* 1423 - */ 0, -/* 1424 - */ 0, -/* 1425 - _V_66_0F_3A_16 */ 0x414f, -/* 1426 - */ 0, -/* 1427 - */ 0, -/* 1428 - */ 0, -/* 1429 - */ 0, -/* 142a - */ 0, -/* 142b - */ 0, -/* 142c - */ 0, -/* 142d - _66_0F_3A_17 */ 0x4150, -/* 142e - */ 0, -/* 142f - */ 0, -/* 1430 - */ 0, -/* 1431 - _V_66_0F_3A_17 */ 0x4151, -/* 1432 - */ 0, -/* 1433 - */ 0, -/* 1434 - */ 0, -/* 1435 - */ 0, -/* 1436 - */ 0, -/* 1437 - */ 0, -/* 1438 - */ 0, -/* 1439 - */ 0, -/* 143a - */ 0, -/* 143b - */ 0, -/* 143c - */ 0, -/* 143d - _V_66_0F_3A_18 */ 0x4152, -/* 143e - */ 0, -/* 143f - */ 0, -/* 1440 - */ 0, -/* 1441 - */ 0, -/* 1442 - */ 0, -/* 1443 - */ 0, -/* 1444 - */ 0, -/* 1445 - */ 0, -/* 1446 - */ 0, -/* 1447 - */ 0, -/* 1448 - */ 0, -/* 1449 - _V_66_0F_3A_19 */ 0x4153, -/* 144a - */ 0, -/* 144b - */ 0, -/* 144c - */ 0, -/* 144d - */ 0, -/* 144e - */ 0, -/* 144f - */ 0, -/* 1450 - */ 0, -/* 1451 - _66_0F_3A_20 */ 0x4154, -/* 1452 - */ 0, -/* 1453 - */ 0, -/* 1454 - */ 0, -/* 1455 - _V_66_0F_3A_20 */ 0x4155, -/* 1456 - */ 0, -/* 1457 - */ 0, -/* 1458 - */ 0, -/* 1459 - */ 0, -/* 145a - */ 0, -/* 145b - */ 0, -/* 145c - */ 0, -/* 145d - _66_0F_3A_21 */ 0x4156, -/* 145e - */ 0, -/* 145f - */ 0, -/* 1460 - */ 0, -/* 1461 - _V_66_0F_3A_21 */ 0x4157, -/* 1462 - */ 0, -/* 1463 - */ 0, -/* 1464 - */ 0, -/* 1465 - */ 0, -/* 1466 - */ 0, -/* 1467 - */ 0, -/* 1468 - */ 0, -/* 1469 - _66_0F_3A_22 */ 0x4158, -/* 146a - */ 0, -/* 146b - */ 0, -/* 146c - */ 0, -/* 146d - _V_66_0F_3A_22 */ 0x4159, -/* 146e - */ 0, -/* 146f - */ 0, -/* 1470 - */ 0, -/* 1471 - */ 0, -/* 1472 - */ 0, -/* 1473 - */ 0, -/* 1474 - */ 0, -/* 1475 - _66_0F_3A_40 */ 0x415a, -/* 1476 - */ 0, -/* 1477 - */ 0, -/* 1478 - */ 0, -/* 1479 - _V_66_0F_3A_40 */ 0x415b, -/* 147a - */ 0, -/* 147b - */ 0, -/* 147c - */ 0, -/* 147d - */ 0, -/* 147e - */ 0, -/* 147f - */ 0, -/* 1480 - */ 0, -/* 1481 - _66_0F_3A_41 */ 0x415c, -/* 1482 - */ 0, -/* 1483 - */ 0, -/* 1484 - */ 0, -/* 1485 - _V_66_0F_3A_41 */ 0x415d, -/* 1486 - */ 0, -/* 1487 - */ 0, -/* 1488 - */ 0, -/* 1489 - */ 0, -/* 148a - */ 0, -/* 148b - */ 0, -/* 148c - */ 0, -/* 148d - _66_0F_3A_42 */ 0x415e, -/* 148e - */ 0, -/* 148f - */ 0, -/* 1490 - */ 0, -/* 1491 - _V_66_0F_3A_42 */ 0x415f, -/* 1492 - */ 0, -/* 1493 - */ 0, -/* 1494 - */ 0, -/* 1495 - */ 0, -/* 1496 - */ 0, -/* 1497 - */ 0, -/* 1498 - */ 0, -/* 1499 - _66_0F_3A_44 */ 0x4160, -/* 149a - */ 0, -/* 149b - */ 0, -/* 149c - */ 0, -/* 149d - _V_66_0F_3A_44 */ 0x4161, -/* 149e - */ 0, -/* 149f - */ 0, -/* 14a0 - */ 0, -/* 14a1 - */ 0, -/* 14a2 - */ 0, -/* 14a3 - */ 0, -/* 14a4 - */ 0, -/* 14a5 - */ 0, -/* 14a6 - */ 0, -/* 14a7 - */ 0, -/* 14a8 - */ 0, -/* 14a9 - _V_66_0F_3A_4A */ 0x4162, -/* 14aa - */ 0, -/* 14ab - */ 0, -/* 14ac - */ 0, -/* 14ad - */ 0, -/* 14ae - */ 0, -/* 14af - */ 0, -/* 14b0 - */ 0, -/* 14b1 - */ 0, -/* 14b2 - */ 0, -/* 14b3 - */ 0, -/* 14b4 - */ 0, -/* 14b5 - _V_66_0F_3A_4B */ 0x4163, -/* 14b6 - */ 0, -/* 14b7 - */ 0, -/* 14b8 - */ 0, -/* 14b9 - */ 0, -/* 14ba - */ 0, -/* 14bb - */ 0, -/* 14bc - */ 0, -/* 14bd - */ 0, -/* 14be - */ 0, -/* 14bf - */ 0, -/* 14c0 - */ 0, -/* 14c1 - _V_66_0F_3A_4C */ 0x4164, -/* 14c2 - */ 0, -/* 14c3 - */ 0, -/* 14c4 - */ 0, -/* 14c5 - */ 0, -/* 14c6 - */ 0, -/* 14c7 - */ 0, -/* 14c8 - */ 0, -/* 14c9 - _66_0F_3A_60 */ 0x4165, -/* 14ca - */ 0, -/* 14cb - */ 0, -/* 14cc - */ 0, -/* 14cd - _V_66_0F_3A_60 */ 0x4166, -/* 14ce - */ 0, -/* 14cf - */ 0, -/* 14d0 - */ 0, -/* 14d1 - */ 0, -/* 14d2 - */ 0, -/* 14d3 - */ 0, -/* 14d4 - */ 0, -/* 14d5 - _66_0F_3A_61 */ 0x4167, -/* 14d6 - */ 0, -/* 14d7 - */ 0, -/* 14d8 - */ 0, -/* 14d9 - _V_66_0F_3A_61 */ 0x4168, -/* 14da - */ 0, -/* 14db - */ 0, -/* 14dc - */ 0, -/* 14dd - */ 0, -/* 14de - */ 0, -/* 14df - */ 0, -/* 14e0 - */ 0, -/* 14e1 - _66_0F_3A_62 */ 0x4169, -/* 14e2 - */ 0, -/* 14e3 - */ 0, -/* 14e4 - */ 0, -/* 14e5 - _V_66_0F_3A_62 */ 0x416a, -/* 14e6 - */ 0, -/* 14e7 - */ 0, -/* 14e8 - */ 0, -/* 14e9 - */ 0, -/* 14ea - */ 0, -/* 14eb - */ 0, -/* 14ec - */ 0, -/* 14ed - _66_0F_3A_63 */ 0x416b, -/* 14ee - */ 0, -/* 14ef - */ 0, -/* 14f0 - */ 0, -/* 14f1 - _V_66_0F_3A_63 */ 0x416c, -/* 14f2 - */ 0, -/* 14f3 - */ 0, -/* 14f4 - */ 0, -/* 14f5 - */ 0, -/* 14f6 - */ 0, -/* 14f7 - */ 0, -/* 14f8 - */ 0, -/* 14f9 - _66_0F_3A_DF */ 0x416d, -/* 14fa - */ 0, -/* 14fb - */ 0, -/* 14fc - */ 0, -/* 14fd - _V_66_0F_3A_DF */ 0x416e, -/* 14fe - */ 0, -/* 14ff - */ 0, -/* 1500 - */ 0, -/* 1501 - */ 0, -/* 1502 - */ 0, -/* 1503 - */ 0, -/* 1504 - _0F_71_02 */ 0x24c0, -/* 1505 - _66_0F_71_02 */ 0x24c1, -/* 1506 - */ 0, -/* 1507 - */ 0, -/* 1508 - */ 0, -/* 1509 - _V_66_0F_71_02 */ 0x416f, -/* 150a - */ 0, -/* 150b - */ 0, -/* 150c - */ 0, -/* 150d - */ 0, -/* 150e - */ 0, -/* 150f - */ 0, -/* 1510 - _0F_71_04 */ 0x24c2, -/* 1511 - _66_0F_71_04 */ 0x24c3, -/* 1512 - */ 0, -/* 1513 - */ 0, -/* 1514 - */ 0, -/* 1515 - _V_66_0F_71_04 */ 0x4170, -/* 1516 - */ 0, -/* 1517 - */ 0, -/* 1518 - */ 0, -/* 1519 - */ 0, -/* 151a - */ 0, -/* 151b - */ 0, -/* 151c - _0F_71_06 */ 0x24c4, -/* 151d - _66_0F_71_06 */ 0x24c5, -/* 151e - */ 0, -/* 151f - */ 0, -/* 1520 - */ 0, -/* 1521 - _V_66_0F_71_06 */ 0x4171, -/* 1522 - */ 0, -/* 1523 - */ 0, -/* 1524 - */ 0, -/* 1525 - */ 0, -/* 1526 - */ 0, -/* 1527 - */ 0, -/* 1528 - _0F_72_02 */ 0x24c6, -/* 1529 - _66_0F_72_02 */ 0x24c7, -/* 152a - */ 0, -/* 152b - */ 0, -/* 152c - */ 0, -/* 152d - _V_66_0F_72_02 */ 0x4172, -/* 152e - */ 0, -/* 152f - */ 0, -/* 1530 - */ 0, -/* 1531 - */ 0, -/* 1532 - */ 0, -/* 1533 - */ 0, -/* 1534 - _0F_72_04 */ 0x24c8, -/* 1535 - _66_0F_72_04 */ 0x24c9, -/* 1536 - */ 0, -/* 1537 - */ 0, -/* 1538 - */ 0, -/* 1539 - _V_66_0F_72_04 */ 0x4173, -/* 153a - */ 0, -/* 153b - */ 0, -/* 153c - */ 0, -/* 153d - */ 0, -/* 153e - */ 0, -/* 153f - */ 0, -/* 1540 - _0F_72_06 */ 0x24ca, -/* 1541 - _66_0F_72_06 */ 0x24cb, -/* 1542 - */ 0, -/* 1543 - */ 0, -/* 1544 - */ 0, -/* 1545 - _V_66_0F_72_06 */ 0x4174, -/* 1546 - */ 0, -/* 1547 - */ 0, -/* 1548 - */ 0, -/* 1549 - */ 0, -/* 154a - */ 0, -/* 154b - */ 0, -/* 154c - _0F_73_02 */ 0x24cc, -/* 154d - _66_0F_73_02 */ 0x24cd, -/* 154e - */ 0, -/* 154f - */ 0, -/* 1550 - */ 0, -/* 1551 - _V_66_0F_73_02 */ 0x4175, -/* 1552 - */ 0, -/* 1553 - */ 0, -/* 1554 - */ 0, -/* 1555 - */ 0, -/* 1556 - */ 0, -/* 1557 - */ 0, -/* 1558 - */ 0, -/* 1559 - _66_0F_73_03 */ 0x24ce, -/* 155a - */ 0, -/* 155b - */ 0, -/* 155c - */ 0, -/* 155d - _V_66_0F_73_03 */ 0x4176, -/* 155e - */ 0, -/* 155f - */ 0, -/* 1560 - */ 0, -/* 1561 - */ 0, -/* 1562 - */ 0, -/* 1563 - */ 0, -/* 1564 - _0F_73_06 */ 0x24cf, -/* 1565 - _66_0F_73_06 */ 0x24d0, -/* 1566 - */ 0, -/* 1567 - */ 0, -/* 1568 - */ 0, -/* 1569 - _V_66_0F_73_06 */ 0x4177, -/* 156a - */ 0, -/* 156b - */ 0, -/* 156c - */ 0, -/* 156d - */ 0, -/* 156e - */ 0, -/* 156f - */ 0, -/* 1570 - */ 0, -/* 1571 - _66_0F_73_07 */ 0x24d1, -/* 1572 - */ 0, -/* 1573 - */ 0, -/* 1574 - */ 0, -/* 1575 - _V_66_0F_73_07 */ 0x4178, -/* 1576 - */ 0, -/* 1577 - */ 0, -/* 1578 - */ 0, -/* 1579 - */ 0, -/* 157a - */ 0, -/* 157b - */ 0, -/* 157c - _0F_AE_00 */ 0x4179, -/* 157d - */ 0, -/* 157e - _F3_0F_AE_00 */ 0x24d2, -/* 157f - */ 0, -/* 1580 - */ 0, -/* 1581 - */ 0, -/* 1582 - */ 0, -/* 1583 - */ 0, -/* 1584 - */ 0, -/* 1585 - */ 0, -/* 1586 - */ 0, -/* 1587 - */ 0, -/* 1588 - _0F_AE_01 */ 0x417a, -/* 1589 - */ 0, -/* 158a - _F3_0F_AE_01 */ 0x24d3, -/* 158b - */ 0, -/* 158c - */ 0, -/* 158d - */ 0, -/* 158e - */ 0, -/* 158f - */ 0, -/* 1590 - */ 0, -/* 1591 - */ 0, -/* 1592 - */ 0, -/* 1593 - */ 0, -/* 1594 - _0F_AE_02 */ 0x24d4, -/* 1595 - */ 0, -/* 1596 - _F3_0F_AE_02 */ 0x24d5, -/* 1597 - */ 0, -/* 1598 - _V_0F_AE_02 */ 0x417b, -/* 1599 - */ 0, -/* 159a - */ 0, -/* 159b - */ 0, -/* 159c - */ 0, -/* 159d - */ 0, -/* 159e - */ 0, -/* 159f - */ 0, -/* 15a0 - _0F_AE_03 */ 0x24d6, -/* 15a1 - */ 0, -/* 15a2 - _F3_0F_AE_03 */ 0x24d7, -/* 15a3 - */ 0, -/* 15a4 - _V_0F_AE_03 */ 0x417c, -/* 15a5 - */ 0, -/* 15a6 - */ 0, -/* 15a7 - */ 0, -/* 15a8 - */ 0, -/* 15a9 - */ 0, -/* 15aa - */ 0, -/* 15ab - */ 0, -/* 15ac - _0F_C7_06 */ 0x417d, -/* 15ad - _66_0F_C7_06 */ 0x24d8, -/* 15ae - _F3_0F_C7_06 */ 0x24d9, -/* 15af - */ 0, -/* 15b0 - */ 0, -/* 15b1 - */ 0, -/* 15b2 - */ 0, -/* 15b3 - */ 0, -/* 15b4 - */ 0, -/* 15b5 - */ 0, -/* 15b6 - */ 0, -/* 15b7 - */ 0 -}; - -uint16_t CmpMnemonicOffsets[8] = { -0, 9, 18, 27, 39, 49, 59, 69 -}; -uint16_t VCmpMnemonicOffsets[32] = { -0, 10, 20, 30, 43, 54, 65, 76, 87, 100, 111, 122, 135, 149, 159, 169, 181, -194, 207, 220, 235, 249, 263, 277, 290, 303, 317, 331, 347, 361, 374, 387 -}; diff --git a/distorm3.2-package/src/insts.h b/distorm3.2-package/src/insts.h deleted file mode 100644 index 0cdf2ef..0000000 --- a/distorm3.2-package/src/insts.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -insts.h - -diStorm3 - Powerful disassembler for X86/AMD64 -http://ragestorm.net/distorm/ -distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - - -#ifndef INSTS_H -#define INSTS_H - -#include "instructions.h" - - -/* Flags Table */ -extern _iflags FlagsTable[]; - -/* Root Trie DB */ -extern _InstInfo InstInfos[]; -extern _InstInfoEx InstInfosEx[]; -extern _InstNode InstructionsTree[]; - -/* 3DNow! Trie DB */ -extern _InstNode Table_0F_0F; -/* AVX related: */ -extern _InstNode Table_0F, Table_0F_38, Table_0F_3A; - -/* Helper tables for pesudo compare mnemonics. */ -extern uint16_t CmpMnemonicOffsets[8]; /* SSE */ -extern uint16_t VCmpMnemonicOffsets[32]; /* AVX */ - -#endif /* INSTS_H */ diff --git a/distorm3.2-package/src/operands.h b/distorm3.2-package/src/operands.h deleted file mode 100644 index e1beb6f..0000000 --- a/distorm3.2-package/src/operands.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -operands.h - -diStorm3 - Powerful disassembler for X86/AMD64 -http://ragestorm.net/distorm/ -distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - - -#ifndef OPERANDS_H -#define OPERANDS_H - -#include "config.h" -#include "decoder.h" -#include "prefix.h" -#include "instructions.h" - - -extern uint16_t _REGISTERTORCLASS[]; - -int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, - _OpType type, _OperandNumberType opNum, - unsigned int modrm, _PrefixState* ps, _DecodeType effOpSz, - _DecodeType effAdrSz, int* lockableInstruction); - -#endif /* OPERANDS_H */ diff --git a/distorm3.2-package/src/x86defs.c b/distorm3.2-package/src/x86defs.c deleted file mode 100644 index 4ee7e42..0000000 --- a/distorm3.2-package/src/x86defs.c +++ /dev/null @@ -1,50 +0,0 @@ -/* -x86defs.c - -diStorm3 - Powerful disassembler for X86/AMD64 -http://ragestorm.net/distorm/ -distorm at gmail dot com -Copyright (C) 2003-2012 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - - -#include "x86defs.h" -#include "instructions.h" -#include "../include/mnemonics.h" - - -/* - * The first field of an _InstInfo is the flagsInex, which goes into FlagsTable in insts.c - * Since this table is auto generated in disOps, we have to make sure that the first 5 entries - * are reserved for our use here. - * The following defined inst-infos have to be synced manually every time you change insts.c. - */ - -_InstInfo II_arpl = {0 /* INST_MODRM_REQUIRED */, OT_REG16, OT_RM16, ISC_INTEGER << 3, I_ARPL}; -/* - * MOVSXD: - * This is the worst defined instruction ever. It has so many variations. - * I decided after a third review, to make it like MOVSXD RAX, EAX when there IS a REX.W. - * Otherwise it will be MOVSXD EAX, EAX, which really zero extends to RAX. - * Completely ignoring DB 0x66, which is possible by the docs, BTW. - */ -_InstInfo II_movsxd = {1 /* INST_MODRM_REQUIRED | INST_PRE_REX | INST_64BITS */, OT_RM32, OT_REG32_64, ISC_INTEGER << 3, I_MOVSXD}; - -_InstInfo II_nop = {2 /* INST_FLAGS_NONE */, OT_NONE, OT_NONE, ISC_INTEGER << 3, I_NOP}; - -_InstInfo II_pause = {3 /* INST_FLAGS_NONE */, OT_NONE, OT_NONE, ISC_INTEGER << 3, I_PAUSE}; - -_InstInfo II_3dnow = {4 /* INST_32BITS | INST_MODRM_REQUIRED | INST_3DNOW_FETCH */, OT_MM64, OT_MM, ISC_3DNOW << 3, I_UNDEFINED}; diff --git a/loader/loader/Loader.c b/loader/loader/Loader.c index f67c555..6792af3 100644 --- a/loader/loader/Loader.c +++ b/loader/loader/Loader.c @@ -19,6 +19,9 @@ along with this program.If not, see . #include #include +#pragma warning(push ) +#pragma warning(disable : 4996) + SYSTEM_INFO SystemInfo; void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...) @@ -271,12 +274,12 @@ static int InjectDllViaThread(HANDLE ProcessHandle, HANDLE ThreadHandle, const c { SetLastError(ExitCode); DoOutputErrorString("InjectDllViaThread: CreateRemoteThread injection failed"); - return 0; + return ERROR_CREATEREMOTETHREAD; } DoOutputDebugString("InjectDllViaThread: Successfully injected Dll into process via CreateRemoteThread.\n"); - return 1; + return 0; } } else @@ -291,7 +294,7 @@ static int InjectDllViaThread(HANDLE ProcessHandle, HANDLE ThreadHandle, const c DoOutputErrorString("InjectDllViaThread: RtlCreateUserThread failed"); return ERROR_RTLCREATEUSERTHREAD; } - else if(RemoteThreadHandle) + else if (RemoteThreadHandle) { WaitForSingleObject(RemoteThreadHandle, INFINITE); GetExitCodeThread(RemoteThreadHandle, &ExitCode); @@ -308,7 +311,7 @@ static int InjectDllViaThread(HANDLE ProcessHandle, HANDLE ThreadHandle, const c DoOutputDebugString("InjectDllViaThread: Successfully injected Dll into process via RtlCreateUserThread.\n"); - return 1; + return 0; } } @@ -409,7 +412,7 @@ static int InjectDllViaIAT(HANDLE ProcessHandle, HANDLE ThreadHandle, const char #ifdef _WIN64 if (Context.Rcx != (DWORD_PTR)(BaseAddress + NtHeader.OptionalHeader.AddressOfEntryPoint)) #else - if (Context.Eax != (DWORD_PTR)(BaseAddress + NtHeader.OptionalHeader.AddressOfEntryPoint)) + if (Context.Eax != (DWORD)(BaseAddress + NtHeader.OptionalHeader.AddressOfEntryPoint)) #endif { DoOutputDebugString("InjectDllViaIAT: Not a new process, bailing.\n"); @@ -629,8 +632,8 @@ static int InjectDllViaIAT(HANDLE ProcessHandle, HANDLE ThreadHandle, const char static int InjectDll(int ProcessId, int ThreadId, const char *DllPath, BOOLEAN ForceLoad) { - HANDLE ProcessHandle, ThreadHandle; - int RetVal = 0; + HANDLE ProcessHandle = NULL, ThreadHandle = NULL; + int RetVal = 0, InitialThreadId; ProcessHandle = NULL; ThreadHandle = NULL; @@ -650,40 +653,57 @@ static int InjectDll(int ProcessId, int ThreadId, const char *DllPath, BOOLEAN F goto out; } - // If no thread id supplied, we fetch the initial thread id - // from the TEB's CLIENT_ID - if (!ThreadId) - ThreadId = GetProcessInitialThreadId(ProcessHandle); - + // If no thread id supplied, we fetch the initial thread id from the TEB's CLIENT_ID if (!ThreadId) { - DoOutputDebugString("InjectDll: GetProcessInitialThreadId failed"); - ForceLoad = TRUE; - //RetVal = ERROR_THREAD_OPEN; - //goto out; - } + InitialThreadId = GetProcessInitialThreadId(ProcessHandle); + + if (!InitialThreadId) + { + DoOutputDebugString("InjectDll: No thread ID supplied, GetProcessInitialThreadId failed.\n"); + //RetVal = ERROR_THREAD_OPEN; + //goto out; + //ForceLoad = TRUE; + } + else + { + ThreadHandle = OpenThread(THREAD_ALL_ACCESS, FALSE, InitialThreadId); + DoOutputDebugString("InjectDll: No thread ID supplied. Initial thread ID %d, handle 0x%x\n", InitialThreadId, ThreadHandle); + } + } else + { ThreadHandle = OpenThread(THREAD_ALL_ACCESS, FALSE, ThreadId); - if (ThreadHandle == NULL) - { - DoOutputDebugString("InjectDll: OpenThread failed"); - ForceLoad = TRUE; - //RetVal = ERROR_THREAD_OPEN; - //goto out; + if (ThreadId && ThreadHandle == NULL) + { + DoOutputDebugString("InjectDll: OpenThread failed"); + //RetVal = ERROR_THREAD_OPEN; + //goto out; + ForceLoad = TRUE; + } } // We try to use IAT patching in case this is a new process. // If it's not, this function is expected to fail. - if (!ForceLoad && InjectDllViaIAT(ProcessHandle, ThreadHandle, DllPath)) - DoOutputDebugString("InjectDll: Successfully patched new process IAT.\n"); + if (!ForceLoad) + { + RetVal = InjectDllViaIAT(ProcessHandle, ThreadHandle, DllPath); + if (RetVal) + { + DoOutputDebugString("InjectDll: Successfully patched new process IAT.\n"); + goto out; + } + else + { + DoOutputDebugString("InjectDll: IAT patching failed, falling back to thread injection.\n"); + //ForceLoad = TRUE; + } + } - // We inject via thread in any case. A new process may have its IAT patching - // overwritten by, for example, process hollowing, so we need a fall back. - // N.B. ForceLoad is intended for use with the debugger, not normal injection. RetVal = InjectDllViaThread(ProcessHandle, ThreadHandle, DllPath, ForceLoad); - if (RetVal) + if (RetVal >= 0) DoOutputDebugString("InjectDll: Successfully injected DLL via thread.\n"); else DoOutputDebugString("InjectDll: DLL injection via thread failed.\n"); @@ -702,24 +722,37 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine DoOutputDebugString("CAPE loader.\n"); if (__argc < 2) + { + DoOutputDebugString("Loader: Error - too few arguments!\n"); return ERROR_ARGCOUNT; + } if (!GrantDebugPrivileges()) + { + DoOutputDebugString("Loader: Error - unable to obtain debug privileges.\n"); return ERROR_DEBUGPRIV; + } if (!strcmp(__argv[1], "inject")) { // usage: loader.exe inject int ProcessId, ThreadId, ret; char *DllName; - if (__argc != 6) + if (__argc != 6) // this includes a dummy for now to maintain compartibility with old loader + { + DoOutputDebugString("Loader: Error - too few arguments for injection (%d)\n", __argc); return ERROR_ARGCOUNT; + } + ProcessId = atoi(__argv[2]); ThreadId = atoi(__argv[3]); DllName = __argv[4]; + + DoOutputDebugString("Loader: Injecting process %d (thread %d) with %s.\n", ProcessId, ThreadId, DllName); + ret = InjectDll(ProcessId, ThreadId, DllName, FALSE); - if (ret) + if (ret >= 0) DoOutputDebugString("Successfully injected DLL %s.\n", __argv[4]); else DoOutputDebugString("Failed to inject DLL %s.\n", __argv[4]); @@ -744,6 +777,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine StringCchCat(szCommand, sizeof(szCommand), " "); StringCchCat(szCommand, sizeof(szCommand), __argv[3]); + DoOutputDebugString("Loader: Loading %s (%s) with DLL %s.\n", __argv[2], szCommand, __argv[3]); + CreateProcess(__argv[2], szCommand, NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_SUSPENDED, NULL, NULL, &si, &pi); ret = InjectDll(pi.dwProcessId, pi.dwThreadId, __argv[4], FALSE); @@ -764,6 +799,133 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine DoOutputDebugString("There was a problem resuming the new process %s.\n", __argv[2]); } + else if (!strcmp(__argv[1], "service")) + { + // usage: loader.exe service <32-bit dll> <64-bit dll> + int RetVal; + SC_HANDLE hSCManager, hService; + HANDLE hProcessSnapshot, hProcess; + PROCESSENTRY32 ProcessEntry32; + char ServicesName[] = "services.exe", ServiceName[] = "NewService", ServiceDisplayName[] = "New Service"; + DWORD ServicesPID = 0; + + // Get a handle to the SCM database + hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + + if (!hSCManager) + { + DoOutputErrorString("OpenSCManager failed"); + return 0; + } + + // Check the service doesn't already exist + hService = OpenService(hSCManager, ServiceName, SERVICE_ALL_ACCESS); + + if (hService) + { + DoOutputDebugString("Service alerady exists.\n"); + CloseServiceHandle(hSCManager); + return 0; + } + + hService = CreateService(hSCManager, ServiceName, ServiceDisplayName, SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS | + SERVICE_INTERACTIVE_PROCESS, SERVICE_DEMAND_START, SERVICE_ERROR_IGNORE, __argv[2], + NULL, NULL, NULL, NULL, NULL); + + if (!hService) + { + DoOutputDebugString("Failed to create service.\n"); + CloseServiceHandle(hSCManager); + return 0; + } + + // Now we need to find the PID for services.exe + hProcessSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + + if (hProcessSnapshot == INVALID_HANDLE_VALUE) + { + DoOutputErrorString("CreateToolhelp32Snapshot (of processes)"); + return FALSE; + } + + // Set the size of the structure before using it. + ProcessEntry32.dwSize = sizeof(PROCESSENTRY32); + + // Retrieve information about the first process, and exit if unsuccessful + if (!Process32First(hProcessSnapshot, &ProcessEntry32)) + { + DoOutputErrorString("Process32First"); + CloseHandle(hProcessSnapshot); + return FALSE; + } + + // Now walk the snapshot + do + { + if (!strncmp(ProcessEntry32.szExeFile, ServicesName, strlen(ServicesName)+1)) + { + ServicesPID = ProcessEntry32.th32ProcessID; + } + } + while (Process32Next(hProcessSnapshot, &ProcessEntry32)); + + if (!ServicesPID) + { + DoOutputDebugString("Failed to find PID for services.exe.\n"); + CloseHandle(hProcessSnapshot); + return FALSE; + } + + hProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE, ServicesPID); + + if (hProcess == NULL) + { + DoOutputErrorString("OpenProcess failed"); + return -18; + } + + GetNativeSystemInfo(&SystemInfo); + + if (SystemInfo.dwProcessorType == PROCESSOR_AMD_X8664) + { + BOOL IsWow64 = FALSE; + + if (IsWow64Process(hProcess, &IsWow64) && IsWow64) + { + RetVal = InjectDllViaThread(hProcess, 0, __argv[3], FALSE); + } + else + { + RetVal = InjectDllViaThread(hProcess, 0, __argv[4], FALSE); + } + } + else + { + RetVal = InjectDllViaThread(hProcess, 0, __argv[3], FALSE); + } + + CloseHandle(hProcess); + + if (RetVal) + { + DoOutputErrorString("Sucessfully injected monitor into services.exe."); + + RetVal = StartService(hService, 0, NULL); + + if (RetVal) + DoOutputErrorString("Sucessfully started service."); + else + DoOutputErrorString("Failed to start service."); + } + else + DoOutputErrorString("Failed to inject monitor into services.exe."); + + CloseServiceHandle(hService); + CloseServiceHandle(hSCManager); + + return RetVal; + + } else if (!strcmp(__argv[1], "shellcode")) { // usage: loader.exe shellcode @@ -1219,6 +1381,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine sprintf_s(PipeName, sizeof(PipeName)-1, "\\\\.\\PIPE\\%s", __argv[2]); + DoOutputDebugString("Loader: Starting pipe %s (DLL to inject %s).\n", PipeName, __argv[3]); + while (1) { PipeHandle = CreateNamedPipeA(PipeName, PIPE_ACCESS_DUPLEX, @@ -1266,4 +1430,4 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine } } return ERROR_MODE; -} +} \ No newline at end of file diff --git a/loader/loader/Loader.h b/loader/loader/Loader.h index 95f67b2..f8f7a74 100644 --- a/loader/loader/Loader.h +++ b/loader/loader/Loader.h @@ -157,7 +157,7 @@ enum ERROR_WRITEMEMORY = -5, ERROR_QUEUEUSERAPC = -6, ERROR_CREATEREMOTETHREAD = -7, - ERROR_RTLCREATEUSERTHREAD = -7, + ERROR_RTLCREATEUSERTHREAD = -8, ERROR_INJECTMODE = -9, ERROR_MODE = -10, ERROR_DEBUGPRIV = -11, diff --git a/loader/loader/loader.vcxproj b/loader/loader/loader.vcxproj index f1024d3..b878bb2 100644 --- a/loader/loader/loader.vcxproj +++ b/loader/loader/loader.vcxproj @@ -22,32 +22,32 @@ {52D1444F-0B18-4F98-BC62-3D11046190CC} Win32Proj loader - 8.1 + 10.0.17134.0 Application true - v140_xp - Unicode + v141 + MultiByte Application true - v140_xp - Unicode + v141_xp + MultiByte Application false - v140_xp + v141 true NotSet Application false - v140_xp + v141_xp true NotSet From 98fed11d1bacdfd57c34ef4f16e0e58575dcac03 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 2 Mar 2019 07:52:37 +0000 Subject: [PATCH 11/12] Relax PE characteristics requirement for recent payloads. --- CAPE/CAPE.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CAPE/CAPE.c b/CAPE/CAPE.c index 9a9c94e..8d1a3d6 100644 --- a/CAPE/CAPE.c +++ b/CAPE/CAPE.c @@ -1263,7 +1263,7 @@ BOOL TestPERequirements(PIMAGE_NT_HEADERS pNtHeader) if (!(pNtHeader->FileHeader.Characteristics & IMAGE_FILE_EXECUTABLE_IMAGE)) { DoOutputDebugString("TestPERequirements: Characteristics bad. (0x%x)", (DWORD_PTR)pNtHeader); - return FALSE; + //return FALSE; } if (pNtHeader->FileHeader.SizeOfOptionalHeader & (sizeof (ULONG_PTR) - 1)) From b5ee75ecc515721dcb8a09d5fddbe04787cff102 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 3 Dec 2019 16:01:22 +0000 Subject: [PATCH 12/12] Update package to get additional C2 list from extracted DLL --- CAPE/CAPE.c | 1068 ++++++++++++++-------- CAPE/CAPE.h | 18 +- CAPE/Debugger.c | 1485 ++++++++++++++++--------------- CAPE/Debugger.h | 14 +- CAPE/GetThreadId.c | 10 +- CAPE/Output.c | 176 +++- CAPE/QakBot.c | 79 +- CAPE/Scylla/ApiReader.cpp | 10 +- CAPE/Scylla/PeParser.cpp | 234 ++--- CAPE/Scylla/ProcessAccessHelp.h | 1 + CAPE/ScyllaHarness.cpp | 621 ++++++++++--- CAPE/wow64_fix.c | 79 +- config.c | 259 +++++- config.h | 31 +- cuckoomon.c | 212 +++-- cuckoomon.vcxproj | 2 +- hook_crypto.c | 42 + hook_file.c | 37 +- hook_misc.c | 361 +++++++- hook_process.c | 265 ++++-- hook_reg.c | 46 +- hook_services.c | 6 +- hook_sleep.c | 51 +- hook_special.c | 18 +- hook_sync.c | 9 + hook_thread.c | 87 +- hook_window.c | 128 +-- hooking.c | 113 ++- hooking.h | 1 + hooking_32.c | 7 +- hooking_64.c | 7 +- hooks.h | 159 +++- log.c | 2 +- lookup.c | 7 +- lookup.h | 1 + misc.c | 71 +- misc.h | 18 +- ntapi.h | 18 +- unhook.c | 53 +- 39 files changed, 3949 insertions(+), 1857 deletions(-) diff --git a/CAPE/CAPE.c b/CAPE/CAPE.c index 8d1a3d6..8c27ae0 100644 --- a/CAPE/CAPE.c +++ b/CAPE/CAPE.c @@ -15,17 +15,19 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.If not, see . */ -#define _CRT_RAND_S +#define _CRT_RAND_S #define MD5LEN 16 #define MAX_PRETRAMP_SIZE 320 #define MAX_TRAMP_SIZE 128 +#define MAX_UNICODE_PATH 32768 -#define BUFSIZE 1024 // For hashing -#define DUMP_MAX 100 +#define BUFSIZE 1024 // For hashing +#define DUMP_MAX 100 #define CAPE_OUTPUT_FILE "CapeOutput.bin" +#define SUSPENDED_THREAD_MAX 4096 -#include +#include #include #include #include @@ -37,12 +39,14 @@ along with this program.If not, see . #include #include #include +#include #include "CAPE.h" #include "Debugger.h" #include "..\alloc.h" #include "..\pipe.h" #include "..\config.h" +#include "..\lookup.h" #pragma comment(lib, "Shlwapi.lib") @@ -100,16 +104,21 @@ typedef struct _hook_info_t { ULONG_PTR main_caller_retaddr; ULONG_PTR parent_caller_retaddr; } hook_info_t; - + +extern hook_t g_hooks[]; + extern uint32_t path_from_handle(HANDLE handle, wchar_t *path, uint32_t path_buffer_len); +extern wchar_t *ensure_absolute_unicode_path(wchar_t *out, const wchar_t *in); extern int called_by_hook(void); extern int operate_on_backtrace(ULONG_PTR _esp, ULONG_PTR _ebp, void *extra, int(*func)(void *, ULONG_PTR)); extern unsigned int address_is_in_stack(PVOID Address); extern hook_info_t *hook_info(); extern ULONG_PTR base_of_dll_of_interest; -extern wchar_t *our_process_path; +extern wchar_t *our_process_path_w; +extern wchar_t *our_commandline; extern ULONG_PTR g_our_dll_base; extern DWORD g_our_dll_size; +extern lookup_t g_caller_regions; extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); extern void DoOutputErrorString(_In_ LPCTSTR lpOutputString, ...); @@ -120,13 +129,19 @@ extern int ScyllaDumpProcess(HANDLE hProcess, DWORD_PTR modBase, DWORD_PTR NewOE extern int ScyllaDumpCurrentProcessFixImports(DWORD_PTR NewOEP); extern int ScyllaDumpProcessFixImports(HANDLE hProcess, DWORD_PTR modBase, DWORD_PTR NewOEP); extern int ScyllaDumpPE(DWORD_PTR Buffer); -extern BOOL SetInitialBreakpoints(PVOID ImageBase); +extern int ScyllaDumpPEToFileHandle(DWORD_PTR Buffer, HANDLE FileHandle); +extern unsigned int ScyllaDumpProcessToFileHandle(HANDLE hProcess, DWORD_PTR ModuleBase, DWORD_PTR NewOEP, HANDLE FileHandle); extern BOOL CountDepth(LPVOID* ReturnAddress, LPVOID Address); extern SIZE_T GetPESize(PVOID Buffer); extern LPVOID GetReturnAddress(hook_info_t *hookinfo); extern PVOID CallingModule; +#ifdef CAPE_TRACE +extern BOOL SetInitialBreakpoints(PVOID ImageBase); +extern BOOL BreakpointsSet; +#endif BOOL ProcessDumped, FilesDumped, ModuleDumped; +static PVOID ImageBase; static unsigned int DumpCount; static __inline ULONG_PTR get_stack_top(void) @@ -146,8 +161,11 @@ static __inline ULONG_PTR get_stack_bottom(void) return __readgsqword(0x10); #endif } + +CRITICAL_SECTION ProcessDumpCriticalSection; + //************************************************************************************** -BOOL InsideHook(LPVOID* ReturnAddress, LPVOID Address) +BOOL InsideMonitor(LPVOID* ReturnAddress, LPVOID Address) //************************************************************************************** { if ((ULONG_PTR)Address >= g_our_dll_base && (ULONG_PTR)Address < (g_our_dll_base + g_our_dll_size)) @@ -156,7 +174,7 @@ BOOL InsideHook(LPVOID* ReturnAddress, LPVOID Address) *ReturnAddress = Address; return TRUE; } - + return FALSE; } @@ -180,8 +198,8 @@ LPVOID GetReturnAddress(hook_info_t *hookinfo) operate_on_backtrace(hookinfo->stack_pointer, hookinfo->frame_pointer, &ReturnAddress, GetCurrentFrame); return ReturnAddress; } - __except(EXCEPTION_EXECUTE_HANDLER) - { + __except(EXCEPTION_EXECUTE_HANDLER) + { #ifdef _WIN64 DoOutputDebugString("GetReturnAddress: Exception trying to get return address with Rip 0x%p.\n", hookinfo->frame_pointer); #else @@ -192,11 +210,15 @@ LPVOID GetReturnAddress(hook_info_t *hookinfo) } //************************************************************************************** -PVOID GetHookCallerBase() +PVOID GetHookCallerBase(hook_info_t *hookinfo) //************************************************************************************** { PVOID ReturnAddress, AllocationBase; - hook_info_t *hookinfo = hook_info(); + if (!hookinfo) + { + DoOutputDebugString("GetHookCallerBase: hookinfo NULL.\n"); + hookinfo = hook_info(); + } if (hookinfo->main_caller_retaddr) ReturnAddress = (PVOID)hookinfo->main_caller_retaddr; @@ -208,7 +230,7 @@ PVOID GetHookCallerBase() if (ReturnAddress) { DWORD ThreadId = GetCurrentThreadId(); - + AllocationBase = GetAllocationBase(ReturnAddress); DoOutputDebugString("GetHookCallerBase: thread %d (handle 0x%x), return address 0x%p, allocation base 0x%p.\n", ThreadId, GetThreadHandle(ThreadId), ReturnAddress, AllocationBase); @@ -230,15 +252,15 @@ void PrintHexBytes(__in char* TextBuffer, __in BYTE* HexBuffer, __in unsigned in //************************************************************************************** { unsigned int i; - + if (HexBuffer == NULL) return; - + for (i=0; iTargetPid = TargetPid; - + if (CapeMetaData->TargetProcess == NULL) { DoOutputDebugString("SetCapeMetaData: failed to allocate memory for target process string.\n"); return FALSE; } - + if (CapeMetaData->TargetProcess == NULL && !GetModuleFileNameEx(hTargetProcess, NULL, CapeMetaData->TargetProcess, MAX_PATH)) { CapeMetaData->TargetProcess = (char*)malloc(MAX_PATH); @@ -423,7 +445,7 @@ BOOL MapFile(HANDLE hFile, unsigned char **Buffer, DWORD* FileSize) { LARGE_INTEGER LargeFileSize; DWORD dwBytesRead; - + if (!GetFileSizeEx(hFile, &LargeFileSize)) { DoOutputErrorString("MapFile: Cannot get file size"); @@ -443,23 +465,23 @@ BOOL MapFile(HANDLE hFile, unsigned char **Buffer, DWORD* FileSize) } *FileSize = LargeFileSize.LowPart; - + DoOutputDebugString("File size: 0x%x", *FileSize); - + *Buffer = malloc(*FileSize); - + if (SetFilePointer(hFile, 0, 0, FILE_BEGIN)) { DoOutputErrorString("MapFile: Failed to set file pointer"); - return FALSE; + return FALSE; } - + if (*Buffer == NULL) { DoOutputErrorString("MapFile: Memory allocation error in MapFile"); return FALSE; } - + if (FALSE == ReadFile(hFile, (LPVOID)*Buffer, *FileSize, &dwBytesRead, NULL)) { DoOutputErrorString("ReadFile error"); @@ -480,7 +502,7 @@ BOOL MapFile(HANDLE hFile, unsigned char **Buffer, DWORD* FileSize) free(Buffer); return FALSE; } - + return TRUE; } @@ -488,19 +510,19 @@ BOOL MapFile(HANDLE hFile, unsigned char **Buffer, DWORD* FileSize) PINJECTIONINFO GetInjectionInfo(DWORD ProcessId) //************************************************************************************** { - DWORD CurrentProcessId; - + DWORD CurrentProcessId; + PINJECTIONINFO CurrentInjectionInfo = InjectionInfoList; while (CurrentInjectionInfo) { CurrentProcessId = CurrentInjectionInfo->ProcessId; - + if (CurrentProcessId == ProcessId) return CurrentInjectionInfo; else CurrentInjectionInfo = CurrentInjectionInfo->NextInjectionInfo; } - + return NULL; } @@ -511,53 +533,53 @@ PINJECTIONINFO CreateInjectionInfo(DWORD ProcessId) PINJECTIONINFO CurrentInjectionInfo, PreviousInjectionInfo; PreviousInjectionInfo = NULL; - + if (InjectionInfoList == NULL) { InjectionInfoList = ((struct InjectionInfo*)malloc(sizeof(struct InjectionInfo))); - + if (InjectionInfoList == NULL) { DoOutputDebugString("CreateInjectionInfo: failed to allocate memory for initial injection info list.\n"); return NULL; } - + memset(InjectionInfoList, 0, sizeof(struct InjectionInfo)); - + InjectionInfoList->ProcessId = ProcessId; } CurrentInjectionInfo = InjectionInfoList; - + while (CurrentInjectionInfo) - { + { if ((CurrentInjectionInfo->ProcessId) == ProcessId) - break; - + break; + PreviousInjectionInfo = CurrentInjectionInfo; CurrentInjectionInfo = CurrentInjectionInfo->NextInjectionInfo; } - + if (!CurrentInjectionInfo) { // We haven't found it in the linked list, so create a new one CurrentInjectionInfo = PreviousInjectionInfo; - + CurrentInjectionInfo->NextInjectionInfo = ((struct InjectionInfo*)malloc(sizeof(struct InjectionInfo))); - + if (CurrentInjectionInfo->NextInjectionInfo == NULL) { DoOutputDebugString("CreateInjectionInfo: Failed to allocate new thread breakpoints.\n"); return NULL; } - + memset(CurrentInjectionInfo->NextInjectionInfo, 0, sizeof(struct InjectionInfo)); - + CurrentInjectionInfo = CurrentInjectionInfo->NextInjectionInfo; - + CurrentInjectionInfo->ProcessId = ProcessId; } - + return CurrentInjectionInfo; } @@ -566,7 +588,7 @@ PINJECTIONSECTIONVIEW GetSectionView(HANDLE SectionHandle) //************************************************************************************** { PINJECTIONSECTIONVIEW CurrentSectionView = SectionViewList; - + while (CurrentSectionView) { if (CurrentSectionView->SectionHandle == SectionHandle) @@ -577,7 +599,7 @@ PINJECTIONSECTIONVIEW GetSectionView(HANDLE SectionHandle) CurrentSectionView = CurrentSectionView->NextSectionView; } - + return NULL; } @@ -588,56 +610,56 @@ PINJECTIONSECTIONVIEW AddSectionView(HANDLE SectionHandle, PVOID LocalView, SIZE PINJECTIONSECTIONVIEW CurrentSectionView, PreviousSectionView; PreviousSectionView = NULL; - + if (SectionViewList == NULL) { SectionViewList = ((struct InjectionSectionView*)malloc(sizeof(struct InjectionSectionView))); - + if (SectionViewList == NULL) { DoOutputDebugString("AddSectionView: failed to allocate memory for initial section view list.\n"); return NULL; } - + memset(SectionViewList, 0, sizeof(struct InjectionSectionView)); - + SectionViewList->SectionHandle = SectionHandle; SectionViewList->LocalView = LocalView; SectionViewList->ViewSize = ViewSize; } CurrentSectionView = SectionViewList; - + while (CurrentSectionView) { if ((CurrentSectionView->SectionHandle) == SectionHandle) - break; - + break; + PreviousSectionView = CurrentSectionView; CurrentSectionView = CurrentSectionView->NextSectionView; } - + if (!CurrentSectionView) { // We haven't found it in the linked list, so create a new one CurrentSectionView = PreviousSectionView; - + CurrentSectionView->NextSectionView = ((struct InjectionSectionView*)malloc(sizeof(struct InjectionSectionView))); - + if (CurrentSectionView->NextSectionView == NULL) { DoOutputDebugString("CreateSectionView: Failed to allocate new injection sectionview structure.\n"); return NULL; } - + memset(CurrentSectionView->NextSectionView, 0, sizeof(struct InjectionSectionView)); - + CurrentSectionView = CurrentSectionView->NextSectionView; CurrentSectionView->SectionHandle = SectionHandle; - CurrentSectionView->LocalView = LocalView; - CurrentSectionView->ViewSize = ViewSize; + CurrentSectionView->LocalView = LocalView; + CurrentSectionView->ViewSize = ViewSize; } - + return CurrentSectionView; } @@ -648,7 +670,7 @@ BOOL DropSectionView(PINJECTIONSECTIONVIEW SectionView) PINJECTIONSECTIONVIEW CurrentSectionView, PreviousSectionView; PreviousSectionView = NULL; - + if (SectionViewList == NULL) { DoOutputDebugString("DropSectionView: failed to obtain initial section view list.\n"); @@ -656,7 +678,7 @@ BOOL DropSectionView(PINJECTIONSECTIONVIEW SectionView) } CurrentSectionView = SectionViewList; - + while (CurrentSectionView) { if (CurrentSectionView == SectionView) @@ -677,16 +699,16 @@ BOOL DropSectionView(PINJECTIONSECTIONVIEW SectionView) SectionViewList = NULL; DoOutputDebugString("DropSectionView: removed the head of the section view list.\n"); } - + free(CurrentSectionView); - - return TRUE; + + return TRUE; } - + PreviousSectionView = CurrentSectionView; CurrentSectionView = CurrentSectionView->NextSectionView; } - + return FALSE; } @@ -699,7 +721,7 @@ void DumpSectionViewsForPid(DWORD Pid) DWORD BufferSize = MAX_PATH; LPVOID PEPointer = NULL; BOOL Dumped = FALSE; - + CurrentInjectionInfo = GetInjectionInfo(Pid); if (CurrentInjectionInfo == NULL) @@ -715,13 +737,13 @@ void DumpSectionViewsForPid(DWORD Pid) if (CurrentSectionView->TargetProcessId == Pid && CurrentSectionView->LocalView) { DoOutputDebugString("DumpSectionViewsForPid: Shared section view found with pid %d, local address 0x%p.\n", Pid); - + PEPointer = CurrentSectionView->LocalView; - + while (ScanForDisguisedPE(PEPointer, CurrentSectionView->ViewSize - ((DWORD_PTR)PEPointer - (DWORD_PTR)CurrentSectionView->LocalView), &PEPointer)) { DoOutputDebugString("DumpSectionViewsForPid: Dumping PE image from shared section view, local address 0x%p.\n", PEPointer); - + CapeMetaData->DumpType = INJECTION_PE; CapeMetaData->TargetPid = Pid; CapeMetaData->Address = PEPointer; @@ -733,35 +755,35 @@ void DumpSectionViewsForPid(DWORD Pid) } else DoOutputDebugString("DumpSectionViewsForPid: Failed to dump PE image from shared section view.\n"); - + ((BYTE*)PEPointer)++; } - + if (Dumped == FALSE) { DoOutputDebugString("DumpSectionViewsForPid: no PE file found in shared section view, attempting raw dump.\n"); - + CapeMetaData->DumpType = INJECTION_SHELLCODE; - + CapeMetaData->TargetPid = Pid; - + if (DumpMemory(CurrentSectionView->LocalView, CurrentSectionView->ViewSize)) { DoOutputDebugString("DumpSectionViewsForPid: Dumped shared section view."); Dumped = TRUE; } else - DoOutputDebugString("DumpSectionViewsForPid: Failed to dump shared section view."); + DoOutputDebugString("DumpSectionViewsForPid: Failed to dump shared section view."); } } - + //DropSectionView(CurrentSectionView); - + CurrentSectionView = CurrentSectionView->NextSectionView; } - + if (Dumped == FALSE) - DoOutputDebugString("DumpSectionViewsForPid: no shared section views found for pid %d.\n", Pid); + DoOutputDebugString("DumpSectionViewsForPid: no shared section views found for pid %d.\n", Pid); return; } @@ -773,7 +795,7 @@ void DumpSectionView(PINJECTIONSECTIONVIEW SectionView) DWORD BufferSize = MAX_PATH; LPVOID PEPointer = NULL; BOOL Dumped = FALSE; - + if (!SectionView->LocalView) { DoOutputDebugString("DumpSectionView: Section view local view address not set.\n"); @@ -785,95 +807,106 @@ void DumpSectionView(PINJECTIONSECTIONVIEW SectionView) DoOutputDebugString("DumpSectionView: Section view has no target process - error.\n"); return; } - + Dumped = DumpPEsInRange(SectionView->LocalView, SectionView->ViewSize); - + if (Dumped) DoOutputDebugString("DumpSectionView: Dumped PE image from shared section view, local address 0x%p.\n", SectionView->LocalView); else { DoOutputDebugString("DumpSectionView: no PE file found in shared section view, attempting raw dump.\n"); - + CapeMetaData->DumpType = INJECTION_SHELLCODE; - + CapeMetaData->TargetPid = SectionView->TargetProcessId; - + if (DumpMemory(SectionView->LocalView, SectionView->ViewSize)) { DoOutputDebugString("DumpSectionView: Dumped shared section view."); Dumped = TRUE; } else - DoOutputDebugString("DumpSectionView: Failed to dump shared section view."); + DoOutputDebugString("DumpSectionView: Failed to dump shared section view."); } - + if (Dumped == TRUE) DropSectionView(SectionView); - + return; } //************************************************************************************** -char* GetName() +char* GetResultsPath(char* FolderName) //************************************************************************************** { - char *OutputFilename, *FullPathName; - SYSTEMTIME Time; + char *FullPath; DWORD RetVal; - unsigned int random; - - FullPathName = (char*) malloc(MAX_PATH); - if (FullPathName == NULL) + FullPath = (char*)malloc(MAX_PATH); + + if (FullPath == NULL) { - DoOutputErrorString("GetName: Error allocating memory for full path string"); - return 0; + DoOutputErrorString("GetResultsPath: Error allocating memory for full path string"); + return 0; } - + + // We want to dump output to the 'results' directory + memset(FullPath, 0, MAX_PATH); + + strncpy_s(FullPath, MAX_PATH, g_config.results, strlen(g_config.results)+1); + + if (strlen(FullPath) + 1 + strlen(FolderName) >= MAX_PATH) + { + DoOutputDebugString("GetResultsPath: Error, destination path too long.\n"); + free(FullPath); + return 0; + } + + PathAppend(FullPath, FolderName); + + RetVal = CreateDirectory(FullPath, NULL); + + if (RetVal == 0 && GetLastError() != ERROR_ALREADY_EXISTS) + { + DoOutputDebugString("GetResultsPath: Error creating output directory.\n"); + free(FullPath); + return 0; + } + + return FullPath; +} + +//************************************************************************************** +char* GetName() +//************************************************************************************** +{ + char *FullPathName,*OutputFilename; + SYSTEMTIME Time; + unsigned int random; + + FullPathName = GetResultsPath("CAPE"); + OutputFilename = (char*)malloc(MAX_PATH); - + if (OutputFilename == NULL) { - DoOutputErrorString("GetName: failed to allocate memory for file name string"); + DoOutputErrorString("DumpMemory: failed to allocate memory for file name string"); return 0; } - + GetSystemTime(&Time); - + if (rand_s(&random)) { - DoOutputErrorString("GetName: failed to obtain a random number"); + DoOutputErrorString("DumpMemory: failed to obtain a random number"); return 0; } - - sprintf_s(OutputFilename, MAX_PATH*sizeof(char), "%d_%d%d%d%d%d%d%d%d", GetCurrentProcessId(), abs(random * Time.wMilliseconds), Time.wSecond, Time.wMinute, Time.wHour, Time.wDay, Time.wDayOfWeek, Time.wMonth, Time.wYear); - - // We want to dump CAPE output to the 'analyzer' directory - memset(FullPathName, 0, MAX_PATH); - - strncpy_s(FullPathName, MAX_PATH, g_config.analyzer, strlen(g_config.analyzer)+1); - - if (strlen(FullPathName) + strlen("\\CAPE\\") + strlen(OutputFilename) >= MAX_PATH) - { - DoOutputDebugString("GetName: Error, CAPE destination path too long."); - free(OutputFilename); - free(FullPathName); - return 0; - } - - PathAppend(FullPathName, "CAPE"); - RetVal = CreateDirectory(FullPathName, NULL); + sprintf_s(OutputFilename, MAX_PATH*sizeof(char), "%d_%d%d%d%d%d%d%d%d", GetCurrentProcessId(), abs(random * Time.wMilliseconds), Time.wSecond, Time.wMinute, Time.wHour, Time.wDay, Time.wDayOfWeek, Time.wMonth, Time.wYear); - if (RetVal == 0 && GetLastError() != ERROR_ALREADY_EXISTS) - { - DoOutputDebugString("GetName: Error creating output directory"); - free(OutputFilename); - free(FullPathName); - return 0; - } + PathAppend(FullPathName, OutputFilename); - PathAppend(FullPathName, OutputFilename); + free(OutputFilename); return FullPathName; } @@ -898,14 +931,14 @@ BOOL GetHash(unsigned char* Buffer, unsigned int Size, char* OutputFilenameBuffe if (!CryptCreateHash(hProv, CALG_MD5, 0, 0, &hHash)) { - DoOutputErrorString("CryptCreateHash failed"); + DoOutputErrorString("CryptCreateHash failed"); CryptReleaseContext(hProv, 0); return 0; } if (!CryptHashData(hHash, Buffer, Size, 0)) { - DoOutputErrorString("CryptHashData failed"); + DoOutputErrorString("CryptHashData failed"); CryptReleaseContext(hProv, 0); CryptDestroyHash(hHash); return 0; @@ -914,17 +947,17 @@ BOOL GetHash(unsigned char* Buffer, unsigned int Size, char* OutputFilenameBuffe cbHash = MD5LEN; if (!CryptGetHashParam(hHash, HP_HASHVAL, MD5Hash, &cbHash, 0)) { - DoOutputErrorString("CryptGetHashParam failed"); + DoOutputErrorString("CryptGetHashParam failed"); } CryptDestroyHash(hHash); CryptReleaseContext(hProv, 0); - + for (i = 0; i < cbHash; i++) { PrintHexBytes(OutputFilenameBuffer, MD5Hash, MD5LEN); } - + return 1; } @@ -939,25 +972,25 @@ char* GetHashFromHandle(HANDLE hFile) char * OutputFilenameBuffer; if (!MapFile(hFile, &Buffer, &FileSize)) - { + { DoOutputErrorString("MapFile error - check the path is valid and the file has size."); return 0; } - + OutputFilenameBuffer = (char*) malloc(MAX_PATH); if (OutputFilenameBuffer == NULL) { DoOutputErrorString("Error allocating memory for hash string"); - return 0; + return 0; } - + if (!GetHash(Buffer, FileSize, (char*)OutputFilenameBuffer)) { DoOutputErrorString("GetHashFromHandle: GetHash function failed"); - return 0; + return 0; } - + DoOutputDebugString("GetHash returned: %s", OutputFilenameBuffer); // Check if we have a valid DOS and PE header at the beginning of Buffer @@ -985,12 +1018,12 @@ char* GetHashFromHandle(HANDLE hFile) } } } - + CloseHandle(hFile); - + // We don't need the file buffer any more free(Buffer); - + // We leak the OutputFilenameBuffer return OutputFilenameBuffer; } @@ -1002,7 +1035,7 @@ int DumpXorPE(LPBYTE Buffer, unsigned int Size) LONG e_lfanew; DWORD NT_Signature; unsigned int i, j, k; - BYTE* DecryptedBuffer; + BYTE* DecryptedBuffer = NULL; for (i=0; i<=0xFF; i++) { @@ -1014,23 +1047,23 @@ int DumpXorPE(LPBYTE Buffer, unsigned int Size) e_lfanew = (LONG)*(DWORD*)(Buffer+0x3c); DoOutputDebugString("Encrypted e_lfanew: 0x%x", e_lfanew); - + for (j=0; j PE_HEADER_LIMIT) - { + { DoOutputDebugString("The pointer to the PE header seems a tad large: 0x%x", e_lfanew); //return FALSE; } // let's get the NT signature a.k.a PE header memcpy(&NT_Signature, Buffer+e_lfanew, 4); - + DoOutputDebugString("Encrypted NT_Signature: 0x%x", NT_Signature); - + // let's try decrypting it with the key for (k=0; k<4; k++) *((BYTE*)&NT_Signature+k) = *((BYTE*)&NT_Signature+k)^i; @@ -1041,23 +1074,23 @@ int DumpXorPE(LPBYTE Buffer, unsigned int Size) if (NT_Signature == IMAGE_NT_SIGNATURE) { DoOutputDebugString("Xor-encrypted PE detected, about to dump.\n"); - + DecryptedBuffer = (BYTE*)malloc(Size); - + if (DecryptedBuffer == NULL) { DoOutputErrorString("Error allocating memory for decrypted PE binary"); return FALSE; } - + memcpy(DecryptedBuffer, Buffer, Size); - + for (k=0; kAddress = DecryptedBuffer; DumpImageInCurrentProcess(DecryptedBuffer); - + free(DecryptedBuffer); return i; } @@ -1068,10 +1101,11 @@ int DumpXorPE(LPBYTE Buffer, unsigned int Size) } } } - + // We free can free DecryptedBuffer as it's no longer needed - free(DecryptedBuffer); - + if(DecryptedBuffer) + free(DecryptedBuffer); + return FALSE; } @@ -1081,32 +1115,32 @@ int ScanPageForNonZero(LPVOID Address) { unsigned int p; DWORD_PTR AddressOfPage; - + if (!Address) - { + { DoOutputDebugString("ScanPageForNonZero: Error - Supplied address zero.\n"); return 0; } - + if (!SystemInfo.dwPageSize) GetSystemInfo(&SystemInfo); - + if (!SystemInfo.dwPageSize) { DoOutputErrorString("ScanPageForNonZero: Failed to obtain system page size.\n"); return 0; } - + AddressOfPage = ((DWORD_PTR)Address/SystemInfo.dwPageSize)*SystemInfo.dwPageSize; - - __try - { + + __try + { for (p=0; pe_lfanew == 0) + if ((ULONG)pDosHeader->e_lfanew == 0) { // e_lfanew is zero continue; @@ -1196,39 +1230,39 @@ int ScanForPE(LPVOID Buffer, SIZE_T Size, LPVOID* Offset) // e_lfanew points beyond end of region continue; } - + pNtHeader = (PIMAGE_NT_HEADERS)((PUCHAR)pDosHeader + (ULONG)pDosHeader->e_lfanew); - - if (pNtHeader->Signature != IMAGE_NT_SIGNATURE) + + if (pNtHeader->Signature != IMAGE_NT_SIGNATURE) { // No 'PE' header - continue; + continue; } - - if ((pNtHeader->FileHeader.Machine == 0) || (pNtHeader->FileHeader.SizeOfOptionalHeader == 0 || pNtHeader->OptionalHeader.SizeOfHeaders == 0)) + + if ((pNtHeader->FileHeader.Machine == 0) || (pNtHeader->FileHeader.SizeOfOptionalHeader == 0 || pNtHeader->OptionalHeader.SizeOfHeaders == 0)) { // Basic requirements DoOutputDebugString("ScanForPE: Basic requirements failure.\n"); continue; } - + if (Offset) { *Offset = (LPVOID)((char*)Buffer+p); } - + DoOutputDebugString("ScanForPE: PE image located at: 0x%x\n", (DWORD_PTR)((char*)Buffer+p)); - + return 1; } - } - __except(EXCEPTION_EXECUTE_HANDLER) - { + } + __except(EXCEPTION_EXECUTE_HANDLER) + { DoOutputDebugString("ScanForPE: Exception occured reading memory address 0x%x\n", (DWORD_PTR)((char*)Buffer+p)); return 0; } } - + DoOutputDebugString("ScanForPE: No PE image located at 0x%x.\n", Buffer); return 0; } @@ -1237,8 +1271,8 @@ int ScanForPE(LPVOID Buffer, SIZE_T Size, LPVOID* Offset) BOOL TestPERequirements(PIMAGE_NT_HEADERS pNtHeader) //************************************************************************************** { - __try - { + __try + { if ((pNtHeader->OptionalHeader.Magic != IMAGE_NT_OPTIONAL_HDR32_MAGIC) && (pNtHeader->OptionalHeader.Magic != IMAGE_NT_OPTIONAL_HDR64_MAGIC)) { //DoOutputDebugString("TestPERequirements: OptionalHeader.Magic bad. (0x%x)", (DWORD_PTR)pNtHeader); // extremely noisy @@ -1246,49 +1280,49 @@ BOOL TestPERequirements(PIMAGE_NT_HEADERS pNtHeader) } //else // DoOutputDebugString("TestPERequirements: OptionalHeader.Magic ok!: 0x%x (0x%x)", pNtHeader->OptionalHeader.Magic, (DWORD_PTR)pNtHeader); - + // Basic requirements - if + if ( - pNtHeader->FileHeader.Machine == 0 || - pNtHeader->FileHeader.SizeOfOptionalHeader == 0 || + pNtHeader->FileHeader.Machine == 0 || + pNtHeader->FileHeader.SizeOfOptionalHeader == 0 || pNtHeader->OptionalHeader.SizeOfHeaders == 0 //|| //pNtHeader->OptionalHeader.FileAlignment == 0 - ) + ) { - //DoOutputDebugString("TestPERequirements: Basic requirements failure (0x%x).\n", (DWORD_PTR)pNtHeader); // very noisy + //DoOutputDebugString("TestPERequirements: Basic requirements failure (0x%x).\n", (DWORD_PTR)pNtHeader); // very noisy return FALSE; } - if (!(pNtHeader->FileHeader.Characteristics & IMAGE_FILE_EXECUTABLE_IMAGE)) + if (!(pNtHeader->FileHeader.Characteristics & IMAGE_FILE_EXECUTABLE_IMAGE)) { DoOutputDebugString("TestPERequirements: Characteristics bad. (0x%x)", (DWORD_PTR)pNtHeader); - //return FALSE; + return FALSE; } - if (pNtHeader->FileHeader.SizeOfOptionalHeader & (sizeof (ULONG_PTR) - 1)) + if (pNtHeader->FileHeader.SizeOfOptionalHeader & (sizeof (ULONG_PTR) - 1)) { DoOutputDebugString("TestPERequirements: SizeOfOptionalHeader bad. (0x%x)", (DWORD_PTR)pNtHeader); return FALSE; } - - if (((pNtHeader->OptionalHeader.FileAlignment-1) & pNtHeader->OptionalHeader.FileAlignment) != 0) + + if (((pNtHeader->OptionalHeader.FileAlignment-1) & pNtHeader->OptionalHeader.FileAlignment) != 0) { DoOutputDebugString("TestPERequirements: FileAlignment invalid. (0x%x)", (DWORD_PTR)pNtHeader); return FALSE; } - - if (pNtHeader->OptionalHeader.SectionAlignment < pNtHeader->OptionalHeader.FileAlignment) - { + + if (pNtHeader->OptionalHeader.SectionAlignment < pNtHeader->OptionalHeader.FileAlignment) + { DoOutputDebugString("TestPERequirements: FileAlignment greater than SectionAlignment.\n (0x%x)", (DWORD_PTR)pNtHeader); - return FALSE; - } + return FALSE; + } // To pass the above tests it should now be safe to assume it's a PE image return TRUE; - } - __except(EXCEPTION_EXECUTE_HANDLER) - { + } + __except(EXCEPTION_EXECUTE_HANDLER) + { DoOutputDebugString("TestPERequirements: Exception occured reading region at 0x%x\n", (DWORD_PTR)(pNtHeader)); return FALSE; } @@ -1301,14 +1335,14 @@ int IsDisguisedPEHeader(LPVOID Buffer) PIMAGE_DOS_HEADER pDosHeader; PIMAGE_NT_HEADERS pNtHeader = NULL; WORD* MachineProbe; - - __try - { + + __try + { pDosHeader = (PIMAGE_DOS_HEADER)Buffer; if (pDosHeader->e_lfanew && (ULONG)pDosHeader->e_lfanew < PE_HEADER_LIMIT && ((ULONG)pDosHeader->e_lfanew & 3) == 0) pNtHeader = (PIMAGE_NT_HEADERS)((PUCHAR)pDosHeader + (ULONG)pDosHeader->e_lfanew); - + if (!pDosHeader->e_lfanew) { // In case the header until and including 'PE' has been zeroed @@ -1321,7 +1355,7 @@ int IsDisguisedPEHeader(LPVOID Buffer) break; } MachineProbe += sizeof(WORD); - } + } } if (pNtHeader && TestPERequirements(pNtHeader)) @@ -1341,17 +1375,17 @@ int IsDisguisedPEHeader(LPVOID Buffer) } } MachineProbe += sizeof(WORD); - } + } if (pNtHeader && TestPERequirements(pNtHeader)) - return 1; - } - __except(EXCEPTION_EXECUTE_HANDLER) - { - DoOutputDebugString("IsDisguisedPEHeader: Exception occured reading region at 0x%x\n", (DWORD_PTR)(Buffer)); - return -1; + return 1; } - + __except(EXCEPTION_EXECUTE_HANDLER) + { + //DoOutputDebugString("IsDisguisedPEHeader: Exception occured reading region at 0x%x\n", (DWORD_PTR)(Buffer)); + return 0; + } + //DoOutputDebugString("IsDisguisedPEHeader: No PE image located\n (0x%x)", (DWORD_PTR)Buffer); return 0; } @@ -1362,17 +1396,17 @@ int ScanForDisguisedPE(LPVOID Buffer, SIZE_T Size, LPVOID* Offset) { SIZE_T p; int RetVal; - + if (Size == 0) { DoOutputDebugString("ScanForDisguisedPE: Error, zero size given\n"); return 0; } - + for (p=0; p < Size - PE_HEADER_LIMIT; p++) // we want to stop short of the max look-ahead in IsDisguisedPEHeader { RetVal = IsDisguisedPEHeader((BYTE*)Buffer+p); - + if (!RetVal) continue; else if (RetVal == -1) @@ -1380,17 +1414,17 @@ int ScanForDisguisedPE(LPVOID Buffer, SIZE_T Size, LPVOID* Offset) DoOutputDebugString("ScanForDisguisedPE: Exception occured scanning buffer at 0x%x\n", (DWORD_PTR)((BYTE*)Buffer+p)); return 0; } - + if (Offset) { *Offset = (LPVOID)((BYTE*)Buffer+p); } - + DoOutputDebugString("ScanForDisguisedPE: PE image located at: 0x%x\n", (DWORD_PTR)((BYTE*)Buffer+p)); - + return 1; } - + DoOutputDebugString("ScanForDisguisedPE: No PE image located in range 0x%x-0x%x.\n", Buffer, (DWORD_PTR)Buffer + Size); return 0; } @@ -1402,20 +1436,20 @@ BOOL DumpPEsInRange(LPVOID Buffer, SIZE_T Size) PBYTE PEImage; PIMAGE_DOS_HEADER pDosHeader; PIMAGE_NT_HEADERS pNtHeader = NULL; - + BOOL RetVal = FALSE; LPVOID PEPointer = Buffer; - + DoOutputDebugString("DumpPEsInRange: Scanning range 0x%x - 0x%x.\n", Buffer, (BYTE*)Buffer + Size); while (ScanForDisguisedPE(PEPointer, Size - ((DWORD_PTR)PEPointer - (DWORD_PTR)Buffer), &PEPointer)) { pDosHeader = (PIMAGE_DOS_HEADER)PEPointer; - + if (*(WORD*)PEPointer != IMAGE_DOS_SIGNATURE || (*(DWORD*)((BYTE*)pDosHeader + pDosHeader->e_lfanew) != IMAGE_NT_SIGNATURE)) - { + { DoOutputDebugString("DumpPEsInRange: Disguised PE image (bad MZ and/or PE headers) at 0x%x.\n", PEPointer); - + // We want to fix the PE header in the dump (for e.g. disassembly etc) PEImage = (BYTE*)calloc(Size - ((DWORD_PTR)PEPointer - (DWORD_PTR)Buffer), sizeof(PUCHAR)); memcpy(PEImage, PEPointer, Size - ((DWORD_PTR)PEPointer - (DWORD_PTR)Buffer)); @@ -1434,7 +1468,7 @@ BOOL DumpPEsInRange(LPVOID Buffer, SIZE_T Size) } MachineProbe += sizeof(WORD); } - + if (pNtHeader) pDosHeader->e_lfanew = (LONG)((PUCHAR)pNtHeader - (PUCHAR)pDosHeader); } @@ -1455,7 +1489,7 @@ BOOL DumpPEsInRange(LPVOID Buffer, SIZE_T Size) } } MachineProbe += sizeof(WORD); - + if (pNtHeader && (PUCHAR)pNtHeader == (PUCHAR)pDosHeader && pNtHeader->OptionalHeader.SizeOfHeaders) { SIZE_T HeaderShift = sizeof(IMAGE_DOS_HEADER); @@ -1466,14 +1500,14 @@ BOOL DumpPEsInRange(LPVOID Buffer, SIZE_T Size) pDosHeader->e_lfanew = (LONG)((PUCHAR)pNtHeader - (PUCHAR)pDosHeader); DoOutputDebugString("DumpPEsInRange: pNtHeader moved from 0x%x to 0x%x, e_lfanew 0x%x\n", pDosHeader, pNtHeader, pDosHeader->e_lfanew); } - } + } } - + *(WORD*)pDosHeader = IMAGE_DOS_SIGNATURE; *(DWORD*)((PUCHAR)pDosHeader + pDosHeader->e_lfanew) = IMAGE_NT_SIGNATURE; SetCapeMetaData(INJECTION_PE, 0, NULL, (PVOID)pDosHeader); - + if (DumpImageInCurrentProcess((LPVOID)pDosHeader)) { DoOutputDebugString("DumpPEsInRange: Dumped PE image from 0x%x.\n", pDosHeader); @@ -1483,12 +1517,12 @@ BOOL DumpPEsInRange(LPVOID Buffer, SIZE_T Size) DoOutputDebugString("DumpPEsInRange: Failed to dump PE image from 0x%x.\n", pDosHeader); if (PEImage) - free(PEImage); + free(PEImage); } else { SetCapeMetaData(INJECTION_PE, 0, NULL, (PVOID)PEPointer); - + if (DumpImageInCurrentProcess((LPVOID)PEPointer)) { DoOutputDebugString("DumpPEsInRange: Dumped PE image from 0x%x.\n", PEPointer); @@ -1497,10 +1531,10 @@ BOOL DumpPEsInRange(LPVOID Buffer, SIZE_T Size) else DoOutputDebugString("DumpPEsInRange: Failed to dump PE image from 0x%x.\n", PEPointer); } - + (BYTE*)PEPointer += PE_HEADER_LIMIT; } - + return RetVal; } @@ -1516,7 +1550,7 @@ int DumpMemory(LPVOID Buffer, SIZE_T Size) FullPathName = GetName(); hOutputFile = CreateFile(FullPathName, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); - + if (hOutputFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_FILE_EXISTS) { DoOutputDebugString("DumpMemory: CAPE output filename exists already: %s", FullPathName); @@ -1528,35 +1562,35 @@ int DumpMemory(LPVOID Buffer, SIZE_T Size) { DoOutputErrorString("DumpMemory: Could not create CAPE output file"); free(FullPathName); - return 0; - } - + return 0; + } + dwBytesWritten = 0; - + DoOutputDebugString("DumpMemory: CAPE output file successfully created: %s", FullPathName); BufferCopy = (LPVOID)((BYTE*)malloc(Size)); - + if (BufferCopy == NULL) { DoOutputDebugString("DumpMemory: Failed to allocate memory for buffer copy.\n"); return FALSE; } - - __try - { + + __try + { memcpy(BufferCopy, Buffer, Size); - } - __except(EXCEPTION_EXECUTE_HANDLER) - { + } + __except(EXCEPTION_EXECUTE_HANDLER) + { DoOutputDebugString("DumpMemory: Exception occured reading memory address 0x%x\n", Buffer); return 0; } - + if (FALSE == WriteFile(hOutputFile, BufferCopy, (DWORD)Size, &dwBytesWritten, NULL)) { DoOutputErrorString("DumpMemory: WriteFile error on CAPE output file"); - free(FullPathName); + free(FullPathName); free(BufferCopy); return 0; } @@ -1565,13 +1599,13 @@ int DumpMemory(LPVOID Buffer, SIZE_T Size) CapeMetaData->Address = Buffer; CapeMetaData->Size = Size; - + CapeOutputFile(FullPathName); - + // We can free the filename buffers - free(FullPathName); + free(FullPathName); free(BufferCopy); - + return 1; } @@ -1582,10 +1616,10 @@ BOOL DumpRegion(PVOID Address) MEMORY_BASIC_INFORMATION MemInfo; PVOID OriginalAllocationBase, OriginalBaseAddress, AddressOfPage; SIZE_T AllocationSize, OriginalRegionSize; - + if (!SystemInfo.dwPageSize) GetSystemInfo(&SystemInfo); - + if (!SystemInfo.dwPageSize) { DoOutputErrorString("DumpRegion: Failed to obtain system page size.\n"); @@ -1597,12 +1631,12 @@ BOOL DumpRegion(PVOID Address) DoOutputErrorString("DumpRegion: unable to query memory address 0x%x", Address); return 0; } - + OriginalAllocationBase = MemInfo.AllocationBase; OriginalBaseAddress = MemInfo.BaseAddress; OriginalRegionSize = MemInfo.RegionSize; AddressOfPage = OriginalAllocationBase; - + while (MemInfo.AllocationBase == OriginalAllocationBase) { (PUCHAR)AddressOfPage += SystemInfo.dwPageSize; @@ -1611,9 +1645,9 @@ BOOL DumpRegion(PVOID Address) { DoOutputErrorString("DumpRegion: unable to query memory page 0x%x", AddressOfPage); return 0; - } + } } - + AllocationSize = (SIZE_T)((DWORD_PTR)AddressOfPage - (DWORD_PTR)OriginalAllocationBase); SetCapeMetaData(EXTRACTION_SHELLCODE, 0, NULL, (PVOID)OriginalAllocationBase); @@ -1629,9 +1663,9 @@ BOOL DumpRegion(PVOID Address) else { DoOutputDebugString("DumpRegion: Failed to dump entire allocation from 0x%p size 0x%x.\n", OriginalAllocationBase, AllocationSize); - + SetCapeMetaData(EXTRACTION_SHELLCODE, 0, NULL, (PVOID)OriginalBaseAddress); - + if (DumpMemory(OriginalBaseAddress, OriginalRegionSize)) { if (address_is_in_stack(Address)) @@ -1688,119 +1722,150 @@ int DumpCurrentProcess() } //************************************************************************************** -int DumpModuleInCurrentProcess(LPVOID ModuleBase) +int DumpImageInCurrentProcess(LPVOID ImageBase) //************************************************************************************** { PIMAGE_DOS_HEADER pDosHeader; + PIMAGE_NT_HEADERS pNtHeader; + + pDosHeader = (PIMAGE_DOS_HEADER)ImageBase; + + if (DumpCount >= DUMP_MAX) + { + DoOutputDebugString("DumpImageInCurrentProcess: CAPE dump limit reached.\n"); + return 0; + } - if (!IsDisguisedPEHeader(ModuleBase)) + if (*(WORD*)ImageBase != IMAGE_DOS_SIGNATURE) { - DoOutputDebugString("DumpModuleInCurrentProcess: Not a valid image at 0x%p - cannot dump.\n", ModuleBase); + DoOutputDebugString("DumpImageInCurrentProcess: No DOS signature in header.\n"); return 0; } - - pDosHeader = (PIMAGE_DOS_HEADER)ModuleBase; - - if (*(WORD*)ModuleBase != IMAGE_DOS_SIGNATURE || (*(DWORD*)((BYTE*)pDosHeader + pDosHeader->e_lfanew) != IMAGE_NT_SIGNATURE)) - { - PBYTE PEImage; - SIZE_T ImageSize; - - DoOutputDebugString("DumpModuleInCurrentProcess: Disguised PE image (bad MZ and/or PE headers) at 0x%p.\n", ModuleBase); - - // We want to fix the PE header in the dump (for e.g. disassembly etc) - ImageSize = GetPESize(ModuleBase); - PEImage = (BYTE*)malloc(ImageSize); - memcpy(PEImage, ModuleBase, ImageSize); - pDosHeader = (PIMAGE_DOS_HEADER)PEImage; - - *(WORD*)PEImage = IMAGE_DOS_SIGNATURE; - *(DWORD*)(PEImage + pDosHeader->e_lfanew) = IMAGE_NT_SIGNATURE; - - ModuleBase = PEImage; - } - - SetCapeMetaData(QAKBOT_PAYLOAD, 0, NULL, (PVOID)ModuleBase); - - if (DumpCount < DUMP_MAX && ScyllaDumpProcess(GetCurrentProcess(), (DWORD_PTR)ModuleBase, 0)) + + if (!pDosHeader->e_lfanew || pDosHeader->e_lfanew > PE_HEADER_LIMIT) { - DumpCount++; - return 1; + DoOutputDebugString("DumpImageInCurrentProcess: bad e_lfanew.\n"); + return 0; } - return 0; + pNtHeader = (PIMAGE_NT_HEADERS)((PUCHAR)pDosHeader + (ULONG)pDosHeader->e_lfanew); + + if (pNtHeader->Signature != IMAGE_NT_SIGNATURE) + { + // No 'PE' header + DoOutputDebugString("DumpImageInCurrentProcess: Invalid PE signature in header.\n"); + return 0; + } + + if ((pNtHeader->FileHeader.Machine == 0) || (pNtHeader->FileHeader.SizeOfOptionalHeader == 0 || pNtHeader->OptionalHeader.SizeOfHeaders == 0)) + { + // Basic requirements + DoOutputDebugString("DumpImageInCurrentProcess: PE image invalid.\n"); + return 0; + } + + if (IsPeImageVirtual(ImageBase) == FALSE) + { + DoOutputDebugString("DumpImageInCurrentProcess: Attempting to dump 'raw' PE image.\n"); + + if (ScyllaDumpPE((DWORD_PTR)ImageBase)) + { + DumpCount++; + return 1; + } + else + { + // failed to dump pe image + DoOutputDebugString("DumpImageInCurrentProcess: Failed to dump 'raw' PE image.\n"); + return 0; + } + } + + DoOutputDebugString("DumpImageInCurrentProcess: Attempting to dump virtual PE image.\n"); + + if (!ScyllaDumpProcess(GetCurrentProcess(), (DWORD_PTR)ImageBase, 0)) + { + DoOutputDebugString("DumpImageInCurrentProcess: Failed to dump PE as virtual image.\n"); + return 0; + } + + DumpCount++; + return 1; } //************************************************************************************** -int DumpImageInCurrentProcess(LPVOID ImageBase) +unsigned int DumpImageToFileHandle(LPVOID ImageBase, HANDLE FileHandle) //************************************************************************************** { + unsigned int BytesWritten; PIMAGE_DOS_HEADER pDosHeader; PIMAGE_NT_HEADERS pNtHeader; - + pDosHeader = (PIMAGE_DOS_HEADER)ImageBase; if (DumpCount >= DUMP_MAX) { - DoOutputDebugString("DumpImageInCurrentProcess: CAPE dump limit reached.\n"); + DoOutputDebugString("DumpImageToFileHandle: CAPE dump limit reached.\n"); return 0; } if (*(WORD*)ImageBase != IMAGE_DOS_SIGNATURE) { - DoOutputDebugString("DumpImageInCurrentProcess: No DOS signature in header.\n"); + DoOutputDebugString("DumpImageToFileHandle: No DOS signature in header.\n"); return 0; } - + if (!pDosHeader->e_lfanew || pDosHeader->e_lfanew > PE_HEADER_LIMIT) { - DoOutputDebugString("DumpImageInCurrentProcess: bad e_lfanew.\n"); - return 0; + DoOutputDebugString("DumpImageToFileHandle: bad e_lfanew.\n"); + return 0; } - + pNtHeader = (PIMAGE_NT_HEADERS)((PUCHAR)pDosHeader + (ULONG)pDosHeader->e_lfanew); - - if (pNtHeader->Signature != IMAGE_NT_SIGNATURE) + + if (pNtHeader->Signature != IMAGE_NT_SIGNATURE) { // No 'PE' header - DoOutputDebugString("DumpImageInCurrentProcess: Invalid PE signature in header.\n"); + DoOutputDebugString("DumpImageToFileHandle: Invalid PE signature in header.\n"); return 0; } - - if ((pNtHeader->FileHeader.Machine == 0) || (pNtHeader->FileHeader.SizeOfOptionalHeader == 0 || pNtHeader->OptionalHeader.SizeOfHeaders == 0)) + + if ((pNtHeader->FileHeader.Machine == 0) || (pNtHeader->FileHeader.SizeOfOptionalHeader == 0 || pNtHeader->OptionalHeader.SizeOfHeaders == 0)) { // Basic requirements - DoOutputDebugString("DumpImageInCurrentProcess: PE image invalid.\n"); + DoOutputDebugString("DumpImageToFileHandle: PE image invalid.\n"); return 0; } - + if (IsPeImageVirtual(ImageBase) == FALSE) { - DoOutputDebugString("DumpImageInCurrentProcess: Attempting to dump 'raw' PE image.\n"); - - if (ScyllaDumpPE((DWORD_PTR)ImageBase)) + DoOutputDebugString("DumpImageToFileHandle: Attempting to dump 'raw' PE image.\n"); + + if (ScyllaDumpPEToFileHandle((DWORD_PTR)ImageBase, FileHandle)) { DumpCount++; - return 1; + return 1; } else { // failed to dump pe image - DoOutputDebugString("DumpImageInCurrentProcess: Failed to dump 'raw' PE image.\n"); - return 0; + DoOutputDebugString("DumpImageToFileHandle: Failed to dump 'raw' PE image.\n"); + return 0; } } - DoOutputDebugString("DumpImageInCurrentProcess: Attempting to dump virtual PE image.\n"); - - if (!ScyllaDumpProcess(GetCurrentProcess(), (DWORD_PTR)ImageBase, 0)) + DoOutputDebugString("DumpImageToFileHandle: Attempting to dump virtual PE image.\n"); + + BytesWritten = ScyllaDumpProcessToFileHandle(GetCurrentProcess(), (DWORD_PTR)ImageBase, 0, FileHandle); + + if (!BytesWritten) { - DoOutputDebugString("DumpImageInCurrentProcess: Failed to dump PE as virtual image.\n"); - return 0; + DoOutputDebugString("DumpImageToFileHandle: Failed to dump PE as virtual image.\n"); + return 0; } DumpCount++; - return 1; + return 1; } //************************************************************************************** @@ -1821,7 +1886,7 @@ int DumpPE(LPVOID Buffer) //************************************************************************************** { SetCapeMetaData(INJECTION_PE, 0, NULL, (PVOID)Buffer); - + if (DumpCount < DUMP_MAX && ScyllaDumpPE((DWORD_PTR)Buffer)) { DumpCount++; @@ -1832,48 +1897,285 @@ int DumpPE(LPVOID Buffer) } //************************************************************************************** -int RoutineProcessDump() +void DumpInterestingRegions(MEMORY_BASIC_INFORMATION MemInfo, PVOID CallerBase) //************************************************************************************** { - PVOID ImageBase, CallerBase = GetHookCallerBase(); + //PIMAGE_DOS_HEADER pDosHeader; + //wchar_t *MappedPath, *ModulePath, *AbsoluteMapped, *AbsoluteModule; - if (base_of_dll_of_interest) - ImageBase = (PVOID)base_of_dll_of_interest; - else - ImageBase = GetModuleHandle(NULL); + if (!MemInfo.BaseAddress) + return; + + if (MemInfo.BaseAddress == (PVOID)g_our_dll_base) + return; + + __try + { + BYTE Test = *(BYTE*)MemInfo.BaseAddress; + Test = *(BYTE*)MemInfo.BaseAddress + PE_HEADER_LIMIT; + } + __except(EXCEPTION_EXECUTE_HANDLER) + { + // No point in continuing if we can't read! + return; + } - if (g_config.procdump && ProcessDumped == FALSE) + if (MemInfo.BaseAddress == ImageBase) { - ProcessDumped = TRUE; // this prevents a second call before the first is complete + DoOutputDebugString("DumpInterestingRegions: Dumping Imagebase at 0x%p.\n", ImageBase); if (g_config.import_reconstruction) ProcessDumped = ScyllaDumpProcessFixImports(GetCurrentProcess(), (DWORD_PTR)ImageBase, 0); else ProcessDumped = ScyllaDumpProcess(GetCurrentProcess(), (DWORD_PTR)ImageBase, 0); + } + // Disable dumping of all calling regions for the moment as this needs further testing. + // (This causes lots of useless dumps from Word processes, for example.) + //else if (lookup_get(&g_caller_regions, (ULONG_PTR)MemInfo.BaseAddress, NULL) || MemInfo.BaseAddress == CallerBase) + else if (MemInfo.BaseAddress == CallerBase) + { + DoOutputDebugString("DumpInterestingRegions: Dumping calling region at 0x%p.\n", MemInfo.BaseAddress); - if (CallerBase && ImageBase != CallerBase && called_by_hook()) + CapeMetaData->ModulePath = NULL; + + if (IsDisguisedPEHeader(MemInfo.BaseAddress)) { - DoOutputDebugString("RoutineProcessDump: Terminate caller base (0x%p) different to imagebase (0x%p) - dumping.\n", CallerBase, ImageBase); - ScyllaDumpProcess(GetCurrentProcess(), (DWORD_PTR)CallerBase, 0); + CapeMetaData->Address = MemInfo.BaseAddress; + CapeMetaData->DumpType = EXTRACTION_PE; + ScyllaDumpProcess(GetCurrentProcess(), (DWORD_PTR)MemInfo.BaseAddress, 0); } + else + DumpRegion(MemInfo.BaseAddress); + } +} + +//************************************************************************************** +int DoProcessDump(PVOID CallerBase) +//************************************************************************************** +{ + HANDLE hSnapShot; + THREADENTRY32 ThreadInfo; + PUCHAR Address; + MEMORY_BASIC_INFORMATION MemInfo; + HANDLE FileHandle; + char *FullDumpPath, *OutputFilename; + + EnterCriticalSection(&ProcessDumpCriticalSection); + + if (base_of_dll_of_interest) + ImageBase = (PVOID)base_of_dll_of_interest; + else + ImageBase = GetModuleHandle(NULL); + + PHANDLE SuspendedThreads = (PHANDLE)malloc(SUSPENDED_THREAD_MAX*sizeof(HANDLE)); + DWORD ThreadId = GetCurrentThreadId(), SuspendedThreadCount = 0; + + if (!SystemInfo.dwPageSize) + GetSystemInfo(&SystemInfo); + + if (!SystemInfo.dwPageSize) + { + DoOutputErrorString("DoProcessDump: Failed to obtain system page size.\n"); + goto out; } - return ProcessDumped; + // suspend other threads before dump + hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); + Thread32First(hSnapShot, &ThreadInfo); + + do + { + if (ThreadInfo.th32OwnerProcessID != CapeMetaData->Pid || ThreadInfo.th32ThreadID == ThreadId || SuspendedThreadCount >= SUSPENDED_THREAD_MAX) + continue; + + SuspendedThreads[SuspendedThreadCount] = OpenThread(THREAD_SUSPEND_RESUME, FALSE, ThreadInfo.th32ThreadID); + + if (SuspendedThreads[SuspendedThreadCount]) + { + SuspendThread(SuspendedThreads[SuspendedThreadCount]); + SuspendedThreadCount++; + } + } + while(Thread32Next(hSnapShot, &ThreadInfo)); + + if (g_config.procmemdump) + { + FullDumpPath = GetResultsPath("memory"); + + if (!FullDumpPath) + { + DoOutputDebugString("DoProcessDump: Unable to get path to dump file directory.\n"); + goto out; + } + + OutputFilename = (char*)malloc(MAX_PATH); + + sprintf_s(OutputFilename, MAX_PATH, "%d.dmp", CapeMetaData->Pid); + + PathAppend(FullDumpPath, OutputFilename); + + FileHandle = CreateFile(FullDumpPath, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); + + if (FileHandle == INVALID_HANDLE_VALUE) + { + DoOutputDebugString("DoProcessDump: Unable to create dump file for full process memory dump.\n"); + goto out; + } + + DoOutputDebugString("DoProcessDump: Created dump file for full process memory dump: %s.\n", FullDumpPath); + } + + for (Address = (PUCHAR)SystemInfo.lpMinimumApplicationAddress; Address < (PUCHAR)SystemInfo.lpMaximumApplicationAddress;) + { + if (!VirtualQuery(Address, &MemInfo, sizeof(MemInfo))) + { + Address += SystemInfo.dwPageSize; + continue; + } + + if (!(MemInfo.State & MEM_COMMIT) || !(MemInfo.Type & (MEM_IMAGE | MEM_MAPPED | MEM_PRIVATE))) + { + Address += MemInfo.RegionSize; + continue; + } + + if (g_config.procdump) + { + DumpInterestingRegions(MemInfo, CallerBase); + } + + if (g_config.procmemdump) + { + LARGE_INTEGER BufferAddress; + DWORD BytesWritten; + PVOID TempBuffer; + + BufferAddress.QuadPart = (ULONGLONG)Address; + TempBuffer = malloc(MemInfo.RegionSize); + if (!TempBuffer) + { + DoOutputDebugString("DoProcessDump: Error allocating memory for copy of region at 0x%p, size 0x%x.\n", MemInfo.BaseAddress, MemInfo.RegionSize); + goto out; + } + __try + { + memcpy(TempBuffer, MemInfo.BaseAddress, MemInfo.RegionSize); + WriteFile(FileHandle, &BufferAddress, sizeof(BufferAddress), &BytesWritten, NULL); + WriteFile(FileHandle, &(DWORD)MemInfo.RegionSize, sizeof(DWORD), &BytesWritten, NULL); + WriteFile(FileHandle, &MemInfo.State, sizeof(MemInfo.State), &BytesWritten, NULL); + WriteFile(FileHandle, &MemInfo.Type, sizeof(MemInfo.Type), &BytesWritten, NULL); + WriteFile(FileHandle, &MemInfo.Protect, sizeof(MemInfo.Protect), &BytesWritten, NULL); + WriteFile(FileHandle, TempBuffer, (DWORD)MemInfo.RegionSize, &BytesWritten, NULL); + free(TempBuffer); + if (BytesWritten != MemInfo.RegionSize) + DoOutputDebugString("DoProcessDump: Anomaly detected, wrote only 0x%x of 0x%x bytes to memory dump from region 0x%p.\n", BytesWritten, MemInfo.RegionSize, MemInfo.BaseAddress); + //else + // DoOutputDebugString("DoProcessDump: Added 0x%x byte region at 0x%p to memory dump (protect 0x%x).\n", MemInfo.RegionSize, MemInfo.BaseAddress, MemInfo.Protect); + } + __except(EXCEPTION_EXECUTE_HANDLER) + { + free(TempBuffer); + //DoOutputDebugString("DoProcessDump: Exception attempting to dump region at 0x%p, size 0x%x.\n", MemInfo.BaseAddress, MemInfo.RegionSize); + } + } + + Address += MemInfo.RegionSize; + } + +out: + if (g_config.procmemdump) + { + if (FileHandle) + { + DoOutputDebugString("DoProcessDump: Full process memory dump saved to file: %s.\n", FullDumpPath); + CloseHandle(FileHandle); + } + if (OutputFilename) + free(OutputFilename); + if (FullDumpPath) + free(FullDumpPath); + } + + if (SuspendedThreads) + { + for (unsigned int i = 0; i < SuspendedThreadCount; i++) + { + ResumeThread(SuspendedThreads[i]); + CloseHandle(SuspendedThreads[i]); + } + free(SuspendedThreads); + } + + LeaveCriticalSection(&ProcessDumpCriticalSection); + return ProcessDumped; +} + +void RestoreHeaders() +{ + DWORD ImportsRVA, ImportsSize, SizeOfHeaders, dwProtect; + PVOID BaseAddress, ImportsVA; + PIMAGE_DOS_HEADER pDosHeader; + PIMAGE_NT_HEADERS pNtHeaders; + + BaseAddress = GetModuleHandle(NULL); + SizeOfHeaders = sizeof(IMAGE_NT_HEADERS); + pDosHeader = (PIMAGE_DOS_HEADER)BaseAddress; + pNtHeaders = (PIMAGE_NT_HEADERS)((PBYTE)BaseAddress + pDosHeader->e_lfanew); + ImportsRVA = pNtHeaders->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress; + ImportsSize = pNtHeaders->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size; + ImportsVA = (PBYTE)BaseAddress + ImportsRVA; + + // Check if we have a PE header after import table + if (*(DWORD*)((PBYTE)ImportsVA + ImportsSize) != IMAGE_NT_SIGNATURE) + return; + + // Set page permissions to allow writing of original headers + if (!VirtualProtect((PBYTE)BaseAddress, SizeOfHeaders, PAGE_EXECUTE_READWRITE, &dwProtect)) + { + DoOutputErrorString("RestoreHeaders: Failed to modify memory page protection of NtHeaders"); + return; + } + + memcpy((PBYTE)BaseAddress + pDosHeader->e_lfanew, (PBYTE)ImportsVA + ImportsSize, SizeOfHeaders); + + // Restore original protection + if (!VirtualProtect((PBYTE)BaseAddress, SizeOfHeaders, dwProtect, &dwProtect)) + { + DoOutputErrorString("RestoreHeaders: Failed to restore previous memory page protection"); + return; + } + + // Free memory + if (!VirtualFree(ImportsVA, 0, MEM_RELEASE)) + { + DoOutputErrorString("RestoreHeaders: Failed to free memory for patched IAT"); + return; + } + + DoOutputDebugString("RestoreHeaders: Restored original import table.\n"); } void init_CAPE() { + char* CommandLine; + + // Restore headers in case of IAT patching + RestoreHeaders(); + // Initialise CAPE global variables // #ifndef STANDALONE CapeMetaData = (PCAPEMETADATA)malloc(sizeof(CAPEMETADATA)); CapeMetaData->Pid = GetCurrentProcessId(); CapeMetaData->ProcessPath = (char*)malloc(MAX_PATH); - WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, (LPCWSTR)our_process_path, (int)wcslen(our_process_path)+1, CapeMetaData->ProcessPath, MAX_PATH, NULL, NULL); + WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, (LPCWSTR)our_process_path_w, (int)wcslen(our_process_path_w)+1, CapeMetaData->ProcessPath, MAX_PATH, NULL, NULL); + CommandLine = (char*)malloc(MAX_PATH); + WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, (LPCWSTR)our_commandline, (int)wcslen(our_commandline)+1, CommandLine, MAX_PATH, NULL, NULL); + // This is package (and technique) dependent: CapeMetaData->DumpType = EXTRACTION_SHELLCODE; ProcessDumped = FALSE; - + DumpCount = 0; // This flag controls whether a dump is automatically @@ -1882,6 +2184,8 @@ void init_CAPE() // or upon submission. (This overrides submission.) g_config.procdump = 0; + InitializeCriticalSection(&ProcessDumpCriticalSection); + // Cuckoo debug output level for development (0=none, 2=max) // g_config.debug = 2; #endif @@ -1898,6 +2202,12 @@ void init_CAPE() #else DoOutputDebugString("CAPE initialised: 32-bit QakBot package loaded in process %d at 0x%x, image base 0x%x, stack from 0x%x-0x%x\n", GetCurrentProcessId(), g_our_dll_base, GetModuleHandle(NULL), get_stack_bottom(), get_stack_top()); #endif + DoOutputDebugString("Commandline: %s.\n", CommandLine); + +#ifdef CAPE_TRACE + if (!g_config.base_on_apiname[0]) + SetInitialBreakpoints(GetModuleHandle(NULL)); +#endif return; } diff --git a/CAPE/CAPE.h b/CAPE/CAPE.h index 53daee1..520c473 100644 --- a/CAPE/CAPE.h +++ b/CAPE/CAPE.h @@ -25,7 +25,9 @@ extern CHAR s_szDllPath[MAX_PATH]; PVOID GetHookCallerBase(); PVOID GetPageAddress(PVOID Address); PVOID GetAllocationBase(PVOID Address); +BOOL InsideMonitor(LPVOID* ReturnAddress, LPVOID Address); BOOL TranslatePathFromDeviceToLetter(__in TCHAR *DeviceFilePath, __out TCHAR* DriveLetterFilePath, __inout LPDWORD lpdwBufferSize); +void PrintHexBytes(__in char* TextBuffer, __in BYTE* HexBuffer, __in unsigned int Count); BOOL DumpPEsInRange(LPVOID Buffer, SIZE_T Size); BOOL DumpRegion(PVOID Address); int DumpMemory(LPVOID Buffer, SIZE_T Size); @@ -112,7 +114,7 @@ struct InjectionSectionView *SectionViewList; #define PLUGX_SIGNATURE 0x5658 // 'XV' -typedef struct CapeMetadata +typedef struct CapeMetadata { char* ProcessPath; char* ModulePath; @@ -130,27 +132,27 @@ BOOL SetCapeMetaData(DWORD DumpType, DWORD TargetPid, HANDLE hTargetProcess, PVO enum { PROCDUMP = 0, - + COMPRESSION = 1, - + INJECTION_PE = 3, INJECTION_SHELLCODE = 4, //INJECTION_RUNPE = 5, EXTRACTION_PE = 8, EXTRACTION_SHELLCODE = 9, - + PLUGX_PAYLOAD = 0x10, PLUGX_CONFIG = 0x11, - + EVILGRAB_PAYLOAD = 0x14, EVILGRAB_DATA = 0x15, - + SEDRECO_DATA = 0x20, - + URSNIF_CONFIG = 0x24, URSNIF_PAYLOAD = 0x25, - + CERBER_CONFIG = 0x30, CERBER_PAYLOAD = 0x31, diff --git a/CAPE/Debugger.c b/CAPE/Debugger.c index 3778ca8..a6fd924 100644 --- a/CAPE/Debugger.c +++ b/CAPE/Debugger.c @@ -28,20 +28,38 @@ along with this program.If not, see . #define PIPEBUFSIZE 512 // eflags register +#define FL_CF 0x00000001 // Carry Flag +#define FL_PF 0x00000004 // Parity Flag +#define FL_AF 0x00000010 // Auxiliary carry Flag #define FL_ZF 0x00000040 // Zero Flag -#define FL_TF 0x00000100 // Trap flag -#define FL_RF 0x00010000 // Resume flag +#define FL_SF 0x00000080 // Sign Flag +#define FL_TF 0x00000100 // Trap Flag +#define FL_IF 0x00000200 // Interrupt Enable +#define FL_DF 0x00000400 // Direction Flag +#define FL_OF 0x00000800 // Overflow Flag +#define FL_IOPL_MASK 0x00003000 // I/O Privilege Level bitmask +#define FL_IOPL_0 0x00000000 // IOPL == 0 +#define FL_IOPL_1 0x00001000 // IOPL == 1 +#define FL_IOPL_2 0x00002000 // IOPL == 2 +#define FL_IOPL_3 0x00003000 // IOPL == 3 +#define FL_NT 0x00004000 // Nested Task +#define FL_RF 0x00010000 // Resume Flag +#define FL_VM 0x00020000 // Virtual 8086 mode +#define FL_AC 0x00040000 // Alignment Check +#define FL_VIF 0x00080000 // Virtual Interrupt Flag +#define FL_VIP 0x00100000 // Virtual Interrupt Pending +#define FL_ID 0x00200000 // ID flag // // debug register DR7 bit fields // -typedef struct _DR7 +typedef struct _DR7 { DWORD L0 : 1; //Local enable bp0 DWORD G0 : 1; //Global enable bp0 DWORD L1 : 1; //Local enable bp1 DWORD G1 : 1; //Global enable bp1 - DWORD L2 : 1; //Local enable bp2 + DWORD L2 : 1; //Local enable bp2 DWORD G2 : 1; //Global enable bp2 DWORD L3 : 1; //Local enable bp3 DWORD G3 : 1; //Global enable bp3 @@ -107,6 +125,9 @@ unsigned int TrapIndex; unsigned int DepthCount; extern int operate_on_backtrace(ULONG_PTR _esp, ULONG_PTR _ebp, void *extra, int(*func)(void *, ULONG_PTR)); +#ifdef CAPE_TRACE +extern BOOL TraceRunning; +#endif //************************************************************************************** BOOL CountDepth(LPVOID* ReturnAddress, LPVOID Address) @@ -122,9 +143,9 @@ BOOL CountDepth(LPVOID* ReturnAddress, LPVOID Address) *ReturnAddress = Address; return TRUE; } - + DepthCount++; - + DoOutputDebugString("CountDepth: Address 0x%p, depthcount = %i.\n", Address, DepthCount); return FALSE; @@ -135,7 +156,7 @@ BOOL IsInTrackedRegions(PVOID Address) //************************************************************************************** { PTRACKEDREGION CurrentTrackedRegion = TrackedRegionList; - + if (TrackedRegionList == NULL) return FALSE; @@ -143,10 +164,10 @@ BOOL IsInTrackedRegions(PVOID Address) { if ((DWORD_PTR)Address >= (DWORD_PTR)CurrentTrackedRegion->BaseAddress && (DWORD_PTR)Address < ((DWORD_PTR)CurrentTrackedRegion->BaseAddress + (DWORD_PTR)CurrentTrackedRegion->RegionSize)) return TRUE; - + CurrentTrackedRegion = CurrentTrackedRegion->NextTrackedRegion; } - + return FALSE; } @@ -155,7 +176,7 @@ PTRACKEDREGION GetTrackedRegion(PVOID Address) //************************************************************************************** { PTRACKEDREGION CurrentTrackedRegion = TrackedRegionList; - + if (Address == NULL) { DoOutputDebugString("GetTrackedRegion: NULL passed as argument - error.\n"); @@ -167,7 +188,7 @@ PTRACKEDREGION GetTrackedRegion(PVOID Address) //DoOutputDebugString("GetTrackedRegion: failed to obtain initial tracked region list.\n"); return FALSE; } - + while (CurrentTrackedRegion) { if ((DWORD_PTR)Address >= (DWORD_PTR)CurrentTrackedRegion->BaseAddress && (DWORD_PTR)Address < ((DWORD_PTR)CurrentTrackedRegion->BaseAddress + (DWORD_PTR)CurrentTrackedRegion->RegionSize)) @@ -178,20 +199,20 @@ PTRACKEDREGION GetTrackedRegion(PVOID Address) CurrentTrackedRegion = CurrentTrackedRegion->NextTrackedRegion; } - + //DoOutputDebugString("GetTrackedRegion: failed to find tracked region in list for address 0x%x.\n", Address); - + return NULL; } //************************************************************************************** PTRACKEDREGION CreateTrackedRegion() //************************************************************************************** -{ +{ if (TrackedRegionList == NULL) { TrackedRegionList = ((struct TrackedRegion*)malloc(sizeof(struct TrackedRegion))); - + if (TrackedRegionList == NULL) { DoOutputDebugString("CreateTrackedRegion: failed to allocate memory for initial tracked region list.\n"); @@ -201,48 +222,48 @@ PTRACKEDREGION CreateTrackedRegion() memset(TrackedRegionList, 0, sizeof(struct TrackedRegion)); } - return TrackedRegionList; + return TrackedRegionList; } //************************************************************************************** PTRACKEDREGION AddTrackedRegion(PVOID Address, SIZE_T RegionSize, ULONG Protect) //************************************************************************************** -{ +{ BOOL PageAlreadyTracked; PTRACKEDREGION CurrentTrackedRegion, PreviousTrackedRegion; unsigned int NumberOfTrackedRegions; - + NumberOfTrackedRegions = 0; PreviousTrackedRegion = NULL; - + if (TrackedRegionList == NULL) CreateTrackedRegion(); - + CurrentTrackedRegion = TrackedRegionList; - + while (CurrentTrackedRegion) { if ((DWORD_PTR)Address >= (DWORD_PTR)CurrentTrackedRegion->BaseAddress && (DWORD_PTR)Address < ((DWORD_PTR)CurrentTrackedRegion->BaseAddress + (DWORD_PTR)CurrentTrackedRegion->RegionSize)) PageAlreadyTracked = TRUE; else PageAlreadyTracked = FALSE; - + NumberOfTrackedRegions++; - + PreviousTrackedRegion = CurrentTrackedRegion; CurrentTrackedRegion = CurrentTrackedRegion->NextTrackedRegion; - } - + } + if (NumberOfTrackedRegions > 10) DoOutputDebugString("AddTrackedRegion: DEBUG Warning - number of tracked regions %d.\n", NumberOfTrackedRegions); - + if (GetPageAddress(Address) == GetPageAddress(TrackedRegionList)) { DoOutputDebugString("AddTrackedRegion: Warning - attempting to track the page (0x%p) containing the tracked region list at 0x%p.\n", Address, TrackedRegionList); - + return NULL; } - + if (PageAlreadyTracked) { DoOutputDebugString("AddTrackedRegion: Region at 0x%p already in list.\n", Address); @@ -251,7 +272,7 @@ PTRACKEDREGION AddTrackedRegion(PVOID Address, SIZE_T RegionSize, ULONG Protect) // We haven't found it in the linked list, so create a new one CurrentTrackedRegion = PreviousTrackedRegion; - + CurrentTrackedRegion->NextTrackedRegion = ((struct TrackedRegion*)malloc(sizeof(struct TrackedRegion))); if (CurrentTrackedRegion->NextTrackedRegion == NULL) @@ -259,38 +280,38 @@ PTRACKEDREGION AddTrackedRegion(PVOID Address, SIZE_T RegionSize, ULONG Protect) DoOutputDebugString("AddTrackedRegion: Failed to allocate new tracked region struct.\n"); return NULL; } - + memset(CurrentTrackedRegion->NextTrackedRegion, 0, sizeof(struct TrackedRegion)); - + if (!VirtualQuery(Address, &CurrentTrackedRegion->MemInfo, sizeof(MEMORY_BASIC_INFORMATION))) { DoOutputErrorString("AddTrackedRegion: unable to query memory region 0x%p", Address); return NULL; } - + CurrentTrackedRegion->BaseAddress = CurrentTrackedRegion->MemInfo.BaseAddress; - + if (Address != CurrentTrackedRegion->BaseAddress) CurrentTrackedRegion->ProtectAddress = Address; - + if ((BYTE*)Address + RegionSize > (BYTE*)CurrentTrackedRegion->BaseAddress + CurrentTrackedRegion->MemInfo.RegionSize) CurrentTrackedRegion->RegionSize = RegionSize; else CurrentTrackedRegion->RegionSize = CurrentTrackedRegion->MemInfo.RegionSize; - + CurrentTrackedRegion->Protect = Protect; - + //DoOutputDebugString("AddTrackedRegion: DEBUG - added region 0x%p to list at 0x%p - 0x%p.\n", Address, TrackedRegionList, (BYTE*)TrackedRegionList + NumberOfTrackedRegions*sizeof(TRACKEDREGION)); - + return CurrentTrackedRegion; } //************************************************************************************** BOOL DropTrackedRegion(PTRACKEDREGION TrackedRegion) //************************************************************************************** -{ +{ PTRACKEDREGION CurrentTrackedRegion, PreviousTrackedRegion; - + if (TrackedRegion == NULL) { DoOutputDebugString("DropTrackedRegion: NULL passed as argument - error.\n"); @@ -298,7 +319,7 @@ BOOL DropTrackedRegion(PTRACKEDREGION TrackedRegion) } PreviousTrackedRegion = NULL; - + if (TrackedRegionList == NULL) { DoOutputDebugString("DropTrackedRegion: failed to obtain initial tracked region list.\n"); @@ -306,16 +327,16 @@ BOOL DropTrackedRegion(PTRACKEDREGION TrackedRegion) } CurrentTrackedRegion = TrackedRegionList; - + while (CurrentTrackedRegion) { DoOutputDebugString("DropTrackedRegion: CurrentTrackedRegion 0x%x, BaseAddress 0x%x.\n", CurrentTrackedRegion, CurrentTrackedRegion->BaseAddress); - + if (CurrentTrackedRegion == TrackedRegion) { // Clear any breakpoints in this region ClearBreakpointsInRange(GetCurrentThreadId(), TrackedRegion->BaseAddress, TrackedRegion->RegionSize); - + DoOutputDebugString("DropTrackedRegion: About to unlink.\n"); // Unlink this from the list and free the memory if (PreviousTrackedRegion && CurrentTrackedRegion->NextTrackedRegion) @@ -333,19 +354,19 @@ BOOL DropTrackedRegion(PTRACKEDREGION TrackedRegion) DoOutputDebugString("DropTrackedRegion: removed pages 0x%x-0x%x from the head of the tracked region list.\n", TrackedRegion->BaseAddress, (DWORD_PTR)TrackedRegion->BaseAddress + TrackedRegion->RegionSize); TrackedRegionList = NULL; } - + DoOutputDebugString("DropTrackedRegion: about to free the memory!\n"); free(CurrentTrackedRegion); - - return TRUE; + + return TRUE; } - + PreviousTrackedRegion = CurrentTrackedRegion; CurrentTrackedRegion = CurrentTrackedRegion->NextTrackedRegion; } - + DoOutputDebugString("DropTrackedRegion: failed to find tracked region in list.\n"); - + return FALSE; } @@ -357,15 +378,15 @@ BOOL ActivateGuardPages(PTRACKEDREGION TrackedRegion) BOOL TrackedRegionFound = FALSE; PTRACKEDREGION CurrentTrackedRegion; PVOID TestAddress; - + SIZE_T MatchingRegionSize; if (TrackedRegion == NULL) { DoOutputDebugString("ActivateGuardPages: NULL passed as argument - error.\n"); return FALSE; - } - + } + if (TrackedRegionList == NULL) { DoOutputDebugString("ActivateGuardPages: Error - no tracked region list.\n"); @@ -373,27 +394,27 @@ BOOL ActivateGuardPages(PTRACKEDREGION TrackedRegion) } CurrentTrackedRegion = TrackedRegionList; - + while (CurrentTrackedRegion) { //DoOutputDebugString("TrackedRegion->BaseAddress 0x%x, CurrentTrackedRegion->BaseAddress 0x%x.\n", TrackedRegion->BaseAddress, CurrentTrackedRegion->BaseAddress); - + __try { TestAddress = CurrentTrackedRegion->BaseAddress; } - __except(EXCEPTION_EXECUTE_HANDLER) - { + __except(EXCEPTION_EXECUTE_HANDLER) + { DoOutputErrorString("ActivateGuardPages: Exception trying to access BaseAddres from tracked region at 0x%x", CurrentTrackedRegion); return FALSE; - } - + } + if (TrackedRegion->BaseAddress == CurrentTrackedRegion->BaseAddress) TrackedRegionFound = TRUE; CurrentTrackedRegion = CurrentTrackedRegion->NextTrackedRegion; } - + if (!TrackedRegionFound) { DoOutputDebugString("ActivateGuardPages: failed to locate tracked region(s) in tracked region list.\n"); @@ -401,7 +422,7 @@ BOOL ActivateGuardPages(PTRACKEDREGION TrackedRegion) } MatchingRegionSize = VirtualQuery(TrackedRegion->BaseAddress, &TrackedRegion->MemInfo, sizeof(MEMORY_BASIC_INFORMATION)); - + if (!MatchingRegionSize) { DoOutputErrorString("ActivateGuardPages: failed to query tracked region(s) status in region 0x%x-0x%x", TrackedRegion->BaseAddress, (DWORD_PTR)TrackedRegion->BaseAddress + TrackedRegion->RegionSize); @@ -409,21 +430,21 @@ BOOL ActivateGuardPages(PTRACKEDREGION TrackedRegion) } //DoOutputDebugString("ActivateGuardPages: BaseAddress 0x%x, AllocationBase 0x%x, AllocationProtect 0x%x, RegionSize 0x%x, State 0x%x, Protect 0x%x, Type 0x%x\n", TrackedRegion->MemInfo.BaseAddress, TrackedRegion->MemInfo.AllocationBase, TrackedRegion->MemInfo.AllocationProtect, TrackedRegion->MemInfo.RegionSize, TrackedRegion->MemInfo.State, TrackedRegion->MemInfo.Protect, TrackedRegion->MemInfo.Type); - + if (MatchingRegionSize == TrackedRegion->RegionSize && TrackedRegion->MemInfo.Protect & PAGE_GUARD) { DoOutputDebugString("ActivateGuardPages: guard page(s) already set in region 0x%x-0x%x", TrackedRegion->BaseAddress, (DWORD_PTR)TrackedRegion->BaseAddress + TrackedRegion->RegionSize); return FALSE; } - + if (!VirtualProtect(TrackedRegion->BaseAddress, TrackedRegion->RegionSize, TrackedRegion->Protect | PAGE_GUARD, &OldProtect)) { DoOutputErrorString("ActivateGuardPages: failed to activate guard page(s) on region 0x%x size 0x%x", TrackedRegion->BaseAddress, TrackedRegion->RegionSize); return FALSE; } - + //DoOutputDebugString("ActivateGuardPages: Activated guard page(s) on region 0x%x size 0x%x", TrackedRegion->BaseAddress, TrackedRegion->RegionSize); - + return TRUE; } @@ -437,16 +458,16 @@ BOOL ActivateGuardPagesOnProtectedRange(PTRACKEDREGION TrackedRegion) DWORD_PTR AddressOfPage; SIZE_T Size; PVOID TestAddress; - + if (TrackedRegion == NULL) { DoOutputDebugString("ActivateGuardPagesOnProtectedRange: NULL passed as argument - error.\n"); return FALSE; - } - + } + if (!SystemInfo.dwPageSize) GetSystemInfo(&SystemInfo); - + if (!SystemInfo.dwPageSize) { DoOutputErrorString("ActivateGuardPagesOnProtectedRange: Failed to obtain system page size.\n"); @@ -460,27 +481,27 @@ BOOL ActivateGuardPagesOnProtectedRange(PTRACKEDREGION TrackedRegion) } CurrentTrackedRegion = TrackedRegionList; - + while (CurrentTrackedRegion) { //DoOutputDebugString("TrackedRegion->BaseAddress 0x%x, CurrentTrackedRegion->BaseAddress 0x%x.\n", TrackedRegion->BaseAddress, CurrentTrackedRegion->BaseAddress); - + __try { TestAddress = CurrentTrackedRegion->BaseAddress; } - __except(EXCEPTION_EXECUTE_HANDLER) - { + __except(EXCEPTION_EXECUTE_HANDLER) + { DoOutputErrorString("ActivateGuardPagesOnProtectedRange: Exception trying to access BaseAddress from tracked region at 0x%x", CurrentTrackedRegion); return FALSE; - } + } if (TrackedRegion->BaseAddress == CurrentTrackedRegion->BaseAddress) TrackedRegionFound = TRUE; CurrentTrackedRegion = CurrentTrackedRegion->NextTrackedRegion; } - + if (!TrackedRegionFound) { DoOutputDebugString("ActivateGuardPagesOnProtectedRange: failed to locate tracked region(s) in tracked region list.\n"); @@ -498,17 +519,17 @@ BOOL ActivateGuardPagesOnProtectedRange(PTRACKEDREGION TrackedRegion) DoOutputErrorString("ActivateGuardPagesOnProtectedRange: unable to query memory region 0x%x", TrackedRegion->BaseAddress); return FALSE; } - - AddressOfPage = ((DWORD_PTR)TrackedRegion->ProtectAddress/SystemInfo.dwPageSize)*SystemInfo.dwPageSize; - + + AddressOfPage = ((DWORD_PTR)TrackedRegion->ProtectAddress/SystemInfo.dwPageSize)*SystemInfo.dwPageSize; + Size = (BYTE*)TrackedRegion->ProtectAddress + TrackedRegion->RegionSize - (BYTE*)AddressOfPage; - + if (!VirtualProtect((LPVOID)AddressOfPage, Size, TrackedRegion->Protect | PAGE_GUARD, &OldProtect)) { DoOutputErrorString("ActivateGuardPagesOnProtectedRange: failed to activate guard page(s) on region 0x%x size 0x%x", AddressOfPage, Size); return FALSE; } - + return TRUE; } @@ -521,19 +542,19 @@ BOOL DeactivateGuardPages(PTRACKEDREGION TrackedRegion) BOOL TrackedRegionFound = FALSE; PTRACKEDREGION CurrentTrackedRegion = TrackedRegionList; PVOID TestAddress; - + if (TrackedRegion == NULL) { DoOutputDebugString("DeactivateGuardPages: NULL passed as argument - error.\n"); return FALSE; - } + } if (TrackedRegionList == NULL) { DoOutputDebugString("DeactivateGuardPages: Error - no tracked region list.\n"); return FALSE; } - + //DoOutputDebugString("DeactivateGuardPages: DEBUG - tracked region list 0x%x, BaseAddress 0x%x.\n", CurrentTrackedRegion, CurrentTrackedRegion->BaseAddress); while (CurrentTrackedRegion) @@ -542,18 +563,18 @@ BOOL DeactivateGuardPages(PTRACKEDREGION TrackedRegion) { TestAddress = CurrentTrackedRegion->BaseAddress; } - __except(EXCEPTION_EXECUTE_HANDLER) - { + __except(EXCEPTION_EXECUTE_HANDLER) + { DoOutputErrorString("DeactivateGuardPages: Exception trying to access BaseAddres from tracked region at 0x%x", CurrentTrackedRegion); return FALSE; - } + } if (TrackedRegion->BaseAddress == CurrentTrackedRegion->BaseAddress) TrackedRegionFound = TRUE; CurrentTrackedRegion = CurrentTrackedRegion->NextTrackedRegion; } - + if (!TrackedRegionFound) { DoOutputDebugString("DeactivateGuardPages: failed to locate tracked region(s) in tracked region list.\n"); @@ -561,13 +582,13 @@ BOOL DeactivateGuardPages(PTRACKEDREGION TrackedRegion) } MatchingRegionSize = VirtualQuery(TrackedRegion->BaseAddress, &TrackedRegion->MemInfo, sizeof(MEMORY_BASIC_INFORMATION)); - + if (!MatchingRegionSize) { DoOutputErrorString("DeactivateGuardPages: failed to query tracked region(s) status in region 0x%x-0x%x", TrackedRegion->BaseAddress, (DWORD_PTR)TrackedRegion->BaseAddress + TrackedRegion->RegionSize); return FALSE; } - + if (MatchingRegionSize == TrackedRegion->RegionSize && !(TrackedRegion->MemInfo.Protect & PAGE_GUARD)) { DoOutputDebugString("DeactivateGuardPages: guard page(s) not set in region 0x%x-0x%x", TrackedRegion->BaseAddress, (DWORD_PTR)TrackedRegion->BaseAddress + TrackedRegion->RegionSize); @@ -579,9 +600,9 @@ BOOL DeactivateGuardPages(PTRACKEDREGION TrackedRegion) DoOutputErrorString("DeactivateGuardPages: failed to deactivate guard page(s) on region 0x%x-0x%x", TrackedRegion->BaseAddress, (DWORD_PTR)TrackedRegion->BaseAddress + TrackedRegion->RegionSize); return FALSE; } - + DoOutputDebugString("DeactivateGuardPages: DEBUG: Deactivated guard page(s) on region 0x%x-0x%x", TrackedRegion->BaseAddress, (DWORD_PTR)TrackedRegion->BaseAddress + TrackedRegion->RegionSize); - + return TRUE; } @@ -594,40 +615,40 @@ BOOL ActivateSurroundingGuardPages(PTRACKEDREGION TrackedRegion) BOOL TrackedRegionFound = FALSE; PTRACKEDREGION CurrentTrackedRegion = TrackedRegionList; PVOID TestAddress; - + if (TrackedRegionList == NULL) - { + { DoOutputDebugString("ActivateSurroundingGuardPages: Error - TrackedRegionList NULL.\n"); return 0; } - + if (!SystemInfo.dwPageSize) GetSystemInfo(&SystemInfo); - + if (!SystemInfo.dwPageSize) { DoOutputErrorString("ActivateSurroundingGuardPages: Failed to obtain system page size.\n"); return 0; } - + while (CurrentTrackedRegion) { __try { TestAddress = CurrentTrackedRegion->BaseAddress; } - __except(EXCEPTION_EXECUTE_HANDLER) - { + __except(EXCEPTION_EXECUTE_HANDLER) + { DoOutputErrorString("ActivateSurroundingGuardPages: Exception trying to access BaseAddres from tracked region at 0x%x", CurrentTrackedRegion); return FALSE; - } + } if (TrackedRegion->BaseAddress == CurrentTrackedRegion->BaseAddress) TrackedRegionFound = TRUE; CurrentTrackedRegion = CurrentTrackedRegion->NextTrackedRegion; } - + if (!TrackedRegionFound) { DoOutputDebugString("ActivateSurroundingGuardPages: Failed to locate tracked region(s) in tracked region list.\n"); @@ -635,7 +656,7 @@ BOOL ActivateSurroundingGuardPages(PTRACKEDREGION TrackedRegion) } if (!TrackedRegion->LastAccessAddress) - { + { DoOutputDebugString("ActivateSurroundingGuardPages: Error - Last access address not set.\n"); return 0; } @@ -645,30 +666,30 @@ BOOL ActivateSurroundingGuardPages(PTRACKEDREGION TrackedRegion) DoOutputDebugString("ActivateSurroundingGuardPages: Last access address 0x%x not within tracked region at 0x%x.\n", TrackedRegion->LastAccessAddress, TrackedRegion->BaseAddress); return FALSE; } - - AddressOfPage = ((DWORD_PTR)TrackedRegion->LastAccessAddress/SystemInfo.dwPageSize)*SystemInfo.dwPageSize; - + + AddressOfPage = ((DWORD_PTR)TrackedRegion->LastAccessAddress/SystemInfo.dwPageSize)*SystemInfo.dwPageSize; + if (!VirtualQuery(TrackedRegion->BaseAddress, &TrackedRegion->MemInfo, sizeof(MEMORY_BASIC_INFORMATION))) { DoOutputErrorString("ProtectionHandler: unable to query memory region 0x%x", TrackedRegion->BaseAddress); return FALSE; } - - for + + for ( - PagePointer = ((DWORD_PTR)TrackedRegion->BaseAddress/SystemInfo.dwPageSize)*SystemInfo.dwPageSize; + PagePointer = ((DWORD_PTR)TrackedRegion->BaseAddress/SystemInfo.dwPageSize)*SystemInfo.dwPageSize; (BYTE*)PagePointer + SystemInfo.dwPageSize < (BYTE*)TrackedRegion->BaseAddress + TrackedRegion->RegionSize; PagePointer += SystemInfo.dwPageSize ) { - // We skip the initial page if a switch to breakpoints has occured + // We skip the initial page if a switch to breakpoints has occurred if (PagePointer == (DWORD_PTR)TrackedRegion->BaseAddress && TrackedRegion->BreakpointsSet) PagePointer += SystemInfo.dwPageSize; - + if (PagePointer != AddressOfPage) { RetVal = VirtualProtect((LPVOID)PagePointer, SystemInfo.dwPageSize, TrackedRegion->Protect | PAGE_GUARD, &OldProtect); - + if (!RetVal) { DoOutputDebugString("ActivateSurroundingGuardPages: Failed to activate page guard on tracked region at 0x%x.\n", PagePointer); @@ -684,20 +705,20 @@ BOOL ActivateSurroundingGuardPages(PTRACKEDREGION TrackedRegion) PTHREADBREAKPOINTS GetThreadBreakpoints(DWORD ThreadId) //************************************************************************************** { - DWORD CurrentThreadId; - + DWORD CurrentThreadId; + PTHREADBREAKPOINTS CurrentThreadBreakpoint = MainThreadBreakpointList; while (CurrentThreadBreakpoint) { CurrentThreadId = MyGetThreadId(CurrentThreadBreakpoint->ThreadHandle); - + if (CurrentThreadId == ThreadId) return CurrentThreadBreakpoint; else CurrentThreadBreakpoint = CurrentThreadBreakpoint->NextThreadBreakpoints; } - + return NULL; } @@ -705,20 +726,20 @@ PTHREADBREAKPOINTS GetThreadBreakpoints(DWORD ThreadId) HANDLE GetThreadHandle(DWORD ThreadId) //************************************************************************************** { - DWORD CurrentThreadId; - + DWORD CurrentThreadId; + PTHREADBREAKPOINTS CurrentThreadBreakpoint = MainThreadBreakpointList; while (CurrentThreadBreakpoint) { CurrentThreadId = MyGetThreadId(CurrentThreadBreakpoint->ThreadHandle); - + if (CurrentThreadId == ThreadId) return CurrentThreadBreakpoint->ThreadHandle; else CurrentThreadBreakpoint = CurrentThreadBreakpoint->NextThreadBreakpoints; } - + return NULL; } @@ -730,61 +751,61 @@ PTHREADBREAKPOINTS CreateThreadBreakpoints(DWORD ThreadId) PTHREADBREAKPOINTS CurrentThreadBreakpoint, PreviousThreadBreakpoint; PreviousThreadBreakpoint = NULL; - + if (MainThreadBreakpointList == NULL) { MainThreadBreakpointList = ((struct ThreadBreakpoints*)malloc(sizeof(struct ThreadBreakpoints))); - + if (MainThreadBreakpointList == NULL) { DoOutputDebugString("CreateThreadBreakpoints: failed to allocate memory for initial thread breakpoint list.\n"); return NULL; } - + memset(MainThreadBreakpointList, 0, sizeof(struct ThreadBreakpoints)); - + MainThreadBreakpointList->ThreadId = MainThreadId; } CurrentThreadBreakpoint = MainThreadBreakpointList; - + while (CurrentThreadBreakpoint) - { + { if (CurrentThreadBreakpoint->ThreadHandle && MyGetThreadId(CurrentThreadBreakpoint->ThreadHandle) == ThreadId) { //It already exists - shouldn't happen DoOutputDebugString("CreateThreadBreakpoints error: found an existing thread breakpoint list for ThreadId 0x%x\n", ThreadId); return NULL; } - + if ((CurrentThreadBreakpoint->ThreadId) == ThreadId) { // We have our thread breakpoint list - break; + break; } - + PreviousThreadBreakpoint = CurrentThreadBreakpoint; CurrentThreadBreakpoint = CurrentThreadBreakpoint->NextThreadBreakpoints; } - + if (!CurrentThreadBreakpoint) { // We haven't found it in the linked list, so create a new one CurrentThreadBreakpoint = PreviousThreadBreakpoint; - + CurrentThreadBreakpoint->NextThreadBreakpoints = ((struct ThreadBreakpoints*)malloc(sizeof(struct ThreadBreakpoints))); - + if (CurrentThreadBreakpoint->NextThreadBreakpoints == NULL) { DoOutputDebugString("CreateThreadBreakpoints: Failed to allocate new thread breakpoints.\n"); return NULL; } - + memset(CurrentThreadBreakpoint->NextThreadBreakpoints, 0, sizeof(struct ThreadBreakpoints)); - + CurrentThreadBreakpoint = CurrentThreadBreakpoint->NextThreadBreakpoints; } - + if (ThreadId == GetCurrentThreadId()) { if (DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &CurrentThreadBreakpoint->ThreadHandle, 0, FALSE, DUPLICATE_SAME_ACCESS) == 0) @@ -797,7 +818,7 @@ PTHREADBREAKPOINTS CreateThreadBreakpoints(DWORD ThreadId) else { CurrentThreadBreakpoint->ThreadHandle = OpenThread(THREAD_ALL_ACCESS, FALSE, ThreadId); - + if (CurrentThreadBreakpoint->ThreadHandle == NULL) { DoOutputDebugString("CreateThreadBreakpoints: Failed to open thread and get a handle.\n"); @@ -805,15 +826,15 @@ PTHREADBREAKPOINTS CreateThreadBreakpoints(DWORD ThreadId) return NULL; } } - + CurrentThreadBreakpoint->ThreadId = ThreadId; - + for (Register = 0; Register < NUMBER_OF_DEBUG_REGISTERS; Register++) { CurrentThreadBreakpoint->BreakpointInfo[Register].Register = Register; CurrentThreadBreakpoint->BreakpointInfo[Register].ThreadHandle = CurrentThreadBreakpoint->ThreadHandle; } - + return CurrentThreadBreakpoint; } @@ -821,37 +842,35 @@ PTHREADBREAKPOINTS CreateThreadBreakpoints(DWORD ThreadId) BOOL InitNewThreadBreakpoints(DWORD ThreadId) //************************************************************************************** { - //DoOutputDebugString("InitNewThreadBreakpoints: Initialising breakpoints for thread %d.\n", ThreadId); - //return TRUE; PTHREADBREAKPOINTS NewThreadBreakpoints; - + if (MainThreadBreakpointList == NULL) { DoOutputDebugString("InitNewThreadBreakpoints: Failed to create thread breakpoints struct.\n"); - return FALSE; + return FALSE; } - + NewThreadBreakpoints = CreateThreadBreakpoints(ThreadId); - + if (NewThreadBreakpoints == NULL) { DoOutputDebugString("InitNewThreadBreakpoints: Cannot create new thread breakpoints.\n"); return FALSE; } - + if (NewThreadBreakpoints->ThreadHandle == NULL) { DoOutputDebugString("InitNewThreadBreakpoints error: main thread handle not set.\n"); - return FALSE; + return FALSE; } - + for (unsigned int Register = 0; Register < NUMBER_OF_DEBUG_REGISTERS; Register++) { if (!MainThreadBreakpointList->BreakpointInfo[Register].Address) continue; - + NewThreadBreakpoints->BreakpointInfo[Register] = MainThreadBreakpointList->BreakpointInfo[Register]; - + if (!NewThreadBreakpoints->BreakpointInfo[Register].Address) DoOutputDebugString("InitNewThreadBreakpoints error: failed to copy the bleeding breakpoint struct!\n"); @@ -861,7 +880,7 @@ BOOL InitNewThreadBreakpoints(DWORD ThreadId) return FALSE; } } - + return TRUE; } @@ -869,9 +888,9 @@ BOOL InitNewThreadBreakpoints(DWORD ThreadId) BOOL GetNextAvailableBreakpoint(DWORD ThreadId, unsigned int* Register) //************************************************************************************** { - DWORD CurrentThreadId; + DWORD CurrentThreadId; unsigned int i; - + PTHREADBREAKPOINTS CurrentThreadBreakpoint = MainThreadBreakpointList; if (CurrentThreadBreakpoint == NULL) @@ -879,11 +898,11 @@ BOOL GetNextAvailableBreakpoint(DWORD ThreadId, unsigned int* Register) DoOutputDebugString("GetNextAvailableBreakpoint: MainThreadBreakpointList NULL.\n"); return FALSE; } - + while (CurrentThreadBreakpoint) { CurrentThreadId = MyGetThreadId(CurrentThreadBreakpoint->ThreadHandle); - + if (CurrentThreadId == ThreadId) { for (i=0; i < NUMBER_OF_DEBUG_REGISTERS; i++) @@ -892,13 +911,13 @@ BOOL GetNextAvailableBreakpoint(DWORD ThreadId, unsigned int* Register) { *Register = i; return TRUE; - } + } } } - + CurrentThreadBreakpoint = CurrentThreadBreakpoint->NextThreadBreakpoints; } - + return FALSE; } @@ -906,17 +925,17 @@ BOOL GetNextAvailableBreakpoint(DWORD ThreadId, unsigned int* Register) BOOL ContextGetNextAvailableBreakpoint(PCONTEXT Context, unsigned int* Register) //************************************************************************************** { - unsigned int i; + unsigned int i; PTHREADBREAKPOINTS CurrentThreadBreakpoint; - + CurrentThreadBreakpoint = GetThreadBreakpoints(GetCurrentThreadId()); - + if (CurrentThreadBreakpoint == NULL) { DoOutputDebugString("ContextGetNextAvailableBreakpoint: Creating new thread breakpoints for thread %d.\n", GetCurrentThreadId()); CurrentThreadBreakpoint = CreateThreadBreakpoints(GetCurrentThreadId()); } - + if (CurrentThreadBreakpoint == NULL) { DoOutputDebugString("ContextGetNextAvailableBreakpoint: Cannot create new thread breakpoints - FATAL.\n"); @@ -932,7 +951,7 @@ BOOL ContextGetNextAvailableBreakpoint(PCONTEXT Context, unsigned int* Register) } } - return FALSE; + return FALSE; } //************************************************************************************** @@ -944,24 +963,24 @@ void DebugOutputThreadBreakpoints() PBREAKPOINTINFO pBreakpointInfo; CurrentThreadBreakpoint = GetThreadBreakpoints(GetCurrentThreadId()); - + for (Register = 0; Register < NUMBER_OF_DEBUG_REGISTERS; Register++) { pBreakpointInfo = &(CurrentThreadBreakpoint->BreakpointInfo[Register]); - + if (pBreakpointInfo == NULL) { DoOutputDebugString("DebugOutputThreadBreakpoints: Can't get BreakpointInfo - FATAL.\n"); } - DoOutputDebugString("Callback = 0x%x, Address = 0x%x, Size = 0x%x, Register = %i, ThreadHandle = 0x%x, Type = 0x%x\n", - pBreakpointInfo->Callback, - pBreakpointInfo->Address, - pBreakpointInfo->Size, - pBreakpointInfo->Register, - pBreakpointInfo->ThreadHandle, + DoOutputDebugString("Callback = 0x%x, Address = 0x%x, Size = 0x%x, Register = %i, ThreadHandle = 0x%x, Type = 0x%x\n", + pBreakpointInfo->Callback, + pBreakpointInfo->Address, + pBreakpointInfo->Size, + pBreakpointInfo->Register, + pBreakpointInfo->ThreadHandle, pBreakpointInfo->Type); - } + } } //************************************************************************************** @@ -969,11 +988,24 @@ void ShowStack(DWORD_PTR StackPointer, unsigned int NumberOfRecords) //************************************************************************************** { unsigned int i; - + for (i=0; iExceptionRecord->ExceptionCode==EXCEPTION_SINGLE_STEP) - { + { BOOL BreakpointFlag; PBREAKPOINTINFO pBreakpointInfo; PTHREADBREAKPOINTS CurrentThreadBreakpoint; @@ -998,7 +1030,7 @@ LONG WINAPI CAPEExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo) { DoOutputDebugString("CAPEExceptionFilter: Can't get thread breakpoints - FATAL.\n"); return EXCEPTION_CONTINUE_SEARCH; - } + } // Test Dr6 to see if this is a breakpoint BreakpointFlag = FALSE; @@ -1009,60 +1041,60 @@ LONG WINAPI CAPEExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo) BreakpointFlag = TRUE; } } - + + // If not it's a single-step if (!BreakpointFlag) - { + { if (SingleStepHandler) SingleStepHandler(ExceptionInfo); else if (TrapIndex) // this is from a 'StepOver' function { DoOutputDebugString("CAPEExceptionFilter: Stepping over execution breakpoint to: 0x%x\n", ExceptionInfo->ExceptionRecord->ExceptionAddress); - + pBreakpointInfo = &(CurrentThreadBreakpoint->BreakpointInfo[TrapIndex-1]); - + ResumeAfterExecutionBreakpoint(ExceptionInfo->ContextRecord, pBreakpointInfo); } else - { - DoOutputDebugString("CAPEExceptionFilter: Error, unhandled single-step exception at: 0x%x\n", ExceptionInfo->ExceptionRecord->ExceptionAddress); + // pass it on return EXCEPTION_CONTINUE_SEARCH; - } - + return EXCEPTION_CONTINUE_EXECUTION; } - + if (TrapIndex) - { DoOutputDebugString("CAPEExceptionFilter: Anomaly detected: Trap index set on non-single-step: %d\n", TrapIndex); - } - + +#ifdef CAPE_TRACE + if (!TraceRunning) +#endif DoOutputDebugString("CAPEExceptionFilter: breakpoint hit by instruction at 0x%p\n", ExceptionInfo->ExceptionRecord->ExceptionAddress); - + for (bp = 0; bp < NUMBER_OF_DEBUG_REGISTERS; bp++) { if (ExceptionInfo->ContextRecord->Dr6 & (DWORD_PTR)(1 << bp)) { pBreakpointInfo = &(CurrentThreadBreakpoint->BreakpointInfo[bp]); - + if (pBreakpointInfo == NULL) { DoOutputDebugString("CAPEExceptionFilter: Can't get BreakpointInfo - FATAL.\n"); return EXCEPTION_CONTINUE_EXECUTION; - } - - if (pBreakpointInfo->Register == bp) + } + + if (pBreakpointInfo->Register == bp) { if (bp == 0 && ((DWORD_PTR)pBreakpointInfo->Address != ExceptionInfo->ContextRecord->Dr0)) DoOutputDebugString("CAPEExceptionFilter: Anomaly detected! bp0 address (0x%x) different to BreakpointInfo (0x%x)!\n", ExceptionInfo->ContextRecord->Dr0, pBreakpointInfo->Address); - + if (bp == 1 && ((DWORD_PTR)pBreakpointInfo->Address != ExceptionInfo->ContextRecord->Dr1)) DoOutputDebugString("CAPEExceptionFilter: Anomaly detected! bp1 address (0x%x) different to BreakpointInfo (0x%x)!\n", ExceptionInfo->ContextRecord->Dr1, pBreakpointInfo->Address); if (bp == 2 && ((DWORD_PTR)pBreakpointInfo->Address != ExceptionInfo->ContextRecord->Dr2)) DoOutputDebugString("CAPEExceptionFilter: Anomaly detected! bp2 address (0x%x) different to BreakpointInfo (0x%x)!\n", ExceptionInfo->ContextRecord->Dr2, pBreakpointInfo->Address); - + if (bp == 3 && ((DWORD_PTR)pBreakpointInfo->Address != ExceptionInfo->ContextRecord->Dr3)) DoOutputDebugString("CAPEExceptionFilter: Anomaly detected! bp3 address (0x%x) different to BreakpointInfo (0x%x)!\n", ExceptionInfo->ContextRecord->Dr3, pBreakpointInfo->Address); #ifndef _WIN64 @@ -1071,7 +1103,7 @@ LONG WINAPI CAPEExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo) if (pBreakpointInfo->Type == BP_READWRITE && ((PDR7)&(ExceptionInfo->ContextRecord->Dr7))->RWE0 == BP_WRITE && address_is_in_stack((DWORD_PTR)pBreakpointInfo->Address)) { DoOutputDebugString("CAPEExceptionFilter: Reinstated BP_READWRITE on breakpoint %d (WoW64 workaround)\n", pBreakpointInfo->Register); - + ContextSetThreadBreakpoint(ExceptionInfo->ContextRecord, pBreakpointInfo->Register, pBreakpointInfo->Size, (BYTE*)pBreakpointInfo->Address, pBreakpointInfo->Type, pBreakpointInfo->Callback); } else @@ -1085,7 +1117,7 @@ LONG WINAPI CAPEExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo) if (pBreakpointInfo->Type == BP_READWRITE && ((PDR7)&(ExceptionInfo->ContextRecord->Dr7))->RWE1 == BP_WRITE && address_is_in_stack((DWORD_PTR)pBreakpointInfo->Address)) { DoOutputDebugString("CAPEExceptionFilter: Reinstated BP_READWRITE on breakpoint %d (WoW64 workaround)\n", pBreakpointInfo->Register); - + ContextSetThreadBreakpoint(ExceptionInfo->ContextRecord, pBreakpointInfo->Register, pBreakpointInfo->Size, (BYTE*)pBreakpointInfo->Address, pBreakpointInfo->Type, pBreakpointInfo->Callback); } else @@ -1099,7 +1131,7 @@ LONG WINAPI CAPEExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo) if (pBreakpointInfo->Type == BP_READWRITE && ((PDR7)&(ExceptionInfo->ContextRecord->Dr7))->RWE2 == BP_WRITE && address_is_in_stack((DWORD_PTR)pBreakpointInfo->Address)) { DoOutputDebugString("CAPEExceptionFilter: Reinstated BP_READWRITE on stack breakpoint %d (WoW64 workaround)\n", pBreakpointInfo->Register); - + ContextSetThreadBreakpoint(ExceptionInfo->ContextRecord, pBreakpointInfo->Register, pBreakpointInfo->Size, (BYTE*)pBreakpointInfo->Address, pBreakpointInfo->Type, pBreakpointInfo->Callback); } else @@ -1113,7 +1145,7 @@ LONG WINAPI CAPEExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo) if (pBreakpointInfo->Type == BP_READWRITE && ((PDR7)&(ExceptionInfo->ContextRecord->Dr7))->RWE3 == BP_WRITE && address_is_in_stack((DWORD_PTR)pBreakpointInfo->Address)) { DoOutputDebugString("CAPEExceptionFilter: Reinstated BP_READWRITE on breakpoint %d (WoW64 workaround)\n", pBreakpointInfo->Register); - + ContextSetThreadBreakpoint(ExceptionInfo->ContextRecord, pBreakpointInfo->Register, pBreakpointInfo->Size, (BYTE*)pBreakpointInfo->Address, pBreakpointInfo->Type, pBreakpointInfo->Callback); } else @@ -1132,25 +1164,25 @@ LONG WINAPI CAPEExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo) DoOutputDebugString("CAPEExceptionFilter: Can't get callback - FATAL.\n"); return EXCEPTION_CONTINUE_EXECUTION; } - + Handler = (BREAKPOINT_HANDLER)pBreakpointInfo->Callback; - + // Invoke the handler Handler(pBreakpointInfo, ExceptionInfo); - + return EXCEPTION_CONTINUE_EXECUTION; } // Page guard violations generate STATUS_GUARD_PAGE_VIOLATION else if (ExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_GUARD_PAGE_VIOLATION) - { + { if (ExceptionInfo->ExceptionRecord->NumberParameters < 2) { DoOutputDebugString("CAPEExceptionFilter: Guard page exception with missing parameters, passing.\n"); - return EXCEPTION_CONTINUE_SEARCH; + return EXCEPTION_CONTINUE_SEARCH; } - + //DoOutputDebugString("Entering CAPEExceptionFilter: guarded page access at 0x%x by 0x%x\n", ExceptionInfo->ExceptionRecord->ExceptionInformation[1], ExceptionInfo->ExceptionRecord->ExceptionAddress); - + if (TrackedRegion = GetTrackedRegion((PVOID)ExceptionInfo->ExceptionRecord->ExceptionInformation[1])) { if (is_address_in_ntdll((ULONG_PTR)ExceptionInfo->ExceptionRecord->ExceptionAddress)) @@ -1159,10 +1191,10 @@ LONG WINAPI CAPEExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo) { DoOutputDebugString("CAPEExceptionFilter: Failed to re-activate page guard on tracked region around 0x%x touched by ntdll.\n", ExceptionInfo->ExceptionRecord->ExceptionInformation[1]); } - + return EXCEPTION_CONTINUE_EXECUTION; } - + if (GuardPageHandler) { if (GuardPageHandler(ExceptionInfo)) @@ -1182,64 +1214,52 @@ LONG WINAPI CAPEExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo) return EXCEPTION_CONTINUE_SEARCH; } } - //else if (ExceptionInfo->ExceptionRecord->ExceptionCode == DBG_PRINTEXCEPTION_C) - //{ - // // This could be useful output - // // TODO: find string buffer(s) and send info to DoOutputDebugString - // return EXCEPTION_CONTINUE_SEARCH; - //} - else if (!VECTORED_HANDLER && OriginalExceptionHandler) + else if (ExceptionInfo->ExceptionRecord->ExceptionCode == DBG_PRINTEXCEPTION_C) { - if ((ULONG_PTR)ExceptionInfo->ExceptionRecord->ExceptionAddress >= g_our_dll_base && (ULONG_PTR)ExceptionInfo->ExceptionRecord->ExceptionAddress < (g_our_dll_base + g_our_dll_size)) - { - // This is a CAPE (or Cuckoo) exception - return EXCEPTION_EXECUTE_HANDLER; - } - - // As it's not a bp, and the sample has registered its own handler - // we return EXCEPTION_EXECUTE_HANDLER - DoOutputDebugString("CAPEExceptionFilter: Non-breakpoint exception caught, passing to sample's handler.\n"); - SetUnhandledExceptionFilter(OriginalExceptionHandler); - return EXCEPTION_EXECUTE_HANDLER; + // This could be useful output + // TODO: find string buffer(s) and send info to DoOutputDebugString + //DoOutputDebugString("CAPEExceptionFilter: DBG_PRINTEXCEPTION_C at 0x%x (0x%x).\n", ExceptionInfo->ExceptionRecord->ExceptionInformation[1], ExceptionInfo->ExceptionRecord->ExceptionInformation[0]); + return EXCEPTION_CONTINUE_SEARCH; } else if (VECTORED_HANDLER && SampleVectoredHandler) - { + { // As it's not a bp and the sample has registered its own handler //DoOutputDebugString("CAPEExceptionFilter: Non-breakpoint exception caught, passing to sample's vectored handler.\n"); - SampleVectoredHandler(ExceptionInfo); + return SampleVectoredHandler(ExceptionInfo); } - + if ((ULONG_PTR)ExceptionInfo->ExceptionRecord->ExceptionAddress >= g_our_dll_base && (ULONG_PTR)ExceptionInfo->ExceptionRecord->ExceptionAddress < (g_our_dll_base + g_our_dll_size)) { // This is a CAPE (or Cuckoo) exception DoOutputDebugString("CAPEExceptionFilter: Exception 0x%x caught at RVA 0x%x in capemon caught accessing 0x%x (expected in memory scans), passing to next handler.\n", ExceptionInfo->ExceptionRecord->ExceptionCode, (BYTE*)ExceptionInfo->ExceptionRecord->ExceptionAddress - g_our_dll_base, ExceptionInfo->ExceptionRecord->ExceptionInformation[1]); return EXCEPTION_CONTINUE_SEARCH; } - + // Some other exception occurred. Pass it to next handler. //DllRVA = 0; //if (ExceptionInfo->ExceptionRecord->ExceptionAddress) // DllName = convert_address_to_dll_name_and_offset((ULONG_PTR)ExceptionInfo->ExceptionRecord->ExceptionAddress, &DllRVA); //else // DllName = "unknown"; - // + // //DoOutputDebugString("CAPEExceptionFilter: Exception 0x%x caught at 0x%x accessing 0x%x (RVA 0x%x in %s) passing.\n", ExceptionInfo->ExceptionRecord->ExceptionCode, ExceptionInfo->ExceptionRecord->ExceptionAddress, ExceptionInfo->ExceptionRecord->ExceptionInformation[1], DllRVA, DllName); return EXCEPTION_CONTINUE_SEARCH; } //************************************************************************************** -BOOL ContextSetDebugRegister +BOOL ContextSetDebugRegisterEx //************************************************************************************** ( PCONTEXT Context, int Register, int Size, LPVOID Address, - DWORD Type + DWORD Type, + BOOL NoSetThreadContext ) { DWORD Length; -#ifdef _WIN64 +#ifdef _WIN64 PTHREADBREAKPOINTS CurrentThreadBreakpoint; #endif @@ -1247,7 +1267,7 @@ BOOL ContextSetDebugRegister PDWORD_PTR Dr1 = &(Context->Dr1); PDWORD_PTR Dr2 = &(Context->Dr2); PDWORD_PTR Dr3 = &(Context->Dr3); - PDR7 Dr7 = (PDR7)&(Context->Dr7); + PDR7 Dr7 = (PDR7)&(Context->Dr7); if ((unsigned int)Type > 3) { @@ -1266,15 +1286,13 @@ BOOL ContextSetDebugRegister DoOutputDebugString("ContextSetDebugRegister: %d is an invalid register, must be 0-3.\n", Register); return FALSE; } - + if (Size < 0 || Size > 8) { DoOutputDebugString("ContextSetDebugRegister: %d is an invalid Size, must be 1, 2, 4 or 8.\n", Size); return FALSE; } - DoOutputDebugString("ContextSetDebugRegister: Setting breakpoint %i within Context, Size=0x%x, Address=0x%p and Type=0x%x.\n", Register, Size, Address, Type); - Length = LengthMask[Size]; // intel spec requires 0 for bp on execution @@ -1284,43 +1302,46 @@ BOOL ContextSetDebugRegister #ifndef _WIN64 if (Type == BP_READWRITE && address_is_in_stack((DWORD_PTR)Address)) WoW64PatchBreakpoint(Register); -#endif - +#endif + if (Register == 0) { *Dr0 = (DWORD_PTR)Address; Dr7->LEN0 = Length; Dr7->RWE0 = Type; - Dr7->L0 = 1; + Dr7->L0 = 1; } else if (Register == 1) { *Dr1 = (DWORD_PTR)Address; Dr7->LEN1 = Length; Dr7->RWE1 = Type; - Dr7->L1 = 1; + Dr7->L1 = 1; } else if (Register == 2) { *Dr2 = (DWORD_PTR)Address; Dr7->LEN2 = Length; Dr7->RWE2 = Type; - Dr7->L2 = 1; + Dr7->L2 = 1; } else if (Register == 3) { *Dr3 = (DWORD_PTR)Address; Dr7->LEN3 = Length; Dr7->RWE3 = Type; - Dr7->L3 = 1; + Dr7->L3 = 1; } - + Dr7->LE = 1; Context->Dr6 = 0; - -#ifdef _WIN64 + +#ifdef _WIN64 + if (NoSetThreadContext) + return TRUE; + CurrentThreadBreakpoint = GetThreadBreakpoints(GetCurrentThreadId()); - + if (CurrentThreadBreakpoint == NULL) { DoOutputDebugString("ContextSetDebugRegister: No breakpoints found for current thread %d.\n", GetCurrentThreadId()); @@ -1334,19 +1355,31 @@ BOOL ContextSetDebugRegister } Context->ContextFlags = CONTEXT_DEBUG_REGISTERS; - + if (!SetThreadContext(CurrentThreadBreakpoint->ThreadHandle, Context)) { DoOutputErrorString("ContextSetDebugRegister: SetThreadContext failed"); return FALSE; - } - else - DoOutputDebugString("ContextSetDebugRegister: SetThreadContext success.\n"); + } #endif return TRUE; } +//************************************************************************************** +BOOL ContextSetDebugRegister +//************************************************************************************** +( + PCONTEXT Context, + int Register, + int Size, + LPVOID Address, + DWORD Type +) +{ + return ContextSetDebugRegisterEx(Context, Register, Size, Address, Type, FALSE); +} + //************************************************************************************** BOOL SetDebugRegister //************************************************************************************** @@ -1384,7 +1417,7 @@ BOOL SetDebugRegister DoOutputDebugString("SetDebugRegister: %d is an invalid register, must be 0-3.\n", Register); return FALSE; } - + if (Size < 0 || Size > 8) { DoOutputDebugString("SetDebugRegister: %d is an invalid Size, must be 1, 2, 4 or 8.\n", Size); @@ -1392,9 +1425,9 @@ BOOL SetDebugRegister } DoOutputDebugString("SetDebugRegister: Setting breakpoint %i hThread=0x%x, Size=0x%x, Address=0x%p and Type=0x%x.\n", Register, hThread, Size, Address, Type); - + Context.ContextFlags = CONTEXT_DEBUG_REGISTERS; - + if (!GetThreadContext(hThread, &Context)) { DoOutputErrorString("SetDebugRegister: GetThreadContext failed (thread handle 0x%x)", hThread); @@ -1410,37 +1443,37 @@ BOOL SetDebugRegister #ifndef _WIN64 if (Type == BP_READWRITE && address_is_in_stack((DWORD_PTR)Address)) WoW64PatchBreakpoint(Register); -#endif - +#endif + if (Register == 0) { *Dr0 = (DWORD_PTR)Address; Dr7->LEN0 = Length; Dr7->RWE0 = Type; - Dr7->L0 = 1; + Dr7->L0 = 1; } else if (Register == 1) { *Dr1 = (DWORD_PTR)Address; Dr7->LEN1 = Length; Dr7->RWE1 = Type; - Dr7->L1 = 1; + Dr7->L1 = 1; } else if (Register == 2) { *Dr2 = (DWORD_PTR)Address; Dr7->LEN2 = Length; Dr7->RWE2 = Type; - Dr7->L2 = 1; + Dr7->L2 = 1; } else if (Register == 3) { *Dr3 = (DWORD_PTR)Address; Dr7->LEN3 = Length; Dr7->RWE3 = Type; - Dr7->L3 = 1; + Dr7->L3 = 1; } - + Dr7->LE = 1; Context.Dr6 = 0; @@ -1451,24 +1484,24 @@ BOOL SetDebugRegister DoOutputErrorString("SetDebugRegister: SetThreadContext failed"); return FALSE; } - + return TRUE; } //************************************************************************************** BOOL ContextCheckDebugRegisters(PCONTEXT Context) //************************************************************************************** -{ +{ PDR7 Dr7; - + if (!Context) { DoOutputDebugString("CheckDebugRegisters - no context supplied.\n"); return FALSE; } - + Dr7 = (PDR7)&(Context->Dr7); - + DoOutputDebugString("Checking breakpoints\n"); DoOutputDebugString("Dr0 0x%x, Dr7->LEN0 %i, Dr7->RWE0 %i, Dr7->L0 %i\n", Context->Dr0, Dr7->LEN0, Dr7->RWE0, Dr7->L0); DoOutputDebugString("Dr1 0x%x, Dr7->LEN1 %i, Dr7->RWE1 %i, Dr7->L1 %i\n", Context->Dr1, Dr7->LEN1, Dr7->RWE1, Dr7->L1); @@ -1489,7 +1522,7 @@ BOOL CheckDebugRegisters(HANDLE hThread, PCONTEXT pContext) PDWORD_PTR Dr2 = &Context.Dr2; PDWORD_PTR Dr3 = &Context.Dr3; PDR7 Dr7 = (PDR7)&(Context.Dr7); - + if (!hThread && !pContext) { DoOutputDebugString("CheckDebugRegisters - required arguments missing.\n"); @@ -1507,9 +1540,9 @@ BOOL CheckDebugRegisters(HANDLE hThread, PCONTEXT pContext) { DoOutputDebugString("CheckDebugRegisters - failed to get thread context.\n"); return FALSE; - } + } } - + DoOutputDebugString("Checking breakpoints\n"); DoOutputDebugString("*Dr0 0x%x, Dr7->LEN0 %i, Dr7->RWE0 %i, Dr7->L0 %i\n", *Dr0, Dr7->LEN0, Dr7->RWE0, Dr7->L0); DoOutputDebugString("*Dr1 0x%x, Dr7->LEN1 %i, Dr7->RWE1 %i, Dr7->L1 %i\n", *Dr1, Dr7->LEN1, Dr7->RWE1, Dr7->L1); @@ -1524,17 +1557,17 @@ BOOL CheckDebugRegisters(HANDLE hThread, PCONTEXT pContext) BOOL ContextClearAllBreakpoints(PCONTEXT Context) //************************************************************************************** { - unsigned int i; + unsigned int i; PTHREADBREAKPOINTS CurrentThreadBreakpoint; - + CurrentThreadBreakpoint = GetThreadBreakpoints(GetCurrentThreadId()); - + if (CurrentThreadBreakpoint == NULL) { DoOutputDebugString("ContextClearAllBreakpoints: No breakpoints found for current thread %d.\n", GetCurrentThreadId()); return FALSE; } - + for (i=0; i < NUMBER_OF_DEBUG_REGISTERS; i++) { CurrentThreadBreakpoint->BreakpointInfo[i].Register = 0; @@ -1551,7 +1584,7 @@ BOOL ContextClearAllBreakpoints(PCONTEXT Context) Context->Dr6 = 0; Context->Dr7 = 0; -#ifdef _WIN64 +#ifdef _WIN64 if (CurrentThreadBreakpoint->ThreadHandle == NULL) { DoOutputDebugString("ContextClearAllBreakpoints: No thread handle found in breakpoints found for current thread %d.\n", GetCurrentThreadId()); @@ -1559,12 +1592,12 @@ BOOL ContextClearAllBreakpoints(PCONTEXT Context) } Context->ContextFlags = CONTEXT_DEBUG_REGISTERS; - + if (!SetThreadContext(CurrentThreadBreakpoint->ThreadHandle, Context)) { DoOutputErrorString("ContextClearAllBreakpoints: SetThreadContext failed"); return FALSE; - } + } else DoOutputDebugString("ContextClearAllBreakpoints: SetThreadContext success.\n"); #endif @@ -1577,8 +1610,8 @@ BOOL ClearAllBreakpoints() //************************************************************************************** { CONTEXT Context; - PTHREADBREAKPOINTS CurrentThreadBreakpoint; - unsigned int Register; + PTHREADBREAKPOINTS CurrentThreadBreakpoint; + unsigned int Register; CurrentThreadBreakpoint = MainThreadBreakpointList; @@ -1609,7 +1642,7 @@ BOOL ClearAllBreakpoints() if (!GetThreadContext(CurrentThreadBreakpoint->ThreadHandle, &Context)) { - DoOutputDebugString("ClearAllBreakpoints: Error getting thread context (thread %d).\n", CurrentThreadBreakpoint->ThreadId); + DoOutputDebugString("ClearAllBreakpoints: Error getting thread context (thread %d, handle 0x%x).\n", CurrentThreadBreakpoint->ThreadId, CurrentThreadBreakpoint->ThreadHandle); return FALSE; } @@ -1619,16 +1652,16 @@ BOOL ClearAllBreakpoints() Context.Dr3 = 0; Context.Dr6 = 0; Context.Dr7 = 0; - + if (!SetThreadContext(CurrentThreadBreakpoint->ThreadHandle, &Context)) { DoOutputDebugString("ClearAllBreakpoints: Error setting thread context (thread %d).\n", CurrentThreadBreakpoint->ThreadId); return FALSE; } - + CurrentThreadBreakpoint = CurrentThreadBreakpoint->NextThreadBreakpoints; } - + return TRUE; } @@ -1641,52 +1674,52 @@ BOOL ContextClearBreakpoint(PCONTEXT Context, PBREAKPOINTINFO pBreakpointInfo) if (Context == NULL) return FALSE; - + Dr0 = &(Context->Dr0); Dr1 = &(Context->Dr1); Dr2 = &(Context->Dr2); Dr3 = &(Context->Dr3); Dr7 = (PDR7)&(Context->Dr7); - + DoOutputDebugString("ContextClearBreakpoint: Clearing breakpoint %i\n", pBreakpointInfo->Register); - + if (pBreakpointInfo->Register == 0) { *Dr0 = 0; Dr7->LEN0 = 0; Dr7->RWE0 = 0; - Dr7->L0 = 0; + Dr7->L0 = 0; } else if (pBreakpointInfo->Register == 1) { *Dr1 = 0; Dr7->LEN1 = 0; Dr7->RWE1 = 0; - Dr7->L1 = 0; + Dr7->L1 = 0; } else if (pBreakpointInfo->Register == 2) { *Dr2 = 0; Dr7->LEN2 = 0; Dr7->RWE2 = 0; - Dr7->L2 = 0; + Dr7->L2 = 0; } else if (pBreakpointInfo->Register == 3) { *Dr3 = 0; Dr7->LEN3 = 0; Dr7->RWE3 = 0; - Dr7->L3 = 0; + Dr7->L3 = 0; } #ifndef _WIN64 if (pBreakpointInfo->Type == BP_READWRITE && address_is_in_stack((DWORD_PTR)pBreakpointInfo->Address)) WoW64UnpatchBreakpoint(pBreakpointInfo->Register); -#endif - +#endif + Context->Dr6 = 0; - -#ifdef _WIN64 + +#ifdef _WIN64 if (pBreakpointInfo->ThreadHandle == NULL) { DoOutputDebugString("ContextClearBreakpoint: No thread handle found in breakpoints found for current thread %d.\n", GetCurrentThreadId()); @@ -1694,16 +1727,16 @@ BOOL ContextClearBreakpoint(PCONTEXT Context, PBREAKPOINTINFO pBreakpointInfo) } Context->ContextFlags = CONTEXT_DEBUG_REGISTERS; - + if (!SetThreadContext(pBreakpointInfo->ThreadHandle, Context)) { DoOutputErrorString("ContextClearBreakpoint: SetThreadContext failed"); return FALSE; - } + } else DoOutputDebugString("ContextClearBreakpoint: SetThreadContext success.\n"); #endif - + pBreakpointInfo->Address = 0; pBreakpointInfo->Size = 0; pBreakpointInfo->Callback = 0; @@ -1717,8 +1750,8 @@ BOOL ClearBreakpointsInRange(DWORD ThreadId, PVOID BaseAddress, SIZE_T Size) //************************************************************************************** { unsigned int Register; - DWORD CurrentThreadId; - + DWORD CurrentThreadId; + PTHREADBREAKPOINTS CurrentThreadBreakpoint = MainThreadBreakpointList; if (BaseAddress == NULL) @@ -1726,15 +1759,15 @@ BOOL ClearBreakpointsInRange(DWORD ThreadId, PVOID BaseAddress, SIZE_T Size) DoOutputDebugString("ClearBreakpointsInRange: No address supplied (may have already been cleared).\n"); return FALSE; } - + if (Size == 0) { DoOutputDebugString("ClearBreakpointsInRange: Size supplied is zero.\n"); return FALSE; } - + DoOutputDebugString("ClearBreakpointsInRange: Clearing breakpoints in range 0x%x - 0x%x.\n", BaseAddress, (BYTE*)BaseAddress + Size); - + while (CurrentThreadBreakpoint) { CurrentThreadId = MyGetThreadId(CurrentThreadBreakpoint->ThreadHandle); @@ -1743,20 +1776,20 @@ BOOL ClearBreakpointsInRange(DWORD ThreadId, PVOID BaseAddress, SIZE_T Size) { for (Register = 0; Register < NUMBER_OF_DEBUG_REGISTERS; Register++) { - if ((DWORD_PTR)CurrentThreadBreakpoint->BreakpointInfo[Register].Address >= (DWORD_PTR)BaseAddress + if ((DWORD_PTR)CurrentThreadBreakpoint->BreakpointInfo[Register].Address >= (DWORD_PTR)BaseAddress && (DWORD_PTR)CurrentThreadBreakpoint->BreakpointInfo[Register].Address < (DWORD_PTR)((BYTE*)BaseAddress + Size)) { DoOutputDebugString("ClearBreakpointsInRange: Clearing breakpoint %d address 0x%x.\n", Register, CurrentThreadBreakpoint->BreakpointInfo[Register].Address); ClearBreakpoint(CurrentThreadBreakpoint->ThreadId, Register); } } - + return TRUE; } else CurrentThreadBreakpoint = CurrentThreadBreakpoint->NextThreadBreakpoints; } - + return FALSE; } @@ -1766,9 +1799,9 @@ BOOL SetResumeFlag(PCONTEXT Context) { if (Context == NULL) return FALSE; - + Context->EFlags |= FL_RF; - + return TRUE; } @@ -1778,9 +1811,9 @@ BOOL SetZeroFlag(PCONTEXT Context) { if (Context == NULL) return FALSE; - + Context->EFlags |= FL_ZF; - + return TRUE; } @@ -1796,16 +1829,70 @@ BOOL ClearZeroFlag(PCONTEXT Context) return TRUE; } +//************************************************************************************** +BOOL FlipZeroFlag(PCONTEXT Context) +//************************************************************************************** +{ + if (Context == NULL) + return FALSE; + + Context->EFlags ^= FL_ZF; + + return TRUE; +} + +//************************************************************************************** +BOOL SetSignFlag(PCONTEXT Context) +//************************************************************************************** +{ + if (Context == NULL) + return FALSE; + + Context->EFlags |= FL_SF; + + return TRUE; +} + +//************************************************************************************** +BOOL ClearSignFlag(PCONTEXT Context) +//************************************************************************************** +{ + if (Context == NULL) + return FALSE; + + Context->EFlags &= ~FL_SF; + + return TRUE; +} + +//************************************************************************************** +BOOL FlipSignFlag(PCONTEXT Context) +//************************************************************************************** +{ + if (Context == NULL) + return FALSE; + + Context->EFlags ^= FL_SF; + + return TRUE; +} + //************************************************************************************** BOOL SetSingleStepMode(PCONTEXT Context, PVOID Handler) //************************************************************************************** { - if (Context == NULL) + if (Context == NULL) return FALSE; - + // set the trap flag Context->EFlags |= FL_TF; - + +#ifdef BRANCH_TRACE + // set bits 8 & 9, LBR & BTF bits for branch trace + PDR7 Dr7 = (PDR7)&(Context->Dr7); + //Dr7->LE = 1; + Dr7->GE = 1; +#endif SingleStepHandler = (SINGLE_STEP_HANDLER)Handler; return TRUE; @@ -1822,9 +1909,9 @@ BOOL ClearSingleStepMode(PCONTEXT Context) Context->EFlags &= ~FL_TF; TrapIndex = 0; - + SingleStepHandler = NULL; - + return TRUE; } @@ -1832,7 +1919,7 @@ BOOL ClearSingleStepMode(PCONTEXT Context) BOOL StepOverExecutionBreakpoint(PCONTEXT Context, PBREAKPOINTINFO pBreakpointInfo) //************************************************************************************** // This function allows us to get past an execution breakpoint while leaving it set. It -// diaables the breakpoint, sets single-step mode to step over the instruction, whereupon +// diaables the breakpoint, sets single-step mode to step over the instruction, whereupon // the breakpoint is restored in ResumeAfterExecutionBreakpoint and execution resumed. { PDR7 Dr7; @@ -1841,7 +1928,7 @@ BOOL StepOverExecutionBreakpoint(PCONTEXT Context, PBREAKPOINTINFO pBreakpointIn return FALSE; Dr7 = (PDR7)&(Context->Dr7); - + switch(pBreakpointInfo->Register) { case 0: @@ -1860,12 +1947,12 @@ BOOL StepOverExecutionBreakpoint(PCONTEXT Context, PBREAKPOINTINFO pBreakpointIn // set the trap flag Context->EFlags |= FL_TF; - + // set the 'trap index' so we know which 'register' we're skipping // (off by one to allow 'set'/'unset' to be signified by !0/0) TrapIndex = pBreakpointInfo->Register + 1; -#ifdef _WIN64 +#ifdef _WIN64 if (pBreakpointInfo->ThreadHandle == NULL) { DoOutputDebugString("StepOverExecutionBreakpoint: No thread handle found in breakpoints found for current thread %d.\n", GetCurrentThreadId()); @@ -1873,14 +1960,14 @@ BOOL StepOverExecutionBreakpoint(PCONTEXT Context, PBREAKPOINTINFO pBreakpointIn } Context->ContextFlags = CONTEXT_DEBUG_REGISTERS; - + if (!SetThreadContext(pBreakpointInfo->ThreadHandle, Context)) { DoOutputErrorString("StepOverExecutionBreakpoint: SetThreadContext failed"); return FALSE; - } + } #endif - + return TRUE; } @@ -1894,15 +1981,15 @@ BOOL ResumeAfterExecutionBreakpoint(PCONTEXT Context, PBREAKPOINTINFO pBreakpoin return FALSE; Dr7 = (PDR7)&(Context->Dr7); - -#ifdef _WIN64 + +#ifdef _WIN64 if (!pBreakpointInfo) { DoOutputDebugString("ResumeAfterExecutionBreakpoint: pBreakpointInfo NULL.\n"); return FALSE; - } + } #endif - + switch(TrapIndex-1) { case 0: @@ -1921,8 +2008,8 @@ BOOL ResumeAfterExecutionBreakpoint(PCONTEXT Context, PBREAKPOINTINFO pBreakpoin // Clear the trap flag Context->EFlags &= ~FL_TF; - -#ifdef _WIN64 + +#ifdef _WIN64 if (pBreakpointInfo->ThreadHandle == NULL) { DoOutputDebugString("ResumeAfterExecutionBreakpoint: No thread handle found in breakpoints found for current thread %d.\n", GetCurrentThreadId()); @@ -1930,17 +2017,17 @@ BOOL ResumeAfterExecutionBreakpoint(PCONTEXT Context, PBREAKPOINTINFO pBreakpoin } Context->ContextFlags = CONTEXT_DEBUG_REGISTERS; - + if (!SetThreadContext(pBreakpointInfo->ThreadHandle, Context)) { DoOutputErrorString("ResumeAfterExecutionBreakpoint: SetThreadContext failed"); return FALSE; } #endif - + // clear the 'trap index' TrapIndex = 0; - + return TRUE; } @@ -1961,7 +2048,7 @@ BOOL ClearDebugRegister PDWORD_PTR Dr2 = &Context.Dr2; PDWORD_PTR Dr3 = &Context.Dr3; PDR7 Dr7 = (PDR7)&(Context.Dr7); - + if ((unsigned int)Type > 3) { DoOutputDebugString("ClearDebugRegister: %d is an invalid breakpoint type, must be 0-3.\n", Type); @@ -1973,7 +2060,7 @@ BOOL ClearDebugRegister DoOutputDebugString("ClearDebugRegister: %d is an invalid register, must be 0-3.\n", Register); return FALSE; } - + if (Size < 0 || Size > 8) { DoOutputDebugString("ClearDebugRegister: %d is an invalid Size, must be 1, 2, 4 or 8.\n", Size); @@ -1981,60 +2068,60 @@ BOOL ClearDebugRegister } Context.ContextFlags = CONTEXT_DEBUG_REGISTERS; - + if (!GetThreadContext(hThread, &Context)) { DoOutputDebugString("ClearDebugRegister: Initial GetThreadContext failed"); return FALSE; - } + } if (Register == 0) { *Dr0 = 0; Dr7->LEN0 = 0; Dr7->RWE0 = 0; - Dr7->L0 = 0; + Dr7->L0 = 0; } else if (Register == 1) { *Dr1 = 0; Dr7->LEN1 = 0; Dr7->RWE1 = 0; - Dr7->L1 = 0; + Dr7->L1 = 0; } else if (Register == 2) { *Dr2 = 0; Dr7->LEN2 = 0; Dr7->RWE2 = 0; - Dr7->L2 = 0; + Dr7->L2 = 0; } else if (Register == 3) { *Dr3 = 0; Dr7->LEN3 = 0; Dr7->RWE3 = 0; - Dr7->L3 = 0; + Dr7->L3 = 0; } #ifndef _WIN64 if (Type == BP_READWRITE && address_is_in_stack((DWORD_PTR)Address)) WoW64UnpatchBreakpoint(Register); -#endif - +#endif + Context.Dr6 = 0; Context.ContextFlags = CONTEXT_DEBUG_REGISTERS; - + if (!SetThreadContext(hThread, &Context)) { DoOutputDebugString("ClearDebugRegister: SetThreadContext failed"); return FALSE; - } - + } + if (DoCloseHandle == TRUE) CloseHandle(hThread); - + return TRUE; } @@ -2043,7 +2130,7 @@ int ContextCheckDebugRegister(CONTEXT Context, int Register) //************************************************************************************** { PDR7 Dr7; - + if (Register < 0 || Register > 3) { DoOutputDebugString("ContextCheckDebugRegister: %d is an invalid register, must be 0-3.\n", Register); @@ -2060,7 +2147,7 @@ int ContextCheckDebugRegister(CONTEXT Context, int Register) return Dr7->L2; else if (Register == 3) return Dr7->L3; - + // should not happen return -1; } @@ -2071,7 +2158,7 @@ int CheckDebugRegister(HANDLE hThread, int Register) { CONTEXT Context; PDR7 Dr7; - + if (Register < 0 || Register > 3) { DoOutputDebugString("CheckDebugRegister: %d is an invalid register, must be 0-3.\n", Register); @@ -2079,9 +2166,9 @@ int CheckDebugRegister(HANDLE hThread, int Register) } Dr7 = (PDR7)&(Context.Dr7); - + Context.ContextFlags = CONTEXT_DEBUG_REGISTERS; - + if (!GetThreadContext(hThread, &Context)) { DoOutputDebugString("CheckDebugRegister: GetThreadContext failed - FATAL\n"); @@ -2096,7 +2183,7 @@ int CheckDebugRegister(HANDLE hThread, int Register) return Dr7->L2; else if (Register == 3) return Dr7->L3; - + // should not happen return -1; } @@ -2107,19 +2194,19 @@ BOOL ContextSetBreakpoint(PTHREADBREAKPOINTS ReferenceThreadBreakpoint) //************************************************************************************** { PTHREADBREAKPOINTS CurrentThreadBreakpoint; - + if (ReferenceThreadBreakpoint == NULL) { DoOutputDebugString("ContextSetBreakpoint: ReferenceThreadBreakpoint NULL.\n"); - return FALSE; + return FALSE; } - + if (MainThreadBreakpointList == NULL) { DoOutputDebugString("ContextSetBreakpoint: MainThreadBreakpointList NULL.\n"); - return FALSE; + return FALSE; } - + CurrentThreadBreakpoint = MainThreadBreakpointList; while (CurrentThreadBreakpoint) @@ -2135,21 +2222,21 @@ BOOL ContextSetBreakpoint(PTHREADBREAKPOINTS ReferenceThreadBreakpoint) CurrentThreadBreakpoint->BreakpointInfo[i].Address = ReferenceThreadBreakpoint->BreakpointInfo[i].Address; CurrentThreadBreakpoint->BreakpointInfo[i].Type = ReferenceThreadBreakpoint->BreakpointInfo[i].Type; CurrentThreadBreakpoint->BreakpointInfo[i].Callback = ReferenceThreadBreakpoint->BreakpointInfo[i].Callback; - + if (CurrentThreadBreakpoint->BreakpointInfo[i].Address) SetThreadBreakpoint(CurrentThreadBreakpoint->ThreadId, CurrentThreadBreakpoint->BreakpointInfo[i].Register, CurrentThreadBreakpoint->BreakpointInfo[i].Size, CurrentThreadBreakpoint->BreakpointInfo[i].Address, CurrentThreadBreakpoint->BreakpointInfo[i].Type, CurrentThreadBreakpoint->BreakpointInfo[i].Callback); } } - + CurrentThreadBreakpoint = CurrentThreadBreakpoint->NextThreadBreakpoints; } - + return TRUE; } //************************************************************************************** -BOOL ContextSetThreadBreakpoint +BOOL ContextSetThreadBreakpointEx //************************************************************************************** ( PCONTEXT Context, @@ -2157,33 +2244,32 @@ BOOL ContextSetThreadBreakpoint int Size, LPVOID Address, DWORD Type, - PVOID Callback + PVOID Callback, + BOOL NoSetThreadContext ) { PTHREADBREAKPOINTS CurrentThreadBreakpoint; - + if (Register > 3 || Register < 0) { DoOutputDebugString("ContextSetThreadBreakpoint: Error - register value %d, can only have value 0-3.\n", Register); return FALSE; } - - if (!ContextSetDebugRegister(Context, Register, Size, Address, Type)) + + if (!ContextSetDebugRegisterEx(Context, Register, Size, Address, Type, NoSetThreadContext)) { DoOutputDebugString("ContextSetThreadBreakpoint: Call to ContextSetDebugRegister failed.\n"); } else { - DoOutputDebugString("ContextSetThreadBreakpoint: Call to ContextSetDebugRegister succeeded.\n"); - CurrentThreadBreakpoint = GetThreadBreakpoints(GetCurrentThreadId()); - + if (CurrentThreadBreakpoint == NULL) { DoOutputDebugString("ContextSetThreadBreakpoint: Error - Failed to acquire thread breakpoints.\n"); return FALSE; } - + CurrentThreadBreakpoint->BreakpointInfo[Register].ThreadHandle = CurrentThreadBreakpoint->ThreadHandle; CurrentThreadBreakpoint->BreakpointInfo[Register].Register = Register; CurrentThreadBreakpoint->BreakpointInfo[Register].Size = Size; @@ -2192,31 +2278,25 @@ BOOL ContextSetThreadBreakpoint CurrentThreadBreakpoint->BreakpointInfo[Register].Callback = Callback; } -#ifdef _WIN64 - if (CurrentThreadBreakpoint->ThreadHandle == NULL) - { - DoOutputDebugString("ContextSetThreadBreakpoint: No thread handle found in breakpoints found for current thread %d.\n", GetCurrentThreadId()); - return FALSE; - } - - Context->ContextFlags = CONTEXT_DEBUG_REGISTERS; - - if (!SetThreadContext(CurrentThreadBreakpoint->ThreadHandle, Context)) - { - DoOutputErrorString("ContextSetThreadBreakpoint: SetThreadContext failed"); - return FALSE; - } -#endif - - //if (!ContextSetBreakpoint(CurrentThreadBreakpoint)) - //{ - // DoOutputErrorString("ContextSetThreadBreakpoint: ContextSetBreakpoint failed"); - // return FALSE; - //} return TRUE; } +//************************************************************************************** +BOOL ContextSetThreadBreakpoint +//************************************************************************************** +( + PCONTEXT Context, + int Register, + int Size, + LPVOID Address, + DWORD Type, + PVOID Callback +) +{ + return ContextSetThreadBreakpointEx(Context, Register, Size, Address, Type, Callback, FALSE); +} + //************************************************************************************** BOOL ContextSetNextAvailableBreakpoint //************************************************************************************** @@ -2242,7 +2322,7 @@ BOOL ContextSetNextAvailableBreakpoint else { unsigned int TempRegister; - + if (!ContextGetNextAvailableBreakpoint(Context, &TempRegister)) { DoOutputDebugString("ContextSetNextAvailableBreakpoint: ContextGetNextAvailableBreakpoint failed\n"); @@ -2267,9 +2347,9 @@ BOOL ContextUpdateCurrentBreakpoint PTHREADBREAKPOINTS CurrentThreadBreakpoint; PBREAKPOINTINFO pBreakpointInfo; unsigned int bp; - + CurrentThreadBreakpoint = GetThreadBreakpoints(GetCurrentThreadId()); - + if (CurrentThreadBreakpoint == NULL) { DoOutputDebugString("ContextUpdateCurrentBreakpoint: Error - Failed to acquire thread breakpoints.\n"); @@ -2281,38 +2361,38 @@ BOOL ContextUpdateCurrentBreakpoint if (Context->Dr6 & (DWORD_PTR)(1 << bp)) { pBreakpointInfo = &(CurrentThreadBreakpoint->BreakpointInfo[bp]); - + if (pBreakpointInfo == NULL) { DoOutputDebugString("ContextUpdateCurrentBreakpoint: Can't get BreakpointInfo.\n"); return FALSE; - } - - if (pBreakpointInfo->Register == bp) + } + + if (pBreakpointInfo->Register == bp) { if (bp == 0 && ((DWORD_PTR)pBreakpointInfo->Address == Context->Dr0) && ((DWORD)pBreakpointInfo->Type == ((PDR7)&(Context->Dr7))->RWE0)) { - return ContextSetThreadBreakpoint(Context, 0, Size, Address, Type, Callback); - } + return ContextSetThreadBreakpoint(Context, 0, Size, Address, Type, Callback); + } if (bp == 1 && ((DWORD_PTR)pBreakpointInfo->Address == Context->Dr1) && ((DWORD)pBreakpointInfo->Type == ((PDR7)&(Context->Dr7))->RWE1)) { - return ContextSetThreadBreakpoint(Context, 1, Size, Address, Type, Callback); - } + return ContextSetThreadBreakpoint(Context, 1, Size, Address, Type, Callback); + } if (bp == 2 && ((DWORD_PTR)pBreakpointInfo->Address == Context->Dr2) && ((DWORD)pBreakpointInfo->Type == ((PDR7)&(Context->Dr7))->RWE2)) { - return ContextSetThreadBreakpoint(Context, 2, Size, Address, Type, Callback); - } + return ContextSetThreadBreakpoint(Context, 2, Size, Address, Type, Callback); + } if (bp == 3 && ((DWORD_PTR)pBreakpointInfo->Address == Context->Dr3) && ((DWORD)pBreakpointInfo->Type == ((PDR7)&(Context->Dr7))->RWE3)) { - return ContextSetThreadBreakpoint(Context, 3, Size, Address, Type, Callback); - } + return ContextSetThreadBreakpoint(Context, 3, Size, Address, Type, Callback); + } } } } - + return FALSE; } @@ -2326,9 +2406,9 @@ BOOL ContextClearCurrentBreakpoint PTHREADBREAKPOINTS CurrentThreadBreakpoint; PBREAKPOINTINFO pBreakpointInfo; unsigned int bp; - + CurrentThreadBreakpoint = GetThreadBreakpoints(GetCurrentThreadId()); - + if (CurrentThreadBreakpoint == NULL) { DoOutputDebugString("ContextUpdateCurrentBreakpoint: Error - Failed to acquire thread breakpoints.\n"); @@ -2340,37 +2420,69 @@ BOOL ContextClearCurrentBreakpoint if (Context->Dr6 & (DWORD_PTR)(1 << bp)) { pBreakpointInfo = &(CurrentThreadBreakpoint->BreakpointInfo[bp]); - + if (pBreakpointInfo == NULL) { DoOutputDebugString("ContextUpdateCurrentBreakpoint: Can't get BreakpointInfo.\n"); return FALSE; - } + } if (pBreakpointInfo->Register == bp) - return ContextClearBreakpoint(Context, pBreakpointInfo); + return ContextClearBreakpoint(Context, pBreakpointInfo); } } - + return FALSE; } //************************************************************************************** -DWORD WINAPI SetBreakpointThread(LPVOID lpParam) +BOOL ContextSetThreadBreakpointsEx(PCONTEXT ThreadContext, PTHREADBREAKPOINTS ThreadBreakpoints, BOOL NoSetThreadContext) +//************************************************************************************** +{ + if (!ThreadContext) + return FALSE; + + for (unsigned int Register = 0; Register < NUMBER_OF_DEBUG_REGISTERS; Register++) + { + if (!ContextSetThreadBreakpointEx + ( + ThreadContext, + ThreadBreakpoints->BreakpointInfo[Register].Register, + ThreadBreakpoints->BreakpointInfo[Register].Size, + ThreadBreakpoints->BreakpointInfo[Register].Address, + ThreadBreakpoints->BreakpointInfo[Register].Type, + ThreadBreakpoints->BreakpointInfo[Register].Callback, + NoSetThreadContext + )) + return FALSE; + } + + return TRUE; +} + +//************************************************************************************** +BOOL ContextSetThreadBreakpoints(PCONTEXT ThreadContext, PTHREADBREAKPOINTS ThreadBreakpoints) +//************************************************************************************** +{ + return ContextSetThreadBreakpointsEx(ThreadContext, ThreadBreakpoints, FALSE); +} + +//************************************************************************************** +DWORD WINAPI SetBreakpointThread(LPVOID lpParam) //************************************************************************************** -{ +{ DWORD RetVal; - + PBREAKPOINTINFO pBreakpointInfo = (PBREAKPOINTINFO)lpParam; - + if (SuspendThread(pBreakpointInfo->ThreadHandle) == 0xFFFFFFFF) DoOutputErrorString("SetBreakpointThread: Call to SuspendThread failed for thread handle 0x%x", pBreakpointInfo->ThreadHandle); - + if (!SetDebugRegister(pBreakpointInfo->ThreadHandle, pBreakpointInfo->Register, pBreakpointInfo->Size, pBreakpointInfo->Address, pBreakpointInfo->Type)) DoOutputErrorString("SetBreakpointThread: Call to SetDebugRegister failed for thread handle 0x%x", pBreakpointInfo->ThreadHandle); RetVal = ResumeThread(pBreakpointInfo->ThreadHandle); - + if (RetVal == -1) DoOutputErrorString("SetBreakpointThread: ResumeThread failed for thread handle 0x%x", pBreakpointInfo->ThreadHandle); else if (RetVal == 0) @@ -2378,19 +2490,19 @@ DWORD WINAPI SetBreakpointThread(LPVOID lpParam) else if (g_config.debug) DoOutputDebugString("SetBreakpointThread: Sample thread with handle 0x%x was suspended, now resumed.\n", pBreakpointInfo->ThreadHandle); - return 1; -} + return 1; +} //************************************************************************************** -DWORD WINAPI ClearBreakpointThread(LPVOID lpParam) +DWORD WINAPI ClearBreakpointThread(LPVOID lpParam) //************************************************************************************** -{ +{ DWORD RetVal; PBREAKPOINTINFO pBreakpointInfo = (PBREAKPOINTINFO)lpParam; - + if (SuspendThread(pBreakpointInfo->ThreadHandle) == 0xFFFFFFFF) DoOutputErrorString("ClearBreakpointThread: Call to SuspendThread failed"); - + if (!ClearDebugRegister(pBreakpointInfo->ThreadHandle, pBreakpointInfo->Register, pBreakpointInfo->Size, pBreakpointInfo->Address, pBreakpointInfo->Type)) { DoOutputDebugString("ClearBreakpointThread: Call to ClearDebugRegister failed.\n"); @@ -2410,58 +2522,8 @@ DWORD WINAPI ClearBreakpointThread(LPVOID lpParam) DoOutputDebugString("ClearBreakpointThread: Sample thread was suspended, now resumed.\n"); } - DebugOutputThreadBreakpoints(); - - return TRUE; -} + DebugOutputThreadBreakpoints(); -//************************************************************************************** -BOOL ClearBreakpointWithoutThread(DWORD ThreadId, int Register) -//************************************************************************************** -{ - PBREAKPOINTINFO pBreakpointInfo; - PTHREADBREAKPOINTS CurrentThreadBreakpoint; - - if (Register > 3 || Register < 0) - { - DoOutputDebugString("ClearBreakpointWithoutThread: Error - register value %d, can only have value 0-3.\n", Register); - return FALSE; - } - - CurrentThreadBreakpoint = GetThreadBreakpoints(ThreadId); - - if (CurrentThreadBreakpoint == NULL) - { - DoOutputDebugString("ClearBreakpointWithoutThread: Creating new thread breakpoints for thread %d.\n", ThreadId); - CurrentThreadBreakpoint = CreateThreadBreakpoints(ThreadId); - } - - if (CurrentThreadBreakpoint == NULL) - { - DoOutputDebugString("ClearBreakpointWithoutThread: Cannot create new thread breakpoints - FATAL.\n"); - return FALSE; - } - - pBreakpointInfo = &CurrentThreadBreakpoint->BreakpointInfo[Register]; - - if (CurrentThreadBreakpoint->ThreadHandle == NULL) - { - DoOutputDebugString("ClearBreakpointWithoutThread: There is no thread handle in the thread breakpoint - Error.\n"); - return FALSE; - } - - if (!ClearDebugRegister(pBreakpointInfo->ThreadHandle, pBreakpointInfo->Register, pBreakpointInfo->Size, pBreakpointInfo->Address, pBreakpointInfo->Type)) - { - DoOutputDebugString("ClearBreakpointWithoutThread: Call to ClearDebugRegister failed.\n"); - return FALSE; - } - - //pBreakpointInfo->Register = 0; - pBreakpointInfo->Size = 0; - pBreakpointInfo->Address = 0; - pBreakpointInfo->Type = 0; - pBreakpointInfo->Callback = NULL; - return TRUE; } @@ -2485,16 +2547,16 @@ BOOL SetBreakpointWithoutThread { DoOutputDebugString("SetBreakpointWithoutThread: Error - register value %d, can only have value 0-3.\n", Register); return FALSE; - } - + } + CurrentThreadBreakpoint = GetThreadBreakpoints(ThreadId); - + if (CurrentThreadBreakpoint == NULL) { DoOutputDebugString("SetBreakpointWithoutThread: Creating new thread breakpoints for thread %d.\n", ThreadId); CurrentThreadBreakpoint = CreateThreadBreakpoints(ThreadId); } - + if (CurrentThreadBreakpoint == NULL) { DoOutputDebugString("SetBreakpointWithoutThread: Cannot create new thread breakpoints - FATAL.\n"); @@ -2502,34 +2564,34 @@ BOOL SetBreakpointWithoutThread } pBreakpointInfo = &CurrentThreadBreakpoint->BreakpointInfo[Register]; - + if (CurrentThreadBreakpoint->ThreadHandle == NULL) { DoOutputDebugString("SetBreakpointWithoutThread: There is no thread handle in the thread breakpoint - Error.\n"); return FALSE; } - + pBreakpointInfo->ThreadHandle = CurrentThreadBreakpoint->ThreadHandle; pBreakpointInfo->Register = Register; pBreakpointInfo->Size = Size; pBreakpointInfo->Address = Address; pBreakpointInfo->Type = Type; pBreakpointInfo->Callback = Callback; - + __try { RetVal = SetDebugRegister(pBreakpointInfo->ThreadHandle, Register, Size, Address, Type); } - __except(EXCEPTION_EXECUTE_HANDLER) - { + __except(EXCEPTION_EXECUTE_HANDLER) + { DoOutputErrorString("SetBreakpointWithoutThread: Exception calling SetDebugRegister"); return FALSE; } - + // Debug DoOutputDebugString("SetBreakpointWithoutThread: bp set with register %d\n", Register); - return TRUE; + return TRUE; } //************************************************************************************** @@ -2552,13 +2614,13 @@ BOOL SetThreadBreakpoint HANDLE hSetBreakpointThread; DWORD SetBreakpointThreadId; BOOL RetVal; - + if (Register > 3 || Register < 0) { DoOutputDebugString("SetThreadBreakpoint: Error - register value %d, can only have value 0-3.\n", Register); return FALSE; - } - + } + CurrentThreadBreakpoint = GetThreadBreakpoints(ThreadId); if (CurrentThreadBreakpoint == NULL) @@ -2566,7 +2628,7 @@ BOOL SetThreadBreakpoint DoOutputDebugString("SetThreadBreakpoint: Creating new thread breakpoints for thread %d.\n", ThreadId); CurrentThreadBreakpoint = CreateThreadBreakpoints(ThreadId); } - + if (CurrentThreadBreakpoint == NULL) { DoOutputDebugString("SetThreadBreakpoint: Cannot create new thread breakpoints - error.\n"); @@ -2574,13 +2636,13 @@ BOOL SetThreadBreakpoint } pBreakpointInfo = &CurrentThreadBreakpoint->BreakpointInfo[Register]; - + if (CurrentThreadBreakpoint->ThreadHandle == NULL) { DoOutputDebugString("SetThreadBreakpoint: There is no thread handle in the thread breakpoint - Error.\n"); return FALSE; } - + pBreakpointInfo->ThreadHandle = CurrentThreadBreakpoint->ThreadHandle; pBreakpointInfo->Register = Register; pBreakpointInfo->Size = Size; @@ -2589,21 +2651,13 @@ BOOL SetThreadBreakpoint pBreakpointInfo->Callback = Callback; if (VECTORED_HANDLER) - { CAPEExceptionFilterHandle = AddVectoredExceptionHandler(1, CAPEExceptionFilter); - OriginalExceptionHandler = NULL; - } - else - { - OriginalExceptionHandler = SetUnhandledExceptionFilter(CAPEExceptionFilter); - CAPEExceptionFilterHandle = NULL; - } __try { - hSetBreakpointThread = CreateThread(NULL, 0, SetBreakpointThread, pBreakpointInfo, 0, &SetBreakpointThreadId); + hSetBreakpointThread = CreateThread(NULL, 0, SetBreakpointThread, pBreakpointInfo, 0, &SetBreakpointThreadId); } - __except(EXCEPTION_EXECUTE_HANDLER) + __except(EXCEPTION_EXECUTE_HANDLER) { DoOutputErrorString("SetThreadBreakpoint: An exception was raised creating SetBreakpointThread thread"); } @@ -2611,29 +2665,29 @@ BOOL SetThreadBreakpoint if (!hSetBreakpointThread) { DoOutputDebugString("SetThreadBreakpoint: Failed to create SetBreakpointThread thread, falling back to SetBreakpointWithoutThread.\n"); - + __try { RetVal = SetBreakpointWithoutThread(ThreadId, Register, Size, Address, Type, Callback); } - __except(EXCEPTION_EXECUTE_HANDLER) - { + __except(EXCEPTION_EXECUTE_HANDLER) + { DoOutputErrorString("SetThreadBreakpoint: Error calling SetBreakpointWithoutThread"); return FALSE; } - + return RetVal; } - + // We wait for the thread to complete - if this hasn't happened // in under a second, we bail and set without creating a thread RetVal = WaitForSingleObject(hSetBreakpointThread, 1000); - + if (RetVal != WAIT_OBJECT_0) { TerminateThread(hSetBreakpointThread, 0); DoOutputDebugString("SetThreadBreakpoint: SetBreakpointThread timeout, thread killed.\n"); - + RetVal = ResumeThread(CurrentThreadBreakpoint->ThreadHandle); if (RetVal == -1) { @@ -2647,21 +2701,21 @@ BOOL SetThreadBreakpoint { DoOutputDebugString("SetThreadBreakpoint: Sample thread was suspended, now resumed. About to set breakpoint without thread.\n"); } - + return SetBreakpointWithoutThread(ThreadId, Register, Size, Address, Type, Callback); - } - - DoOutputDebugString("SetThreadBreakpoint: Set bp %d thread id %d type %d at address 0x%p, size %d with Callback 0x%x.\n", - Register, + } + + DoOutputDebugString("SetThreadBreakpoint: Set bp %d thread id %d type %d at address 0x%p, size %d with Callback 0x%x.\n", + Register, ThreadId, Type, - Address, - Size, + Address, + Size, Callback ); CloseHandle(hSetBreakpointThread); - + return TRUE; } @@ -2679,9 +2733,9 @@ BOOL SetBreakpoint if (MainThreadBreakpointList == NULL) { DoOutputDebugString("SetBreakpoint: MainThreadBreakpointList NULL.\n"); - return FALSE; + return FALSE; } - + PTHREADBREAKPOINTS ThreadBreakpoints = MainThreadBreakpointList; while (ThreadBreakpoints) @@ -2693,14 +2747,14 @@ BOOL SetBreakpoint ThreadBreakpoints->BreakpointInfo[Register].Address = Address; ThreadBreakpoints->BreakpointInfo[Register].Type = Type; ThreadBreakpoints->BreakpointInfo[Register].Callback = Callback; - + DoOutputDebugString("SetBreakpoint: About to call SetThreadBreakpoint for thread %d.\n", ThreadBreakpoints->ThreadId); - + SetThreadBreakpoint(ThreadBreakpoints->ThreadId, Register, Size, Address, Type, Callback); - + ThreadBreakpoints = ThreadBreakpoints->NextThreadBreakpoints; } - + return TRUE; } @@ -2711,7 +2765,7 @@ BOOL SetThreadBreakpoints(PTHREADBREAKPOINTS ThreadBreakpoints) if (!ThreadBreakpoints->ThreadId) { DoOutputErrorString("SetThreadBreakpoints: Error - Thread ID missing from ThreadBreakpoints.\n"); - return FALSE; + return FALSE; } for (unsigned int Register = 0; Register < NUMBER_OF_DEBUG_REGISTERS; Register++) @@ -2724,10 +2778,10 @@ BOOL SetThreadBreakpoints(PTHREADBREAKPOINTS ThreadBreakpoints) ThreadBreakpoints->BreakpointInfo[Register].Address, ThreadBreakpoints->BreakpointInfo[Register].Type, ThreadBreakpoints->BreakpointInfo[Register].Callback - )) + )) return FALSE; } - + return TRUE; } @@ -2735,91 +2789,50 @@ BOOL SetThreadBreakpoints(PTHREADBREAKPOINTS ThreadBreakpoints) BOOL ClearBreakpoint(DWORD ThreadId, int Register) //************************************************************************************** { - return ClearBreakpointWithoutThread(ThreadId, Register); -/* PBREAKPOINTINFO pBreakpointInfo; PTHREADBREAKPOINTS CurrentThreadBreakpoint; - HANDLE hClearBreakpointThread; - BOOL RetVal; if (Register > 3 || Register < 0) { DoOutputDebugString("ClearBreakpoint: Error - register value %d, can only have value 0-3.\n", Register); return FALSE; - } - - CurrentThreadBreakpoint = GetThreadBreakpoints(ThreadId); - + } + + CurrentThreadBreakpoint = GetThreadBreakpoints(ThreadId); + + if (CurrentThreadBreakpoint == NULL) + { + DoOutputDebugString("ClearBreakpoint: Creating new thread breakpoints for thread %d.\n", ThreadId); + CurrentThreadBreakpoint = CreateThreadBreakpoints(ThreadId); + } + if (CurrentThreadBreakpoint == NULL) { - DoOutputDebugString("Cannot find thread breakpoints - failed to clear.\n"); + DoOutputDebugString("ClearBreakpoint: Cannot create new thread breakpoints - FATAL.\n"); return FALSE; } pBreakpointInfo = &CurrentThreadBreakpoint->BreakpointInfo[Register]; - + if (CurrentThreadBreakpoint->ThreadHandle == NULL) { DoOutputDebugString("ClearBreakpoint: There is no thread handle in the thread breakpoint - Error.\n"); return FALSE; } - - pBreakpointInfo->ThreadHandle = CurrentThreadBreakpoint->ThreadHandle; - - __try - { - hClearBreakpointThread = CreateThread(NULL, 0, ClearBreakpointThread, pBreakpointInfo, 0, &ThreadId); - } - __except(EXCEPTION_EXECUTE_HANDLER) - { - DoOutputErrorString("ClearBreakpoint: Unable to create ClearBreakpointThread thread"); - } - - if (hClearBreakpointThread) - { - DoOutputDebugString("ClearBreakpoint: thread created, handle 0x%x.\n", hClearBreakpointThread); - - // If this hasn't happened in under a second, we bail - // and clear without creating a thread - RetVal = WaitForSingleObject(hClearBreakpointThread, 1000); - - DoOutputDebugString("ClearBreakpoint: Aboot tae close handle.\n"); - //CloseHandle(hClearBreakpointThread); - - if (RetVal != WAIT_OBJECT_0) - { - DoOutputDebugString("ClearBreakpoint: thread timeout, falling back to clearing without thread.\n"); - return ClearBreakpointWithoutThread(ThreadId, Register); - } - - DoOutputDebugString("ClearBreakpoint: Cleared breakpoint %d.\n", pBreakpointInfo->Register); + if (!ClearDebugRegister(pBreakpointInfo->ThreadHandle, pBreakpointInfo->Register, pBreakpointInfo->Size, pBreakpointInfo->Address, pBreakpointInfo->Type)) + { + DoOutputDebugString("ClearBreakpoint: Call to ClearDebugRegister failed.\n"); + return FALSE; + } - return TRUE; - } - else - { - __try - { - RetVal = ClearBreakpointWithoutThread(ThreadId, Register); - } - __except(EXCEPTION_EXECUTE_HANDLER) - { - DoOutputErrorString("ClearBreakpoint: Error calling ClearBreakpointWithoutThread"); - return FALSE; - } - - return RetVal; - } - //pBreakpointInfo->Register = 0; pBreakpointInfo->Size = 0; pBreakpointInfo->Address = 0; pBreakpointInfo->Type = 0; pBreakpointInfo->Callback = NULL; - + return TRUE; -*/ } //************************************************************************************** @@ -2841,7 +2854,7 @@ BOOL SetNextAvailableBreakpoint DoOutputDebugString("SetNextAvailableBreakpoint: Creating new thread breakpoints for thread %d.\n", ThreadId); CurrentThreadBreakpoint = CreateThreadBreakpoints(ThreadId); } - + if (CurrentThreadBreakpoint == NULL) { DoOutputDebugString("SetNextAvailableBreakpoint: Cannot create new thread breakpoints - FATAL.\n"); @@ -2876,64 +2889,56 @@ BOOL InitialiseDebugger(void) if (MainThreadBreakpointList == NULL) { DoOutputDebugString("InitialiseDebugger: Failed to create thread breakpoints struct.\n"); - return FALSE; + return FALSE; } - + if (MainThreadBreakpointList->ThreadHandle == NULL) { DoOutputDebugString("InitialiseDebugger error: main thread handle not set.\n"); - return FALSE; + return FALSE; } - + // Initialise global variables ChildProcessId = 0; SingleStepHandler = NULL; SampleVectoredHandler = NULL; - VECTORED_HANDLER = TRUE; + VECTORED_HANDLER = FALSE; #ifndef _WIN64 // Ensure wow64 patch is installed if needed WoW64fix(); -#endif +#endif // Set up handler to catch breakpoint exceptions if (VECTORED_HANDLER) - { CAPEExceptionFilterHandle = AddVectoredExceptionHandler(1, CAPEExceptionFilter); - OriginalExceptionHandler = NULL; - } - else // deprecated alternative via unhandled exception filter - { - OriginalExceptionHandler = SetUnhandledExceptionFilter(CAPEExceptionFilter); - CAPEExceptionFilterHandle = NULL; - } - + // Global switch for guard pages GuardPagesDisabled = TRUE; - + return TRUE; } //************************************************************************************** DWORD_PTR GetNestedStackPointer(void) //************************************************************************************** -{ +{ CONTEXT context; RtlCaptureContext(&context); - + #ifdef _WIN64 return (DWORD_PTR)context.Rsp; #else return (DWORD_PTR)context.Esp; -#endif +#endif } #ifndef _WIN64 //************************************************************************************** __declspec (naked dllexport) void DebuggerInit(void) //************************************************************************************** -{ +{ DWORD StackPointer; _asm @@ -2945,10 +2950,10 @@ __declspec (naked dllexport) void DebuggerInit(void) sub esp, __LOCAL_SIZE pushad } - + if (!InitialiseDebugger()) DoOutputDebugString("Debugger initialisation failure!\n"); - + // Package specific code // End of package specific code DoOutputDebugString("Debugger initialisation complete, about to execute OEP at 0x%p\n", OEP); @@ -2966,16 +2971,16 @@ __declspec (naked dllexport) void DebuggerInit(void) //************************************************************************************** __declspec(dllexport) void DebuggerInit(void) //************************************************************************************** -{ +{ DWORD_PTR StackPointer; StackPointer = GetNestedStackPointer() - 8; // this offset has been determined experimentally - TODO: tidy - + if (!InitialiseDebugger()) DoOutputDebugString("Debugger initialisation failure!\n"); else DoOutputDebugString("Debugger initialised, ESP = 0x%x\n", StackPointer); - + // Package specific code // End of package specific code @@ -2987,36 +2992,36 @@ __declspec(dllexport) void DebuggerInit(void) #endif BOOL SendDebuggerMessage(PVOID Input) -{ +{ BOOL fSuccess; - DWORD cbReplyBytes, cbWritten; + DWORD cbReplyBytes, cbWritten; cbReplyBytes = sizeof(PVOID); - + if (hCapePipe == NULL) - { + { DoOutputErrorString("SendDebuggerMessage: hCapePipe NULL."); return FALSE; } - // Write the reply to the pipe. + // Write the reply to the pipe. fSuccess = WriteFile - ( - hCapePipe, // handle to pipe - &Input, // buffer to write from - cbReplyBytes, // number of bytes to write - &cbWritten, // number of bytes written - NULL // not overlapped I/O + ( + hCapePipe, // handle to pipe + &Input, // buffer to write from + cbReplyBytes, // number of bytes to write + &cbWritten, // number of bytes written + NULL // not overlapped I/O ); if (!fSuccess || cbReplyBytes != cbWritten) - { + { DoOutputErrorString("SendDebuggerMessage: Failed to send message via pipe"); return FALSE; } DoOutputDebugString("SendDebuggerMessage: Sent message via pipe: 0x%x\n", Input); - + return TRUE; } @@ -3024,14 +3029,14 @@ BOOL SendDebuggerMessage(PVOID Input) BOOL DebugNewProcess(unsigned int ProcessId, unsigned int ThreadId, DWORD CreationFlags) //************************************************************************************** { - HANDLE hProcess, hThread; + HANDLE hProcess, hThread; char lpszPipename[MAX_PATH]; BOOL fSuccess, fConnected; CONTEXT Context; - DWORD cbBytesRead, cbWritten, cbReplyBytes; + DWORD cbBytesRead, cbWritten, cbReplyBytes; memset(lpszPipename, 0, MAX_PATH*sizeof(CHAR)); - + sprintf_s(lpszPipename, MAX_PATH, "\\\\.\\pipe\\CAPEpipe_%x", ProcessId); hProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE, ProcessId); @@ -3042,27 +3047,27 @@ BOOL DebugNewProcess(unsigned int ProcessId, unsigned int ThreadId, DWORD Creati } hThread = OpenThread(THREAD_ALL_ACCESS, TRUE, ThreadId); - if (hThread == NULL) + if (hThread == NULL) { DoOutputErrorString("DebugNewProcess: OpenThread failed"); return FALSE; } hCapePipe = CreateNamedPipe - ( - lpszPipename, - PIPE_ACCESS_DUPLEX, - PIPE_TYPE_MESSAGE | - PIPE_READMODE_MESSAGE | - PIPE_WAIT, - PIPE_UNLIMITED_INSTANCES, - PIPEBUFSIZE, - PIPEBUFSIZE, - 0, + ( + lpszPipename, + PIPE_ACCESS_DUPLEX, + PIPE_TYPE_MESSAGE | + PIPE_READMODE_MESSAGE | + PIPE_WAIT, + PIPE_UNLIMITED_INSTANCES, + PIPEBUFSIZE, + PIPEBUFSIZE, + 0, NULL - ); + ); - if (hCapePipe == INVALID_HANDLE_VALUE) + if (hCapePipe == INVALID_HANDLE_VALUE) { DoOutputErrorString("DebugNewProcess: CreateNamedPipe failed"); return FALSE; @@ -3071,11 +3076,11 @@ BOOL DebugNewProcess(unsigned int ProcessId, unsigned int ThreadId, DWORD Creati DoOutputDebugString("DebugNewProcess: Announcing new process to Cuckoo, pid: %d\n", ProcessId); pipe("DEBUGGER:%d,%d", ProcessId, ThreadId); - fConnected = ConnectNamedPipe(hCapePipe, NULL) ? TRUE : (GetLastError() == ERROR_PIPE_CONNECTED); + fConnected = ConnectNamedPipe(hCapePipe, NULL) ? TRUE : (GetLastError() == ERROR_PIPE_CONNECTED); fSuccess = FALSE; cbBytesRead = 0; - - if (!fConnected) + + if (!fConnected) { DoOutputDebugString("DebugNewProcess: The client could not connect, closing pipe.\n"); CloseHandle(hCapePipe); @@ -3083,18 +3088,18 @@ BOOL DebugNewProcess(unsigned int ProcessId, unsigned int ThreadId, DWORD Creati } DoOutputDebugString("DebugNewProcess: Client connected.\n"); - + fSuccess = ReadFile - ( - hCapePipe, - &DebuggerEP, - sizeof(DWORD_PTR), - &cbBytesRead, - NULL + ( + hCapePipe, + &DebuggerEP, + sizeof(DWORD_PTR), + &cbBytesRead, + NULL ); - + if (!fSuccess || cbBytesRead == 0) - { + { if (GetLastError() == ERROR_BROKEN_PIPE) { DoOutputErrorString("DebugNewProcess: Client disconnected."); @@ -3110,7 +3115,7 @@ BOOL DebugNewProcess(unsigned int ProcessId, unsigned int ThreadId, DWORD Creati DoOutputErrorString("DebugNewProcess: Successfully read from pipe, however DebuggerEP = 0."); return FALSE; } - + Context.ContextFlags = CONTEXT_ALL; if (!GetThreadContext(hThread, &Context)) { @@ -3122,22 +3127,22 @@ BOOL DebugNewProcess(unsigned int ProcessId, unsigned int ThreadId, DWORD Creati OEP = (PVOID)Context.Rcx; #else OEP = (PVOID)Context.Eax; -#endif - +#endif + cbWritten = 0; cbReplyBytes = sizeof(DWORD_PTR); - // Send the OEP to the new process + // Send the OEP to the new process fSuccess = WriteFile - ( - hCapePipe, - &OEP, + ( + hCapePipe, + &OEP, cbReplyBytes, - &cbWritten, - NULL + &cbWritten, + NULL ); if (!fSuccess || cbReplyBytes != cbWritten) - { + { DoOutputErrorString("DebugNewProcess: Failed to send OEP via pipe."); return FALSE; } @@ -3145,13 +3150,13 @@ BOOL DebugNewProcess(unsigned int ProcessId, unsigned int ThreadId, DWORD Creati DoOutputDebugString("DebugNewProcess: Sent OEP 0x%p via pipe\n", OEP); Context.ContextFlags = CONTEXT_ALL; - + #ifdef _WIN64 Context.Rcx = DebuggerEP; // set the new EP to debugger_init #else - Context.Eax = DebuggerEP; -#endif - + Context.Eax = DebuggerEP; +#endif + if (!SetThreadContext(hThread, &Context)) { DoOutputDebugString("DebugNewProcess: Failed to set new EP\n"); @@ -3163,7 +3168,7 @@ BOOL DebugNewProcess(unsigned int ProcessId, unsigned int ThreadId, DWORD Creati #else DoOutputDebugString("DebugNewProcess: Set new EP to DebuggerInit: 0x%x\n", Context.Eax); #endif - + CloseHandle(hProcess); CloseHandle(hThread); @@ -3173,99 +3178,99 @@ BOOL DebugNewProcess(unsigned int ProcessId, unsigned int ThreadId, DWORD Creati //************************************************************************************** DWORD WINAPI DebuggerLaunch(LPVOID lpParam) //************************************************************************************** -{ - HANDLE hPipe; - BOOL fSuccess = FALSE, NT5; +{ + HANDLE hPipe; + BOOL fSuccess = FALSE, NT5; DWORD cbRead, cbToWrite, cbWritten, dwMode; PVOID FuncAddress; - char lpszPipename[MAX_PATH]; + char lpszPipename[MAX_PATH]; OSVERSIONINFO VersionInfo; - + DoOutputDebugString("DebuggerLaunch: About to connect to CAPEpipe.\n"); memset(lpszPipename, 0, MAX_PATH*sizeof(CHAR)); - + sprintf_s(lpszPipename, MAX_PATH, "\\\\.\\pipe\\CAPEpipe_%x", GetCurrentProcessId()); - - while (1) - { + + while (1) + { hPipe = CreateFile( - lpszPipename, - GENERIC_READ | - GENERIC_WRITE, - 0, - NULL, - OPEN_EXISTING, - 0, - NULL); - - if (hPipe != INVALID_HANDLE_VALUE) - break; - - if (GetLastError() != ERROR_PIPE_BUSY) + lpszPipename, + GENERIC_READ | + GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + 0, + NULL); + + if (hPipe != INVALID_HANDLE_VALUE) + break; + + if (GetLastError() != ERROR_PIPE_BUSY) { - DoOutputErrorString("DebuggerLaunch: Could not open pipe"); + DoOutputErrorString("DebuggerLaunch: Could not open pipe"); return -1; } - if (!WaitNamedPipe(lpszPipename, 20)) - { - DoOutputDebugString("DebuggerLaunch: Could not open pipe: 20 ms wait timed out.\n"); + if (!WaitNamedPipe(lpszPipename, 20)) + { + DoOutputDebugString("DebuggerLaunch: Could not open pipe: 20 ms wait timed out.\n"); return -1; - } - } + } + } - // The pipe connected; change to message-read mode. - dwMode = PIPE_READMODE_MESSAGE; + // The pipe connected; change to message-read mode. + dwMode = PIPE_READMODE_MESSAGE; fSuccess = SetNamedPipeHandleState ( - hPipe, + hPipe, &dwMode, - NULL, - NULL + NULL, + NULL ); - if (!fSuccess) + if (!fSuccess) { - DoOutputDebugString("DebuggerLaunch: SetNamedPipeHandleState failed.\n"); + DoOutputDebugString("DebuggerLaunch: SetNamedPipeHandleState failed.\n"); return -1; } // Send VA of DebuggerInit to loader FuncAddress = &DebuggerInit; - + cbToWrite = sizeof(PVOID); - + fSuccess = WriteFile ( - hPipe, + hPipe, &FuncAddress, - cbToWrite, - &cbWritten, - NULL + cbToWrite, + &cbWritten, + NULL ); - if (!fSuccess) + if (!fSuccess) { - DoOutputErrorString("DebuggerLaunch: WriteFile to pipe failed"); + DoOutputErrorString("DebuggerLaunch: WriteFile to pipe failed"); return -1; } DoOutputDebugString("DebuggerLaunch: DebuggerInit VA sent to loader: 0x%x\n", FuncAddress); fSuccess = ReadFile( - hPipe, - &OEP, - sizeof(DWORD_PTR), + hPipe, + &OEP, + sizeof(DWORD_PTR), &cbRead, - NULL); - + NULL); + if (!fSuccess && GetLastError() == ERROR_MORE_DATA) { DoOutputDebugString("DebuggerLaunch: ReadFile on Pipe: ERROR_MORE_DATA\n"); CloseHandle(hPipe); return -1; } - + if (!fSuccess) { DoOutputErrorString("DebuggerLaunch: ReadFile (OEP) from pipe failed"); @@ -3274,30 +3279,30 @@ DWORD WINAPI DebuggerLaunch(LPVOID lpParam) } DoOutputDebugString("DebuggerLaunch: Read OEP from pipe: 0x%p\n", OEP); - + while (1) { fSuccess = ReadFile( - hPipe, - &OEP, - sizeof(DWORD_PTR), + hPipe, + &OEP, + sizeof(DWORD_PTR), &cbRead, - NULL); - + NULL); + if (!fSuccess && GetLastError() == ERROR_BROKEN_PIPE) { DoOutputDebugString("DebuggerLaunch: Pipe closed, no further updates to OEP\n"); CloseHandle(hPipe); break; } - + if (!fSuccess && GetLastError() == ERROR_MORE_DATA) { DoOutputDebugString("DebuggerLaunch: ReadFile on Pipe: ERROR_MORE_DATA\n"); CloseHandle(hPipe); return -1; } - + if (!fSuccess) { DoOutputErrorString("DebuggerLaunch: ReadFile from pipe failed"); @@ -3307,13 +3312,13 @@ DWORD WINAPI DebuggerLaunch(LPVOID lpParam) else DoOutputDebugString("DebuggerLaunch: Read updated EP from pipe: 0x%p\n", OEP); } - + ZeroMemory(&VersionInfo, sizeof(OSVERSIONINFO)); VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&VersionInfo); NT5 = (VersionInfo.dwMajorVersion == 5); - + if (NT5) { DoOutputDebugString("NT5: Leaving debugger thread alive.\n"); @@ -3324,8 +3329,8 @@ DWORD WINAPI DebuggerLaunch(LPVOID lpParam) } DoOutputDebugString("NT6+: Terminating debugger thread.\n"); - - return 0; + + return 0; } //************************************************************************************** @@ -3338,21 +3343,21 @@ int launch_debugger() HANDLE hDebuggerLaunch; hDebuggerLaunch = CreateThread( - NULL, - 0, + NULL, + 0, DebuggerLaunch, - NULL, - 0, - &NewThreadId); + NULL, + 0, + &NewThreadId); - if (hDebuggerLaunch == NULL) + if (hDebuggerLaunch == NULL) { DoOutputDebugString("CAPE: Failed to create debugger launch thread.\n"); return 0; } - + DoOutputDebugString("CAPE: Launching debugger.\n"); - + CloseHandle(hDebuggerLaunch); return 1; @@ -3360,7 +3365,23 @@ int launch_debugger() else { DebuggerInitialised = InitialiseDebugger(); - + return DebuggerInitialised; } +} + +void NtContinueHandler(PCONTEXT ThreadContext) +{ + if (!ThreadContext->Dr0 && !ThreadContext->Dr1 && !ThreadContext->Dr2 && !ThreadContext->Dr3) + { + DWORD ThreadId = GetCurrentThreadId(); + if (ThreadId == MainThreadId) + { + PTHREADBREAKPOINTS ThreadBreakpoints = GetThreadBreakpoints(ThreadId); + if (ThreadBreakpoints) { + DoOutputDebugString("NtContinue hook: restoring breakpoints for thread %d.\n", ThreadId); + ContextSetThreadBreakpointsEx(ThreadContext, ThreadBreakpoints, TRUE); + } + } + } } \ No newline at end of file diff --git a/CAPE/Debugger.h b/CAPE/Debugger.h index fc38b5a..e70f64d 100644 --- a/CAPE/Debugger.h +++ b/CAPE/Debugger.h @@ -3,6 +3,7 @@ #define DEBUGGER_LAUNCHER 0 #define DisableThreadSuspend 0 +//#define BRANCH_TRACE #define BP_EXEC 0x00 #define BP_WRITE 0x01 @@ -19,12 +20,14 @@ #define EXTRACTION_MIN_SIZE 0x1001 +#if (NTDDI_VERSION <= NTDDI_WINBLUE) typedef struct _EXCEPTION_REGISTRATION_RECORD { struct _EXCEPTION_REGISTRATION_RECORD *Next; PEXCEPTION_ROUTINE Handler; } EXCEPTION_REGISTRATION_RECORD; typedef EXCEPTION_REGISTRATION_RECORD *PEXCEPTION_REGISTRATION_RECORD; +#endif typedef struct BreakpointInfo { @@ -97,8 +100,8 @@ extern "C" { BOOL DebuggerInitialised; // Global variables for submission options -void *CAPE_var1, *CAPE_var2, *CAPE_var3, *CAPE_var4; PVOID bp0, bp1, bp2, bp3; +PVOID bpw0, bpw1, bpw2, bpw3; LONG WINAPI CAPEExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo); PVOID CAPEExceptionFilterHandle; @@ -107,7 +110,7 @@ PEXCEPTION_ROUTINE SEH_TopLevelHandler; LPTOP_LEVEL_EXCEPTION_FILTER OriginalExceptionHandler; BOOL VECTORED_HANDLER; BOOL GuardPagesDisabled; - +BOOL DisableSetThreadContext; DWORD ChildProcessId; DWORD ChildThreadId; DWORD_PTR DebuggerEP; @@ -120,7 +123,10 @@ BOOL SetBreakpoint(int Register, int Size, LPVOID Address, DWORD Type, PVOID Cal BOOL SetThreadBreakpoint(DWORD ThreadId, int Register, int Size, LPVOID Address, DWORD Type, PVOID Callback); BOOL ContextSetThreadBreakpoint(PCONTEXT Context, int Register, int Size, LPVOID Address, DWORD Type, PVOID Callback); BOOL ContextSetDebugRegister(PCONTEXT Context, int Register, int Size, LPVOID Address, DWORD Type); +BOOL ContextSetDebugRegisterEx(PCONTEXT Context, int Register, int Size, LPVOID Address, DWORD Type, BOOL NoSetThreadContext); BOOL SetThreadBreakpoints(PTHREADBREAKPOINTS ThreadBreakpoints); +BOOL ContextSetThreadBreakpoints(PCONTEXT ThreadContext, PTHREADBREAKPOINTS ThreadBreakpoints); +BOOL ContextSetThreadBreakpointsEx(PCONTEXT ThreadContext, PTHREADBREAKPOINTS ThreadBreakpoints, BOOL NoSetThreadContext); BOOL ContextSetBreakpoint(PTHREADBREAKPOINTS ThreadBreakpoints); BOOL ContextUpdateCurrentBreakpoint(PCONTEXT Context, int Size, LPVOID Address, DWORD Type, PVOID Callback); BOOL SetNextAvailableBreakpoint(DWORD ThreadId, unsigned int* Register, int Size, LPVOID Address, DWORD Type, PVOID Callback); @@ -128,6 +134,10 @@ BOOL SetSingleStepMode(PCONTEXT Context, PVOID Handler); BOOL SetResumeFlag(PCONTEXT Context); BOOL SetZeroFlag(PCONTEXT Context); BOOL ClearZeroFlag(PCONTEXT Context); +BOOL FlipZeroFlag(PCONTEXT Context); +BOOL SetSignFlag(PCONTEXT Context); +BOOL ClearSignFlag(PCONTEXT Context); +BOOL FlipSignFlag(PCONTEXT Context); PTHREADBREAKPOINTS CreateThreadBreakpoints(DWORD ThreadId); // Get diff --git a/CAPE/GetThreadId.c b/CAPE/GetThreadId.c index 727bf75..db8c136 100644 --- a/CAPE/GetThreadId.c +++ b/CAPE/GetThreadId.c @@ -26,7 +26,7 @@ typedef PVOID PTEB; // Thread Information Classes // -typedef enum _THREADINFOCLASS +typedef enum _THREADINFOCLASS { ThreadBasicInformation, ThreadTimes, @@ -52,7 +52,7 @@ typedef enum _THREADINFOCLASS MaxThreadInfoClass } THREADINFOCLASS; -typedef struct _CLIENT_ID +typedef struct _CLIENT_ID { HANDLE UniqueProcess; HANDLE UniqueThread; @@ -67,7 +67,7 @@ typedef struct _CLIENT_ID // NtQueryInformationThread using ThreadBasicInfo // -typedef struct _THREAD_BASIC_INFORMATION +typedef struct _THREAD_BASIC_INFORMATION { NTSTATUS ExitStatus; PTEB TebBaseAddress; @@ -115,7 +115,7 @@ DWORD MyGetThreadId return 0; } - FreeLibrary(hModule); - + FreeLibrary(hModule); + return (DWORD)(UINT_PTR)ThreadBasicInfo.ClientId.UniqueThread; } diff --git a/CAPE/Output.c b/CAPE/Output.c index f7f8e36..5f56c73 100644 --- a/CAPE/Output.c +++ b/CAPE/Output.c @@ -15,41 +15,55 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.If not, see . */ +#include #include #include #include +#include #include "cape.h" #include "..\pipe.h" #include "..\config.h" #define MAX_INT_STRING_LEN 10 // 4294967294 -TCHAR DebugOutput[MAX_PATH]; -TCHAR PipeOutput[MAX_PATH]; -TCHAR ErrorOutput[MAX_PATH]; +CHAR DebugOutput[MAX_PATH]; +CHAR PipeOutput[MAX_PATH]; +CHAR ErrorOutput[MAX_PATH]; +CHAR DebuggerLine[MAX_PATH]; +extern char* GetResultsPath(char* FolderName); extern struct CapeMetadata *CapeMetaData; extern ULONG_PTR base_of_dll_of_interest; +#ifdef CAPE_TRACE +HANDLE DebuggerLog; +extern SIZE_T LastWriteLength; +extern BOOL StopTrace; +#endif //************************************************************************************** -void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...) +void OutputString(_In_ LPCTSTR lpOutputString, va_list args) //************************************************************************************** { - va_list args; - - va_start(args, lpOutputString); - - memset(DebugOutput, 0, MAX_PATH*sizeof(TCHAR)); - _vsntprintf_s(DebugOutput, MAX_PATH, MAX_PATH, lpOutputString, args); + memset(DebugOutput, 0, MAX_PATH*sizeof(CHAR)); + _vsntprintf_s(DebugOutput, MAX_PATH, _TRUNCATE, lpOutputString, args); #ifdef STANDALONE OutputDebugString(DebugOutput); #else - memset(PipeOutput, 0, MAX_PATH*sizeof(TCHAR)); - _sntprintf_s(PipeOutput, MAX_PATH, MAX_PATH, "DEBUG:%s", DebugOutput); + memset(PipeOutput, 0, MAX_PATH*sizeof(CHAR)); + _sntprintf_s(PipeOutput, MAX_PATH, _TRUNCATE, "DEBUG:%s", DebugOutput); pipe(PipeOutput, strlen(PipeOutput)); #endif - va_end(args); + return; +} +//************************************************************************************** +void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...) +//************************************************************************************** +{ + va_list args; + va_start(args, lpOutputString); + OutputString(lpOutputString, args); + va_end(args); return; } @@ -59,9 +73,9 @@ void DoOutputErrorString(_In_ LPCTSTR lpOutputString, ...) { va_list args; LPVOID lpMsgBuf; - DWORD ErrorCode; + DWORD ErrorCode; - ErrorCode = GetLastError(); + ErrorCode = GetLastError(); va_start(args, lpOutputString); FormatMessage( @@ -70,22 +84,22 @@ void DoOutputErrorString(_In_ LPCTSTR lpOutputString, ...) ErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, - 0, + 0, NULL); - - memset(DebugOutput, 0, MAX_PATH*sizeof(TCHAR)); - _vsntprintf_s(DebugOutput, MAX_PATH, MAX_PATH, lpOutputString, args); - - memset(ErrorOutput, 0, MAX_PATH*sizeof(TCHAR)); - _sntprintf_s(ErrorOutput, MAX_PATH, MAX_PATH, "Error %d (0x%x) - %s: %s", ErrorCode, ErrorCode, DebugOutput, (char*)lpMsgBuf); + + memset(DebugOutput, 0, MAX_PATH*sizeof(CHAR)); + _vsntprintf_s(DebugOutput, MAX_PATH, _TRUNCATE, lpOutputString, args); + + memset(ErrorOutput, 0, MAX_PATH*sizeof(CHAR)); + _sntprintf_s(ErrorOutput, MAX_PATH, _TRUNCATE, "Error %d (0x%x) - %s: %s", ErrorCode, ErrorCode, DebugOutput, (char*)lpMsgBuf); #ifdef STANDALONE OutputDebugString(ErrorOutput); #else - memset(PipeOutput, 0, MAX_PATH*sizeof(TCHAR)); - _sntprintf_s(PipeOutput, MAX_PATH, MAX_PATH, "DEBUG:%s", ErrorOutput); + memset(PipeOutput, 0, MAX_PATH*sizeof(CHAR)); + _sntprintf_s(PipeOutput, MAX_PATH, _TRUNCATE, "DEBUG:%s", ErrorOutput); pipe(PipeOutput, strlen(PipeOutput)); #endif - + va_end(args); return; @@ -103,7 +117,7 @@ void CapeOutputFile(_In_ LPCTSTR lpOutputFile) if (CapeMetaData && CapeMetaData->DumpType == PROCDUMP) { - memset(MetadataPath, 0, MAX_PATH * sizeof(TCHAR)); + memset(MetadataPath, 0, MAX_PATH * sizeof(CHAR)); _sntprintf_s(MetadataPath, MAX_PATH, MAX_PATH, "%s_info.txt", lpOutputFile); hMetadata = CreateFile(MetadataPath, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); @@ -116,8 +130,8 @@ void CapeOutputFile(_In_ LPCTSTR lpOutputFile) if (hMetadata == INVALID_HANDLE_VALUE) { DoOutputErrorString("Could not create CAPE metadata file"); - return; - } + return; + } BufferSize = 3 * (MAX_PATH + MAX_INT_STRING_LEN + 2) + 2; //// max size string can be @@ -131,13 +145,13 @@ void CapeOutputFile(_In_ LPCTSTR lpOutputFile) DoOutputDebugString("CAPE Error: g_config.file_of_interest is NULL.\n", g_config.file_of_interest); return; } - + CapeMetaData->ModulePath = (char*)malloc(MAX_PATH); WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, (LPCWSTR)g_config.file_of_interest, (int)wcslen(g_config.file_of_interest)+1, CapeMetaData->ModulePath, MAX_PATH, NULL, NULL); } else CapeMetaData->ModulePath = CapeMetaData->ProcessPath; - + // This metadata format is specific to process dumps _snprintf_s(Buffer, BufferSize, BufferSize, "%d\n%d\n%s\n%s\n", CapeMetaData->DumpType, CapeMetaData->Pid, CapeMetaData->ProcessPath, CapeMetaData->ModulePath); @@ -150,13 +164,13 @@ void CapeOutputFile(_In_ LPCTSTR lpOutputFile) } CloseHandle(hMetadata); - - memset(DebugOutput, 0, MAX_PATH*sizeof(TCHAR)); + + memset(DebugOutput, 0, MAX_PATH*sizeof(CHAR)); _sntprintf_s(DebugOutput, MAX_PATH, MAX_PATH, "Process dump output file: %s", lpOutputFile); #ifdef STANDALONE OutputDebugString(DebugOutput); #else - memset(PipeOutput, 0, MAX_PATH*sizeof(TCHAR)); + memset(PipeOutput, 0, MAX_PATH*sizeof(CHAR)); _sntprintf_s(PipeOutput, MAX_PATH, MAX_PATH, "FILE_DUMP:%s", lpOutputFile); pipe(PipeOutput, strlen(PipeOutput)); #endif @@ -164,7 +178,7 @@ void CapeOutputFile(_In_ LPCTSTR lpOutputFile) } else if (CapeMetaData && CapeMetaData->DumpType != PROCDUMP) { - memset(MetadataPath, 0, MAX_PATH * sizeof(TCHAR)); + memset(MetadataPath, 0, MAX_PATH * sizeof(CHAR)); _sntprintf_s(MetadataPath, MAX_PATH, MAX_PATH, "%s_info.txt", lpOutputFile); hMetadata = CreateFile(MetadataPath, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); @@ -177,8 +191,8 @@ void CapeOutputFile(_In_ LPCTSTR lpOutputFile) if (hMetadata == INVALID_HANDLE_VALUE) { DoOutputErrorString("Could not create CAPE metadata file"); - return; - } + return; + } BufferSize = 3 * (MAX_PATH + MAX_INT_STRING_LEN + 2) + 2; //// max size string can be @@ -187,7 +201,7 @@ void CapeOutputFile(_In_ LPCTSTR lpOutputFile) if (!CapeMetaData->ProcessPath) CapeMetaData->ProcessPath = "Unknown path"; CapeMetaData->ModulePath = CapeMetaData->ProcessPath; - + if (CapeMetaData->DumpType == EXTRACTION_PE || CapeMetaData->DumpType == EXTRACTION_SHELLCODE) { // Extraction-specific format @@ -217,19 +231,99 @@ void CapeOutputFile(_In_ LPCTSTR lpOutputFile) } CloseHandle(hMetadata); - - memset(DebugOutput, 0, MAX_PATH*sizeof(TCHAR)); + + memset(DebugOutput, 0, MAX_PATH*sizeof(CHAR)); _sntprintf_s(DebugOutput, MAX_PATH, MAX_PATH, "CAPE Output file: %s", lpOutputFile); #ifdef STANDALONE OutputDebugString(DebugOutput); #else - memset(PipeOutput, 0, MAX_PATH*sizeof(TCHAR)); + memset(PipeOutput, 0, MAX_PATH*sizeof(CHAR)); _sntprintf_s(PipeOutput, MAX_PATH, MAX_PATH, "FILE_CAPE:%s", lpOutputFile); pipe(PipeOutput, strlen(PipeOutput)); #endif } else DoOutputDebugString("No CAPE metadata (or wrong type) for file: %s\n", lpOutputFile); - + return; } + +#ifdef CAPE_TRACE +//************************************************************************************** +void DebuggerOutput(_In_ LPCTSTR lpOutputString, ...) +//************************************************************************************** +{ + va_list args; + + va_start(args, lpOutputString); + + if (g_config.divert_debugger_log) + { + OutputString(lpOutputString, args); + va_end(args); + return; + } + + char *FullPathName, *OutputFilename, *Character; + + FullPathName = GetResultsPath("debugger"); + + OutputFilename = (char*)malloc(MAX_PATH); + + if (OutputFilename == NULL) + { + DoOutputErrorString("DebuggerOutput: failed to allocate memory for file name string"); + return; + } + + sprintf_s(OutputFilename, MAX_PATH, "%d.log", GetCurrentProcessId()); + + PathAppend(FullPathName, OutputFilename); + + free(OutputFilename); + + if (!DebuggerLog && !StopTrace) + { + time_t Time; + CHAR TimeBuffer[64]; + + DebuggerLog = CreateFile(FullPathName, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + + if (DebuggerLog == INVALID_HANDLE_VALUE) + { + DoOutputErrorString("DebuggerOutput: Unable to open debugger logfile %s.\n", FullPathName); + return; + } + DoOutputDebugString("DebuggerOutput: Debugger logfile %s.\n", FullPathName); + + time(&Time); + memset(DebuggerLine, 0, MAX_PATH*sizeof(CHAR)); + ctime_s(TimeBuffer, 64, (const time_t *)&Time); + _snprintf_s(DebuggerLine, MAX_PATH, _TRUNCATE, "CAPE Sandbox - Debugger log: %s" , TimeBuffer); + WriteFile(DebuggerLog, DebuggerLine, (DWORD)strlen(DebuggerLine), (LPDWORD)&LastWriteLength, NULL); + while (*lpOutputString == 0x0a) + lpOutputString++; + } + else if (StopTrace) + { + CloseHandle(DebuggerLog); + va_end(args); + return; + } + + memset(DebuggerLine, 0, MAX_PATH*sizeof(CHAR)); + _vsnprintf_s(DebuggerLine, MAX_PATH, _TRUNCATE, lpOutputString, args); + Character = DebuggerLine; + while (*Character) + { // Restrict to ASCII range + if (*Character < 0x0a || *Character > 0x7E) + *Character = 0x3F; // '?' + Character++; + } + WriteFile(DebuggerLog, DebuggerLine, (DWORD)strlen(DebuggerLine), (LPDWORD)&LastWriteLength, NULL); + + va_end(args); + + return; +} +#endif diff --git a/CAPE/QakBot.c b/CAPE/QakBot.c index 9ca1135..c7d29fc 100644 --- a/CAPE/QakBot.c +++ b/CAPE/QakBot.c @@ -32,12 +32,17 @@ extern char *convert_address_to_dll_name_and_offset(ULONG_PTR addr, unsigned int extern DWORD_PTR FileOffsetToVA(DWORD_PTR modBase, DWORD_PTR dwOffset); extern BOOL ScyllaGetSectionByName(PVOID ImageBase, char* Name, PVOID* SectionData, SIZE_T* SectionSize); -BOOL BreakpointSet, DllPrinted; +char *ModuleName, *PreviousModuleName; +BOOL BreakpointsSet, BreakpointsHit, FilterTrace, TraceAll, StopTrace, DllPrinted; PVOID ModuleBase, DumpAddress; -SIZE_T DumpSize; -BOOL GetSystemTimeAsFileTimeImported, PayloadMarker, PayloadDumped; -unsigned int DumpCount, Correction, StepCount, StepLimit; -int StepOverRegister, TraceDepthCount, TraceDepthLimit; +BOOL GetSystemTimeAsFileTimeImported, PayloadMarker, PayloadDumped, TraceRunning; +unsigned int DumpCount, Correction, StepCount, StepLimit, TraceDepthLimit; +char Action0[MAX_PATH], Action1[MAX_PATH], Action2[MAX_PATH], Action3[MAX_PATH], *Instruction0, *Instruction1, *Instruction2, *Instruction3; +unsigned int Type0, Type1, Type2, Type3; +int StepOverRegister, TraceDepthCount, EntryPointRegister; +CONTEXT LastContext; +SIZE_T DumpSize, LastWriteLength; +char DumpSizeString[MAX_PATH], DebuggerBuffer[MAX_PATH]; BOOL Trace(struct _EXCEPTION_POINTERS* ExceptionInfo); BOOL Trace2(struct _EXCEPTION_POINTERS* ExceptionInfo); @@ -288,7 +293,7 @@ BOOL BreakpointCallback2(PBREAKPOINTINFO pBreakpointInfo, struct _EXCEPTION_POIN DoOutputDebugString("Trace: CALL detected, grabbing size 0x%x and buffer 0x%x from stack.\n", DumpSize, DumpAddress); - if (DumpSize > 0x400) + if (DumpSize > 0x1000) DoOutputDebugString("Trace: Size too big, not the config.\n"); else if (!ContextSetThreadBreakpoint(ExceptionInfo->ContextRecord, 2, 0, ((BYTE*)ExceptionInfo->ContextRecord->Eip)+5, BP_EXEC, BreakpointCallback3)) DoOutputDebugString("Trace: failed to set breakpoint on call return at 0x%x", ((BYTE*)ExceptionInfo->ContextRecord->Eip)+5); @@ -325,7 +330,7 @@ BOOL BreakpointCallback3(PBREAKPOINTINFO pBreakpointInfo, struct _EXCEPTION_POIN #else _DecodeType DecodeType = Decode32Bits; Result = distorm_decode(Offset, (const unsigned char*)ExceptionInfo->ContextRecord->Eip, CHUNKSIZE, DecodeType, &DecodedInstruction, 1, &DecodedInstructionsCount); - DoOutputDebugString("0x%x (%02d) %-24s %s%s%s\n", ExceptionInfo->ContextRecord->Eip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); + DoOutputDebugString("0x%x (%02d) %-24s %s%s%s\n", ExceptionInfo-> ContextRecord->Eip, DecodedInstruction.size, (char*)DecodedInstruction.instructionHex.p, (char*)DecodedInstruction.mnemonic.p, DecodedInstruction.operands.length != 0 ? " " : "", (char*)DecodedInstruction.operands.p); #endif if (DumpSize && DumpAddress && DumpCount < 1) @@ -366,7 +371,7 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) if (!StepLimit) StepLimit = SINGLE_STEP_LIMIT; - if (!bp0 && !bp1)// && !bp2 && !bp3) + if (!bp0 && !bp1 && !bp2)// && !bp3) { DoOutputDebugString("SetInitialBreakpoints: Error - No address specified for QakBot breakpoints.\n"); return FALSE; @@ -381,7 +386,7 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) else DoOutputDebugString("SetInitialBreakpoints: ImageBase set to 0x%p.\n", ImageBase); - BreakpointSet = FALSE; + BreakpointsSet = FALSE; if (bp0) { @@ -395,7 +400,7 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) _DecodeType DecodeType = Decode32Bits; Result = distorm_decode(Offset, (const unsigned char*)BreakpointVA, ChunkSize, DecodeType, DecodedInstructions, 1, &DecodedInstructionsCount); - for (unsigned int i = 0; i < DecodedInstructionsCount; i++) + for (unsigned int i = 0; i < DecodedInstructionsCount; i++) { DoOutputDebugString("0x%x (%02d) %-24s %s%s%s\n", BreakpointVA + Delta, DecodedInstructions[i].size, (char*)DecodedInstructions[i].instructionHex.p, (char*)DecodedInstructions[i].mnemonic.p, DecodedInstructions[i].operands.length != 0 ? " " : "", (char*)DecodedInstructions[i].operands.p); @@ -404,7 +409,7 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA + Delta, BP_EXEC, BreakpointCallback1)) { DoOutputDebugString("SetInitialBreakpoint: Breakpoint %d set on jle instruction at 0x%x.\n", Register, (BYTE*)BreakpointVA + Delta); - BreakpointSet = TRUE; + BreakpointsSet = TRUE; break; } else @@ -441,7 +446,7 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA + Delta, BP_EXEC, BreakpointCallback2)) { DoOutputDebugString("SetInitialBreakpoint: Breakpoint %d set on call instruction at 0x%x.\n", Register, (BYTE*)BreakpointVA + Delta); - BreakpointSet = TRUE; + BreakpointsSet = TRUE; break; } else @@ -455,27 +460,45 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) } } else - DoOutputDebugString("SetInitialBreakpoint: No breakpoint supplied for QakBot config dump.\n"); -/* + DoOutputDebugString("SetInitialBreakpoint: No breakpoint supplied for QakBot primary config dump.\n"); + if (bp2) { + Delta = 0; Register = 2; + BreakpointVA = FileOffsetToVA((DWORD_PTR)ImageBase, (DWORD_PTR)bp2); - BreakpointVA = (DWORD_PTR)ImageBase + (DWORD_PTR)bp2; + ChunkSize = 0x80; // Size of code to disassemble + memset(&DecodedInstructions, 0, sizeof(DecodedInstructions)); + + _DecodeType DecodeType = Decode32Bits; + Result = distorm_decode(Offset, (const unsigned char*)BreakpointVA, ChunkSize, DecodeType, DecodedInstructions, 1, &DecodedInstructionsCount); - if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) - { - DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p (RVA 0x%x)\n", Register, BreakpointVA, bp2); - BreakpointSet = TRUE; - } - else + for (unsigned int i = 0; i < DecodedInstructionsCount; i++) { - DoOutputDebugString("SetInitialBreakpoints: SetBreakpoint failed.\n"); - BreakpointSet = FALSE; - return FALSE; + DoOutputDebugString("0x%x (%02d) %-24s %s%s%s\n", BreakpointVA + Delta, DecodedInstructions[i].size, (char*)DecodedInstructions[i].instructionHex.p, (char*)DecodedInstructions[i].mnemonic.p, DecodedInstructions[i].operands.length != 0 ? " " : "", (char*)DecodedInstructions[i].operands.p); + + if (!strcmp(DecodedInstructions[i].mnemonic.p, "CALL")) + { + if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA + Delta, BP_EXEC, BreakpointCallback2)) + { + DoOutputDebugString("SetInitialBreakpoint: Breakpoint %d set on call instruction at 0x%x.\n", Register, (BYTE*)BreakpointVA + Delta); + BreakpointsSet = TRUE; + break; + } + else + { + DoOutputDebugString("SetInitialBreakpoint: SetBreakpoint failed #2.\n"); + return FALSE; + } + } + + Delta += DecodedInstructions[i].size; } } - + else + DoOutputDebugString("SetInitialBreakpoint: No breakpoint supplied for QakBot secondary config dump.\n"); +/* if (bp3) { Register = 3; @@ -485,15 +508,15 @@ BOOL SetInitialBreakpoints(PVOID ImageBase) if (SetBreakpoint(Register, 0, (BYTE*)BreakpointVA, BP_EXEC, BreakpointCallback)) { DoOutputDebugString("SetInitialBreakpoints: Breakpoint %d set on address 0x%p (RVA 0x%x)\n", Register, BreakpointVA, bp3); - BreakpointSet = TRUE; + BreakpointsSet = TRUE; } else { DoOutputDebugString("SetInitialBreakpoints: SetBreakpoint failed.\n"); - BreakpointSet = FALSE; + BreakpointsSet = FALSE; return FALSE; } } */ - return BreakpointSet; + return BreakpointsSet; } diff --git a/CAPE/Scylla/ApiReader.cpp b/CAPE/Scylla/ApiReader.cpp index 415aa58..713d2c4 100644 --- a/CAPE/Scylla/ApiReader.cpp +++ b/CAPE/Scylla/ApiReader.cpp @@ -389,13 +389,19 @@ void ApiReader::parseExportTable(ModuleInfo *module, PIMAGE_NT_HEADERS pNtHeader { DWORD *addressOfFunctionsArray = 0,*addressOfNamesArray = 0; WORD *addressOfNameOrdinalsArray = 0; - char *functionName = 0; + char *functionName = 0, *directoryName; DWORD_PTR RVA = 0, VA = 0; WORD ordinal = 0; WORD i = 0, j = 0; bool withoutName; - + if (pExportDir && pExportDir->Name) { + directoryName = (char*)((PBYTE)pExportDir->Name + deltaAddress); + strncpy_s(module->DirectoryName, directoryName, strlen(directoryName)+1); +#ifdef DEBUG_COMMENTS + DoOutputDebugString("parseExportTable :: pExportDir->Name %s", module->DirectoryName); +#endif + } addressOfFunctionsArray = (DWORD *)((DWORD_PTR)pExportDir->AddressOfFunctions + deltaAddress); addressOfNamesArray = (DWORD *)((DWORD_PTR)pExportDir->AddressOfNames + deltaAddress); addressOfNameOrdinalsArray = (WORD *)((DWORD_PTR)pExportDir->AddressOfNameOrdinals + deltaAddress); diff --git a/CAPE/Scylla/PeParser.cpp b/CAPE/Scylla/PeParser.cpp index 87727f5..8d8b2a2 100644 --- a/CAPE/Scylla/PeParser.cpp +++ b/CAPE/Scylla/PeParser.cpp @@ -49,7 +49,7 @@ PeParser::PeParser(const DWORD_PTR moduleBase, bool readSectionHeaders) if (moduleBaseAddress) { readPeHeaderFromProcess(readSectionHeaders); - + if (readSectionHeaders) { if (isValidPeFile()) @@ -98,7 +98,7 @@ void PeParser::initClass() filename = 0; fileSize = 0; - dumpSize = 0; + dumpSize = 0; moduleBaseAddress = 0; hFile = INVALID_HANDLE_VALUE; } @@ -304,7 +304,7 @@ bool PeParser::readPeSectionsFromProcess() DWORD_PTR readOffset = 0; DWORD fileAlignment = 0, sectionAlignment = 0; unsigned int NumberOfSections = getNumberOfSections(); - + if (isPE32()) { fileAlignment = pNTHeader32->OptionalHeader.FileAlignment; @@ -317,32 +317,32 @@ bool PeParser::readPeSectionsFromProcess() } listPeSection.reserve(NumberOfSections); - + for (WORD i = 0; i < NumberOfSections; i++) { - readOffset = listPeSection[i].sectionHeader.VirtualAddress + moduleBaseAddress; - if (i < NumberOfSections - 1) { - if ((listPeSection[i].sectionHeader.Misc.VirtualSize) > (listPeSection[i+1].sectionHeader.VirtualAddress - listPeSection[i].sectionHeader.VirtualAddress)) + if (listPeSection[i].sectionHeader.Misc.VirtualSize > (listPeSection[i+1].sectionHeader.VirtualAddress - listPeSection[i].sectionHeader.VirtualAddress)) { listPeSection[i].normalSize = alignValue(listPeSection[i+1].sectionHeader.VirtualAddress - listPeSection[i].sectionHeader.VirtualAddress, sectionAlignment); #ifdef DEBUG_COMMENTS DoOutputDebugString("PeParser::readPeSectionsFromProcess: Correcting VirtualSize for section %d from 0x%x to 0x%x.\n", i+1, listPeSection[i].sectionHeader.Misc.VirtualSize, listPeSection[i].normalSize); #endif + listPeSection[i].sectionHeader.Misc.VirtualSize = listPeSection[i].normalSize; } else { listPeSection[i].normalSize = alignValue(listPeSection[i].sectionHeader.Misc.VirtualSize, sectionAlignment); + listPeSection[i].sectionHeader.Misc.VirtualSize = listPeSection[i].normalSize; #ifdef DEBUG_COMMENTS DoOutputDebugString("PeParser::readPeSectionsFromProcess: VirtualSize for section %d ok: 0x%x.\n", i+1, listPeSection[i].sectionHeader.Misc.VirtualSize); -#endif +#endif } if (i) { DWORD EndOfPreviousSection = alignValue(listPeSection[i-1].sectionHeader.VirtualAddress + listPeSection[i-1].sectionHeader.Misc.VirtualSize, sectionAlignment); - + if (listPeSection[i].sectionHeader.VirtualAddress && (listPeSection[i].sectionHeader.VirtualAddress != EndOfPreviousSection)) { #ifdef DEBUG_COMMENTS @@ -352,27 +352,35 @@ bool PeParser::readPeSectionsFromProcess() } } } - else + else // last section { - if ((listPeSection[i].sectionHeader.Misc.VirtualSize) > alignValue(listPeSection[i].sectionHeader.SizeOfRawData, sectionAlignment)) + DWORD NewVirtualSize = alignValue(listPeSection[i].sectionHeader.SizeOfRawData, sectionAlignment); + + if (NewVirtualSize && listPeSection[i].sectionHeader.Misc.VirtualSize > NewVirtualSize) { + listPeSection[i].normalSize = NewVirtualSize; #ifdef DEBUG_COMMENTS - DoOutputDebugString("PeParser::readPeSectionsFromProcess: Correcting VirtualSize for last section (%d) from 0x%x to 0x%x.\n", i+1, listPeSection[i].sectionHeader.Misc.VirtualSize, alignValue(listPeSection[i].sectionHeader.SizeOfRawData, sectionAlignment)); + DoOutputDebugString("PeParser::readPeSectionsFromProcess: Correcting VirtualSize for last section (%d) from 0x%x to 0x%x.\n", i+1, listPeSection[i].sectionHeader.Misc.VirtualSize, NewVirtualSize); #endif - listPeSection[i].normalSize = alignValue(listPeSection[i].sectionHeader.SizeOfRawData, sectionAlignment); + listPeSection[i].sectionHeader.Misc.VirtualSize = NewVirtualSize; } else { - listPeSection[i].normalSize = alignValue(listPeSection[i].sectionHeader.Misc.VirtualSize, sectionAlignment); + NewVirtualSize = alignValue(listPeSection[i].sectionHeader.Misc.VirtualSize, sectionAlignment); + if (NewVirtualSize && listPeSection[i].sectionHeader.Misc.VirtualSize > NewVirtualSize) + { + listPeSection[i].sectionHeader.Misc.VirtualSize = NewVirtualSize; + listPeSection[i].normalSize = NewVirtualSize; #ifdef DEBUG_COMMENTS - DoOutputDebugString("PeParser::readPeSectionsFromProcess: VirtualSize for last section (%d) ok: 0x%x.\n", i+1, listPeSection[i].sectionHeader.Misc.VirtualSize); + DoOutputDebugString("PeParser::readPeSectionsFromProcess: VirtualSize for last section (%d) ok: 0x%x.\n", i+1, listPeSection[i].sectionHeader.Misc.VirtualSize); #endif + } } if (i) { DWORD EndOfPreviousSection = alignValue(listPeSection[i-1].sectionHeader.VirtualAddress + listPeSection[i-1].sectionHeader.Misc.VirtualSize, sectionAlignment); - + if (listPeSection[i].sectionHeader.VirtualAddress && (listPeSection[i].sectionHeader.VirtualAddress != EndOfPreviousSection)) { #ifdef DEBUG_COMMENTS @@ -381,14 +389,16 @@ bool PeParser::readPeSectionsFromProcess() listPeSection[i].sectionHeader.VirtualAddress = EndOfPreviousSection; } } - } - + } + if (listPeSection[i].sectionHeader.Misc.VirtualSize > SIZE_LIMIT) { DoOutputDebugString("PeParser: Section %d size too big: 0x%x\n", i+1, listPeSection[i].sectionHeader.Misc.VirtualSize); return false; } + readOffset = listPeSection[i].sectionHeader.VirtualAddress + moduleBaseAddress; + if (!readSectionFromProcess(readOffset, listPeSection[i])) { #ifdef DEBUG_COMMENTS @@ -397,6 +407,7 @@ bool PeParser::readPeSectionsFromProcess() retValue = false; } } + #ifdef DEBUG_COMMENTS DoOutputDebugString("PeParser::readPeSectionsFromProcess: readSectionFromProcess success.\n"); #endif @@ -423,7 +434,7 @@ bool PeParser::readPeSectionsFromFile() { retValue = false; } - + } closeFileHandle(); @@ -447,7 +458,15 @@ bool PeParser::getSectionHeaders() for (WORD i = 0; i < getNumberOfSections(); i++) { - memcpy_s(&peFileSection.sectionHeader, sizeof(IMAGE_SECTION_HEADER), pSection, sizeof(IMAGE_SECTION_HEADER)); + __try + { + memcpy_s(&peFileSection.sectionHeader, sizeof(IMAGE_SECTION_HEADER), pSection, sizeof(IMAGE_SECTION_HEADER)); + } + __except(EXCEPTION_EXECUTE_HANDLER) + { + DoOutputDebugString("getSectionHeaders: Exception copying section header at 0x%p.\n", pSection); + return FALSE; + } listPeSection.push_back(peFileSection); pSection++; @@ -459,7 +478,7 @@ bool PeParser::getSectionHeaders() bool PeParser::getSectionNameUnicode(const int sectionIndex, CHAR * output, const int outputLen) { CHAR sectionNameA[IMAGE_SIZEOF_SHORT_NAME + 1] = {0}; - + output[0] = 0; memcpy(sectionNameA, listPeSection[sectionIndex].sectionHeader.Name, IMAGE_SIZEOF_SHORT_NAME); //not null terminated @@ -486,7 +505,7 @@ void PeParser::getDosAndNtHeader(BYTE * memory, LONG size) { pDosHeader = (PIMAGE_DOS_HEADER)memory; DWORD readSize = getInitialHeaderReadSize(true); - + pNTHeader32 = 0; pNTHeader64 = 0; dosStubSize = 0; @@ -508,7 +527,7 @@ void PeParser::getDosAndNtHeader(BYTE * memory, LONG size) pDosHeader->e_lfanew = sizeof(IMAGE_DOS_HEADER); } } - + if (!pDosHeader->e_lfanew) { // In case the header until and including 'PE' has been zeroed (e.g. Ursnif) @@ -520,11 +539,11 @@ void PeParser::getDosAndNtHeader(BYTE * memory, LONG size) pNtHeader = (PIMAGE_NT_HEADERS)((PUCHAR)MachineProbe - 4); MachineProbe += sizeof(WORD); } - + if (pNtHeader) pDosHeader->e_lfanew = (LONG)((PUCHAR)pNtHeader - (PUCHAR)pDosHeader); } - + if (!pDosHeader->e_lfanew) { // In case the header until and including 'PE' is missing @@ -540,7 +559,7 @@ void PeParser::getDosAndNtHeader(BYTE * memory, LONG size) } } MachineProbe += sizeof(WORD); - + if (pNtHeader && (PUCHAR)pNtHeader == (PUCHAR)pDosHeader) { SIZE_T HeaderShift = sizeof(IMAGE_DOS_HEADER); @@ -555,7 +574,7 @@ void PeParser::getDosAndNtHeader(BYTE * memory, LONG size) } #ifdef DEBUG_COMMENTS DoOutputDebugString("PeParser::getDosAndNtHeader: Corrected: DOS header 0x%x, lfanew 0x%x, NT header 0x%x.\n", pDosHeader, pDosHeader->e_lfanew, pNtHeader); -#endif +#endif } } } @@ -563,14 +582,14 @@ void PeParser::getDosAndNtHeader(BYTE * memory, LONG size) if (pDosHeader->e_lfanew && pDosHeader->e_magic != IMAGE_DOS_SIGNATURE) { PIMAGE_NT_HEADERS pNtHeader = (PIMAGE_NT_HEADERS)((PUCHAR)pDosHeader + (ULONG)pDosHeader->e_lfanew); - + if ((pNtHeader->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC) || (pNtHeader->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC)) { pDosHeader->e_magic = IMAGE_DOS_SIGNATURE; pNtHeader->Signature = IMAGE_NT_SIGNATURE; } } - + if (pDosHeader->e_lfanew) { pNTHeader32 = (PIMAGE_NT_HEADERS32)((DWORD_PTR)pDosHeader + pDosHeader->e_lfanew); @@ -729,7 +748,7 @@ bool PeParser::readSectionFrom(const DWORD_PTR readOffset, PeFileSection & peFil #ifdef DEBUG_COMMENTS DoOutputDebugString("PeParser: readSectionFrom: readSize <= maxReadSize: 0x%x.\n", readSize); #endif - + if (isProcess) { return readPeSectionFromProcess(readOffset, peFileSection); @@ -755,7 +774,7 @@ bool PeParser::readSectionFrom(const DWORD_PTR readOffset, PeFileSection & peFil while(currentOffset >= readOffset) //start from the end { ZeroMemory(data, currentReadSize); - + if (isProcess) { retValue = ProcessAccessHelp::readMemoryPartlyFromProcess(currentOffset, currentReadSize, data); @@ -856,7 +875,7 @@ bool PeParser::savePeFileToDisk(const CHAR *newFile) #ifdef DEBUG_COMMENTS //DoOutputDebugString("PeParser::savePeFileToDisk: Function entry.\n"); #endif - + DWORD dwFileOffset = 0, dwWriteSize = 0; if (getNumberOfSections() != listPeSection.size()) @@ -993,23 +1012,23 @@ bool PeParser::savePeFileToDisk(const CHAR *newFile) if (!newFile) { closeFileHandle(); - + if (!GetFullPathName(CAPE_OUTPUT_FILE, MAX_PATH, CapeOutputPath, NULL)) { DoOutputErrorString("savePeFileToDisk: There was a problem obtaining the full file path"); - return 0; + return 0; } - + CapeName = GetName(); - + if (MoveFile(CapeOutputPath, CapeName)) { memset(CapeOutputPath, 0, MAX_PATH); - + if (!GetFullPathName(CapeName, MAX_PATH, CapeOutputPath, NULL)) { DoOutputErrorString("savePeFileToDisk: There was a problem obtaining the full file path"); - return 0; + return 0; } CapeOutputFile(CapeOutputPath); @@ -1017,17 +1036,17 @@ bool PeParser::savePeFileToDisk(const CHAR *newFile) else if (GetLastError() == ERROR_ALREADY_EXISTS) // have seen this occasionally { DoOutputDebugString("savePeFileToDisk: Name clash, trying to obtain new name..."); - + CapeName = GetName(); - + if (MoveFile(CapeOutputPath, CapeName)) { memset(CapeOutputPath, 0, MAX_PATH); - + if (!GetFullPathName(CapeName, MAX_PATH, CapeOutputPath, NULL)) { DoOutputErrorString("savePeFileToDisk: There was a problem obtaining the full file path"); - return 0; + return 0; } CapeOutputFile(CapeOutputPath); @@ -1035,29 +1054,29 @@ bool PeParser::savePeFileToDisk(const CHAR *newFile) else { DoOutputErrorString("savePeFileToDisk: Failed twice to rename file"); - + if (!DeleteFile(CapeOutputPath)) { DoOutputErrorString("savePeFileToDisk: There was a problem deleting the file: %s", CapeOutputPath); } - + return 0; - } + } } else { DoOutputErrorString("savePeFileToDisk: There was a problem renaming the file"); - + if (!DeleteFile(CapeOutputPath)) { DoOutputErrorString("savePeFileToDisk: There was a problem deleting the file: %s", CapeOutputPath); } - + return 0; } } } - + return retValue; } @@ -1068,7 +1087,7 @@ bool PeParser::savePeFileToHandle(HANDLE FileHandle) #ifdef DEBUG_COMMENTS //DoOutputDebugString("PeParser::savePeFileToDisk: Function entry.\n"); #endif - + DWORD dwFileOffset = 0, dwWriteSize = 0; if (getNumberOfSections() != listPeSection.size()) @@ -1197,7 +1216,7 @@ bool PeParser::savePeFileToHandle(HANDLE FileHandle) // (this will allow a subsequent 'raw' memory dump) if (!SectionDataWritten) return false; - + return retValue; } @@ -1218,16 +1237,16 @@ bool PeParser::saveCompletePeToDisk(const CHAR *newFile) DoOutputDebugString("PE Parser: Error - image seems incomplete: (%d sections, PointerToRawData: 0x%x, SizeOfRawData: 0x%x) - dump failed.\n", getNumberOfSections(), listPeSection[getNumberOfSections()-1].sectionHeader.PointerToRawData, listPeSection[getNumberOfSections()-1].sectionHeader.SizeOfRawData); return false; } - + if (openWriteFileHandle(newFile)) { #ifdef DEBUG_COMMENTS DoOutputDebugString("Number of sections: %d, PointerToRawData: 0x%x, SizeOfRawData: 0x%x\n", getNumberOfSections(), listPeSection[getNumberOfSections() - 1].sectionHeader.PointerToRawData, listPeSection[getNumberOfSections() - 1].sectionHeader.SizeOfRawData); #endif - + dwWriteSize = listPeSection[getNumberOfSections()-1].sectionHeader.PointerToRawData + listPeSection[getNumberOfSections()-1].sectionHeader.SizeOfRawData; - + if (!ProcessAccessHelp::writeMemoryToFile(hFile, 0, dwWriteSize, (LPCVOID)moduleBaseAddress)) { retValue = false; @@ -1241,23 +1260,23 @@ bool PeParser::saveCompletePeToDisk(const CHAR *newFile) else { closeFileHandle(); - + if (!GetFullPathName(CAPE_OUTPUT_FILE, MAX_PATH, CapeOutputPath, NULL)) { DoOutputErrorString("saveCompletePeToDisk: There was a problem obtaining the full file path"); - return 0; + return 0; } - + CapeName = GetName(); - + if (MoveFile(CapeOutputPath, CapeName)) { memset(CapeOutputPath, 0, MAX_PATH); - + if (!GetFullPathName(CapeName, MAX_PATH, CapeOutputPath, NULL)) { DoOutputErrorString("saveCompletePeToDisk: There was a problem obtaining the full file path"); - return 0; + return 0; } CapeOutputFile(CapeOutputPath); @@ -1265,12 +1284,12 @@ bool PeParser::saveCompletePeToDisk(const CHAR *newFile) else { DoOutputErrorString("saveCompletePeToDisk: There was a problem renaming the file"); - + if (!DeleteFile(CapeOutputPath)) { DoOutputErrorString("saveCompletePeToDisk: There was a problem deleting the file: %s", CapeOutputPath); } - + return 0; } } @@ -1294,14 +1313,14 @@ bool PeParser::saveCompletePeToHandle(HANDLE FileHandle) DoOutputDebugString("PE Parser: Error - image seems incomplete: (%d sections, PointerToRawData: 0x%x, SizeOfRawData: 0x%x) - dump failed.\n", getNumberOfSections(), listPeSection[getNumberOfSections()-1].sectionHeader.PointerToRawData, listPeSection[getNumberOfSections()-1].sectionHeader.SizeOfRawData); return false; } - + #ifdef DEBUG_COMMENTS DoOutputDebugString("Number of sections: %d, PointerToRawData: 0x%x, SizeOfRawData: 0x%x\n", getNumberOfSections(), listPeSection[getNumberOfSections() - 1].sectionHeader.PointerToRawData, listPeSection[getNumberOfSections() - 1].sectionHeader.SizeOfRawData); #endif - + dwWriteSize = listPeSection[getNumberOfSections()-1].sectionHeader.PointerToRawData + listPeSection[getNumberOfSections()-1].sectionHeader.SizeOfRawData; - + if (!ProcessAccessHelp::writeMemoryToFile(FileHandle, 0, dwWriteSize, (LPCVOID)moduleBaseAddress)) { DoOutputDebugString("saveCompletePeToHandle: writeMemoryToFile failed.\n"); @@ -1525,7 +1544,7 @@ void PeParser::fixPeHeader() pNTHeader64->OptionalHeader.NumberOfRvaAndSizes = IMAGE_NUMBEROF_DIRECTORY_ENTRIES; pNTHeader64->FileHeader.SizeOfOptionalHeader = sizeof(IMAGE_OPTIONAL_HEADER64); - + pNTHeader64->OptionalHeader.SizeOfImage = getSectionHeaderBasedSizeOfImage(); pNTHeader64->OptionalHeader.SizeOfHeaders = alignValue(dwSize + pNTHeader64->FileHeader.SizeOfOptionalHeader + (getNumberOfSections() * sizeof(IMAGE_SECTION_HEADER)), pNTHeader64->OptionalHeader.FileAlignment); @@ -1615,93 +1634,20 @@ void PeParser::alignAllSectionHeaders() } NumberOfSections = getNumberOfSections(); - - std::sort(listPeSection.begin(), listPeSection.end(), PeFileSectionSortByPointerToRawData); //sort by PointerToRawData ascending + + std::sort(listPeSection.begin(), listPeSection.end(), PeFileSectionSortByVirtualAddress); //sort by VirtualAddress ascending newFileSize = pDosHeader->e_lfanew + sizeof(DWORD) + sizeof(IMAGE_FILE_HEADER) + pNTHeader32->FileHeader.SizeOfOptionalHeader + (NumberOfSections * sizeof(IMAGE_SECTION_HEADER)); for (WORD i = 0; i < NumberOfSections; i++) - { + { listPeSection[i].sectionHeader.VirtualAddress = alignValue(listPeSection[i].sectionHeader.VirtualAddress, sectionAlignment); listPeSection[i].sectionHeader.PointerToRawData = alignValue(newFileSize, fileAlignment); listPeSection[i].sectionHeader.SizeOfRawData = alignValue(listPeSection[i].dataSize, fileAlignment); - + newFileSize = listPeSection[i].sectionHeader.PointerToRawData + listPeSection[i].sectionHeader.SizeOfRawData; } - - for (WORD i = 0; i < NumberOfSections; i++) - { - if (i < NumberOfSections - 1) - { - - if ((listPeSection[i].sectionHeader.Misc.VirtualSize) > (listPeSection[i+1].sectionHeader.VirtualAddress - listPeSection[i].sectionHeader.VirtualAddress)) - { - listPeSection[i].sectionHeader.Misc.VirtualSize = alignValue(listPeSection[i+1].sectionHeader.VirtualAddress - listPeSection[i].sectionHeader.VirtualAddress, sectionAlignment); -#ifdef DEBUG_COMMENTS - DoOutputDebugString("PeParser::alignAllSectionHeaders: Correcting VirtualSize for last section (%d) from 0x%x to 0x%x.\n", i+1, listPeSection[i].sectionHeader.Misc.VirtualSize, alignValue(listPeSection[i].sectionHeader.SizeOfRawData, sectionAlignment)); -#endif - } - else - { - listPeSection[i].sectionHeader.Misc.VirtualSize = alignValue(listPeSection[i].sectionHeader.Misc.VirtualSize, sectionAlignment); -#ifdef DEBUG_COMMENTS - DoOutputDebugString("PeParser::alignAllSectionHeaders: VirtualSize for section %d ok: 0x%x.\n", i+1, listPeSection[i].sectionHeader.Misc.VirtualSize); -#endif - } - - if (i) - { - DWORD EndOfPreviousSection = alignValue(listPeSection[i-1].sectionHeader.VirtualAddress + listPeSection[i-1].sectionHeader.Misc.VirtualSize, sectionAlignment); - - if (listPeSection[i].sectionHeader.VirtualAddress && (listPeSection[i].sectionHeader.VirtualAddress != EndOfPreviousSection)) - { -#ifdef DEBUG_COMMENTS - DoOutputDebugString("PeParser::alignAllSectionHeaders: Correcting VirtualAddress for section %d from: 0x%x to 0x%x.\n", i+1, listPeSection[i].sectionHeader.VirtualAddress, EndOfPreviousSection); -#endif - listPeSection[i].sectionHeader.VirtualAddress = EndOfPreviousSection; - } - } - } - else - { - if ((listPeSection[i].sectionHeader.Misc.VirtualSize) > alignValue(listPeSection[i].sectionHeader.SizeOfRawData, sectionAlignment)) - { -#ifdef DEBUG_COMMENTS - DoOutputDebugString("PeParser::alignAllSectionHeaders: Correcting VirtualSize for last section (%d) from 0x%x to 0x%x.\n", i+1, listPeSection[i].sectionHeader.Misc.VirtualSize, alignValue(listPeSection[i].sectionHeader.SizeOfRawData, sectionAlignment)); -#endif - listPeSection[i].sectionHeader.Misc.VirtualSize = alignValue(listPeSection[i].sectionHeader.SizeOfRawData, sectionAlignment); - } - else - { - listPeSection[i].sectionHeader.Misc.VirtualSize = alignValue(listPeSection[i].sectionHeader.Misc.VirtualSize, sectionAlignment); -#ifdef DEBUG_COMMENTS - DoOutputDebugString("PeParser::alignAllSectionHeaders: VirtualSize for last section (%d) ok: 0x%x.\n", i+1, listPeSection[i].sectionHeader.Misc.VirtualSize); -#endif - } - - if (i) - { - DWORD EndOfPreviousSection = alignValue(listPeSection[i-1].sectionHeader.VirtualAddress + listPeSection[i-1].sectionHeader.Misc.VirtualSize, sectionAlignment); - - if (listPeSection[i].sectionHeader.VirtualAddress && (listPeSection[i].sectionHeader.VirtualAddress != EndOfPreviousSection)) - { -#ifdef DEBUG_COMMENTS - DoOutputDebugString("PeParser::alignAllSectionHeaders: Correcting VirtualAddress for last section (%d) from: 0x%x to 0x%x.\n", i+1, listPeSection[i].sectionHeader.VirtualAddress, EndOfPreviousSection); -#endif - listPeSection[i].sectionHeader.VirtualAddress = EndOfPreviousSection; - } - } - } - - if (listPeSection[i].sectionHeader.Misc.VirtualSize > SIZE_LIMIT) - { - DoOutputDebugString("PeParser::alignAllSectionHeaders: Section %d size too big: 0x%x\n", i+1, listPeSection[i].sectionHeader.Misc.VirtualSize); - //return; - } - } - - std::sort(listPeSection.begin(), listPeSection.end(), PeFileSectionSortByVirtualAddress); //sort by VirtualAddress ascending } bool PeParser::dumpProcess(DWORD_PTR modBase, DWORD_PTR entryPoint, const CHAR * dumpFilePath) @@ -1711,7 +1657,7 @@ bool PeParser::dumpProcess(DWORD_PTR modBase, DWORD_PTR entryPoint, const CHAR * #ifdef DEBUG_COMMENTS DoOutputDebugString("DumpProcess: called with modBase = 0x%x.\n", modBase); #endif - + if (!readPeSectionsFromProcess()) DoOutputDebugString("DumpProcess: There was a problem reading one or more sections, the dump may be incomplete.\n"); #ifdef DEBUG_COMMENTS @@ -1765,7 +1711,7 @@ bool PeParser::dumpProcessToHandle(DWORD_PTR modBase, DWORD_PTR entryPoint, HAND #ifdef DEBUG_COMMENTS DoOutputDebugString("DumpProcess: called with modBase = 0x%x.\n", modBase); #endif - + if (!readPeSectionsFromProcess()) DoOutputDebugString("DumpProcess: There was a problem reading one or more sections, the dump may be incomplete.\n"); #ifdef DEBUG_COMMENTS diff --git a/CAPE/Scylla/ProcessAccessHelp.h b/CAPE/Scylla/ProcessAccessHelp.h index 5c1bfc8..46c5669 100644 --- a/CAPE/Scylla/ProcessAccessHelp.h +++ b/CAPE/Scylla/ProcessAccessHelp.h @@ -25,6 +25,7 @@ class ModuleInfo CHAR fullPath[MAX_PATH]; DWORD_PTR modBaseAddr; DWORD modBaseSize; + CHAR DirectoryName[MAX_PATH]; bool isAlreadyParsed; bool parsing; diff --git a/CAPE/ScyllaHarness.cpp b/CAPE/ScyllaHarness.cpp index b6ff1de..ce7d35d 100644 --- a/CAPE/ScyllaHarness.cpp +++ b/CAPE/ScyllaHarness.cpp @@ -6,7 +6,7 @@ This program is free software : you can redistribute it and / or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the @@ -31,12 +31,15 @@ typedef unsigned __int64 QWORD; #define CREATE_NEW_IAT_IN_SECTION FALSE #define OFT_SUPPORT FALSE +#define PE_HEADER_LIMIT 0x200 #define CAPE_OUTPUT_FILE "CapeOutput.bin" //#define DEBUG_COMMENTS extern "C" void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); extern "C" void DoOutputErrorString(_In_ LPCTSTR lpOutputString, ...); extern "C" int ScanForNonZero(LPVOID Buffer, unsigned int Size); +extern "C" PVOID GetAllocationBase(PVOID Address); +extern "C" int IsDisguisedPEHeader(LPVOID Buffer); extern char CapeOutputPath[MAX_PATH]; @@ -57,13 +60,19 @@ void ScyllaInitCurrentProcess() extern "C" DWORD_PTR GetEntryPointVA(DWORD_PTR modBase) //************************************************************************************** { + DWORD_PTR EntryPointVA; + PeParser * peFile = 0; ScyllaInitCurrentProcess(); - + peFile = new PeParser((DWORD_PTR)modBase, true); - return peFile->getEntryPoint() + (DWORD_PTR)modBase; + EntryPointVA = peFile->getEntryPoint() + (DWORD_PTR)modBase; + + delete peFile; + + return EntryPointVA; } //************************************************************************************** @@ -74,14 +83,14 @@ extern "C" DWORD_PTR FileOffsetToVA(DWORD_PTR modBase, DWORD_PTR dwOffset) PeParser * peFile = 0; ScyllaInitCurrentProcess(); - + peFile = new PeParser(modBase, true); if (peFile->isValidPeFile()) { //return peFile->convertOffsetToRVAVector(dwOffset) + modBase; Test = peFile->convertOffsetToRVAVector(dwOffset) + modBase; - + DoOutputDebugString("FileOffsetToVA: Debug - VA = 0x%p.\n", Test); return Test; @@ -96,10 +105,10 @@ extern "C" int ScyllaDumpCurrentProcess(DWORD_PTR NewOEP) DWORD_PTR entrypoint = 0; PeParser * peFile = 0; DWORD_PTR ModuleBase; - + ModuleBase = (DWORD)(ULONG_PTR)GetModuleHandle(NULL); ScyllaInitCurrentProcess(); - + DoOutputDebugString("DumpCurrentProcess: Instantiating PeParser with address: 0x%p.\n", ModuleBase); peFile = new PeParser(ModuleBase, TRUE); @@ -110,9 +119,9 @@ extern "C" int ScyllaDumpCurrentProcess(DWORD_PTR NewOEP) entrypoint = NewOEP; else entrypoint = peFile->getEntryPoint() + ModuleBase; - + DoOutputDebugString("DumpCurrentProcess: Module entry point VA is 0x%p.\n", entrypoint); - + if (peFile->dumpProcess(ModuleBase, entrypoint, NULL)) { DoOutputDebugString("DumpCurrentProcess: Module image dump success.\n"); @@ -153,12 +162,162 @@ void ScyllaInit(HANDLE hProcess) extern "C" int ScyllaDumpProcess(HANDLE hProcess, DWORD_PTR ModuleBase, DWORD_PTR NewOEP) //************************************************************************************** { - SIZE_T SectionBasedFileSize; + SIZE_T SectionBasedSizeOfImage; + PeParser *peFile = 0; + DWORD_PTR entrypoint = NULL; + + ScyllaInit(hProcess); + + DoOutputDebugString("DumpProcess: Instantiating PeParser with address: 0x%p.\n", ModuleBase); + + peFile = new PeParser(ModuleBase, TRUE); + + if (peFile->isValidPeFile()) + { + if (NewOEP) + entrypoint = NewOEP; + else + entrypoint = peFile->getEntryPoint(); + + SectionBasedSizeOfImage = (SIZE_T)peFile->getSectionHeaderBasedSizeOfImage(); + + if ((SIZE_T)entrypoint >= SectionBasedSizeOfImage) + { + DoOutputDebugString("DumpProcess: Error - entry point too big: 0x%x, ignoring.\n", entrypoint); + entrypoint = NULL; + } + else + { + DoOutputDebugString("DumpProcess: Module entry point VA is 0x%p.\n", entrypoint); + entrypoint = entrypoint + (DWORD_PTR)ModuleBase; + } + + if (peFile->dumpProcess(ModuleBase, entrypoint, NULL)) + DoOutputDebugString("DumpProcess: Module image dump success - dump size 0x%x.\n", peFile->dumpSize); + } + else + { + PBYTE PEImage; + PIMAGE_NT_HEADERS pNtHeader; + PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)ModuleBase; + + if (IsDisguisedPEHeader((LPVOID)ModuleBase) && *(WORD*)pDosHeader != IMAGE_DOS_SIGNATURE || (*(DWORD*)((BYTE*)pDosHeader + pDosHeader->e_lfanew) != IMAGE_NT_SIGNATURE)) + { + MEMORY_BASIC_INFORMATION MemInfo; + + DoOutputDebugString("DumpProcess: Disguised PE image (bad MZ and/or PE headers) at 0x%p.\n", ModuleBase); + + if (!VirtualQuery((LPVOID)ModuleBase, &MemInfo, sizeof(MEMORY_BASIC_INFORMATION))) + { + DoOutputErrorString("DumpProcess: unable to query memory address 0x%p", ModuleBase); + goto fail; + } + + PEImage = (BYTE*)calloc(MemInfo.RegionSize, sizeof(BYTE)); + memcpy(PEImage, MemInfo.BaseAddress, MemInfo.RegionSize); + + if (!pDosHeader->e_lfanew) + { + // In case the header until and including 'PE' has been zeroed + WORD* MachineProbe = (WORD*)&pDosHeader->e_lfanew; + while ((PUCHAR)MachineProbe < (PUCHAR)pDosHeader + (PE_HEADER_LIMIT - offsetof(IMAGE_DOS_HEADER, e_lfanew))) + { + if (*MachineProbe == IMAGE_FILE_MACHINE_I386 || *MachineProbe == IMAGE_FILE_MACHINE_AMD64) + { + if ((PUCHAR)MachineProbe > (PUCHAR)pDosHeader + 3) + pNtHeader = (PIMAGE_NT_HEADERS)((PUCHAR)MachineProbe - 4); + } + MachineProbe += sizeof(WORD); + } + + if (pNtHeader) + pDosHeader->e_lfanew = (LONG)((PUCHAR)pNtHeader - (PUCHAR)pDosHeader); + } + + if (!pDosHeader->e_lfanew) + { + // In case the header until and including 'PE' is missing + pNtHeader = NULL; + WORD* MachineProbe = (WORD*)pDosHeader; + while ((PUCHAR)MachineProbe < (PUCHAR)pDosHeader + (PE_HEADER_LIMIT - offsetof(IMAGE_DOS_HEADER, e_lfanew))) + { + if (*MachineProbe == IMAGE_FILE_MACHINE_I386 || *MachineProbe == IMAGE_FILE_MACHINE_AMD64) + { + if ((PUCHAR)MachineProbe >= (PUCHAR)pDosHeader + 4) + { + pNtHeader = (PIMAGE_NT_HEADERS)((PUCHAR)MachineProbe - 4); + //break; + } + } + MachineProbe += sizeof(WORD); + + if (pNtHeader && (PUCHAR)pNtHeader == (PUCHAR)pDosHeader && pNtHeader->OptionalHeader.SizeOfHeaders) + { + SIZE_T HeaderShift = sizeof(IMAGE_DOS_HEADER); + memmove(PEImage + HeaderShift, PEImage, pNtHeader->OptionalHeader.SizeOfHeaders - HeaderShift); + memset(PEImage, 0, HeaderShift); + pDosHeader = (PIMAGE_DOS_HEADER)PEImage; + pNtHeader = (PIMAGE_NT_HEADERS)(PEImage + HeaderShift); + pDosHeader->e_lfanew = (LONG)((PUCHAR)pNtHeader - (PUCHAR)pDosHeader); + DoOutputDebugString("DumpProcess: pNtHeader moved from 0x%x to 0x%x, e_lfanew 0x%x\n", pDosHeader, pNtHeader, pDosHeader->e_lfanew); + } + } + } + + peFile = new PeParser((char*)PEImage, TRUE); + + if (peFile->isValidPeFile()) + { + if (NewOEP) + entrypoint = NewOEP; + else + entrypoint = peFile->getEntryPoint(); + + SectionBasedSizeOfImage = (SIZE_T)peFile->getSectionHeaderBasedSizeOfImage(); + + if ((SIZE_T)entrypoint >= SectionBasedSizeOfImage) + { + DoOutputDebugString("DumpProcess: Error - entry point too big: 0x%x, ignoring.\n", entrypoint); + entrypoint = NULL; + } + else + { + DoOutputDebugString("DumpProcess: Module entry point VA is 0x%p.\n", entrypoint); + entrypoint = entrypoint + (DWORD_PTR)ModuleBase; + } + + if (peFile->dumpProcess(ModuleBase, entrypoint, NULL)) + DoOutputDebugString("DumpProcess: Module image dump success - dump size 0x%x.\n", peFile->dumpSize); + } + + } + else + { + DoOutputDebugString("DumpProcess: Invalid PE file or invalid PE header.\n"); + goto fail; + } + } + + delete peFile; + + return 1; +fail: + delete peFile; + + return 0; +} + +//************************************************************************************** +extern "C" unsigned int ScyllaDumpProcessToFileHandle(HANDLE hProcess, DWORD_PTR ModuleBase, DWORD_PTR NewOEP, HANDLE FileHandle) +//************************************************************************************** +{ + unsigned int BytesWritten = 0; + SIZE_T SectionBasedSizeOfImage; PeParser * peFile = 0; DWORD_PTR entrypoint = NULL; ScyllaInit(hProcess); - + DoOutputDebugString("DumpProcess: Instantiating PeParser with address: 0x%p.\n", ModuleBase); peFile = new PeParser(ModuleBase, TRUE); @@ -170,9 +329,9 @@ extern "C" int ScyllaDumpProcess(HANDLE hProcess, DWORD_PTR ModuleBase, DWORD_PT else entrypoint = peFile->getEntryPoint(); - SectionBasedFileSize = (SIZE_T)peFile->getSectionHeaderBasedFileSize(); + SectionBasedSizeOfImage = (SIZE_T)peFile->getSectionHeaderBasedSizeOfImage(); - if ((SIZE_T)entrypoint > SectionBasedFileSize) + if ((SIZE_T)entrypoint >= SectionBasedSizeOfImage) { DoOutputDebugString("DumpProcess: Error - entry point too big: 0x%x, ignoring.\n", entrypoint); entrypoint = NULL; @@ -182,10 +341,11 @@ extern "C" int ScyllaDumpProcess(HANDLE hProcess, DWORD_PTR ModuleBase, DWORD_PT DoOutputDebugString("DumpProcess: Module entry point VA is 0x%p.\n", entrypoint); entrypoint = entrypoint + (DWORD_PTR)ModuleBase; } - + if (peFile->dumpProcess(ModuleBase, entrypoint, NULL)) { - DoOutputDebugString("DumpProcess: Module image dump success - dump size 0x%x.\n", peFile->dumpSize); + BytesWritten = peFile->dumpSize; + DoOutputDebugString("DumpProcess: Module image dump success - dump size 0x%x.\n", BytesWritten); } else { @@ -203,7 +363,7 @@ extern "C" int ScyllaDumpProcess(HANDLE hProcess, DWORD_PTR ModuleBase, DWORD_PT delete peFile; - return 1; + return BytesWritten; } //************************************************************************************** @@ -211,17 +371,17 @@ DWORD SafeGetDword(PVOID Address) //************************************************************************************** { DWORD RetVal = NULL; - - __try - { + + __try + { RetVal = *(DWORD*)Address; - } - __except(EXCEPTION_EXECUTE_HANDLER) - { + } + __except(EXCEPTION_EXECUTE_HANDLER) + { DoOutputDebugString("SafeGetDword: Exception occured reading memory address 0x%p\n", Address); return NULL; } - + return RetVal; } @@ -232,41 +392,41 @@ extern "C" int ScyllaDumpPE(DWORD_PTR Buffer) DWORD_PTR PointerToLastSection, entrypoint = 0; PeParser * peFile = 0; unsigned int SizeOfLastSection, NumberOfSections = 0; - + NativeWinApi::initialize(); ProcessAccessHelp::setCurrentProcessAsTarget(); - + DoOutputDebugString("DumpPE: Instantiating PeParser with address: 0x%p.\n", Buffer); - + peFile = new PeParser((DWORD_PTR)Buffer, TRUE); if (peFile->isValidPeFile()) - { + { NumberOfSections = peFile->getNumberOfSections(); if (NumberOfSections == 0) { DoOutputDebugString("DumpPE: no sections in PE image, ignoring.\n"); - return 0; + return 0; } - + PointerToLastSection = SafeGetDword(&(peFile->listPeSection[NumberOfSections - 1].sectionHeader.PointerToRawData)); - + if (!PointerToLastSection) { DoOutputDebugString("DumpPE: failed to obtain pointer to last section.\n"); - return 0; + return 0; } - + PointerToLastSection += (DWORD_PTR)Buffer; - + SizeOfLastSection = SafeGetDword(&(peFile->listPeSection[NumberOfSections - 1].sectionHeader.SizeOfRawData)); - + if (!SizeOfLastSection) { DoOutputDebugString("DumpPE: failed to obtain size of last section.\n"); - return 0; + return 0; } if (!ScanForNonZero((LPVOID)PointerToLastSection, SizeOfLastSection)) @@ -275,8 +435,8 @@ extern "C" int ScyllaDumpPE(DWORD_PTR Buffer) return 0; } - entrypoint = peFile->getEntryPoint(); - + entrypoint = peFile->getEntryPoint(); + if (peFile->saveCompletePeToDisk(NULL)) { DoOutputDebugString("DumpPE: PE file in memory dumped successfully - dump size 0x%x.\n", peFile->dumpSize); @@ -296,7 +456,82 @@ extern "C" int ScyllaDumpPE(DWORD_PTR Buffer) } delete peFile; - + + return 1; +} + +//************************************************************************************** +extern "C" int ScyllaDumpPEToFileHandle(DWORD_PTR Buffer, HANDLE FileHandle) +//************************************************************************************** +{ + DWORD_PTR PointerToLastSection, entrypoint = 0; + PeParser * peFile = 0; + unsigned int SizeOfLastSection, NumberOfSections = 0; + + NativeWinApi::initialize(); + + ProcessAccessHelp::setCurrentProcessAsTarget(); + + DoOutputDebugString("DumpPEToFileHandle: Instantiating PeParser with address: 0x%p.\n", Buffer); + + peFile = new PeParser((DWORD_PTR)Buffer, TRUE); + + if (peFile->isValidPeFile()) + { + NumberOfSections = peFile->getNumberOfSections(); + + if (NumberOfSections == 0) + { + DoOutputDebugString("DumpPEToFileHandle: no sections in PE image, ignoring.\n"); + return 0; + } + + PointerToLastSection = SafeGetDword(&(peFile->listPeSection[NumberOfSections - 1].sectionHeader.PointerToRawData)); + + if (!PointerToLastSection) + { + DoOutputDebugString("DumpPEToFileHandle: failed to obtain pointer to last section.\n"); + return 0; + } + + PointerToLastSection += (DWORD_PTR)Buffer; + + SizeOfLastSection = SafeGetDword(&(peFile->listPeSection[NumberOfSections - 1].sectionHeader.SizeOfRawData)); + + if (!SizeOfLastSection) + { + DoOutputDebugString("DumpPEToFileHandle: failed to obtain size of last section.\n"); + return 0; + } + + if (!ScanForNonZero((LPVOID)PointerToLastSection, SizeOfLastSection)) + { + DoOutputDebugString("DumpPEToFileHandle: Empty or inaccessible last section, file image seems incomplete (from 0x%p to 0x%p).\n", PointerToLastSection, (DWORD_PTR)PointerToLastSection + SizeOfLastSection); + return 0; + } + + entrypoint = peFile->getEntryPoint(); + + if (peFile->saveCompletePeToHandle(FileHandle)) + { + DoOutputDebugString("DumpPEToFileHandle: PE file in memory dumped successfully - dump size 0x%x.\n", peFile->dumpSize); + } + else + { + DoOutputDebugString("DumpPEToFileHandle: Error: Cannot dump PE file from memory.\n"); + delete peFile; + return 0; + } + } + else + { + DoOutputDebugString("DumpPEToFileHandle: Error: Invalid PE file or invalid PE header.\n"); + delete peFile; + return 0; + } + + delete peFile; + return 1; } @@ -304,9 +539,9 @@ extern "C" int ScyllaDumpPE(DWORD_PTR Buffer) extern "C" int LooksLikeSectionBoundary(DWORD_PTR Buffer) //************************************************************************************** { - __try - { - if + __try + { + if ( (*(DWORD*)((BYTE*)Buffer - 4) == 0) && // end of previous section has zeros (*(DWORD*)((BYTE*)Buffer) != 0) // beginning of section is non-zero @@ -322,15 +557,15 @@ extern "C" int LooksLikeSectionBoundary(DWORD_PTR Buffer) #ifdef DEBUG_COMMENTS if (*(DWORD*)((BYTE*)Buffer - 4) != 0) DoOutputDebugString("LooksLikeSectionBoundary: No - end of previous candidate section 0x%p not zero.\n", Buffer); - - if (*(DWORD*)((BYTE*)Buffer) == 0) + + if (*(DWORD*)((BYTE*)Buffer) == 0) DoOutputDebugString("LooksLikeSectionBoundary: No - beginning of candidate section 0x%p zero.\n", Buffer); #endif return 0; } - } - __except(EXCEPTION_EXECUTE_HANDLER) - { + } + __except(EXCEPTION_EXECUTE_HANDLER) + { DoOutputDebugString("LooksLikeSectionBoundary: Exception occured reading around suspected boundary at 0x%p\n", Buffer); return 0; } @@ -343,50 +578,50 @@ extern "C" SIZE_T GetPESize(PVOID Buffer) PeParser * peFile = 0; unsigned int NumberOfSections = 0; SIZE_T SectionBasedFileSize, SectionBasedImageSize; - + NativeWinApi::initialize(); ProcessAccessHelp::setCurrentProcessAsTarget(); - + peFile = new PeParser((DWORD_PTR)Buffer, TRUE); - + NumberOfSections = peFile->getNumberOfSections(); SectionBasedFileSize = (SIZE_T)peFile->getSectionHeaderBasedFileSize(); SectionBasedImageSize = (SIZE_T)peFile->getSectionHeaderBasedSizeOfImage(); - + #ifdef DEBUG_COMMENTS DoOutputDebugString("IsPeImageVirtual: NumberOfSections %d, SectionBasedFileSize 0x%x.\n", NumberOfSections, SectionBasedFileSize); -#endif +#endif if (NumberOfSections == 0) // makes no difference in this case { #ifdef DEBUG_COMMENTS DoOutputDebugString("IsPeImageVirtual: zero sections, therefore meaningless.\n"); -#endif +#endif delete peFile; return SectionBasedFileSize; } - + for (unsigned int SectionIndex = 0; SectionIndex < NumberOfSections; SectionIndex++) { #ifdef DEBUG_COMMENTS DoOutputDebugString ( "IsPeImageVirtual: Section %d, PointerToRawData 0x%x, VirtualAddress 0x%x, SizeOfRawData 0x%x, VirtualSize 0x%x.\n", - SectionIndex+1, - peFile->listPeSection[SectionIndex].sectionHeader.PointerToRawData, + SectionIndex+1, + peFile->listPeSection[SectionIndex].sectionHeader.PointerToRawData, peFile->listPeSection[SectionIndex].sectionHeader.VirtualAddress, peFile->listPeSection[SectionIndex].sectionHeader.SizeOfRawData, peFile->listPeSection[SectionIndex].sectionHeader.Misc.VirtualSize ); -#endif +#endif if (peFile->listPeSection[SectionIndex].sectionHeader.PointerToRawData != peFile->listPeSection[SectionIndex].sectionHeader.VirtualAddress) { if (LooksLikeSectionBoundary((DWORD_PTR)Buffer + peFile->listPeSection[SectionIndex].sectionHeader.PointerToRawData)) { #ifdef DEBUG_COMMENTS DoOutputDebugString("IsPeImageVirtual: Found what looks like a 'raw' section boundary - image looks raw.\n"); -#endif +#endif delete peFile; return SectionBasedFileSize; } @@ -394,13 +629,13 @@ extern "C" SIZE_T GetPESize(PVOID Buffer) { #ifdef DEBUG_COMMENTS DoOutputDebugString("IsPeImageVirtual: Found what looks like a virtual section boundary - image looks virtual.\n"); -#endif +#endif delete peFile; return SectionBasedImageSize; } } - } - + } + delete peFile; return SectionBasedImageSize; } @@ -412,50 +647,50 @@ extern "C" int IsPeImageVirtual(DWORD_PTR Buffer) PeParser * peFile = 0; unsigned int NumberOfSections = 0; DWORD SectionBasedFileSize; - + NativeWinApi::initialize(); ProcessAccessHelp::setCurrentProcessAsTarget(); - + peFile = new PeParser((DWORD_PTR)Buffer, TRUE); - + if (peFile->isValidPeFile()) - { + { NumberOfSections = peFile->getNumberOfSections(); SectionBasedFileSize = peFile->getSectionHeaderBasedFileSize(); #ifdef DEBUG_COMMENTS DoOutputDebugString("IsPeImageVirtual: NumberOfSections %d, SectionBasedFileSize 0x%x.\n", NumberOfSections, SectionBasedFileSize); -#endif +#endif if (NumberOfSections == 0) // makes no difference in this case { #ifdef DEBUG_COMMENTS DoOutputDebugString("IsPeImageVirtual: zero sections, therefore meaningless.\n"); -#endif +#endif delete peFile; return 1; } - + for (unsigned int SectionIndex = 0; SectionIndex < NumberOfSections; SectionIndex++) { #ifdef DEBUG_COMMENTS DoOutputDebugString ( "IsPeImageVirtual: Section %d, PointerToRawData 0x%x, VirtualAddress 0x%x, SizeOfRawData 0x%x, VirtualSize 0x%x.\n", - SectionIndex+1, - peFile->listPeSection[SectionIndex].sectionHeader.PointerToRawData, + SectionIndex+1, + peFile->listPeSection[SectionIndex].sectionHeader.PointerToRawData, peFile->listPeSection[SectionIndex].sectionHeader.VirtualAddress, peFile->listPeSection[SectionIndex].sectionHeader.SizeOfRawData, peFile->listPeSection[SectionIndex].sectionHeader.Misc.VirtualSize ); -#endif +#endif if (peFile->listPeSection[SectionIndex].sectionHeader.PointerToRawData != peFile->listPeSection[SectionIndex].sectionHeader.VirtualAddress) { if (LooksLikeSectionBoundary((DWORD_PTR)Buffer + peFile->listPeSection[SectionIndex].sectionHeader.PointerToRawData)) { #ifdef DEBUG_COMMENTS DoOutputDebugString("IsPeImageVirtual: Found what looks like a 'raw' section boundary - image looks raw.\n"); -#endif +#endif delete peFile; return 0; } @@ -463,14 +698,14 @@ extern "C" int IsPeImageVirtual(DWORD_PTR Buffer) { #ifdef DEBUG_COMMENTS DoOutputDebugString("IsPeImageVirtual: Found what looks like a virtual section boundary - image looks virtual.\n"); -#endif +#endif delete peFile; return 1; } } - } + } } - + delete peFile; return 1; } @@ -491,7 +726,7 @@ bool isIATOutsidePeImage (DWORD_PTR addressIAT) minAdd = ProcessAccessHelp::targetImageBase; maxAdd = minAdd + ProcessAccessHelp::targetSizeOfImage; } - + if (addressIAT > minAdd && addressIAT < maxAdd) { return FALSE; //inside pe image @@ -510,7 +745,7 @@ extern "C" int ScyllaDumpCurrentProcessFixImports(DWORD_PTR NewOEP) BOOL IAT_Found, AdvancedIATSearch = FALSE; bool isAfter; DWORD_PTR ModuleBase; - + IATSearch iatSearch; ApiReader apiReader; IATReferenceScan iatReferenceScan; @@ -520,7 +755,7 @@ extern "C" int ScyllaDumpCurrentProcessFixImports(DWORD_PTR NewOEP) PeParser * peFile = 0; ModuleBase = (DWORD)(ULONG_PTR)GetModuleHandle(NULL); - + //Clear stuff first ProcessAccessHelp::ownModuleList.clear(); apiReader.clearAll(); @@ -535,7 +770,7 @@ extern "C" int ScyllaDumpCurrentProcessFixImports(DWORD_PTR NewOEP) ProcessAccessHelp::moduleList = ProcessAccessHelp::ownModuleList; ProcessAccessHelp::targetImageBase = ModuleBase; ProcessAccessHelp::getSizeOfImageCurrentProcess(); - + // Enumerate DLLs and imported functions apiReader.readApisFromModuleList(); @@ -551,32 +786,32 @@ extern "C" int ScyllaDumpCurrentProcessFixImports(DWORD_PTR NewOEP) entrypointRVA = peFile->getEntryPoint(); DoOutputDebugString(TEXT("DumpCurrentProcessFixImports: Module entry point VA is 0x%p"), ModuleBase + entrypointRVA); - + // Let's dump then fix the dump on disk if (peFile->dumpProcess(ModuleBase, ModuleBase + entrypointRVA, CAPE_OUTPUT_FILE)) { DoOutputDebugString("DumpCurrentProcessFixImports: Module image dump success %s", CapeOutputPath); } - + // IAT search - we'll try the simple search first IAT_Found = iatSearch.searchImportAddressTableInProcess(ModuleBase + entrypointRVA, (DWORD_PTR*)&addressIAT, &sizeIAT, FALSE); - + // Let's try the advanced search now if (IAT_Found == FALSE) IAT_Found = iatSearch.searchImportAddressTableInProcess(ModuleBase + entrypointRVA, (DWORD_PTR*)&addressIAT, &sizeIAT, TRUE); - + if (addressIAT && sizeIAT) { DoOutputDebugString("DumpCurrentProcessFixImports: Found IAT: 0x%x, size: 0x%x", addressIAT, sizeIAT); - + apiReader.readAndParseIAT(addressIAT, sizeIAT, importsHandling.moduleList); importsHandling.scanAndFixModuleList(); - + if (SCAN_DIRECT_IMPORTS) { iatReferenceScan.ScanForDirectImports = true; iatReferenceScan.ScanForNormalImports = false; - + iatReferenceScan.apiReader = &apiReader; iatReferenceScan.startScan(ProcessAccessHelp::targetImageBase, (DWORD)ProcessAccessHelp::targetSizeOfImage, addressIAT, sizeIAT); @@ -597,11 +832,11 @@ extern "C" int ScyllaDumpCurrentProcessFixImports(DWORD_PTR NewOEP) if (FIX_DIRECT_IMPORTS_NORMAL) { // From the Scylla source: - // "Direct Imports found. I can patch only direct imports by JMP/CALL - // (use universal method if you don't like this) - // but where is the junk byte?\r\n\r\nYES = After Instruction\r\nNO = + // "Direct Imports found. I can patch only direct imports by JMP/CALL + // (use universal method if you don't like this) + // but where is the junk byte?\r\n\r\nYES = After Instruction\r\nNO = // Before the Instruction\r\nCancel = Do nothing", L"Information", MB_YESNOCANCEL|MB_ICONINFORMATION); - + // This hasn't yet been tested! isAfter = 1; @@ -615,16 +850,16 @@ extern "C" int ScyllaDumpCurrentProcessFixImports(DWORD_PTR NewOEP) { DoOutputDebugString("DumpCurrentProcessFixImports: Warning - IAT is not inside the PE image, requires rebasing.\n"); } - + ImportRebuilder importRebuild(CAPE_OUTPUT_FILE); - + if (OFT_SUPPORT) { // Untested importRebuild.enableOFTSupport(); DoOutputDebugString("DumpCurrentProcessFixImports: OFT support enabled.\n"); } - + if (SCAN_DIRECT_IMPORTS && FIX_DIRECT_IMPORTS_UNIVERSAL) { if (iatReferenceScan.numberOfFoundDirectImports() > 0) @@ -640,7 +875,7 @@ extern "C" int ScyllaDumpCurrentProcessFixImports(DWORD_PTR NewOEP) importRebuild.iatReferenceScan = &iatReferenceScan; importRebuild.enableNewIatInSection(addressIAT, sizeIAT); } - + if (importRebuild.rebuildImportTable(NULL, importsHandling.moduleList)) { DoOutputDebugString("DumpCurrentProcessFixImports: Import table rebuild success.\n"); @@ -651,13 +886,13 @@ extern "C" int ScyllaDumpCurrentProcessFixImports(DWORD_PTR NewOEP) { DoOutputDebugString("DumpCurrentProcessFixImports: Import table rebuild failed, falling back to unfixed dump.\n"); peFile->savePeFileToDisk(NULL); - } + } } else { DoOutputDebugString("DumpCurrentProcessFixImports: Warning - Unable to find IAT in scan.\n"); } - + } else { @@ -667,7 +902,7 @@ extern "C" int ScyllaDumpCurrentProcessFixImports(DWORD_PTR NewOEP) } delete peFile; - + return 1; } @@ -679,7 +914,7 @@ extern "C" int ScyllaDumpProcessFixImports(HANDLE hProcess, DWORD_PTR ModuleBase DWORD sizeIAT; DWORD_PTR addressIAT; BOOL IAT_Found, AdvancedIATSearch = FALSE; - + IATSearch iatSearch; ApiReader apiReader; IATReferenceScan iatReferenceScan; @@ -698,7 +933,7 @@ extern "C" int ScyllaDumpProcessFixImports(HANDLE hProcess, DWORD_PTR ModuleBase ProcessAccessHelp::hProcess = hProcess; ProcessAccessHelp::getProcessModules(ProcessAccessHelp::hProcess, ProcessAccessHelp::moduleList); ProcessAccessHelp::targetImageBase = ModuleBase; - + apiReader.readApisFromModuleList(); DoOutputDebugString(TEXT("DumpProcessFixImports: Instantiating PeParser with address: 0x%p"), ModuleBase); @@ -713,32 +948,32 @@ extern "C" int ScyllaDumpProcessFixImports(HANDLE hProcess, DWORD_PTR ModuleBase entrypointRVA = peFile->getEntryPoint(); DoOutputDebugString(TEXT("DumpProcessFixImports: Module entry point VA is 0x%p"), ModuleBase + entrypointRVA); - + // Let's dump then fix the dump on disk if (peFile->dumpProcess(ModuleBase, ModuleBase + entrypointRVA, CAPE_OUTPUT_FILE)) { DoOutputDebugString("Module image dump success %s", CapeOutputPath); } - + // We'll try the simple search first IAT_Found = iatSearch.searchImportAddressTableInProcess(ModuleBase + entrypointRVA, &addressIAT, &sizeIAT, FALSE); - + // Let's try the advanced search now if (IAT_Found == FALSE) IAT_Found = iatSearch.searchImportAddressTableInProcess(ModuleBase + entrypointRVA, &addressIAT, &sizeIAT, TRUE); - + if (addressIAT && sizeIAT) { DoOutputDebugString("DumpProcessFixImports: Found IAT - 0x%x, size: 0x%x", addressIAT, sizeIAT); - + apiReader.readAndParseIAT(addressIAT, sizeIAT, importsHandling.moduleList); importsHandling.scanAndFixModuleList(); - + if (SCAN_DIRECT_IMPORTS) { iatReferenceScan.ScanForDirectImports = true; iatReferenceScan.ScanForNormalImports = false; - + iatReferenceScan.apiReader = &apiReader; iatReferenceScan.startScan(ProcessAccessHelp::targetImageBase, (DWORD)ProcessAccessHelp::targetSizeOfImage, addressIAT, sizeIAT); @@ -759,11 +994,11 @@ extern "C" int ScyllaDumpProcessFixImports(HANDLE hProcess, DWORD_PTR ModuleBase if (FIX_DIRECT_IMPORTS_NORMAL) { // From the Scylla source: - // "Direct Imports found. I can patch only direct imports by JMP/CALL - // (use universal method if you don't like this) - // but where is the junk byte?\r\n\r\nYES = After Instruction\r\nNO = + // "Direct Imports found. I can patch only direct imports by JMP/CALL + // (use universal method if you don't like this) + // but where is the junk byte?\r\n\r\nYES = After Instruction\r\nNO = // Before the Instruction\r\nCancel = Do nothing", L"Information", MB_YESNOCANCEL|MB_ICONINFORMATION); - + // This hasn't yet been tested! isAfter = 1; @@ -777,16 +1012,16 @@ extern "C" int ScyllaDumpProcessFixImports(HANDLE hProcess, DWORD_PTR ModuleBase { DoOutputDebugString("Warning - IAT is not inside the PE image, requires rebasing.\n"); } - + ImportRebuilder importRebuild(CapeOutputPath); - + if (OFT_SUPPORT) { // Untested importRebuild.enableOFTSupport(); DoOutputDebugString("importRebuild: OFT support enabled.\n"); } - + if (SCAN_DIRECT_IMPORTS && FIX_DIRECT_IMPORTS_UNIVERSAL) { if (iatReferenceScan.numberOfFoundDirectImports() > 0) @@ -802,7 +1037,7 @@ extern "C" int ScyllaDumpProcessFixImports(HANDLE hProcess, DWORD_PTR ModuleBase importRebuild.iatReferenceScan = &iatReferenceScan; importRebuild.enableNewIatInSection(addressIAT, sizeIAT); } - + if (importRebuild.rebuildImportTable(NULL, importsHandling.moduleList)) { DoOutputDebugString("Import table rebuild success.\n"); @@ -813,7 +1048,7 @@ extern "C" int ScyllaDumpProcessFixImports(HANDLE hProcess, DWORD_PTR ModuleBase { DoOutputDebugString("Import table rebuild failed, falling back to unfixed dump.\n"); peFile->savePeFileToDisk(NULL); - } + } } else { @@ -850,7 +1085,7 @@ extern "C" BOOL ScyllaGetSectionByName(PVOID ImageBase, char* Name, PVOID* Secti { DoOutputDebugString("ScyllaGetSectionByName: Failed to read PE sections from image.\n"); return 0; - } + } unsigned int NumberOfSections = peFile->getNumberOfSections(); @@ -866,4 +1101,158 @@ extern "C" BOOL ScyllaGetSectionByName(PVOID ImageBase, char* Name, PVOID* Secti } return FALSE; -} \ No newline at end of file +} + +//************************************************************************************** +extern "C" PCHAR ScyllaGetExportNameByAddress(PVOID Address, PCHAR* ModuleName) +//************************************************************************************** +{ + ApiReader apiReader; + ApiInfo* apiInfo; + unsigned int ModuleIndex = 0; + bool dummy; + + ScyllaInitCurrentProcess(); + + for (unsigned int i = 0; i < ProcessAccessHelp::ownModuleList.size(); i++) { + if ((DWORD_PTR)Address >= ProcessAccessHelp::ownModuleList[i].modBaseAddr && (DWORD_PTR)Address < (ProcessAccessHelp::ownModuleList[i].modBaseAddr + ProcessAccessHelp::ownModuleList[i].modBaseSize)) + ModuleIndex = i+1; + } + + if (!ModuleIndex) + { +#ifdef DEBUG_COMMENTS + DoOutputDebugString("ScyllaGetExportNameByAddress: Address 0x%p not within loaded modules.\n", Address); +#endif + //return NULL; + } + + PVOID ModuleBase = GetAllocationBase(Address); + + if (!ModuleBase) + { +#ifdef DEBUG_COMMENTS + DoOutputDebugString("ScyllaGetExportNameByAddress: GetAllocationBase failed for 0x%p.\n", Address); +#endif + return NULL; + } + + PeParser *peFile = new PeParser((DWORD_PTR)ModuleBase, true); + + if (!peFile->isValidPeFile()) + { +#ifdef DEBUG_COMMENTS + DoOutputDebugString("ScyllaGetExportNameByAddress: Invalid PE image at 0x%p.\n", Address); +#endif + delete peFile; + return NULL; + } + + if (!peFile->hasExportDirectory()) + { +#ifdef DEBUG_COMMENTS + DoOutputDebugString("ScyllaGetExportNameByAddress: Module has no exports.\n"); +#endif + delete peFile; + return NULL; + } + + apiReader.clearAll(); + + // This creates moduleInfo->apiList + apiReader.parseModuleWithOwnProcess(&ProcessAccessHelp::ownModuleList[ModuleIndex-1]); + apiInfo = apiReader.getApiByVirtualAddress((DWORD_PTR)Address, &dummy); + + if (apiInfo) + { + if (ModuleName) + *ModuleName = apiInfo->module->fullPath; +#ifdef DEBUG_COMMENTS + DoOutputDebugString("ScyllaGetExportNameByAddress: Located function %s within module %s.\n", apiInfo->name, apiInfo->module->fullPath); +#endif + delete peFile; + return (PCHAR)apiInfo->name; + } +#ifdef DEBUG_COMMENTS + else + DoOutputDebugString("ScyllaGetExportNameByAddress: Failed to locate function among module exports.\n"); +#endif + + delete peFile; + return NULL; +} + +//************************************************************************************** +extern "C" PCHAR ScyllaGetExportDirectory(PVOID Address) +//************************************************************************************** +{ + ApiReader apiReader; + unsigned int ModuleIndex = 0; + + ScyllaInitCurrentProcess(); + + for (unsigned int i = 0; i < ProcessAccessHelp::ownModuleList.size(); i++) { + if ((DWORD_PTR)Address >= ProcessAccessHelp::ownModuleList[i].modBaseAddr && (DWORD_PTR)Address < (ProcessAccessHelp::ownModuleList[i].modBaseAddr + ProcessAccessHelp::ownModuleList[i].modBaseSize)) + ModuleIndex = i+1; + } + + if (!ModuleIndex) + { +#ifdef DEBUG_COMMENTS + DoOutputDebugString("ScyllaGetExportDirectory: Address 0x%p not within loaded modules.\n", Address); +#endif + return NULL; + } + + PVOID ModuleBase = GetAllocationBase(Address); + + if (!ModuleBase) + { +#ifdef DEBUG_COMMENTS + DoOutputDebugString("ScyllaGetExportDirectory: GetAllocationBase failed for 0x%p.\n", Address); +#endif + return NULL; + } + + PeParser *peFile = new PeParser((DWORD_PTR)ModuleBase, true); + + if (!peFile->isValidPeFile()) + { +#ifdef DEBUG_COMMENTS + DoOutputDebugString("ScyllaGetExportDirectory: Invalid PE image at 0x%p.\n", Address); +#endif + delete peFile; + return NULL; + } + + if (!peFile->hasExportDirectory()) + { +#ifdef DEBUG_COMMENTS + DoOutputDebugString("ScyllaGetExportDirectory: Module has no exports.\n"); +#endif + delete peFile; + return NULL; + } + + apiReader.clearAll(); + + // This creates moduleInfo->apiList + apiReader.parseModuleWithOwnProcess(&ProcessAccessHelp::ownModuleList[ModuleIndex-1]); + char *DirectoryName = (&ProcessAccessHelp::ownModuleList[ModuleIndex-1])->DirectoryName; + + if (DirectoryName) + { +#ifdef DEBUG_COMMENTS + DoOutputDebugString("ScyllaGetExportDirectory: Export directory name %s.\n", DirectoryName); +#endif + delete peFile; + return (PCHAR)DirectoryName; + } +#ifdef DEBUG_COMMENTS + else + DoOutputDebugString("ScyllaGetExportDirectory: Failed to locate export directory name.\n"); +#endif + + delete peFile; + return NULL; +} diff --git a/CAPE/wow64_fix.c b/CAPE/wow64_fix.c index 2e18aa1..1da7f0a 100644 --- a/CAPE/wow64_fix.c +++ b/CAPE/wow64_fix.c @@ -45,10 +45,10 @@ extern BOOL WoW64PatchBreakpoint(unsigned int Register) { if (WoW64HookInstalled == FALSE) return FALSE; - + DoOutputDebugString("WoW64PatchBreakpoint entry, debug register: %d, current DR7 mask = 0x%x\n", Register, *(DWORD*)(((PBYTE)lpNewJumpLocation)+37)); - switch(Register) + switch(Register) { case 0: *(DWORD*)(((PBYTE)lpNewJumpLocation)+37) = (*(DWORD*)(((PBYTE)lpNewJumpLocation)+37) & DR7_MASK_RWE0); @@ -63,9 +63,9 @@ extern BOOL WoW64PatchBreakpoint(unsigned int Register) *(DWORD*)(((PBYTE)lpNewJumpLocation)+37) = (*(DWORD*)(((PBYTE)lpNewJumpLocation)+37) & DR7_MASK_RWE3); break; } - + DoOutputDebugString("WoW64PatchBreakpoint: patched DR7 mask = 0x%x\n", *(DWORD*)(((PBYTE)lpNewJumpLocation)+37)); - + return TRUE; } @@ -78,24 +78,24 @@ extern BOOL WoW64UnpatchBreakpoint(unsigned int Register) DoOutputDebugString("WoW64UnpatchBreakpoint entry, debug register: %d, current DR7 mask = 0x%x\n", Register, *(DWORD*)(((PBYTE)lpNewJumpLocation)+37)); - switch(Register) + switch(Register) { case 0: *(DWORD*)(((PBYTE)lpNewJumpLocation)+37) = (*(DWORD*)(((PBYTE)lpNewJumpLocation)+37) | ~DR7_MASK_RWE0); - break; - case 1: + break; + case 1: *(DWORD*)(((PBYTE)lpNewJumpLocation)+37) = (*(DWORD*)(((PBYTE)lpNewJumpLocation)+37) | ~DR7_MASK_RWE1); - break; - case 2: + break; + case 2: *(DWORD*)(((PBYTE)lpNewJumpLocation)+37) = (*(DWORD*)(((PBYTE)lpNewJumpLocation)+37) | ~DR7_MASK_RWE2); - break; - case 3: + break; + case 3: *(DWORD*)(((PBYTE)lpNewJumpLocation)+37) = (*(DWORD*)(((PBYTE)lpNewJumpLocation)+37) | ~DR7_MASK_RWE3); break; } - + DoOutputDebugString("WoW64UnpatchBreakpoint: unpatched DR7 mask = 0x%x\n", *(DWORD*)(((PBYTE)lpNewJumpLocation)+37)); - + return TRUE; } @@ -105,7 +105,7 @@ const DWORD64 CreateHook(const DWORD_PTR pKiUserExceptionDispatcher, const DWORD // credit to Omega Red http://pastebin.ca/raw/475547 { unsigned char HookBytes[] = - { + { 0x81, 0xBC, 0x24, 0xF0, 0x04, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x40, //cmp dword [rsp+0x4f0], 0x4000001e ; wow64 single step? 0 0x75, 0x37, //jne hook_end 11 @@ -122,8 +122,8 @@ const DWORD64 CreateHook(const DWORD_PTR pKiUserExceptionDispatcher, const DWORD 0x4C, 0x89, 0xEA, //mov rdx, r13 59 0x4D, 0x89, 0xF0, //mov r8, r14 62 0x4D, 0x89, 0xF9, //mov r9, r15 65 -//hook_end - 0xFC, //cld - first two instructions from KiUserExceptionDispatcher 68 +//hook_end + 0xFC, //cld - first two instructions from KiUserExceptionDispatcher 68 0x48, 0xB8, 0xDD, 0xCC, 0xBB, 0xAA, 0x00, 0x00, 0x00, 0x00, //mov rax, 0AABBCCDDh 69 0x50, //push rax - jump back to KiUserExceptionDispatcher+8 79 0x48, 0xB8, 0xDD, 0xCC, 0xBB, 0xAA, 0x00, 0x00, 0x00, 0x00, //mov rax, 0AABBCCDDh 80 @@ -132,21 +132,21 @@ const DWORD64 CreateHook(const DWORD_PTR pKiUserExceptionDispatcher, const DWORD }; // 86 lpHookCode = VirtualAllocEx64((HANDLE) -1, (DWORD64)NULL, PAGE_SIZE, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); - + //insert relative address of NtSetContextThread64 from instruction after call DWORD RelativeOffset = pNtSetContextThread64 - ((DWORD)lpHookCode + 56); memcpy(&HookBytes[52], &RelativeOffset, sizeof(DWORD_PTR)); - + //insert VA of Wow64PrepareForException memcpy(&HookBytes[71], &pWow64PrepareForException, sizeof(DWORD_PTR)); - + //insert address to return to from hook code at 8 bytes into KiUserExceptionDispatcher DWORD ReturnAddress = pKiUserExceptionDispatcher + 8; - memcpy(&HookBytes[82], &ReturnAddress, sizeof(DWORD_PTR)); //(8 is address of third instruction) - + memcpy(&HookBytes[82], &ReturnAddress, sizeof(DWORD_PTR)); //(8 is address of third instruction) + //copy it to newly created page memcpy((LPVOID)lpHookCode, (const void *)HookBytes, sizeof(HookBytes)); - + return lpHookCode; } @@ -157,7 +157,7 @@ const void EnableWow64Hook() unsigned char trampolineBytes[] = { 0xE9, 0xDD, 0xCC, 0xBB, 0xAA, // jmp +0xAABBCCDDEE+5 - 0xCC, 0xCC, 0xCC // + 0xCC, 0xCC, 0xCC // }; DWORD pNew = (DWORD)lpNewJumpLocation; DWORD pOrig = (DWORD)pfnKiUserExceptionDispatcher + 5; @@ -170,44 +170,59 @@ const void EnableWow64Hook() DoOutputErrorString("VirtualProtectEx64 failed to set PAGE_EXECUTE_READWRITE"); return; } - + memcpy((PVOID)pfnKiUserExceptionDispatcher, &trampolineBytes, sizeof(trampolineBytes)); if (!VirtualProtectEx64((HANDLE)-1, (DWORD64)pfnKiUserExceptionDispatcher, PAGE_SIZE, dwOldProtect, &dwOldProtect)) { DoOutputErrorString("VirtualProtect failed to restore dwOldProtect"); return; - } + } } //************************************************************************************** extern BOOL WoW64fix(void) //************************************************************************************** { + OSVERSIONINFO OSVersion; + OSVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + + if (!GetVersionEx(&OSVersion)) + { + DoOutputErrorString("WoW64fix: Failed to get OS version"); + return FALSE; + } + + if (OSVersion.dwMajorVersion == 6 && OSVersion.dwMinorVersion > 1) + { + DoOutputDebugString("WoW64fix: Windows version %d.%d not supported.\n", OSVersion.dwMajorVersion, OSVersion.dwMinorVersion); + return FALSE; + } + IsWow64Process(GetCurrentProcess(), &WoW64HookInstalled); if (WoW64HookInstalled == FALSE) { DoOutputDebugString("WoW64 not detected.\n"); return FALSE; } - + //DWORD ntdll64 = getNTDLL64(); //DWORD wow64dll = GetModuleHandle64(L"wow64.dll"); - + DWORD64 ntdll64 = GetModuleBase64(L"ntdll.dll"); DWORD64 wow64dll = GetModuleBase64(L"wow64.dll"); DWORD64 pfnWow64PrepareForException = GetProcAddress64(wow64dll, "Wow64PrepareForException"); pfnKiUserExceptionDispatcher = GetProcAddress64(ntdll64, "KiUserExceptionDispatcher"); - pfnNtSetContextThread = GetProcAddress64(ntdll64, "NtSetContextThread"); + pfnNtSetContextThread = GetProcAddress64(ntdll64, "NtSetContextThread"); DoOutputDebugString("WoW64 detected: 64-bit ntdll base: 0x%x, KiUserExceptionDispatcher: 0x%x, NtSetContextThread: 0x%x, Wow64PrepareForException: 0x%x\n", ntdll64, pfnKiUserExceptionDispatcher, pfnNtSetContextThread, pfnWow64PrepareForException); - + lpNewJumpLocation = CreateHook((DWORD_PTR)pfnKiUserExceptionDispatcher, (DWORD_PTR)pfnNtSetContextThread, (DWORD_PTR)pfnWow64PrepareForException); - + EnableWow64Hook(); - + DoOutputDebugString("WoW64 workaround: KiUserExceptionDispatcher hook installed at: 0x%x\n", lpNewJumpLocation); - + return TRUE; } #endif \ No newline at end of file diff --git a/config.c b/config.c index 508fed0..c6181d4 100644 --- a/config.c +++ b/config.c @@ -22,26 +22,54 @@ along with this program. If not, see . #include "misc.h" #include "log.h" #include "hooking.h" +#include "Shlwapi.h" extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); +extern char *our_dll_path; +extern wchar_t *our_process_path_w; +#ifdef CAPE_TRACE +#define BP_EXEC 0x00 +#define BP_WRITE 0x01 +#define BP_RESERVED 0x02 +#define BP_READWRITE 0x03 +#define DoClearZeroFlag 1 +#define DoSetZeroFlag 2 +#define PrintEAX 3 extern PVOID bp0, bp1, bp2, bp3; -extern unsigned int StepLimit; -extern int TraceDepthLimit; +extern int TraceDepthLimit, EntryPointRegister; +extern unsigned int StepLimit, Type0, Type1, Type2, Type3; +extern char Action0[MAX_PATH], Action1[MAX_PATH], Action2[MAX_PATH], Action3[MAX_PATH], *Instruction0, *Instruction1, *Instruction2, *Instruction3; +extern char DumpSizeString[MAX_PATH]; +extern SIZE_T DumpSize; +#endif int read_config(void) { - // TODO unicode support - char buf[32768], config_fname[MAX_PATH]; + char buf[32768], config_fname[MAX_PATH], analyzer_path[MAX_PATH]; FILE *fp; unsigned int i; unsigned int vallen; - sprintf(config_fname, "C:\\%u.ini", GetCurrentProcessId()); + // look for the config in analyzer directory + strncpy(analyzer_path, our_dll_path, strlen(our_dll_path)); + PathRemoveFileSpec(analyzer_path); // remove filename + PathRemoveFileSpec(analyzer_path); // remove dll folder + sprintf(config_fname, "%s\\%u.ini", analyzer_path, GetCurrentProcessId()); fp = fopen(config_fname, "r"); + + // backward compatibility if (fp == NULL) { - // for debugging purposes - fp = fopen("C:\\config.ini", "r"); + memset(config_fname, 0, sizeof(config_fname)); + sprintf(config_fname, "C:\\%u.ini", GetCurrentProcessId()); + fp = fopen(config_fname, "r"); + } + + // for debugging purposes + if (fp == NULL) { + memset(config_fname, 0, sizeof(config_fname)); + sprintf(config_fname, "%s\\config.ini", analyzer_path); + fp = fopen(config_fname, "r"); if (fp == NULL) return 0; } @@ -53,6 +81,12 @@ int read_config(void) g_config.hook_type = HOOK_HOTPATCH_JMP_INDIRECT; #endif g_config.procdump = 0; + g_config.procmemdump = 0; + +#ifdef CAPE_TRACE + EntryPointRegister = 0; + TraceDepthLimit = 0xFFFFFFFF; +#endif memset(buf, 0, sizeof(buf)); while (fgets(buf, sizeof(buf), fp) != NULL) @@ -96,7 +130,7 @@ int read_config(void) g_config.file_of_interest = ascii_to_unicode_dup(tmp); free(tmp); // if the file of interest is our own executable, then don't do any special handling - if (wcsicmp(our_process_path, g_config.file_of_interest)) + if (wcsicmp(our_process_path_w, g_config.file_of_interest)) g_config.suspend_logging = TRUE; } else { @@ -236,36 +270,202 @@ int read_config(void) p = p2 + 1; } } - else if (!strcmp(key, "bp0")) { - bp0 = (PVOID)strtoul(value, NULL, 10); - DoOutputDebugString("bp0 set to 0x%x", bp0); + else if (!strcmp(key, "dump-on-api")) { + unsigned int x = 0; + char *p2; + p = value; + while (p && x < EXCLUSION_MAX) { + p2 = strchr(p, ':'); + if (p2) { + *p2 = '\0'; + } + g_config.dump_on_apinames[x++] = strdup(p); + DoOutputDebugString("Added '%s' to dump-on-API list.\n", p); + if (p2 == NULL) + break; + p = p2 + 1; + } + } + else if (!strcmp(key, "dump-on-api-type")) { + g_config.dump_on_api_type = (unsigned int)strtoul(value, NULL, 0); + } +#ifdef CAPE_TRACE + else if (!strcmp(key, "file-offsets")) { + g_config.file_offsets = value[0] == '1'; + if (g_config.file_offsets) + DoOutputDebugString("Breakpoints interpreted as file offsets.\n"); + } + else if (!stricmp(key, "bp0")) { + char *p; + p = strchr(value, ':'); + if (p && *(p+1) == ':') { + bp0 = 0; + *p = '\0'; + *(p+1) = '\0'; + HANDLE Module = GetModuleHandle(value); + g_config.break_on_apiname = strdup(p+2); + g_config.break_on_modname = strdup(value); + if (Module) + bp0 = GetProcAddress(Module, p+2); + else + DoOutputDebugString("Config: Failed to get base for module (%s).\n", g_config.break_on_modname); + if (bp0) { + g_config.break_on_apiname_set = TRUE; + DoOutputDebugString("Config: bp0 set to 0x%p (%s::%s).\n", bp0, g_config.break_on_modname, g_config.break_on_apiname); + } + else { + bp0 = (PVOID)(DWORD_PTR)strtoul(p+2, NULL, 0); + if (bp0) { + g_config.break_on_apiname_set = TRUE; + DoOutputDebugString("Config: bp0 set to 0x%p (%s::%s).\n", bp0, g_config.break_on_modname, g_config.break_on_apiname); + } + else + DoOutputDebugString("Config: Failed to get address for function %s::%s.\n", g_config.break_on_modname, g_config.break_on_apiname); + } + } + else if (!strncmp(value, "ep", 2)) { + DoOutputDebugString("Config: bp0 set to entry point.\n", bp0); + EntryPointRegister = 1; + } + else { + bp0 = (PVOID)(DWORD_PTR)strtoul(value, NULL, 0); + DoOutputDebugString("Config: bp0 set to 0x%x.\n", bp0); + } } - else if (!strcmp(key, "bp1")) { - bp1 = (PVOID)strtoul(value, NULL, 10); - DoOutputDebugString("bp1 set to 0x%x", bp1); + else if (!stricmp(key, "bp1")) { + if (!strncmp(value, "ep", 2)) { + DoOutputDebugString("Config: bp1 set to entry point.\n", bp1); + EntryPointRegister = 2; + } + else { + bp1 = (PVOID)(DWORD_PTR)strtoul(value, NULL, 0); + DoOutputDebugString("Config: bp1 set to 0x%x.\n", bp1); + } } - else if (!strcmp(key, "bp2")) { - bp2 = (PVOID)strtoul(value, NULL, 10); - DoOutputDebugString("bp2 set to 0x%x", bp2); + else if (!stricmp(key, "bp2")) { + if (!strncmp(value, "ep", 2)) { + DoOutputDebugString("Config: bp2 set to entry point.\n", bp2); + EntryPointRegister = 3; + } + else { + bp2 = (PVOID)(DWORD_PTR)strtoul(value, NULL, 0); + DoOutputDebugString("Config: bp2 set to 0x%x.\n", bp2); + } } - else if (!strcmp(key, "bp3")) { - bp3 = (PVOID)strtoul(value, NULL, 10); - DoOutputDebugString("bp3 set to 0x%x", bp3); + else if (!stricmp(key, "bp3")) { + if (!strncmp(value, "ep", 2)) { + DoOutputDebugString("Config: bp3 set to entry point.\n", bp3); + EntryPointRegister = 4; + } + else { + bp3 = (PVOID)(DWORD_PTR)strtoul(value, NULL, 0); + DoOutputDebugString("Config: bp3 set to 0x%x.\n", bp3); + } } - else if (!strcmp(key, "depth")) { + else if (!stricmp(key, "depth")) { TraceDepthLimit = (int)strtoul(value, NULL, 10); - DoOutputDebugString("Trace depth set to 0x%x", TraceDepthLimit); + DoOutputDebugString("Config: Trace depth set to 0x%x", TraceDepthLimit); } - else if (!strcmp(key, "count")) { + else if (!stricmp(key, "count")) { StepLimit = (unsigned int)strtoul(value, NULL, 10); - DoOutputDebugString("Trace instruction count set to 0x%x", StepLimit); + DoOutputDebugString("Config: Trace instruction count set to 0x%x", StepLimit); + } + else if (!stricmp(key, "step-out")) { + bp0 = (PVOID)(DWORD_PTR)strtoul(value, NULL, 0); + if (bp0) { + g_config.step_out = '1'; + DoOutputDebugString("Config: Step-out breakpoint set to 0x%x.\n", bp0); + } + } + else if (!stricmp(key, "dumpsize")) { + DumpSize = (int)strtoul(value, NULL, 10); + if (DumpSize) + DoOutputDebugString("Config: DumpSize set to 0x%x", DumpSize); + else { + strncpy(DumpSizeString, value, strlen(value)); + DoOutputDebugString("Config: DumpSize set to %s.", DumpSizeString); + } + } + else if (!stricmp(key, "action0")) { + strncpy(Action0, value, strlen(value)); + DoOutputDebugString("Config: Action0 set to %s.", Action0); + } + else if (!stricmp(key, "instruction0")) { + Instruction0 = calloc(1, MAX_PATH); + strncpy(Instruction0, value, strlen(value)); + DoOutputDebugString("Config: Instruction0 set to %s.", value); } + else if (!stricmp(key, "instruction1")) { + Instruction1 = calloc(1, MAX_PATH); + strncpy(Instruction1, value, strlen(value)); + DoOutputDebugString("Config: Instruction1 set to %s.", value); + } + else if (!stricmp(key, "break-on-return")) { + strncpy(g_config.break_on_return, value, ARRAYSIZE(g_config.break_on_return)); + g_config.break_on_return_set = TRUE; + DoOutputDebugString("Config: Break-on-return set to %s.", g_config.break_on_return); + } + else if (!stricmp(key, "trace-all")) { + g_config.trace_all = value[0] == '1'; + if (g_config.trace_all) + DoOutputDebugString("Config: Trace all enabled.\n"); + } + else if (!stricmp(key, "trace-into-api")) { + unsigned int x = 0; + char *p2; + p = value; + while (p && x < EXCLUSION_MAX) { + p2 = strchr(p, ':'); + if (p2) { + *p2 = '\0'; + } + g_config.trace_into_api[x++] = strdup(p); + DoOutputDebugString("Config: Added '%s' to trace-into-API list.\n", p); + if (p2 == NULL) + break; + p = p2 + 1; + } + } + else if (!strcmp(key, "dumptype0")) { + g_config.dumptype0 = (unsigned int)strtoul(value, NULL, 0); + } + else if (!stricmp(key, "type0")) { + if (!strnicmp(value, "w", 1)) { + DoOutputDebugString("Config: Breakpoint 0 type set to write (Type0 = BP_WRITE).\n"); + Type0 = BP_WRITE; + } + else if (!strnicmp(value, "r", 1) || !strnicmp(value, "rw", 2)) { + DoOutputDebugString("Config: Breakpoint 0 type set to read/write (Type0 = BP_READWRITE).\n"); + Type0 = BP_READWRITE; + } + else if (!strnicmp(value, "x", 1)) { + DoOutputDebugString("Config: Breakpoint 0 type set to execute (Type0 = BP_EXEC).\n"); + Type0 = BP_EXEC; + } + } + else if (!strcmp(key, "divert-debugger-log")) { + g_config.divert_debugger_log = value[0] == '1'; + if (g_config.divert_debugger_log) + DoOutputDebugString("Debugger log diverted (to analysis log).\n"); + } +#endif else if (!strcmp(key, "procdump")) { g_config.procdump = value[0] == '1'; if (g_config.procdump) - DoOutputDebugString("Process memory dumps enabled.\n"); + DoOutputDebugString("Process dumps enabled.\n"); + else + DoOutputDebugString("Process dumps disabled.\n"); + } + else if (!strcmp(key, "procmemdump")) { + // for backwards compatibility with spender + if (!strcmp(value, "yes")) + g_config.procmemdump = 1; else - DoOutputDebugString("Process memory dumps disabled.\n"); + g_config.procmemdump = value[0] == '1'; + if (g_config.procmemdump) + DoOutputDebugString("Full process memory dumps enabled.\n"); + else + DoOutputDebugString("Full process memory dumps disabled.\n"); } else if (!strcmp(key, "import_reconstruction")) { g_config.import_reconstruction = value[0] == '1'; @@ -274,6 +474,13 @@ int read_config(void) else DoOutputDebugString("Import reconstruction of process dumps disabled.\n"); } + else if (!strcmp(key, "terminate-processes")) { + g_config.terminate_processes = value[0] == '1'; + if (g_config.terminate_processes) + DoOutputDebugString("Terminate processes on terminate_event enabled.\n"); + else + DoOutputDebugString("Terminate processes on terminate_event disabled.\n"); + } else DoOutputDebugString("CAPE debug - unrecognised key %s.\n", key); } } diff --git a/config.h b/config.h index d60503f..d2196e0 100644 --- a/config.h +++ b/config.h @@ -32,7 +32,7 @@ struct _g_config { // results directory, has to be hidden wchar_t w_results[MAX_PATH]; - + // analyzer directory, has to be hidden char analyzer[MAX_PATH]; @@ -44,7 +44,7 @@ struct _g_config { // file of interest wchar_t *file_of_interest; - + // URL of interest wchar_t *url_of_interest; @@ -105,12 +105,35 @@ struct _g_config { char *excluded_apinames[EXCLUSION_MAX]; wchar_t *excluded_dllnames[EXCLUSION_MAX]; char *base_on_apiname[EXCLUSION_MAX]; - + char *dump_on_apinames[EXCLUSION_MAX]; + int dump_on_api_type; + // should we dump each process on exit/analysis timeout? int procdump; - + int procmemdump; + // should we attempt import reconstruction on each process dump? (slow) int import_reconstruction; + + // should we terminate processes after dumping on terminate_event? + int terminate_processes; + + // To specify dump type code +#ifdef CAPE_TRACE + char *break_on_apiname; + char *break_on_modname; + char break_on_return[MAX_PATH]; + BOOLEAN break_on_return_set; + BOOLEAN break_on_apiname_set; + + int dumptype0; + int trace_all; + int step_out; + int file_offsets; + int divert_debugger_log; +#endif + + char *trace_into_api[EXCLUSION_MAX]; }; extern struct _g_config g_config; diff --git a/cuckoomon.c b/cuckoomon.c index 80cdcdd..8d3e3d9 100644 --- a/cuckoomon.c +++ b/cuckoomon.c @@ -17,7 +17,6 @@ along with this program. If not, see . */ #include - #include "ntapi.h" #include "misc.h" #include "hooking.h" @@ -30,14 +29,24 @@ along with this program. If not, see . #include "config.h" #include "unhook.h" #include "bson.h" +#include "Shlwapi.h" +struct _g_config g_config; +char *our_process_path; +char *our_dll_path; +wchar_t *our_process_path_w; +wchar_t *our_dll_path_w; +wchar_t *our_commandline; +BOOL is_64bit_os; volatile int dummy_val; extern void init_CAPE(); extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); extern LONG WINAPI CAPEExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo); -extern BOOL SetInitialBreakpoints(PVOID ImageBase); extern ULONG_PTR base_of_dll_of_interest; +#ifdef CAPE_TRACE +extern BOOL SetInitialBreakpoints(PVOID ImageBase); +#endif void disable_tail_call_optimization(void) { @@ -83,15 +92,13 @@ static hook_t g_hooks[] = { HOOK_NOTAIL_ALT(ntdll, LdrLoadDll, 4), HOOK_NOTAIL(ntdll, LdrUnloadDll, 1), + HOOK_SPECIAL(ntdll, NtCreateUserProcess), HOOK_SPECIAL(kernel32, CreateProcessInternalW), - //HOOK_SPECIAL(ntdll, NtCreateThread), - //HOOK_SPECIAL(ntdll, NtCreateThreadEx), - //HOOK_SPECIAL(ntdll, NtTerminateThread), - //HOOK_SPECIAL(kernel32, lstrcpynA), - //HOOK_SPECIAL(kernel32, lstrcmpiA), - // has special handling + //HOOK(kernel32, lstrcpynA), + //HOOK(kernel32, lstrcmpiA), + // special handling HOOK_SPECIAL(jscript, COleScript_ParseScriptText), HOOK_NOTAIL(jscript, JsEval, 5), HOOK_SPECIAL(jscript9, JsParseScript), @@ -103,7 +110,7 @@ static hook_t g_hooks[] = { HOOK_SPECIAL(ole32, CoCreateInstanceEx), HOOK_SPECIAL(ole32, CoGetClassObject), - HOOK_NOTAIL(ntdll, RtlDispatchException, 2), + HOOK_SPECIAL(ntdll, RtlDispatchException), HOOK_NOTAIL(ntdll, NtRaiseException, 3), // lowest variant of MoveFile() @@ -111,9 +118,7 @@ static hook_t g_hooks[] = { HOOK_NOTAIL_ALT(kernelbase, MoveFileWithProgressTransactedW, 6), HOOK_NOTAIL_ALT(kernel32, MoveFileWithProgressTransactedW, 6), - // // File Hooks - // HOOK(ntdll, NtQueryAttributesFile), HOOK(ntdll, NtQueryFullAttributesFile), HOOK(ntdll, NtCreateFile), @@ -238,10 +243,7 @@ static hook_t g_hooks[] = { HOOK(kernel32, RegCloseKey), HOOK(kernel32, RegNotifyChangeKeyValue), - // // Native Registry Hooks - // - HOOK(ntdll, NtCreateKey), HOOK(ntdll, NtOpenKey), HOOK(ntdll, NtOpenKeyEx), @@ -261,10 +263,7 @@ static hook_t g_hooks[] = { HOOK(ntdll, NtSaveKey), HOOK(ntdll, NtSaveKeyEx), - // // Window Hooks - // - HOOK_NOTAIL(user32, CreateWindowExA, 12), HOOK_NOTAIL(user32, CreateWindowExW, 12), @@ -286,13 +285,11 @@ static hook_t g_hooks[] = { HOOK(user32, SetWindowLongW), HOOK(user32, SetWindowLongPtrA), HOOK(user32, SetWindowLongPtrW), - - // - // Sync Hooks - // + // Sync Hooks HOOK(ntdll, NtCreateMutant), HOOK(ntdll, NtOpenMutant), + HOOK(ntdll, NtReleaseMutant), HOOK(ntdll, NtCreateEvent), HOOK(ntdll, NtOpenEvent), HOOK(ntdll, NtCreateNamedPipeFile), @@ -301,17 +298,15 @@ static hook_t g_hooks[] = { HOOK(ntdll, NtFindAtom), HOOK(ntdll, NtDeleteAtom), HOOK(ntdll, NtQueryInformationAtom), - - // - // Process Hooks - // + // Process Hooks HOOK(kernel32, CreateToolhelp32Snapshot), HOOK(kernel32, Process32FirstW), HOOK(kernel32, Process32NextW), + HOOK(kernel32, Module32FirstW), + HOOK(kernel32, Module32NextW), HOOK(ntdll, NtCreateProcess), HOOK(ntdll, NtCreateProcessEx), - HOOK(ntdll, NtCreateUserProcess), HOOK(ntdll, RtlCreateUserProcess), HOOK(ntdll, NtOpenProcess), HOOK(ntdll, NtTerminateProcess), @@ -341,11 +336,9 @@ static hook_t g_hooks[] = { HOOK(kernel32, VirtualProtectEx), HOOK(ntdll, NtFreeVirtualMemory), //HOOK(kernel32, VirtualFreeEx), - HOOK(msvcrt, system), - // + // Thread Hooks - // HOOK(ntdll, NtCreateThread), HOOK(ntdll, NtCreateThreadEx), HOOK(ntdll, NtTerminateThread), @@ -361,19 +354,19 @@ static hook_t g_hooks[] = { HOOK(ntdll, RtlCreateUserThread), HOOK(ntdll, NtSetInformationThread), HOOK(ntdll, NtQueryInformationThread), + HOOK(ntdll, NtYieldExecution), - // // Misc Hooks - // + + // for debugging only + //HOOK(kernel32, GetLastError), #ifndef _WIN64 HOOK(ntdll, memcpy), #endif + HOOK(kernel32, HeapCreate), HOOK(msvcrt, memcpy), HOOK(msvcrt, srand), - - // for debugging only - //HOOK(kernel32, GetLastError), - + HOOK(user32, ChangeWindowMessageFilter), HOOK(user32, SetWindowsHookExA), HOOK(user32, SetWindowsHookExW), HOOK(user32, UnhookWindowsHookEx), @@ -424,22 +417,38 @@ static hook_t g_hooks[] = { HOOK(rasapi32, RasConnectionNotificationW), HOOK(kernel32, SystemTimeToTzSpecificLocalTime), HOOK(ole32, CLSIDFromProgID), + //HOOK(ole32, OleConvertOLESTREAMToIStorage), HOOK(kernel32, GlobalMemoryStatus), HOOK(kernel32, GlobalMemoryStatusEx), HOOK(user32, SystemParametersInfoA), HOOK(user32, SystemParametersInfoW), HOOK(pstorec, PStoreCreateInstance), HOOK(advapi32, SaferIdentifyLevel), - HOOK(kernel32, FindResourceA), - HOOK(kernel32, FindResourceW), + HOOK(user32, GetKeyboardLayout), + + // PE resource related functions + HOOK(kernel32, FindResourceExA), + HOOK(kernel32, FindResourceExW), HOOK(kernel32, LoadResource), HOOK(kernel32, LockResource), HOOK(kernel32, SizeofResource), - // - // Network Hooks - // + // functions with callbacks (abused for control-flow transfer) + HOOK(kernel32, EnumResourceTypesExA), + HOOK(kernel32, EnumResourceTypesExW), + HOOK(kernel32, EnumCalendarInfoA), + HOOK(kernel32, EnumCalendarInfoW), + HOOK(kernel32, EnumTimeFormatsA), + HOOK(kernel32, EnumTimeFormatsW), + + // transaction functions (for process doppel-ganging) + HOOK(ntdll, NtCreateTransaction), + HOOK(ntdll, NtOpenTransaction), + HOOK(ntdll, NtRollbackTransaction), + HOOK(ntdll, NtCommitTransaction), + HOOK(ntdll, RtlSetCurrentTransaction), + // Network Hooks HOOK(netapi32, NetUserGetInfo), HOOK(netapi32, NetGetJoinInformation), HOOK(netapi32, NetUserGetLocalGroups), @@ -499,10 +508,7 @@ static hook_t g_hooks[] = { HOOK(iphlpapi, GetAdaptersInfo), HOOK(urlmon, CoInternetSetFeatureEnabled), - // // Service Hooks - // - HOOK(advapi32, OpenSCManagerA), HOOK(advapi32, OpenSCManagerW), HOOK(advapi32, CreateServiceA), @@ -514,9 +520,7 @@ static hook_t g_hooks[] = { HOOK(advapi32, ControlService), HOOK(advapi32, DeleteService), - // // Sleep Hooks - // HOOK(ntdll, NtQueryPerformanceCounter), HOOK(ntdll, NtDelayExecution), HOOK(ntdll, NtWaitForSingleObject), @@ -533,10 +537,7 @@ static hook_t g_hooks[] = { HOOK(user32, MsgWaitForMultipleObjectsEx), HOOK(kernel32, CreateTimerQueueTimer), - // // Socket Hooks - // - HOOK(ws2_32, WSAStartup), HOOK(ws2_32, gethostname), HOOK(ws2_32, gethostbyname), @@ -597,10 +598,13 @@ static hook_t g_hooks[] = { HOOK(advapi32, CryptCreateHash), HOOK(advapi32, CryptEnumProvidersA), HOOK(advapi32, CryptEnumProvidersW), + HOOK(advapi32, QueryUsersOnEncryptedFile), + HOOK(advapi32, CryptGenRandom), + HOOK(advapi32, CryptImportKey), HOOK(wintrust, HTTPSCertificateTrust), HOOK(wintrust, HTTPSFinalProv), - + HOOK(crypt32, CryptDecodeObjectEx), HOOK(crypt32, CryptImportPublicKeyInfo), @@ -623,6 +627,11 @@ static hook_t g_hooks[] = { HOOK(cryptsp, CryptCreateHash), HOOK(cryptsp, CryptEnumProvidersA), HOOK(cryptsp, CryptEnumProvidersW), + HOOK(cryptsp, CryptHashSessionKey), + HOOK(cryptsp, CryptGenRandom), + HOOK(cryptsp, CryptImportKey), + + HOOK(vbe7, rtcEnvironBstr), }; void set_hooks_dll(const wchar_t *library) @@ -658,7 +667,7 @@ VOID CALLBACK New_DllLoadNotification( _In_ const PLDR_DLL_NOTIFICATION_DATA NotificationData, _In_opt_ PVOID Context) { - PWCHAR dllname; + PWCHAR dllname, rundll_path; COPY_UNICODE_STRING(library, NotificationData->Loaded.FullDllName); if (g_config.debug) { @@ -666,13 +675,34 @@ VOID CALLBACK New_DllLoadNotification( /* Just for debug purposes, gives a stripped fake function name */ LOQ_void("system", "sup", "NotificationReason", NotificationReason == 1 ? "load" : "unload", "DllName", library.Buffer, "DllBase", NotificationReason == 1 ? NotificationData->Loaded.DllBase : NotificationData->Unloaded.DllBase); } - - if (NotificationReason == 1) { + + // for rundll32 only + rundll_path = wcschr(our_commandline, ' '); + if (rundll_path) + if (*rundll_path == L' ') rundll_path++; + + if (NotificationReason == 1) { if (g_config.file_of_interest && !wcsicmp(library.Buffer, g_config.file_of_interest)) { if (!base_of_dll_of_interest) set_dll_of_interest((ULONG_PTR)NotificationData->Loaded.DllBase); DoOutputDebugString("Target DLL loaded at 0x%p: %ws (0x%x bytes).\n", NotificationData->Loaded.DllBase, library.Buffer, NotificationData->Loaded.SizeOfImage); +#ifdef CAPE_TRACE + SetInitialBreakpoints((PVOID)base_of_dll_of_interest); +#endif + } + else if (((!wcsnicmp(our_commandline, L"c:\\windows\\system32\\rundll32.exe", 32) || + !wcsnicmp(our_commandline, L"c:\\windows\\syswow64\\rundll32.exe", 32) || + !wcsnicmp(our_commandline, L"c:\\windows\\sysnative\\rundll32.exe", 33))) && + !wcsnicmp(rundll_path, library.Buffer, wcslen(library.Buffer))) { + set_dll_of_interest((ULONG_PTR)NotificationData->Loaded.DllBase); + if (g_config.file_of_interest == NULL) { + g_config.file_of_interest = calloc(1, (wcslen(library.Buffer) + 1) * sizeof(wchar_t)); + wcsncpy(g_config.file_of_interest, library.Buffer, wcslen(library.Buffer)); + } + DoOutputDebugString("rundll32 target DLL loaded at 0x%p: %ws (0x%x bytes).\n", NotificationData->Loaded.DllBase, library.Buffer, NotificationData->Loaded.SizeOfImage); +#ifdef CAPE_TRACE SetInitialBreakpoints((PVOID)base_of_dll_of_interest); +#endif } else { // unoptimized, but easy @@ -712,8 +742,7 @@ void set_hooks() // the hooks contain executable code as well, so they have to be RWX DWORD old_protect; - VirtualProtect(g_hooks, sizeof(g_hooks), PAGE_EXECUTE_READWRITE, - &old_protect); + VirtualProtect(g_hooks, sizeof(g_hooks), PAGE_EXECUTE_READWRITE, &old_protect); memset(&threadInfo, 0, sizeof(threadInfo)); threadInfo.dwSize = sizeof(threadInfo); @@ -836,7 +865,7 @@ LONG WINAPI cuckoomon_exception_handler(__in struct _EXCEPTION_POINTERS *Excepti operate_on_backtrace((ULONG_PTR)stack, ebp_or_rip, msg, &parse_stack_trace); #ifdef _FULL_STACK_TRACE - if (is_valid_address_range((ULONG_PTR)stack, 100 * sizeof(ULONG_PTR))) + if (is_valid_address_range((ULONG_PTR)stack, 100 * sizeof(ULONG_PTR))) { DWORD i; // overflows ahoy @@ -880,23 +909,49 @@ static void notify_successful_load(void) pipe("LOADED:%d", GetCurrentProcessId()); } -struct _g_config g_config; -wchar_t *our_process_path; -BOOL is_64bit_os; - void get_our_process_path(void) { wchar_t *tmp = calloc(1, 32768 * sizeof(wchar_t)); wchar_t *tmp2 = calloc(1, 32768 * sizeof(wchar_t)); + our_process_path = (char*)calloc(sizeof(char), MAX_PATH); GetModuleFileNameW(NULL, tmp, 32768); ensure_absolute_unicode_path(tmp2, tmp); - our_process_path = tmp2; + our_process_path_w = tmp2; + + WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, (LPCWSTR)our_process_path_w, (int)wcslen(our_process_path_w)+1, our_process_path, MAX_PATH, NULL, NULL); + + free(tmp); +} + +void get_our_dll_path(void) +{ + wchar_t *tmp = calloc(1, 32768 * sizeof(wchar_t)); + wchar_t *tmp2 = calloc(1, 32768 * sizeof(wchar_t)); + our_dll_path = (char*)calloc(sizeof(char), MAX_PATH); + + GetModuleFileNameW((HMODULE)g_our_dll_base, tmp, 32768); + + ensure_absolute_unicode_path(tmp2, tmp); + + our_dll_path_w = tmp2; + + WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, (LPCWSTR)our_dll_path_w, (int)wcslen(our_dll_path_w)+1, our_dll_path, MAX_PATH, NULL, NULL); free(tmp); } +void get_our_commandline(void) +{ + wchar_t *tmp = calloc(1, 32768 * sizeof(wchar_t)); + + PEB *peb = get_peb(); + + ensure_absolute_unicode_path(tmp, peb->ProcessParameters->CommandLine.Buffer); + + our_commandline = tmp; +} void set_os_bitness(void) { @@ -937,9 +992,16 @@ void init_private_heap(void) #endif } -BOOLEAN g_dll_main_complete; +BOOL inside_hook(LPVOID Address) +{ + for (unsigned int i = 0; i < ARRAYSIZE(g_hooks); i++) { + if ((ULONG_PTR)Address >= (ULONG_PTR)g_hooks[i].hookdata && (ULONG_PTR)Address < (ULONG_PTR)(g_hooks[i].hookdata + sizeof(hook_data_t))) + return TRUE; + } -DWORD g_tls_hook_index; + return FALSE; +} +BOOLEAN g_dll_main_complete; extern void ignored_threads_init(void); @@ -952,7 +1014,7 @@ OSVERSIONINFOA g_osverinfo; BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved) { - char config_fname[MAX_PATH]; + char config_fname[MAX_PATH], analyzer_path[MAX_PATH]; lasterror_t lasterror; get_lasterrors(&lasterror); @@ -981,7 +1043,7 @@ BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved) g_our_dll_base = (ULONG_PTR)hModule; g_our_dll_size = get_image_size(g_our_dll_base); - + g_osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA); GetVersionEx(&g_osverinfo); @@ -998,11 +1060,11 @@ BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved) file_init(); //ignored_threads_init(); + get_our_dll_path(); + get_our_process_path(); - g_tls_hook_index = TlsAlloc(); - if (g_tls_hook_index == TLS_OUT_OF_INDEXES) - goto abort; + get_our_commandline(); // adds our own DLL range as well, since the hiding is done later add_all_dlls_to_dll_ranges(); @@ -1011,13 +1073,15 @@ BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved) if (!read_config()) #if CUCKOODBG ; + else + DoOutputDebugString("Config loaded.\n"); #else // if we're not debugging, then failure to read the cuckoomon config should be a critical error goto abort; #endif // don't inject into our own binaries run out of the analyzer directory unless they're the first process (intended) - if (wcslen(g_config.w_analyzer) && !wcsnicmp(our_process_path, g_config.w_analyzer, wcslen(g_config.w_analyzer)) && !g_config.first_process) + if (wcslen(g_config.w_analyzer) && !wcsnicmp(our_process_path_w, g_config.w_analyzer, wcslen(g_config.w_analyzer)) && !g_config.first_process) goto abort; if (g_config.debug) { @@ -1095,10 +1159,20 @@ BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved) g_dll_main_complete = TRUE; set_lasterrors(&lasterror); return TRUE; - + abort: + // delete config file + strncpy(analyzer_path, our_dll_path, strlen(our_dll_path)); + PathRemoveFileSpec(analyzer_path); // remove filename + PathRemoveFileSpec(analyzer_path); // remove dll folder + sprintf(config_fname, "%s\\%u.ini", analyzer_path, GetCurrentProcessId()); + DeleteFileA(config_fname); + + // backward compatibility + memset(config_fname, 0, sizeof(config_fname)); sprintf(config_fname, "C:\\%u.ini", GetCurrentProcessId()); DeleteFileA(config_fname); + set_lasterrors(&lasterror); return FALSE; } diff --git a/cuckoomon.vcxproj b/cuckoomon.vcxproj index 921c0ac..8422c76 100644 --- a/cuckoomon.vcxproj +++ b/cuckoomon.vcxproj @@ -142,7 +142,7 @@ - WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGSNDEBUG;_WINDOWS;_USRDLL;MONGO_HAVE_STDINT;MONGO_STATIC_BUILD;CUCKOOMON_EXPORTS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions);_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS + WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGSNDEBUG;_WINDOWS;_USRDLL;MONGO_HAVE_STDINT;MONGO_STATIC_BUILD;CUCKOOMON_EXPORTS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;CAPE_TRACE;%(PreprocessorDefinitions);_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS MultiThreaded Level3 ProgramDatabase diff --git a/hook_crypto.c b/hook_crypto.c index 59ee66b..a306b2c 100644 --- a/hook_crypto.c +++ b/hook_crypto.c @@ -351,3 +351,45 @@ HOOKDEF(BOOL, WINAPI, CryptEnumProvidersW, LOQ_bool("crypto", "iu", "Index", dwIndex, "ProviderName", pszProvName); return ret; } + +HOOKDEF(BOOL, WINAPI, CryptHashSessionKey, + _In_ HCRYPTHASH hHash, + _In_ HCRYPTKEY hKey, + _In_ DWORD dwFlags +) { + BOOL ret = Old_CryptHashSessionKey(hHash, hKey, dwFlags); + LOQ_bool("crypto", "pph", "CryptHash", hHash, "CryptKey", hKey, "Flags", dwFlags); + return ret; +} + +HOOKDEF(DWORD, WINAPI, QueryUsersOnEncryptedFile, + LPCWSTR lpFileName, + PVOID *pUsers +) { + DWORD ret = Old_QueryUsersOnEncryptedFile(lpFileName, pUsers); + LOQ_nonzero("crypto", "up", "FileName", lpFileName, "pUsers", pUsers); + return ret; +} + +HOOKDEF(BOOL, WINAPI, CryptGenRandom, + HCRYPTPROV hProv, + DWORD dwLen, + BYTE *pbBuffer +) { + BOOL ret = Old_CryptGenRandom(hProv, dwLen, pbBuffer); + LOQ_bool("crypto", "b", "Buffer", dwLen, pbBuffer); + return ret; +} + +HOOKDEF(BOOL, WINAPI, CryptImportKey, + HCRYPTPROV hProv, + const BYTE *pbData, + DWORD dwDataLen, + HCRYPTKEY hPubKey, + DWORD dwFlags, + HCRYPTKEY *phKey +) { + BOOL ret = Old_CryptImportKey(hProv, pbData, dwDataLen, hPubKey, dwFlags, phKey); + LOQ_bool("crypto", "bhp", "KeyBlob", dwDataLen, pbData, "Flags", dwFlags, "CryptKey", *phKey); + return ret; +} diff --git a/hook_file.c b/hook_file.c index 94e7749..5277f52 100644 --- a/hook_file.c +++ b/hook_file.c @@ -34,6 +34,9 @@ along with this program. If not, see . #define UNILEN(x) (sizeof(x) / sizeof(wchar_t) - 1) extern BOOL FilesDumped; +#ifdef CAPE_TRACE +extern HANDLE DebuggerLog; +#endif typedef struct _file_record_t { unsigned int attributes; @@ -213,7 +216,7 @@ static void __handle_duplicate(lookup_t *d, HANDLE old_handle, HANDLE new_handle { unsigned int size; void *rdata; - + lasterror_t lasterror; get_lasterrors(&lasterror); @@ -281,7 +284,11 @@ void file_handle_terminate() } } - set_lasterrors(&lasterror); + CloseHandle(DebuggerLog); + + DebuggerLog = NULL; + + set_lasterrors(&lasterror); } static BOOLEAN is_protected_objattr(POBJECT_ATTRIBUTES obj) @@ -325,7 +332,7 @@ HOOKDEF(NTSTATUS, WINAPI, NtCreateFile, return STATUS_ACCESS_DENIED; file_existed = file_exists(ObjectAttributes); - + ret = Old_NtCreateFile(FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock, AllocationSize, FileAttributes, ShareAccess | FILE_SHARE_READ, CreateDisposition, CreateOptions, EaBuffer, EaLength); @@ -349,7 +356,7 @@ HOOKDEF(NTSTATUS, WINAPI, NtOpenFile, __in ULONG OpenOptions ) { NTSTATUS ret; - + check_for_logging_resumption(ObjectAttributes); if (is_protected_objattr(ObjectAttributes)) @@ -635,10 +642,10 @@ HOOKDEF(NTSTATUS, WINAPI, NtQueryVolumeInformationFile, ) { NTSTATUS ret = Old_NtQueryVolumeInformationFile ( - FileHandle, + FileHandle, IoStatusBlock, - FsInformation, - Length, + FsInformation, + Length, FsInformationClass ); LOQ_ntstatus("filesystem", "pib", "FileHandle", FileHandle, "FsInformationClass", FsInformationClass, @@ -691,13 +698,13 @@ HOOKDEF(NTSTATUS, WINAPI, NtSetInformationFile, wcsncpy(fname + ((FILE_RENAME_INFORMATION*)FileInformation)->FileNameLength/sizeof(WCHAR), L"\0", 1); ensure_absolute_unicode_path(renamepath, fname); } - + ret = Old_NtSetInformationFile(FileHandle, IoStatusBlock, FileInformation, Length, FileInformationClass); - + if (FileInformation != NULL && FileInformationClass == FileRenameInformation) { if(NT_SUCCESS(ret)) - pipe("FILE_MOVE:%Z::%Z", absolutepath, renamepath); + pipe("FILE_MOVE:%Z::%Z", absolutepath, renamepath); LOQ_ntstatus("filesystem", "puiu", "FileHandle", FileHandle, "HandleName", absolutepath, "FileInformationClass", FileInformationClass, "FileName", renamepath); } @@ -925,7 +932,7 @@ HOOKDEF (HANDLE, WINAPI, CreateFileTransactedA, __in_opt PUSHORT pusMiniVersion, __reserved PVOID pExtendedParameter ) { - HANDLE ret = Old_CreateFileTransactedA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, + HANDLE ret = Old_CreateFileTransactedA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile, hTransaction, pusMiniVersion, pExtendedParameter); LOQ_handle("filesystem", "hfhh", "FileHandle", ret, "FileName", lpFileName, "TransactionHandle", hTransaction, "FlagsAndAttributes", dwFlagsAndAttributes); @@ -945,7 +952,7 @@ HOOKDEF (HANDLE, WINAPI, CreateFileTransactedW, __in_opt PUSHORT pusMiniVersion, __reserved PVOID pExtendedParameter ) { - HANDLE ret = Old_CreateFileTransactedW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, + HANDLE ret = Old_CreateFileTransactedW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile, hTransaction, pusMiniVersion, pExtendedParameter); LOQ_handle("filesystem", "hFhh", "FileHandle", ret, "FileName", lpFileName, "TransactionHandle", hTransaction, "FlagsAndAttributes", dwFlagsAndAttributes); @@ -1177,7 +1184,7 @@ HOOKDEF(BOOL, WINAPI, DeleteFileA, BOOL ret; ensure_absolute_ascii_path(path, lpFileName); - + pipe("FILE_DEL:%z", path); ret = Old_DeleteFileA(lpFileName); @@ -1217,7 +1224,7 @@ HOOKDEF(BOOL, WINAPI, GetDiskFreeSpaceExA, ) { BOOL ret = Old_GetDiskFreeSpaceExA(lpDirectoryName, lpFreeBytesAvailable, lpTotalNumberOfBytes, lpTotalNumberOfFreeBytes); LOQ_bool("filesystem", "s", "DirectoryName", lpDirectoryName); - + /* Fake harddrive size to 256GB */ if (!g_config.no_stealth && ret && lpTotalNumberOfBytes) { lpTotalNumberOfBytes->QuadPart = 256060514304L; @@ -1384,7 +1391,7 @@ HOOKDEF(HRESULT, WINAPI, SHGetKnownFolderPath, IID id1; char idbuf[40]; HRESULT ret = Old_SHGetKnownFolderPath(rfid, dwFlags, hToken, ppszPath); - + get_lasterrors(&lasterrors); memcpy(&id1, rfid, sizeof(id1)); sprintf(idbuf, "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", id1.Data1, id1.Data2, id1.Data3, diff --git a/hook_misc.c b/hook_misc.c index e9980d3..0010017 100644 --- a/hook_misc.c +++ b/hook_misc.c @@ -62,7 +62,7 @@ HOOKDEF(HHOOK, WINAPI, SetWindowsHookExW, ) { HHOOK ret; - + if (hMod && lpfn && dwThreadId) { DWORD pid = get_pid_by_tid(dwThreadId); if (pid && pid != GetCurrentProcessId()) @@ -172,14 +172,14 @@ HOOKDEF(NTSTATUS, WINAPI, LdrGetProcedureAddress, if (FunctionName != NULL && FunctionName->Length == 13 && FunctionName->Buffer != NULL && (!strncmp(FunctionName->Buffer, "EncodePointer", 13) || !strncmp(FunctionName->Buffer, "DecodePointer", 13))) return ret; - + LOQ_ntstatus("system", "opSiP", "ModuleName", get_basename_of_module(ModuleHandle), "ModuleHandle", ModuleHandle, "FunctionName", FunctionName != NULL ? FunctionName->Length : 0, FunctionName != NULL ? FunctionName->Buffer : NULL, "Ordinal", Ordinal, "FunctionAddress", FunctionAddress); if (hook_info()->main_caller_retaddr && g_config.first_process && FunctionName != NULL && (ret == 0xc000007a || ret == 0xc0000139) && FunctionName->Length == 7 && - !strncmp(FunctionName->Buffer, "DllMain", 7) && wcsicmp(our_process_path, g_config.file_of_interest)) { + !strncmp(FunctionName->Buffer, "DllMain", 7) && wcsicmp(our_process_path_w, g_config.file_of_interest)) { log_flush(); ExitThread(0); } @@ -199,7 +199,7 @@ HOOKDEF(BOOL, WINAPI, DeviceIoControl, ) { BOOL ret; ENSURE_DWORD(lpBytesReturned); - + ret = Old_DeviceIoControl(hDevice, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, lpOverlapped); @@ -593,6 +593,7 @@ HOOKDEF(SHORT, WINAPI, GetAsyncKeyState, return ret; } +#ifndef CAPE_COMPRESSION HOOKDEF(NTSTATUS, WINAPI, RtlDecompressBuffer, __in USHORT CompressionFormat, __out PUCHAR UncompressedBuffer, @@ -615,6 +616,7 @@ HOOKDEF(NTSTATUS, WINAPI, RtlDecompressBuffer, return ret; } +#endif HOOKDEF(NTSTATUS, WINAPI, RtlCompressBuffer, _In_ USHORT CompressionFormatAndEngine, @@ -840,7 +842,7 @@ HOOKDEF(HDEVINFO, WINAPI, SetupDiGetClassDevsW, LOQ_handle("misc", "ss", "ClassGuid", idbuf, "Known", known); else LOQ_handle("misc", "s", "ClassGuid", idbuf); - + set_lasterrors(&lasterror); } return ret; @@ -1095,15 +1097,15 @@ HOOKDEF(void, WINAPIV, memcpy, void *dest, const void *src, size_t count -) +) { int ret = 0; // needed for LOQ_void Old_memcpy(dest, src, count); - + if (count > 0xa00) LOQ_void("misc", "bppi", "DestinationBuffer", count, dest, "source", src, "destination", dest, "count", count); - + return; } @@ -1147,33 +1149,59 @@ HOOKDEF(int, WINAPI, lstrcmpiA, return ret; } -HOOKDEF(HRSRC, WINAPI, FindResourceA, - HMODULE hModule, - LPCSTR lpName, - LPCSTR lpType +HOOKDEF(HRSRC, WINAPI, FindResourceExA, + HMODULE hModule, + LPCSTR lpType, + LPCSTR lpName, + WORD wLanguage ) { - HRSRC ret = Old_FindResourceA(hModule, lpName, lpType); + HRSRC ret = Old_FindResourceExA(hModule, lpType, lpName, wLanguage); + + char type_id[8]; + if (IS_INTRESOURCE(lpType)) { + snprintf(type_id, sizeof type_id, "#%hu", (WORD)lpType); + lpType = type_id; + } - LOQ_handle("misc", "ps", "Module", hModule, "Name", lpName); + char name_id[8]; + if (IS_INTRESOURCE(lpName)) { + snprintf(name_id, sizeof name_id, "#%hu", (WORD)lpName); + lpName = name_id; + } + + LOQ_handle("misc", "pssh", "Module", hModule, "Type", lpType, "Name", lpName, "Language", wLanguage); return ret; } - HOOKDEF(HRSRC, WINAPI, FindResourceW, - HMODULE hModule, - LPCWSTR lpName, - LPCWSTR lpType +HOOKDEF(HRSRC, WINAPI, FindResourceExW, + HMODULE hModule, + LPCWSTR lpType, + LPCWSTR lpName, + WORD wLanguage ) { - HRSRC ret = Old_FindResourceW(hModule, lpName, lpType); + HRSRC ret = Old_FindResourceExW(hModule, lpType, lpName, wLanguage); - LOQ_handle("misc", "pu", "Module", hModule, "Name", lpName); + wchar_t type_id[8]; + if (IS_INTRESOURCE(lpType)) { + swprintf(type_id, sizeof type_id, L"#%hu", (WORD)lpType); + lpType = type_id; + } + + wchar_t name_id[8]; + if (IS_INTRESOURCE(lpName)) { + swprintf(name_id, sizeof name_id, L"#%hu", (WORD)lpName); + lpName = name_id; + } + + LOQ_handle("misc", "puuh", "Module", hModule, "Type", lpType, "Name", lpName, "Language", wLanguage); return ret; } - HOOKDEF(HGLOBAL, WINAPI, LoadResource, +HOOKDEF(HGLOBAL, WINAPI, LoadResource, _In_opt_ HMODULE hModule, _In_ HRSRC hResInfo ) @@ -1207,3 +1235,294 @@ HOOKDEF(DWORD, WINAPI, SizeofResource, return ret; } + +HOOKDEF(BOOL, WINAPI, EnumResourceTypesExA, + _In_opt_ HMODULE hModule, + _In_ ENUMRESTYPEPROC lpEnumFunc, + _In_ LONG_PTR lParam, + _In_ DWORD dwFlags, + _In_ LANGID LangId +) { + BOOL ret = TRUE; + LOQ_bool("misc", "ppphh", + "ModuleHandle", hModule, + "EnumFunc", lpEnumFunc, + "Parameter", lParam, + "Flags", dwFlags, + "LangId", LangId + ); + return Old_EnumResourceTypesExA(hModule, lpEnumFunc, lParam, dwFlags, LangId);; +} + +HOOKDEF(BOOL, WINAPI, EnumResourceTypesExW, + _In_opt_ HMODULE hModule, + _In_ ENUMRESTYPEPROC lpEnumFunc, + _In_ LONG_PTR lParam, + _In_ DWORD dwFlags, + _In_ LANGID LangId +) { + BOOL ret = TRUE; + LOQ_bool("misc", "ppphh", + "ModuleHandle", hModule, + "EnumFunc", lpEnumFunc, + "Parameter", lParam, + "Flags", dwFlags, + "LangId", LangId + ); + return Old_EnumResourceTypesExW(hModule, lpEnumFunc, lParam, dwFlags, LangId);; +} + +HOOKDEF(BOOL, WINAPI, EnumCalendarInfoA, + CALINFO_ENUMPROCA lpCalInfoEnumProc, + LCID Locale, + CALID Calendar, + CALTYPE CalType +) { + BOOL ret = TRUE; + LOQ_bool("misc", "phhh", + "CalInfoEnumProc", lpCalInfoEnumProc, + "Locale", Locale, + "Calendar", Calendar, + "CalType", CalType + ); + return Old_EnumCalendarInfoA(lpCalInfoEnumProc, Locale, Calendar, CalType); +} + +HOOKDEF(BOOL, WINAPI, EnumCalendarInfoW, + CALINFO_ENUMPROCA lpCalInfoEnumProc, + LCID Locale, + CALID Calendar, + CALTYPE CalType +) { + BOOL ret = TRUE; + LOQ_bool("misc", "phhh", + "CalInfoEnumProc", lpCalInfoEnumProc, + "Locale", Locale, + "Calendar", Calendar, + "CalType", CalType + ); + return Old_EnumCalendarInfoW(lpCalInfoEnumProc, Locale, Calendar, CalType); +} + +HOOKDEF(BOOL, WINAPI, EnumTimeFormatsA, + TIMEFMT_ENUMPROCA lpTimeFmtEnumProc, + LCID Locale, + DWORD dwFlags +) { + BOOL ret = TRUE; + LOQ_bool("misc", "phh", + "TimeFmtEnumProc", lpTimeFmtEnumProc, + "Locale", Locale, + "Flags", dwFlags + ); + return Old_EnumTimeFormatsA(lpTimeFmtEnumProc, Locale, dwFlags); +} + +HOOKDEF(BOOL, WINAPI, EnumTimeFormatsW, + TIMEFMT_ENUMPROCA lpTimeFmtEnumProc, + LCID Locale, + DWORD dwFlags +) { + BOOL ret = TRUE; + LOQ_bool("misc", "phh", + "TimeFmtEnumProc", lpTimeFmtEnumProc, + "Locale", Locale, + "Flags", dwFlags + ); + return Old_EnumTimeFormatsW(lpTimeFmtEnumProc, Locale, dwFlags); +} + +HOOKDEF(NTSTATUS, WINAPI, NtCreateTransaction, + PHANDLE TransactionHandle, + ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes, + LPGUID Uow, + HANDLE TmHandle, + ULONG CreateOptions, + ULONG IsolationLevel, + ULONG IsolationFlags, + PLARGE_INTEGER Timeout, + PUNICODE_STRING Description +) { + NTSTATUS ret = Old_NtCreateTransaction(TransactionHandle, DesiredAccess, ObjectAttributes, Uow, TmHandle, CreateOptions, IsolationLevel, IsolationFlags, Timeout, Description); + LOQ_ntstatus("misc", "PhObphhhio", + "TransactionHandle", TransactionHandle, + "DesiredAccess", DesiredAccess, + "ObjectAttributes", ObjectAttributes, + "UnitOfWork", sizeof (GUID), Uow, + "TmHandle", TmHandle, + "CreateOptions", CreateOptions, + "IsolationLevel", IsolationLevel, + "IsolationFlags", IsolationFlags, + "Timeout", Timeout, + "Description", Description + ); + return ret; +} + +HOOKDEF(NTSTATUS, WINAPI, NtOpenTransaction, + PHANDLE TransactionHandle, + ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes, + LPGUID Uow, + HANDLE TmHandle +) { + NTSTATUS ret = Old_NtOpenTransaction(TransactionHandle, DesiredAccess, ObjectAttributes, Uow, TmHandle); + LOQ_ntstatus("misc", "PhObp", + "TransactionHandle", TransactionHandle, + "DesiredAccess", DesiredAccess, + "ObjectAttributes", ObjectAttributes, + "UnitOfWork", sizeof (GUID), Uow, + "TmHandle", TmHandle + ); + return ret; +} + +HOOKDEF(NTSTATUS, WINAPI, NtRollbackTransaction, + HANDLE TransactionHandle, + BOOLEAN Wait +) { + NTSTATUS ret = Old_NtRollbackTransaction(TransactionHandle, Wait); + LOQ_ntstatus("misc", "pi", "TransactionHandle", TransactionHandle, "Wait", Wait); + return ret; +} + +HOOKDEF(NTSTATUS, WINAPI, NtCommitTransaction, + HANDLE TransactionHandle, + BOOLEAN Wait +) { + NTSTATUS ret = Old_NtCommitTransaction(TransactionHandle, Wait); + LOQ_ntstatus("misc", "pi", "TransactionHandle", TransactionHandle, "Wait", Wait); + return ret; +} + +HOOKDEF(BOOL, WINAPI, RtlSetCurrentTransaction, + _In_ HANDLE TransactionHandle +) { + BOOL ret = Old_RtlSetCurrentTransaction(TransactionHandle); + LOQ_bool("misc", "p", "TransactionHandle", TransactionHandle); + return ret; +} + +HOOKDEF(HRESULT, WINAPI, OleConvertOLESTREAMToIStorage, + IN LPOLESTREAM lpolestream, + OUT LPSTORAGE pstg, + IN const DVTARGETDEVICE *ptd +) { + void *buf = NULL; uintptr_t len = 0; + + HRESULT ret = Old_OleConvertOLESTREAMToIStorage(lpolestream, pstg, ptd); + +#ifndef _WIN64 + if (lpolestream != NULL) { + buf = (PVOID)*((uint8_t *) lpolestream + 8); + len = *((uint8_t *) lpolestream + 12); + } +#endif + + LOQ_bool("misc", "b", "OLE2", len, buf); + return ret; +} + +HOOKDEF(HANDLE, WINAPI, HeapCreate, + _In_ DWORD flOptions, + _In_ SIZE_T dwInitialSize, + _In_ SIZE_T dwMaximumSize +) +{ + HANDLE ret; + ret = Old_HeapCreate(flOptions, dwInitialSize, dwMaximumSize); + LOQ_nonnull("misc", "ihh", "Options", flOptions, "InitialSize", dwInitialSize, "MaximumSize", dwMaximumSize); + return ret; +} + +HOOKDEF(BOOL, WINAPI, FlsAlloc, + _In_ PFLS_CALLBACK_FUNCTION lpCallback +) { + BOOL ret = Old_FlsAlloc(lpCallback); + LOQ_bool("misc", "p", "Callback", lpCallback); + return ret; +} + +HOOKDEF(BOOL, WINAPI, FlsSetValue, + _In_ DWORD dwFlsIndex, + _In_opt_ PVOID lpFlsData +) { + BOOL ret = Old_FlsSetValue(dwFlsIndex, lpFlsData); + LOQ_bool("misc", "ip", "Index", dwFlsIndex, "Data", lpFlsData); + return ret; +} + + +HOOKDEF(PVOID, WINAPI, FlsGetValue, + _In_ DWORD dwFlsIndex +) { + PVOID ret = Old_FlsGetValue(dwFlsIndex); + LOQ_nonnull("misc", "ip", "Index", dwFlsIndex, "ReturnValue", ret); + return ret; +} + +HOOKDEF(BOOL, WINAPI, FlsFree, + _In_ DWORD dwFlsIndex +) { + BOOL ret = Old_FlsFree(dwFlsIndex); + LOQ_bool("misc", "ip", "Index", dwFlsIndex); + return ret; +} + + +HOOKDEF(PVOID, WINAPI, LocalAlloc, + _In_ UINT uFlags, + _In_ SIZE_T uBytes) +{ + PVOID ret = Old_LocalAlloc(uFlags, uBytes); + LOQ_nonnull("misc", "ii", "Flags", uFlags, "Bytes", uBytes); + return ret; +} + +HOOKDEF(VOID, WINAPI, LocalFree, + HLOCAL hMem) +{ + int ret = 0; + Old_LocalFree(hMem); + LOQ_void("misc", "p", "SourceBuffer", hMem); +} + +#define MSGFLT_ADD 1 +#define MSGFLT_REMOVE 2 +HOOKDEF(BOOL, WINAPI, ChangeWindowMessageFilter, + UINT message, + DWORD dwFlag +) +{ + BOOL ret; + if (dwFlag != MSGFLT_REMOVE && dwFlag != MSGFLT_ADD) { + ret = FALSE; + SetLastError(ERROR_INVALID_PARAMETER); + } + else + ret = Old_ChangeWindowMessageFilter(message, dwFlag); + LOQ_bool("misc", "ii", "message", message, "dwFlag", dwFlag); + return ret; +} + +HOOKDEF(LPWSTR, WINAPI, rtcEnvironBstr, + struct envstruct *es +) +{ + LPWSTR ret = Old_rtcEnvironBstr(es); + LOQ_bool("misc", "uu", "EnvVar", es->envstr, "EnvStr", ret); + if (ret && !wcsicmp(es->envstr, L"userdomain")) + // replace first char so it differs from computername + *ret = '#'; + return ret; +} + +HOOKDEF(HKL, WINAPI, GetKeyboardLayout, + DWORD idThread +) +{ + HKL ret = Old_GetKeyboardLayout(idThread); + LOQ_nonnull("misc", "p", "KeyboardLayout", (DWORD)ret & 0xFFFF); + return ret; +} \ No newline at end of file diff --git a/hook_process.c b/hook_process.c index fe2ae87..af725a6 100644 --- a/hook_process.c +++ b/hook_process.c @@ -27,11 +27,32 @@ along with this program. If not, see . #include "hook_sleep.h" #include "unhook.h" #include "config.h" +#include "CAPE\CAPE.h" +#include "CAPE\Debugger.h" extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); +extern void DoOutputErrorString(_In_ LPCTSTR lpOutputString, ...); + +#ifdef CAPE_INJECTION +extern void OpenProcessHandler(HANDLE ProcessHandle, DWORD Pid); +extern void ResumeProcessHandler(HANDLE ProcessHandle, DWORD Pid); +extern void UnmapSectionViewHandler(PVOID BaseAddress); +extern void MapSectionViewHandler(HANDLE ProcessHandle, HANDLE SectionHandle, PVOID BaseAddress, SIZE_T ViewSize); +extern void WriteMemoryHandler(HANDLE ProcessHandle, LPVOID BaseAddress, LPCVOID Buffer, SIZE_T NumberOfBytesWritten); +#endif +#ifdef CAPE_EXTRACTION +extern struct TrackedRegion *TrackedRegionList; +extern void AllocationHandler(PVOID BaseAddress, SIZE_T RegionSize, ULONG AllocationType, ULONG Protect); +extern void ProtectionHandler(PVOID BaseAddress, SIZE_T RegionSize, ULONG Protect, ULONG OldProtect); +extern void FreeHandler(PVOID BaseAddress); +extern void ProcessTrackedRegion(); +#endif + +extern BOOL CAPEExceptionDispatcher(PEXCEPTION_RECORD ExceptionRecord, PCONTEXT Context); extern void file_handle_terminate(); -extern int RoutineProcessDump(); -extern BOOL ProcessDumped, ModuleDumped; +extern int DoProcessDump(PVOID CallerBase); +extern PVOID GetHookCallerBase(hook_info_t *hookinfo); +extern BOOL ProcessDumped; HOOKDEF(HANDLE, WINAPI, CreateToolhelp32Snapshot, __in DWORD dwFlags, @@ -80,6 +101,34 @@ HOOKDEF(BOOL, WINAPI, Process32FirstW, return ret; } +HOOKDEF(BOOL, WINAPI, Module32NextW, + __in HANDLE hSnapshot, + __out LPMODULEENTRY32W lpme + ) { + BOOL ret = Old_Module32NextW(hSnapshot, lpme); + + if (ret) + LOQ_bool("process", "uii", "ModuleName", lpme->szModule, "ModuleID", lpme->th32ModuleID, "ProcessId", lpme->th32ProcessID); + else + LOQ_bool("process", ""); + + return ret; +} + +HOOKDEF(BOOL, WINAPI, Module32FirstW, + __in HANDLE hSnapshot, + __out LPMODULEENTRY32W lpme + ) { + BOOL ret = Old_Module32FirstW(hSnapshot, lpme); + + if (ret) + LOQ_bool("process", "uii", "ModuleName", lpme->szModule, "ModuleID", lpme->th32ModuleID, "ProcessId", lpme->th32ProcessID); + else + LOQ_bool("process", ""); + + return ret; +} + HOOKDEF(NTSTATUS, WINAPI, NtCreateProcess, __out PHANDLE ProcessHandle, __in ACCESS_MASK DesiredAccess, @@ -93,10 +142,10 @@ HOOKDEF(NTSTATUS, WINAPI, NtCreateProcess, NTSTATUS ret = Old_NtCreateProcess(ProcessHandle, DesiredAccess, ObjectAttributes, ParentProcess, InheritObjectTable, SectionHandle, DebugPort, ExceptionPort); - LOQ_ntstatus("process", "PphO", "ProcessHandle", ProcessHandle, "ParentHandle", ParentProcess, "DesiredAccess", DesiredAccess, - "FileName", ObjectAttributes); + DWORD pid = pid_from_process_handle(*ProcessHandle); + LOQ_ntstatus("process", "PphOl", "ProcessHandle", ProcessHandle, "ParentHandle", ParentProcess, "DesiredAccess", DesiredAccess, + "FileName", ObjectAttributes, "ProcessId", pid); if(NT_SUCCESS(ret)) { - DWORD pid = pid_from_process_handle(*ProcessHandle); pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); disable_sleep_skip(); } @@ -117,8 +166,9 @@ HOOKDEF(NTSTATUS, WINAPI, NtCreateProcessEx, NTSTATUS ret = Old_NtCreateProcessEx(ProcessHandle, DesiredAccess, ObjectAttributes, ParentProcess, Flags, SectionHandle, DebugPort, ExceptionPort, InJob); - LOQ_ntstatus("process", "PphOhh", "ProcessHandle", ProcessHandle, "ParentHandle", ParentProcess, "DesiredAccess", DesiredAccess, - "FileName", ObjectAttributes, "Flags", Flags, "SectionHandle", SectionHandle); + DWORD pid = pid_from_process_handle(*ProcessHandle); + LOQ_ntstatus("process", "PphOhhl", "ProcessHandle", ProcessHandle, "ParentHandle", ParentProcess, "DesiredAccess", DesiredAccess, + "FileName", ObjectAttributes, "Flags", Flags, "SectionHandle", SectionHandle, "ProcessId", pid); if(NT_SUCCESS(ret)) { DWORD pid = pid_from_process_handle(*ProcessHandle); pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); @@ -147,22 +197,22 @@ HOOKDEF(NTSTATUS, WINAPI, NtCreateUserProcess, if(ProcessParameters == NULL) ProcessParameters = &_ProcessParameters; - ret = Old_NtCreateUserProcess(ProcessHandle, ThreadHandle, ProcessDesiredAccess, ThreadDesiredAccess, ProcessObjectAttributes, ThreadObjectAttributes, ProcessFlags, ThreadFlags | 1, ProcessParameters, CreateInfo, AttributeList); - LOQ_ntstatus("process", "PPhhOOoo", "ProcessHandle", ProcessHandle, + DWORD pid = pid_from_process_handle(*ProcessHandle); + LOQ_ntstatus("process", "PPhhOOool", "ProcessHandle", ProcessHandle, "ThreadHandle", ThreadHandle, "ProcessDesiredAccess", ProcessDesiredAccess, "ThreadDesiredAccess", ThreadDesiredAccess, "ProcessFileName", ProcessObjectAttributes, "ThreadName", ThreadObjectAttributes, "ImagePathName", &ProcessParameters->ImagePathName, - "CommandLine", &ProcessParameters->CommandLine); + "CommandLine", &ProcessParameters->CommandLine, + "ProcessId", pid); if(NT_SUCCESS(ret)) { - DWORD pid = pid_from_process_handle(*ProcessHandle); DWORD tid = tid_from_thread_handle(*ThreadHandle); pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); if (!(ThreadFlags & 1)) @@ -188,10 +238,10 @@ HOOKDEF(NTSTATUS, WINAPI, RtlCreateUserProcess, ProcessParameters, ProcessSecurityDescriptor, ThreadSecurityDescriptor, ParentProcess, InheritHandles, DebugPort, ExceptionPort, ProcessInformation); - LOQ_ntstatus("process", "ohp", "ImagePath", ImagePath, "ObjectAttributes", ObjectAttributes, - "ParentHandle", ParentProcess); + DWORD pid = pid_from_process_handle(ProcessInformation->ProcessHandle); + LOQ_ntstatus("process", "ohpl", "ImagePath", ImagePath, "ObjectAttributes", ObjectAttributes, + "ParentHandle", ParentProcess, "ProcessId", pid); if(NT_SUCCESS(ret)) { - DWORD pid = pid_from_process_handle(ProcessInformation->ProcessHandle); DWORD tid = tid_from_thread_handle(ProcessInformation->ThreadHandle); pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); disable_sleep_skip(); @@ -331,8 +381,12 @@ HOOKDEF(NTSTATUS, WINAPI, NtOpenProcess, return ret; } - ret = Old_NtOpenProcess(ProcessHandle, DesiredAccess, - ObjectAttributes, ClientId); + ret = Old_NtOpenProcess(ProcessHandle, DesiredAccess, ObjectAttributes, ClientId); + +#ifdef CAPE_INJECTION + if (NT_SUCCESS(ret)) + OpenProcessHandler(*ProcessHandle, pid); +#endif LOQ_ntstatus("process", "Phi", "ProcessHandle", ProcessHandle, "DesiredAccess", DesiredAccess, "ProcessIdentifier", pid); @@ -345,14 +399,15 @@ HOOKDEF(NTSTATUS, WINAPI, NtResumeProcess, ) { NTSTATUS ret; DWORD pid = pid_from_process_handle(ProcessHandle); +#ifdef CAPE_INJECTION + ResumeProcessHandler(ProcessHandle, pid); +#endif pipe("RESUME:%d", pid); - ret = Old_NtResumeProcess(ProcessHandle); - LOQ_ntstatus("process", "p", "ProcessHandle", ProcessHandle); + LOQ_ntstatus("process", "pl", "ProcessHandle", ProcessHandle, "ProcessId", pid); return ret; } - int process_shutting_down; HOOKDEF(NTSTATUS, WINAPI, NtTerminateProcess, @@ -363,34 +418,34 @@ HOOKDEF(NTSTATUS, WINAPI, NtTerminateProcess, NTSTATUS ret = 0; lasterror_t lasterror; - if (ModuleDumped && ExitStatus == 1) - { - DoOutputDebugString("NtTerminateProcess hook: Fixing return value to bypass QakBot anti-sandbox.\n"); - ExitStatus = 0; - } - get_lasterrors(&lasterror); if (ProcessHandle == NULL) { // we mark this here as this termination type will kill all threads but ours, including // the logging thread. By setting this, we'll switch into a direct logging mode // for the subsequent call to NtTerminateProcess against our own process handle +#ifdef CAPE_EXTRACTION + ProcessTrackedRegion(); +#endif if (g_config.procdump && !ProcessDumped) { DoOutputDebugString("NtTerminateProcess hook: Attempting to dump process %d\n", GetCurrentProcessId()); - RoutineProcessDump(); + DoProcessDump(GetHookCallerBase(NULL)); } process_shutting_down = 1; - LOQ_ntstatus("process", "ph", "ProcessHandle", ProcessHandle, "ExitCode", ExitStatus); + LOQ_ntstatus("process", "phl", "ProcessHandle", ProcessHandle, "ExitCode", ExitStatus, "ProcessId", GetCurrentProcessId()); file_handle_terminate(); } else if (GetCurrentProcessId() == our_getprocessid(ProcessHandle)) { +#ifdef CAPE_EXTRACTION + ProcessTrackedRegion(); +#endif if (g_config.procdump && !ProcessDumped) { DoOutputDebugString("NtTerminateProcess hook: Attempting to dump process %d\n", GetCurrentProcessId()); - RoutineProcessDump(); + DoProcessDump(GetHookCallerBase(NULL)); } process_shutting_down = 1; - LOQ_ntstatus("process", "ph", "ProcessHandle", ProcessHandle, "ExitCode", ExitStatus); + LOQ_ntstatus("process", "phl", "ProcessHandle", ProcessHandle, "ExitCode", ExitStatus, "ProcessId", GetCurrentProcessId()); pipe("KILL:%d", GetCurrentProcessId()); log_free(); file_handle_terminate(); @@ -399,17 +454,17 @@ HOOKDEF(NTSTATUS, WINAPI, NtTerminateProcess, DWORD PID = pid_from_process_handle(ProcessHandle); if (is_protected_pid(PID)) { ret = STATUS_ACCESS_DENIED; - LOQ_ntstatus("process", "ph", "ProcessHandle", ProcessHandle, "ExitCode", ExitStatus); + LOQ_ntstatus("process", "phl", "ProcessHandle", ProcessHandle, "ExitCode", ExitStatus, "ProcessId", GetCurrentProcessId()); return ret; } else { - LOQ_ntstatus("process", "ph", "ProcessHandle", ProcessHandle, "ExitCode", ExitStatus); + LOQ_ntstatus("process", "phl", "ProcessHandle", ProcessHandle, "ExitCode", ExitStatus, "ProcessId", GetCurrentProcessId()); } pipe("KILL:%d", PID); } set_lasterrors(&lasterror); - ret = Old_NtTerminateProcess(ProcessHandle, ExitStatus); + ret = Old_NtTerminateProcess(ProcessHandle, ExitStatus); return ret; } @@ -478,6 +533,10 @@ HOOKDEF(NTSTATUS, WINAPI, NtUnmapViewOfSection, sizeof(mbi)) == sizeof(mbi)) { map_size = mbi.RegionSize; } +#ifdef CAPE_INJECTION + UnmapSectionViewHandler(BaseAddress); +#endif + ret = Old_NtUnmapViewOfSection(ProcessHandle, BaseAddress); LOQ_ntstatus("process", "ppp", "ProcessHandle", ProcessHandle, "BaseAddress", BaseAddress, @@ -498,7 +557,7 @@ HOOKDEF(NTSTATUS, WINAPI, NtMapViewOfSection, __in ULONG AllocationType, __in ULONG Win32Protect ) { - NTSTATUS ret = Old_NtMapViewOfSection(SectionHandle, ProcessHandle, + NTSTATUS ret = Old_NtMapViewOfSection(SectionHandle, ProcessHandle, BaseAddress, ZeroBits, CommitSize, SectionOffset, ViewSize, InheritDisposition, AllocationType, Win32Protect); DWORD pid = pid_from_process_handle(ProcessHandle); @@ -508,10 +567,20 @@ HOOKDEF(NTSTATUS, WINAPI, NtMapViewOfSection, "SectionOffset", SectionOffset, "ViewSize", ViewSize, "Win32Protect", Win32Protect, "StackPivoted", is_stack_pivoted() ? "yes" : "no"); if (NT_SUCCESS(ret)) { - if (pid != GetCurrentProcessId()) { +#ifdef CAPE_INJECTION + MapSectionViewHandler(ProcessHandle, SectionHandle, *BaseAddress, *ViewSize); +#endif +#ifdef CAPE_EXTRACTION + ProtectionHandler(*BaseAddress, ViewSize, Win32Protect, 0); +#endif + if (pid != GetCurrentProcessId()) { pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); disable_sleep_skip(); } + //else if (ret == STATUS_IMAGE_NOT_AT_BASE && Win32Protect == PAGE_READONLY) { + //else if (ret == STATUS_IMAGE_NOT_AT_BASE) { + // prevent_module_reloading(BaseAddress); + //} } return ret; } @@ -528,10 +597,13 @@ HOOKDEF(NTSTATUS, WINAPI, NtAllocateVirtualMemory, NTSTATUS ret = Old_NtAllocateVirtualMemory(ProcessHandle, BaseAddress, ZeroBits, RegionSize, AllocationType, Protect); - if (ret != STATUS_CONFLICTING_ADDRESSES) { - LOQ_ntstatus("process", "pPPhs", "ProcessHandle", ProcessHandle, "BaseAddress", BaseAddress, - "RegionSize", RegionSize, "Protection", Protect, "StackPivoted", is_stack_pivoted() ? "yes" : "no"); - } +#ifdef CAPE_EXTRACTION + if (NT_SUCCESS(ret) && !called_by_hook() && GetCurrentProcessId() == our_getprocessid(ProcessHandle)) + AllocationHandler(*BaseAddress, *RegionSize, AllocationType, Protect); +#endif + + LOQ_ntstatus("process", "pPPhs", "ProcessHandle", ProcessHandle, "BaseAddress", BaseAddress, + "RegionSize", RegionSize, "Protection", Protect, "StackPivoted", is_stack_pivoted() ? "yes" : "no"); return ret; } @@ -586,7 +658,7 @@ HOOKDEF(NTSTATUS, WINAPI, NtWriteVirtualMemory, pid = pid_from_process_handle(ProcessHandle); - LOQ_ntstatus("process", "ppBhs", + LOQ_ntstatus("process", "ppBhs", "ProcessHandle", ProcessHandle, "BaseAddress", BaseAddress, "Buffer", NumberOfBytesWritten, Buffer, @@ -595,6 +667,9 @@ HOOKDEF(NTSTATUS, WINAPI, NtWriteVirtualMemory, if (pid != GetCurrentProcessId()) { if (NT_SUCCESS(ret)) { +#ifdef CAPE_INJECTION + WriteMemoryHandler(ProcessHandle, BaseAddress, Buffer, *NumberOfBytesWritten); +#endif pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); disable_sleep_skip(); } @@ -624,6 +699,9 @@ HOOKDEF(BOOL, WINAPI, WriteProcessMemory, if (pid != GetCurrentProcessId()) { if (ret) { +#ifdef CAPE_INJECTION + WriteMemoryHandler(hProcess, lpBaseAddress, lpBuffer, *lpNumberOfBytesWritten); +#endif pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); disable_sleep_skip(); } @@ -694,6 +772,21 @@ HOOKDEF(NTSTATUS, WINAPI, NtProtectVirtualMemory, ) { NTSTATUS ret; MEMORY_BASIC_INFORMATION meminfo; +#ifdef CAPE_EXTRACTION + PTRACKEDREGION TrackedRegion; +#endif + + if (NewAccessProtection == PAGE_EXECUTE_READWRITE && BaseAddress && NumberOfBytesToProtect && *NumberOfBytesToProtect >= 0x2000 && + GetCurrentProcessId() == our_getprocessid(ProcessHandle) && is_in_dll_range((ULONG_PTR)*BaseAddress)) { + unsigned int offset; + char *dllname = convert_address_to_dll_name_and_offset((ULONG_PTR)*BaseAddress, &offset); + if (dllname && !strcmp(dllname, "ntdll.dll")) { + // don't allow writes, this will cause memory access violations + // that we are going to handle in the RtlDispatchException hook + NewAccessProtection = PAGE_EXECUTE_READ; + } + if (dllname) free(dllname); + } if (NewAccessProtection == PAGE_EXECUTE_READ && BaseAddress && NumberOfBytesToProtect && GetCurrentProcessId() == our_getprocessid(ProcessHandle) && is_in_dll_range((ULONG_PTR)*BaseAddress)) @@ -710,6 +803,16 @@ HOOKDEF(NTSTATUS, WINAPI, NtProtectVirtualMemory, set_lasterrors(&lasterrors); } +#ifdef CAPE_EXTRACTION + if (NT_SUCCESS(ret) && !called_by_hook() && GetCurrentProcessId() == our_getprocessid(ProcessHandle)) + { + ProtectionHandler(*BaseAddress, *NumberOfBytesToProtect, NewAccessProtection, *OldAccessProtection); + + if ((TrackedRegion = GetTrackedRegion(*BaseAddress)) && TrackedRegion->Guarded) + *OldAccessProtection &= (~PAGE_GUARD); + } +#endif + if (NewAccessProtection == PAGE_EXECUTE_READWRITE && (ULONG_PTR)meminfo.AllocationBase >= get_stack_bottom() && (((ULONG_PTR)meminfo.AllocationBase + meminfo.RegionSize) <= get_stack_top())) { LOQ_ntstatus("process", "pPPhhHss", "ProcessHandle", ProcessHandle, "BaseAddress", BaseAddress, @@ -737,6 +840,9 @@ HOOKDEF(BOOL, WINAPI, VirtualProtectEx, ) { BOOL ret; MEMORY_BASIC_INFORMATION meminfo; +#ifdef CAPE_EXTRACTION + PTRACKEDREGION TrackedRegion; +#endif if (flNewProtect == PAGE_EXECUTE_READ && GetCurrentProcessId() == our_getprocessid(hProcess) && is_in_dll_range((ULONG_PTR)lpAddress)) @@ -753,6 +859,16 @@ HOOKDEF(BOOL, WINAPI, VirtualProtectEx, set_lasterrors(&lasterrors); } +#ifdef CAPE_EXTRACTION + if (NT_SUCCESS(ret) && !called_by_hook() && GetCurrentProcessId() == our_getprocessid(hProcess)) + { + ProtectionHandler(lpAddress, dwSize, flNewProtect, *lpflOldProtect); + + if ((TrackedRegion = GetTrackedRegion(lpAddress)) && TrackedRegion->Guarded) + *lpflOldProtect &= (~PAGE_GUARD); + } +#endif + if (flNewProtect == PAGE_EXECUTE_READWRITE && GetCurrentProcessId() == our_getprocessid(hProcess) && (ULONG_PTR)meminfo.AllocationBase >= get_stack_bottom() && (((ULONG_PTR)meminfo.AllocationBase + meminfo.RegionSize) <= get_stack_top())) { LOQ_bool("process", "ppphhHss", "ProcessHandle", hProcess, "Address", lpAddress, @@ -772,6 +888,11 @@ HOOKDEF(NTSTATUS, WINAPI, NtFreeVirtualMemory, IN OUT PSIZE_T RegionSize, IN ULONG FreeType ) { +#ifdef CAPE_EXTRACTION + if (!called_by_hook() && GetCurrentProcessId() == our_getprocessid(ProcessHandle) && *RegionSize == 0 && (FreeType & MEM_RELEASE)) + FreeHandler(*BaseAddress); +#endif + NTSTATUS ret = Old_NtFreeVirtualMemory(ProcessHandle, BaseAddress, RegionSize, FreeType); @@ -852,28 +973,68 @@ HOOKDEF(NTSTATUS, WINAPI, DbgUiWaitStateChange, return ret; } -HOOKDEF_NOTAIL(WINAPI, RtlDispatchException, +HOOKDEF(BOOLEAN, WINAPI, RtlDispatchException, __in PEXCEPTION_RECORD ExceptionRecord, __in PCONTEXT Context) { -#ifndef _WIN64 + BOOL RetVal; + if (ExceptionRecord && ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && ExceptionRecord->ExceptionFlags == 0 && + ExceptionRecord->NumberParameters == 2 && ExceptionRecord->ExceptionInformation[0] == 1) { + unsigned int offset; + char *dllname = convert_address_to_dll_name_and_offset(ExceptionRecord->ExceptionInformation[1], &offset); + if (dllname && !strcmp(dllname, "ntdll.dll")) { + free(dllname); + // if trying to write to ntdll.dll, then just skip the instruction +#ifdef _WIN64 + Context->Rip += lde((void *)Context->Rip); +#else + Context->Eip += lde((void *)Context->Eip); +#endif + return TRUE; + } + if (dllname) free(dllname); + } + if (ExceptionRecord && (ULONG_PTR)ExceptionRecord->ExceptionAddress >= g_our_dll_base && (ULONG_PTR)ExceptionRecord->ExceptionAddress < (g_our_dll_base + g_our_dll_size)) { - char buf[160]; - ULONG_PTR seh = 0; - DWORD *tebtmp = (DWORD *)NtCurrentTeb(); - if (tebtmp[0] != 0xffffffff) - seh = ((DWORD *)tebtmp[0])[1]; - if (seh < g_our_dll_base || seh >= (g_our_dll_base + g_our_dll_size)) { - _snprintf(buf, sizeof(buf), "Exception 0x%x reported at offset 0x%x in capemon itself while accessing 0x%x from hook %s", ExceptionRecord->ExceptionCode, (DWORD)((ULONG_PTR)ExceptionRecord->ExceptionAddress - g_our_dll_base), ExceptionRecord->ExceptionInformation[1], hook_info()->current_hook ? hook_info()->current_hook->funcname : "unknown"); - log_anomaly("cuckoocrash", buf); + if (!(DEBUGGER_ENABLED && ExceptionRecord->ExceptionCode == EXCEPTION_SINGLE_STEP)) { + char buf[160]; + ULONG_PTR seh = 0; + DWORD_PTR *tebtmp = (DWORD_PTR *)NtCurrentTeb(); + if (tebtmp[0] != 0xffffffff) + seh = ((DWORD_PTR *)tebtmp[0])[1]; + if (seh < g_our_dll_base || seh >= (g_our_dll_base + g_our_dll_size)) { + _snprintf(buf, sizeof(buf), "Single-step exception (0x%x) reported at offset 0x%x in capemon itself while accessing 0x%x from hook %s", ExceptionRecord->ExceptionCode, (DWORD)((ULONG_PTR)ExceptionRecord->ExceptionAddress - g_our_dll_base), (unsigned int)ExceptionRecord->ExceptionInformation[1], hook_info()->current_hook ? hook_info()->current_hook->funcname : "unknown"); + log_anomaly("capemon crash", buf); + } } } -#endif // flush logs prior to handling of an exception without having to register a vectored exception handler log_flush(); - return 0; + if (DEBUGGER_ENABLED) + { + if (CAPEExceptionDispatcher(ExceptionRecord, Context)) + return 1; + else + RetVal = Old_RtlDispatchException(ExceptionRecord, Context); + } + else + RetVal = Old_RtlDispatchException(ExceptionRecord, Context); + + if (!RetVal && ExceptionRecord) { + if (ExceptionRecord->NumberParameters == 1) { + DoOutputDebugString("RtlDispatchException: Unhandled exception! Address 0x%p, code 0x%x, flags 0x%x, parameter 0x%x.\n", ExceptionRecord->ExceptionAddress, ExceptionRecord->ExceptionCode, ExceptionRecord->ExceptionFlags, ExceptionRecord->ExceptionInformation[0]); + } + else if (ExceptionRecord->NumberParameters == 2) { + DoOutputDebugString("RtlDispatchException: Unhandled exception! Address 0x%p, code 0x%x, flags 0x%x, parameters 0x%x and 0x%x.\n", ExceptionRecord->ExceptionAddress, ExceptionRecord->ExceptionCode, ExceptionRecord->ExceptionFlags, ExceptionRecord->ExceptionInformation[0], ExceptionRecord->ExceptionInformation[1]); + } + else { + DoOutputDebugString("RtlDispatchException: Unhandled exception! Address 0x%p, code 0x%x, flags 0x%x, %d parameters: 0x%x, 0x%x & ...\n", ExceptionRecord->ExceptionAddress, ExceptionRecord->ExceptionCode, ExceptionRecord->ExceptionFlags, ExceptionRecord->NumberParameters, ExceptionRecord->ExceptionInformation[0], ExceptionRecord->ExceptionInformation[1]); + } + } + + return RetVal; } HOOKDEF_NOTAIL(WINAPI, NtRaiseException, @@ -890,4 +1051,4 @@ HOOKDEF_NOTAIL(WINAPI, NtRaiseException, cuckoomon_exception_handler(&exc); return 0; -} +} \ No newline at end of file diff --git a/hook_reg.c b/hook_reg.c index f3f45ff..767fc58 100644 --- a/hook_reg.c +++ b/hook_reg.c @@ -64,6 +64,10 @@ HOOKDEF(LONG, WINAPI, RegOpenKeyExA, break; } } + + // fake some values + if (lpSubKey && !g_config.no_stealth) + perform_ascii_registry_fakery(keypath, (LPVOID)lpSubKey, (ULONG)strlen(lpSubKey)); free(keybuf); } @@ -113,6 +117,10 @@ HOOKDEF(LONG, WINAPI, RegOpenKeyExW, break; } } + + // fake some values + if (lpSubKey && !g_config.no_stealth) + perform_unicode_registry_fakery(keypath, lpSubKey, (ULONG)wcslen(lpSubKey)); free(keybuf); } @@ -255,13 +263,14 @@ HOOKDEF(LONG, WINAPI, RegEnumKeyW, wchar_t *parent_keys[] = { L"HKEY_LOCAL_MACHINE\\HARDWARE\\ACPI\\DSDT", L"HKEY_LOCAL_MACHINE\\HARDWARE\\ACPI\\FADT", - L"HKEY_LOCAL_MACHINE\\HARDWARE\\ACPI\\RSDT", + L"HKEY_LOCAL_MACHINE\\HARDWARE\\ACPI\\RSDT" + L"HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Enum\\IDE" }; wchar_t *replace_subkeys[] = { L"VBOX__", L"DELL__", - L"VBOX__", L"DELL__", - L"VBOX__", L"DELL__" + L"VMware_", L"Dell_", + L"VMWar_", L"Dell_", }; for (i = 0, j = 0; i < _countof(parent_keys); i += 1, j += 2) { @@ -303,12 +312,13 @@ HOOKDEF(LONG, WINAPI, RegEnumKeyExA, L"HKEY_LOCAL_MACHINE\\HARDWARE\\ACPI\\DSDT", L"HKEY_LOCAL_MACHINE\\HARDWARE\\ACPI\\FADT", L"HKEY_LOCAL_MACHINE\\HARDWARE\\ACPI\\RSDT" + L"HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Enum\\IDE" }; char *replace_subkeys[] = { "VBOX__", "DELL__", - "VBOX__", "DELL__", - "VBOX__", "DELL__" + "VMware_", "Dell_", + "VMWar_", "Dell_", }; for (i = 0, j = 0; i < _countof(parent_keys); i += 1, j += 2) { @@ -317,6 +327,10 @@ HOOKDEF(LONG, WINAPI, RegEnumKeyExA, break; } } + + // fake some values + if (lpName && !g_config.no_stealth) + perform_ascii_registry_fakery(keypath, lpName, (ULONG)strlen(lpName)); free(keybuf); } @@ -348,13 +362,13 @@ HOOKDEF(LONG, WINAPI, RegEnumKeyExW, wchar_t *parent_keys[] = { L"HKEY_LOCAL_MACHINE\\HARDWARE\\ACPI\\DSDT", L"HKEY_LOCAL_MACHINE\\HARDWARE\\ACPI\\FADT", - L"HKEY_LOCAL_MACHINE\\HARDWARE\\ACPI\\RSDT", + L"HKEY_LOCAL_MACHINE\\HARDWARE\\ACPI\\RSDT" }; wchar_t *replace_subkeys[] = { L"VBOX__", L"DELL__", - L"VBOX__", L"DELL__", - L"VBOX__", L"DELL__" + L"VMware_", L"Dell_", + L"VMWar_", L"Dell_", }; for (i = 0, j = 0; i < _countof(parent_keys); i += 1, j += 2) { @@ -363,6 +377,10 @@ HOOKDEF(LONG, WINAPI, RegEnumKeyExW, break; } } + + // fake some values + if (lpName && !g_config.no_stealth) + perform_unicode_registry_fakery(keypath, lpName, (ULONG)wcslen(lpName)); free(keybuf); } @@ -489,14 +507,14 @@ HOOKDEF(LONG, WINAPI, RegQueryValueExA, PKEY_NAME_INFORMATION keybuf = malloc(allocsize); wchar_t *keypath = get_full_keyvalue_pathA(hKey, lpValueName, keybuf, allocsize); - LOQ_zero("registry", "psru", "Handle", hKey, "ValueName", lpValueName, - "Data", *lpType, *lpcbData, lpData, - "FullName", keypath); - // fake some values - if (!g_config.no_stealth) + if (lpData && !g_config.no_stealth) perform_ascii_registry_fakery(keypath, lpData, *lpcbData); free(keybuf); + + LOQ_zero("registry", "psru", "Handle", hKey, "ValueName", lpValueName, + "Data", *lpType, *lpcbData, lpData, + "FullName", keypath); } else if (ret == ERROR_MORE_DATA) { LOQ_zero("registry", "psPIv", "Handle", hKey, "ValueName", lpValueName, @@ -533,7 +551,7 @@ HOOKDEF(LONG, WINAPI, RegQueryValueExW, "FullName", keypath); // fake some values - if (!g_config.no_stealth) + if (lpData && !g_config.no_stealth) perform_unicode_registry_fakery(keypath, lpData, *lpcbData); free(keybuf); } diff --git a/hook_services.c b/hook_services.c index 93a1f5b..a9035be 100644 --- a/hook_services.c +++ b/hook_services.c @@ -179,7 +179,7 @@ HOOKDEF(SC_HANDLE, WINAPI, OpenServiceW, return ret; } -extern wchar_t *our_process_path; +extern wchar_t *our_process_path_w; HOOKDEF(BOOL, WINAPI, StartServiceA, __in SC_HANDLE hService, @@ -190,7 +190,7 @@ HOOKDEF(BOOL, WINAPI, StartServiceA, BOOLEAN dispret = servicename_from_handle(hService, servicename); BOOL ret; - if (dispret && !g_config.suspend_logging && (wcsicmp(servicename, L"osppsvc") || !g_config.file_of_interest || !wcsicmp(our_process_path, g_config.file_of_interest))) + if (dispret && !g_config.suspend_logging && (wcsicmp(servicename, L"osppsvc") || !g_config.file_of_interest || !wcsicmp(our_process_path_w, g_config.file_of_interest))) pipe("SERVICE:%Z", servicename); ret = Old_StartServiceA(hService, dwNumServiceArgs, lpServiceArgVectors); @@ -209,7 +209,7 @@ HOOKDEF(BOOL, WINAPI, StartServiceW, BOOLEAN dispret = servicename_from_handle(hService, servicename); BOOL ret; - if (dispret && !g_config.suspend_logging && (wcsicmp(servicename, L"osppsvc") || !g_config.file_of_interest || !wcsicmp(our_process_path, g_config.file_of_interest))) + if (dispret && !g_config.suspend_logging && (wcsicmp(servicename, L"osppsvc") || !g_config.file_of_interest || !wcsicmp(our_process_path_w, g_config.file_of_interest))) pipe("SERVICE:%Z", servicename); ret = Old_StartServiceW(hService, dwNumServiceArgs, lpServiceArgVectors); diff --git a/hook_sleep.c b/hook_sleep.c index 9f08c1e..6ac4fc5 100644 --- a/hook_sleep.c +++ b/hook_sleep.c @@ -23,10 +23,14 @@ along with this program. If not, see . #include "pipe.h" #include "config.h" #include "misc.h" +#include "CAPE\CAPE.h" +#include "CAPE\Debugger.h" -// only skip Sleep()'s the first five seconds +// only skip Sleep()s the first five seconds #define MAX_SLEEP_SKIP_DIFF 5000 +extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); +extern void DoOutputErrorString(_In_ LPCTSTR lpOutputString, ...); // skipping sleep calls is done while this variable is set to true static int sleep_skip_active = 1; @@ -587,6 +591,38 @@ HOOKDEF(void, WINAPI, GetSystemTimeAsFileTime, return; } +WAITORTIMERCALLBACK HookedCallback; + +typedef VOID(CALLBACK *_WaitOrTimerCallback)( + _In_ PVOID lpParameter, + _In_ BOOLEAN TimerOrWaitFired +); + +VOID CALLBACK CallbackHook( + _In_ PVOID lpParameter, + _In_ BOOLEAN TimerOrWaitFired +) +{ + _WaitOrTimerCallback pWaitOrTimerCallback; + + if (!HookedCallback) { + DoOutputDebugString("Timer callback hook: error, HookedCallback NULL.\n"); + return; + } + + if (DEBUGGER_ENABLED) { + DWORD Tid = GetCurrentThreadId(); + DoOutputDebugString("Timer callback hook: Initialising breakpoints for thread %d.\n", Tid); + InitNewThreadBreakpoints(Tid); + } + else + DoOutputDebugString("Timer callback hook: passing to callback at 0x%p.\n", HookedCallback); + + *(FARPROC*)&pWaitOrTimerCallback = (FARPROC)HookedCallback; + HookedCallback = NULL; + pWaitOrTimerCallback(lpParameter, TimerOrWaitFired); +} + HOOKDEF(BOOL, WINAPI, CreateTimerQueueTimer, _Out_ PHANDLE phNewTimer, _In_opt_ HANDLE TimerQueue, @@ -596,7 +632,18 @@ HOOKDEF(BOOL, WINAPI, CreateTimerQueueTimer, _In_ DWORD Period, _In_ ULONG Flags ) { - BOOL ret = Old_CreateTimerQueueTimer(phNewTimer, TimerQueue, Callback, Parameter, DueTime, Period, Flags); + BOOL ret; + + if (Callback && !HookedCallback) { + HookedCallback = Callback; + Callback = &CallbackHook; + } + + ret = Old_CreateTimerQueueTimer(phNewTimer, TimerQueue, Callback, Parameter, DueTime, Period, Flags); + + if (HookedCallback) + Callback = HookedCallback; + LOQ_bool("system", "Pphhiii", "phNewTimer", phNewTimer, "TimerQueue", TimerQueue, "Callback", Callback, "Parameter", Parameter, "DueTime", DueTime, "Period", Period, "Flags", Flags); return ret; } diff --git a/hook_special.c b/hook_special.c index f00a7d0..f5b89ae 100644 --- a/hook_special.c +++ b/hook_special.c @@ -26,8 +26,12 @@ along with this program. If not, see . #include "config.h" extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); -extern int RoutineProcessDump(); +extern int DoProcessDump(PVOID CallerBase); extern ULONG_PTR base_of_dll_of_interest; +extern PVOID GetHookCallerBase(hook_info_t *hookinfo); +#ifdef CAPE_INJECTION +extern void CreateProcessHandler(LPWSTR lpApplicationName, LPWSTR lpCommandLine, LPPROCESS_INFORMATION lpProcessInformation); +#endif PVOID LastDllUnload; @@ -120,7 +124,7 @@ HOOKDEF_NOTAIL(WINAPI, LdrUnloadDll, PVOID DllImageBase ) { if (DllImageBase && DllImageBase == (PVOID)base_of_dll_of_interest) - RoutineProcessDump(); + DoProcessDump(GetHookCallerBase(NULL)); if (DllImageBase && DllImageBase != LastDllUnload) { @@ -155,17 +159,21 @@ HOOKDEF(BOOL, WINAPI, CreateProcessInternalW, lpCurrentDirectory, lpStartupInfo, lpProcessInformation, lpUnknown2); memcpy(hook_info(), &saved_hookinfo, sizeof(saved_hookinfo)); - if(ret != FALSE) { + if (ret != FALSE) { BOOL dont_monitor = FALSE; if (g_config.file_of_interest && g_config.suspend_logging && lpApplicationName && !wcsicmp(lpApplicationName, L"c:\\windows\\splwow64.exe")) dont_monitor = TRUE; - if (!dont_monitor) + if (!dont_monitor) { +#ifdef CAPE_INJECTION + CreateProcessHandler(lpApplicationName, lpCommandLine, lpProcessInformation); +#endif pipe("PROCESS:%d:%d,%d", (dwCreationFlags & CREATE_SUSPENDED) ? 1 : 0, lpProcessInformation->dwProcessId, lpProcessInformation->dwThreadId); + } // if the CREATE_SUSPENDED flag was not set, then we have to resume the main thread ourself - if((dwCreationFlags & CREATE_SUSPENDED) == 0) { + if ((dwCreationFlags & CREATE_SUSPENDED) == 0) { ResumeThread(lpProcessInformation->hThread); } diff --git a/hook_sync.c b/hook_sync.c index 640e6ac..ab3b6d7 100644 --- a/hook_sync.c +++ b/hook_sync.c @@ -48,6 +48,15 @@ HOOKDEF(NTSTATUS, WINAPI, NtOpenMutant, return ret; } +HOOKDEF(NTSTATUS, WINAPI, NtReleaseMutant, + __in HANDLE MutantHandle, + __out_opt PLONG PreviousCount +) { + NTSTATUS ret = Old_NtReleaseMutant(MutantHandle, PreviousCount); + LOQ_ntstatus("synchronization", "h", "Handle", MutantHandle); + return ret; +} + HOOKDEF(NTSTATUS, WINAPI, NtCreateEvent, __out PHANDLE EventHandle, __in ACCESS_MASK DesiredAccess, diff --git a/hook_thread.c b/hook_thread.c index d3f6fab..2d63401 100644 --- a/hook_thread.c +++ b/hook_thread.c @@ -29,6 +29,20 @@ along with this program. If not, see . #include "CAPE\Debugger.h" extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); +#ifdef CAPE_INJECTION +extern void GetThreadContextHandler(DWORD Pid, LPCONTEXT Context); +extern void SetThreadContextHandler(DWORD Pid, const CONTEXT *Context); +extern void ResumeThreadHandler(DWORD Pid); +#endif +#ifdef CAPE_TRACE +//extern PTHREADBREAKPOINTS GetThreadBreakpoints(DWORD ThreadId); +//extern BOOL ContextSetThreadBreakpoints(PCONTEXT ThreadContext, PTHREADBREAKPOINTS ThreadBreakpoints); +//extern BOOL ContextSetDebugRegister(PCONTEXT Context, int Register, int Size, LPVOID Address, DWORD Type); +//extern BOOL ContextCheckDebugRegisters(PCONTEXT Context); +//extern PVOID bp0, bp1, bp2, bp3; +extern void NtContinueHandler(PCONTEXT ThreadContext); +unsigned int TestFlag = 0; +#endif static lookup_t g_ignored_threads; @@ -84,7 +98,8 @@ HOOKDEF(NTSTATUS, WINAPI, NtQueueApcThread, DWORD tid = tid_from_thread_handle(ThreadHandle); NTSTATUS ret; - pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); + if (pid != GetCurrentProcessId()) + pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); ret = Old_NtQueueApcThread(ThreadHandle, ApcRoutine, ApcRoutineContext, ApcStatusBlock, ApcReserved); @@ -108,7 +123,8 @@ HOOKDEF(NTSTATUS, WINAPI, NtQueueApcThreadEx, DWORD tid = tid_from_thread_handle(ThreadHandle); NTSTATUS ret; - pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); + if (pid != GetCurrentProcessId()) + pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); ret = Old_NtQueueApcThreadEx(ThreadHandle, UserApcReserveHandle, ApcRoutine, ApcRoutineContext, ApcStatusBlock, ApcReserved); @@ -145,7 +161,8 @@ HOOKDEF(NTSTATUS, WINAPI, NtCreateThread, InitNewThreadBreakpoints(tid); } - pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); + if (pid != GetCurrentProcessId()) + pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); if (CreateSuspended == FALSE) { lasterror_t lasterror; @@ -255,14 +272,18 @@ HOOKDEF(NTSTATUS, WINAPI, NtGetContextThread, NTSTATUS ret = Old_NtGetContextThread(ThreadHandle, Context); - if (Context && Context->ContextFlags & CONTEXT_CONTROL) + if (Context && Context->ContextFlags & CONTEXT_CONTROL) #ifdef _WIN64 - LOQ_ntstatus("threading", "ppi", "ThreadHandle", ThreadHandle, "InstructionPointer", Context->Rcx, "ThreadId", tid); + LOQ_ntstatus("threading", "pp", "ThreadHandle", ThreadHandle, "InstructionPointer", Context->Rcx); #else - LOQ_ntstatus("threading", "ppi", "ThreadHandle", ThreadHandle, "InstructionPointer", Context->Eax, "ThreadId", tid); + LOQ_ntstatus("threading", "pp", "ThreadHandle", ThreadHandle, "InstructionPointer", Context->Eax); #endif else - LOQ_ntstatus("threading", "pi", "ThreadHandle", ThreadHandle, "ThreadId", tid); + LOQ_ntstatus("threading", "p", "ThreadHandle", ThreadHandle); +#ifdef CAPE_INJECTION + DWORD pid = pid_from_thread_handle(ThreadHandle); + GetThreadContextHandler(pid, Context); +#endif return ret; } @@ -271,24 +292,24 @@ HOOKDEF(NTSTATUS, WINAPI, NtSetContextThread, __in const CONTEXT *Context ) { NTSTATUS ret; - ENSURE_HANDLE(ThreadHandle); - ENSURE_STRUCT(Context, CONTEXT); DWORD pid = pid_from_thread_handle(ThreadHandle); DWORD tid = tid_from_thread_handle(ThreadHandle); - if (pid != GetCurrentProcessId()) - pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); - ret = Old_NtSetContextThread(ThreadHandle, Context); - if (Context && Context->ContextFlags & CONTEXT_CONTROL) + if (Context && Context->ContextFlags & CONTEXT_CONTROL) #ifdef _WIN64 - LOQ_ntstatus("threading", "ppi", "ThreadHandle", ThreadHandle, "InstructionPointer", Context->Rcx, "ThreadId", tid); + LOQ_ntstatus("threading", "pp", "ThreadHandle", ThreadHandle, "InstructionPointer", Context->Rcx); #else - LOQ_ntstatus("threading", "ppi", "ThreadHandle", ThreadHandle, "InstructionPointer", Context->Eax, "ThreadId", tid); + LOQ_ntstatus("threading", "pp", "ThreadHandle", ThreadHandle, "InstructionPointer", Context->Eax); #endif else - LOQ_ntstatus("threading", "pi", "ThreadHandle", ThreadHandle, "ThreadId", tid); + LOQ_ntstatus("threading", "p", "ThreadHandle", ThreadHandle); +#ifdef CAPE_INJECTION + SetThreadContextHandler(pid, Context); +#endif + if (pid != GetCurrentProcessId()) + pipe("PROCESS:%d:%d,%d", is_suspended(pid, tid), pid, tid); return ret; } @@ -326,10 +347,14 @@ HOOKDEF(NTSTATUS, WINAPI, NtResumeThread, DWORD tid = tid_from_thread_handle(ThreadHandle); NTSTATUS ret; ENSURE_ULONG(SuspendCount); - pipe("RESUME:%d,%d", pid, tid); +#ifdef CAPE_INJECTION + ResumeThreadHandler(pid); +#endif + if (pid != GetCurrentProcessId()) + pipe("RESUME:%d,%d", pid, tid); ret = Old_NtResumeThread(ThreadHandle, SuspendCount); - LOQ_ntstatus("threading", "pIi", "ThreadHandle", ThreadHandle, "SuspendCount", SuspendCount, "ThreadId", tid); + LOQ_ntstatus("threading", "pI", "ThreadHandle", ThreadHandle, "SuspendCount", SuspendCount); return ret; } @@ -387,7 +412,7 @@ HOOKDEF(HANDLE, WINAPI, CreateThread, InitNewThreadBreakpoints(*lpThreadId); } - if (!(dwCreationFlags && CREATE_SUSPENDED)) { + if (!(dwCreationFlags & CREATE_SUSPENDED)) { lasterror_t lasterror; get_lasterrors(&lasterror); ResumeThread(ret); @@ -514,7 +539,7 @@ HOOKDEF(NTSTATUS, WINAPI, NtSetInformationThread, ret = Old_NtSetInformationThread(ThreadHandle, ThreadInformationClass, ThreadInformation, ThreadInformationLength); if (ThreadInformationClass == ThreadHideFromDebugger) - LOQ_ntstatus("threading", "pib", "ThreadHandle", ThreadHandle, + LOQ_ntstatus("threading", "pii", "ThreadHandle", ThreadHandle, "ThreadInformationClass", ThreadInformationClass, "ThreadId", tid); @@ -541,3 +566,25 @@ HOOKDEF(NTSTATUS, WINAPI, NtQueryInformationThread, return ret; } + +HOOKDEF(NTSTATUS, WINAPI, NtYieldExecution, + VOID +) { + NTSTATUS ret = 0; + LOQ_void("threading", ""); + ret = Old_NtYieldExecution(); + return ret; +} + +HOOKDEF(NTSTATUS, WINAPI, NtContinue, + IN PCONTEXT ThreadContext, + IN BOOLEAN RaiseAlert +) +{ + NTSTATUS ret = 0; +#ifdef CAPE_TRACE + NtContinueHandler(ThreadContext); +#endif + ret = Old_NtContinue(ThreadContext, RaiseAlert); + return ret; +} \ No newline at end of file diff --git a/hook_window.c b/hook_window.c index fac3ca5..65a0262 100644 --- a/hook_window.c +++ b/hook_window.c @@ -151,9 +151,11 @@ HOOKDEF(BOOL, WINAPI, PostMessageA, lasterror_t lasterror; get_lasterrors(&lasterror); - GetWindowThreadProcessId(hWnd, &pid); - if (pid != GetCurrentProcessId()) - pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); + if (hWnd) { + GetWindowThreadProcessId(hWnd, &pid); + if (pid != GetCurrentProcessId()) + pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); + } set_lasterrors(&lasterror); ret = Old_PostMessageA(hWnd, Msg, wParam, lParam); @@ -173,9 +175,11 @@ HOOKDEF(BOOL, WINAPI, PostMessageW, lasterror_t lasterror; get_lasterrors(&lasterror); - GetWindowThreadProcessId(hWnd, &pid); - if (pid != GetCurrentProcessId()) - pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); + if (hWnd) { + GetWindowThreadProcessId(hWnd, &pid); + if (pid != GetCurrentProcessId()) + pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); + } set_lasterrors(&lasterror); ret = Old_PostMessageW(hWnd, Msg, wParam, lParam); @@ -195,9 +199,11 @@ HOOKDEF(BOOL, WINAPI, SendMessageA, lasterror_t lasterror; get_lasterrors(&lasterror); - GetWindowThreadProcessId(hWnd, &pid); - if (pid != GetCurrentProcessId()) - pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); + if (hWnd) { + GetWindowThreadProcessId(hWnd, &pid); + if (pid != GetCurrentProcessId()) + pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); + } set_lasterrors(&lasterror); ret = Old_SendMessageA(hWnd, Msg, wParam, lParam); @@ -217,9 +223,11 @@ HOOKDEF(BOOL, WINAPI, SendMessageW, lasterror_t lasterror; get_lasterrors(&lasterror); - GetWindowThreadProcessId(hWnd, &pid); - if (pid != GetCurrentProcessId()) - pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); + if (hWnd) { + GetWindowThreadProcessId(hWnd, &pid); + if (pid != GetCurrentProcessId()) + pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); + } set_lasterrors(&lasterror); ret = Old_SendMessageW(hWnd, Msg, wParam, lParam); @@ -239,9 +247,11 @@ HOOKDEF(BOOL, WINAPI, SendNotifyMessageA, lasterror_t lasterror; get_lasterrors(&lasterror); - GetWindowThreadProcessId(hWnd, &pid); - if (pid != GetCurrentProcessId()) - pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); + if (hWnd) { + GetWindowThreadProcessId(hWnd, &pid); + if (pid != GetCurrentProcessId()) + pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); + } set_lasterrors(&lasterror); ret = Old_SendNotifyMessageA(hWnd, Msg, wParam, lParam); @@ -261,9 +271,11 @@ HOOKDEF(BOOL, WINAPI, SendNotifyMessageW, lasterror_t lasterror; get_lasterrors(&lasterror); - GetWindowThreadProcessId(hWnd, &pid); - if (pid != GetCurrentProcessId()) - pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); + if (hWnd) { + GetWindowThreadProcessId(hWnd, &pid); + if (pid != GetCurrentProcessId()) + pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); + } set_lasterrors(&lasterror); ret = Old_SendNotifyMessageW(hWnd, Msg, wParam, lParam); @@ -283,15 +295,17 @@ HOOKDEF(LONG, WINAPI, SetWindowLongA, BOOL isbad = FALSE; get_lasterrors(&lasterror); - our_GetWindowThreadProcessId(hWnd, &pid); - if (pid != GetCurrentProcessId()) { - char classname[1024]; - our_GetClassNameA(hWnd, classname, sizeof(classname)); - if (!stricmp(classname, "Shell_TrayWnd") && nIndex == 0) { - pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); - isbad = TRUE; - } - } + if (hWnd) { + our_GetWindowThreadProcessId(hWnd, &pid); + if (pid != GetCurrentProcessId()) { + char classname[1024]; + our_GetClassNameA(hWnd, classname, sizeof(classname)); + if (!stricmp(classname, "Shell_TrayWnd") && nIndex == 0) { + pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); + isbad = TRUE; + } + } + } set_lasterrors(&lasterror); ret = Old_SetWindowLongA(hWnd, nIndex, dwNewLong); @@ -313,15 +327,17 @@ HOOKDEF(LONG_PTR, WINAPI, SetWindowLongPtrA, BOOL isbad = FALSE; get_lasterrors(&lasterror); - our_GetWindowThreadProcessId(hWnd, &pid); - if (pid != GetCurrentProcessId()) { - char classname[1024]; - our_GetClassNameA(hWnd, classname, sizeof(classname)); - if (!stricmp(classname, "Shell_TrayWnd") && nIndex == 0) { - pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); - isbad = TRUE; - } - } + if (hWnd) { + our_GetWindowThreadProcessId(hWnd, &pid); + if (pid != GetCurrentProcessId()) { + char classname[1024]; + our_GetClassNameA(hWnd, classname, sizeof(classname)); + if (!stricmp(classname, "Shell_TrayWnd") && nIndex == 0) { + pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); + isbad = TRUE; + } + } + } set_lasterrors(&lasterror); ret = Old_SetWindowLongPtrA(hWnd, nIndex, dwNewLong); @@ -343,15 +359,17 @@ HOOKDEF(LONG, WINAPI, SetWindowLongW, BOOL isbad = FALSE; get_lasterrors(&lasterror); - our_GetWindowThreadProcessId(hWnd, &pid); - if (pid != GetCurrentProcessId()) { - char classname[1024]; - our_GetClassNameA(hWnd, classname, sizeof(classname)); - if (!stricmp(classname, "Shell_TrayWnd") && nIndex == 0) { - pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); - isbad = TRUE; - } - } + if (hWnd) { + our_GetWindowThreadProcessId(hWnd, &pid); + if (pid != GetCurrentProcessId()) { + char classname[1024]; + our_GetClassNameA(hWnd, classname, sizeof(classname)); + if (!stricmp(classname, "Shell_TrayWnd") && nIndex == 0) { + pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); + isbad = TRUE; + } + } + } set_lasterrors(&lasterror); ret = Old_SetWindowLongW(hWnd, nIndex, dwNewLong); @@ -374,15 +392,17 @@ HOOKDEF(LONG_PTR, WINAPI, SetWindowLongPtrW, BOOL isbad = FALSE; get_lasterrors(&lasterror); - our_GetWindowThreadProcessId(hWnd, &pid); - if (pid != GetCurrentProcessId()) { - char classname[1024]; - our_GetClassNameA(hWnd, classname, sizeof(classname)); - if (!stricmp(classname, "Shell_TrayWnd") && nIndex == 0) { - pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); - isbad = TRUE; - } - } + if (hWnd) { + our_GetWindowThreadProcessId(hWnd, &pid); + if (pid != GetCurrentProcessId()) { + char classname[1024]; + our_GetClassNameA(hWnd, classname, sizeof(classname)); + if (!stricmp(classname, "Shell_TrayWnd") && nIndex == 0) { + pipe("PROCESS:%d:%d", is_suspended(pid, 0), pid); + isbad = TRUE; + } + } + } set_lasterrors(&lasterror); ret = Old_SetWindowLongPtrW(hWnd, nIndex, dwNewLong); diff --git a/hooking.c b/hooking.c index b6eaabe..ced322e 100644 --- a/hooking.c +++ b/hooking.c @@ -25,17 +25,7 @@ along with this program. If not, see . #include "unhook.h" #include "misc.h" #include "pipe.h" - -extern DWORD g_tls_hook_index; - -extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); -extern PVOID GetHookCallerBase(); -extern int DumpModuleInCurrentProcess(LPVOID ModuleBase); -extern PVOID GetAllocationBase(PVOID Address); -extern SIZE_T GetAllocationSize(PVOID Address); -extern BOOL ModuleDumped; -extern BOOL SetInitialBreakpoints(PVOID ImageBase); -BOOL BreakpointsSet; +#include "CAPE\CAPE.h" #ifdef _WIN64 #define TLS_LAST_WIN32_ERROR 0x68 @@ -46,10 +36,25 @@ BOOL BreakpointsSet; #endif static lookup_t g_hook_info; +lookup_t g_caller_regions; + +extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); +extern BOOL DumpRegion(PVOID Address); +extern int DumpImageInCurrentProcess(LPVOID ImageBase); +extern PVOID GetAllocationBase(PVOID Address); +extern PVOID GetHookCallerBase(hook_info_t *hookinfo); +extern BOOL ModuleDumped; +#ifdef CAPE_TRACE +extern BOOL SetInitialBreakpoints(PVOID ImageBase); +//extern BOOL BreakpointOnReturn(PVOID Address); +extern BOOL BreakpointsSet; +extern BOOL TraceRunning; +#endif void hook_init() { - lookup_init(&g_hook_info); + lookup_init_no_cs(&g_hook_info); + lookup_init(&g_caller_regions); } void emit_rel(unsigned char *buf, unsigned char *source, unsigned char *target) @@ -65,6 +70,12 @@ static int set_caller_info(void *unused, ULONG_PTR addr) hook_info_t *hookinfo = hook_info(); if (!is_in_dll_range(addr)) { + PVOID AllocationBase = GetAllocationBase((PVOID)addr); + if (AllocationBase && !lookup_get(&g_caller_regions, (ULONG_PTR)AllocationBase, 0)) { + DoOutputDebugString("set_caller_info: Adding region at 0x%p to caller regions list (%ws::%s).\n", AllocationBase, hookinfo->current_hook->library, hookinfo->current_hook->funcname); + lookup_add(&g_caller_regions, (ULONG_PTR)AllocationBase, 0); + } + if (hookinfo->main_caller_retaddr == 0) hookinfo->main_caller_retaddr = addr; else { @@ -114,43 +125,77 @@ int called_by_hook(void) return __called_by_hook(hookinfo->stack_pointer, hookinfo->frame_pointer); } -void base_on_api(hook_t *h) +void api_dispatch(hook_t *h, hook_info_t *hookinfo) { unsigned int i; + ULONG_PTR main_caller_retaddr, parent_caller_retaddr; + PVOID AllocationBase = NULL; - for (i = 0; i < ARRAYSIZE(g_config.base_on_apiname); i++) { - PVOID AllocationBase; + main_caller_retaddr = hookinfo->main_caller_retaddr; + parent_caller_retaddr = hookinfo->parent_caller_retaddr; + + for (i = 0; i < ARRAYSIZE(g_config.base_on_apiname); i++) { if (!g_config.base_on_apiname[i]) break; - if (!BreakpointsSet && !called_by_hook() && !stricmp(h->funcname, g_config.base_on_apiname[i])) { - DoOutputDebugString("Base-on-API: %s call detected in thread %d.\n", g_config.base_on_apiname[i], GetCurrentThreadId()); - AllocationBase = GetHookCallerBase(); + if (!__called_by_hook(hookinfo->stack_pointer, hookinfo->frame_pointer) && !stricmp(h->funcname, g_config.base_on_apiname[i])) { + DoOutputDebugString("Base-on-API: %s call detected in thread %d, main_caller_retaddr 0x%p.\n", g_config.base_on_apiname[i], GetCurrentThreadId(), main_caller_retaddr); + AllocationBase = GetHookCallerBase(hookinfo); if (AllocationBase) { BreakpointsSet = SetInitialBreakpoints((PVOID)AllocationBase); if (BreakpointsSet) - { DoOutputDebugString("Base-on-API: GetHookCallerBase success 0x%p - Breakpoints set.\n", AllocationBase); - if (!ModuleDumped && DumpModuleInCurrentProcess(AllocationBase)) { + else + DoOutputDebugString("Base-on-API: Failed to set breakpoints on 0x%p.\n", AllocationBase); + } + else + DoOutputDebugString("Base-on-API: GetHookCallerBase fail.\n"); + break; + } + } + + for (i = 0; i < ARRAYSIZE(g_config.dump_on_apinames); i++) { + if (!g_config.dump_on_apinames[i]) + break; + if (!ModuleDumped && !stricmp(h->funcname, g_config.dump_on_apinames[i])) { + DoOutputDebugString("Dump-on-API: %s call detected in thread %d, main_caller_retaddr 0x%p.\n", g_config.base_on_apiname[i], GetCurrentThreadId(), main_caller_retaddr); + if (main_caller_retaddr) { + if (!AllocationBase) + AllocationBase = GetHookCallerBase(hookinfo); + if (AllocationBase) { + if (g_config.dump_on_api_type) + CapeMetaData->DumpType = g_config.dump_on_api_type; + if (DumpImageInCurrentProcess(AllocationBase)) { ModuleDumped = TRUE; DoOutputDebugString("Dump-on-API: Dumped module at 0x%p due to %s call.\n", AllocationBase, h->funcname); } + else if (DumpRegion(AllocationBase)) { + ModuleDumped = TRUE; + DoOutputDebugString("Dump-on-API: Dumped memory region at 0x%p due to %s call.\n", AllocationBase, h->funcname); + } else { - DoOutputDebugString("Dump-on-API: Failed to dump module at 0x%p due to %s call.\n", AllocationBase, h->funcname); + DoOutputDebugString("Dump-on-API: Failed to dump memory region at 0x%p due to %s call.\n", AllocationBase, h->funcname); } } else - DoOutputDebugString("Base-on-API: Failed to set breakpoints on 0x%p.\n", AllocationBase); + DoOutputDebugString("Dump-on-API: Failed to obtain current module base address.\n"); } - else - DoOutputDebugString("Base-on-API: GetHookCallerBase fail.\n"); + break; } - } - - return; + } + + //if (!__called_by_hook(hookinfo->stack_pointer, hookinfo->frame_pointer) && !stricmp(h->funcname, g_config.break_on_return)) { + // DoOutputDebugString("Break-on-return: %s call detected in thread %d.\n", g_config.break_on_return, GetCurrentThreadId()); + // TraceRunning = TRUE; + // if (main_caller_retaddr) + // BreakpointOnReturn((PVOID)main_caller_retaddr); + // else if (parent_caller_retaddr) + // BreakpointOnReturn((PVOID)parent_caller_retaddr); + // else + // BreakpointOnReturn((PVOID)hookinfo->return_address); + //} } extern BOOLEAN is_ignored_thread(DWORD tid); - static hook_info_t tmphookinfo; DWORD tmphookinfo_threadid; @@ -160,7 +205,7 @@ DWORD tmphookinfo_threadid; int WINAPI enter_hook(hook_t *h, ULONG_PTR sp, ULONG_PTR ebp_or_rip) { hook_info_t *hookinfo; - + if (h->fully_emulate) return 1; @@ -192,7 +237,7 @@ int WINAPI enter_hook(hook_t *h, ULONG_PTR sp, ULONG_PTR ebp_or_rip) operate_on_backtrace(sp, ebp_or_rip, NULL, set_caller_info); - base_on_api(h); + api_dispatch(h, hookinfo); return 1; } @@ -205,7 +250,7 @@ hook_info_t *hook_info() hook_info_t *ptr; lasterror_t lasterror; - + if (tmphookinfo_threadid && tmphookinfo_threadid == GetCurrentThreadId()) return &tmphookinfo; @@ -225,9 +270,9 @@ hook_info_t *hook_info() void get_lasterrors(lasterror_t *errors) { char *teb; - + errors->Eflags = (DWORD)__readeflags(); - + teb = (char *)NtCurrentTeb(); errors->Win32Error = *(DWORD *)(teb + TLS_LAST_WIN32_ERROR); @@ -241,7 +286,7 @@ void set_lasterrors(lasterror_t *errors) *(DWORD *)(teb + TLS_LAST_WIN32_ERROR) = errors->Win32Error; *(DWORD *)(teb + TLS_LAST_NTSTATUS_ERROR) = errors->NtstatusError; - + __writeeflags(errors->Eflags); } diff --git a/hooking.h b/hooking.h index a2a7015..19b843c 100644 --- a/hooking.h +++ b/hooking.h @@ -112,6 +112,7 @@ typedef struct _hook_t { int is_hooked; hook_data_t *hookdata; + const wchar_t *exportdirectory; } hook_t; typedef struct _hook_info_t { diff --git a/hooking_32.c b/hooking_32.c index 71c7259..a2d7246 100644 --- a/hooking_32.c +++ b/hooking_32.c @@ -29,13 +29,8 @@ along with this program. If not, see . #include "pipe.h" #include "config.h" -extern DWORD g_tls_hook_index; - -// do not change this number -#define TLS_LAST_ERROR 0x34 - // length disassembler engine -static int lde(void *addr) +int lde(void *addr) { // the length of an instruction is 16 bytes max, but there can also be // 16 instructions of length one, so.. we support "decomposing" 16 diff --git a/hooking_64.c b/hooking_64.c index 854a557..6b49866 100644 --- a/hooking_64.c +++ b/hooking_64.c @@ -28,13 +28,8 @@ along with this program. If not, see . #include "pipe.h" #include "config.h" -extern DWORD g_tls_hook_index; - -// do not change this number -#define TLS_LAST_ERROR 0x34 - // length disassembler engine -static int lde(void *addr) +int lde(void *addr) { // the length of an instruction is 16 bytes max, but there can also be // 16 instructions of length one, so.. we support "decomposing" 16 diff --git a/hooks.h b/hooks.h index 200820d..9f66438 100644 --- a/hooks.h +++ b/hooks.h @@ -880,6 +880,11 @@ extern HOOKDEF(NTSTATUS, WINAPI, NtOpenMutant, __in POBJECT_ATTRIBUTES ObjectAttributes ); +extern HOOKDEF(NTSTATUS, WINAPI, NtReleaseMutant, + __in HANDLE MutantHandle, + __out_opt PLONG PreviousCount +); + extern HOOKDEF(NTSTATUS, WINAPI, NtCreateEvent, __out PHANDLE EventHandle, __in ACCESS_MASK DesiredAccess, @@ -961,6 +966,16 @@ extern HOOKDEF(BOOL, WINAPI, Process32NextW, __out LPPROCESSENTRY32W lppe ); +extern HOOKDEF(BOOL, WINAPI, Module32FirstW, + __in HANDLE hSnapshot, + __out LPMODULEENTRY32W lpme +); + +extern HOOKDEF(BOOL, WINAPI, Module32NextW, + __in HANDLE hSnapshot, + __out LPMODULEENTRY32W lpme +); + extern HOOKDEF(NTSTATUS, WINAPI, NtCreateProcess, __out PHANDLE ProcessHandle, __in ACCESS_MASK DesiredAccess, @@ -1086,7 +1101,7 @@ extern HOOKDEF(NTSTATUS, WINAPI, DbgUiWaitStateChange, __in_opt PLARGE_INTEGER Timeout ); -extern HOOKDEF_NOTAIL(WINAPI, RtlDispatchException, +extern HOOKDEF(BOOLEAN, WINAPI, RtlDispatchException, __in PEXCEPTION_RECORD ExceptionRecord, __in PCONTEXT Context ); @@ -2782,6 +2797,23 @@ extern HOOKDEF(BOOL, WINAPI, CryptImportPublicKeyInfo, _Out_ HCRYPTKEY *phKey ); +extern HOOKDEF(BOOL, WINAPI, CryptHashSessionKey, + _In_ HCRYPTHASH hHash, + _In_ HCRYPTKEY hKey, + _In_ DWORD dwFlags +); + +extern HOOKDEF(DWORD, WINAPI, QueryUsersOnEncryptedFile, + LPCWSTR lpFileName, + PVOID *pUsers +); + +extern HOOKDEF(BOOL, WINAPI, CryptGenRandom, + HCRYPTPROV hProv, + DWORD dwLen, + BYTE *pbBuffer +); + // // Special Hooks // @@ -2894,16 +2926,18 @@ extern HOOKDEF(int, WINAPI, lstrcmpiA, _In_ LPCSTR lpString2 ); -extern HOOKDEF(HRSRC, WINAPI, FindResourceA, +extern HOOKDEF(HRSRC, WINAPI, FindResourceExA, HMODULE hModule, + LPCSTR lpType, LPCSTR lpName, - LPCSTR lpType + WORD wLanguage ); -extern HOOKDEF(HRSRC, WINAPI, FindResourceW, +extern HOOKDEF(HRSRC, WINAPI, FindResourceExW, HMODULE hModule, + LPCWSTR lpType, LPCWSTR lpName, - LPCWSTR lpType + WORD wLanguage ); extern HOOKDEF(HGLOBAL, WINAPI, LoadResource, @@ -2919,3 +2953,118 @@ extern HOOKDEF(DWORD, WINAPI, SizeofResource, _In_opt_ HMODULE hModule, _In_ HRSRC hResInfo ); + +extern HOOKDEF(BOOL, WINAPI, EnumResourceTypesExA, + _In_opt_ HMODULE hModule, + _In_ ENUMRESTYPEPROC lpEnumFunc, + _In_ LONG_PTR lParam, + _In_ DWORD dwFlags, + _In_ LANGID LangId +); + +extern HOOKDEF(BOOL, WINAPI, EnumResourceTypesExW, + _In_opt_ HMODULE hModule, + _In_ ENUMRESTYPEPROC lpEnumFunc, + _In_ LONG_PTR lParam, + _In_ DWORD dwFlags, + _In_ LANGID LangId +); + +extern HOOKDEF(BOOL, WINAPI, EnumCalendarInfoA, + CALINFO_ENUMPROCA lpCalInfoEnumProc, + LCID Locale, + CALID Calendar, + CALTYPE CalType +); + +extern HOOKDEF(BOOL, WINAPI, EnumCalendarInfoW, + CALINFO_ENUMPROCA lpCalInfoEnumProc, + LCID Locale, + CALID Calendar, + CALTYPE CalType +); + +extern HOOKDEF(BOOL, WINAPI, EnumTimeFormatsA, + TIMEFMT_ENUMPROCA lpTimeFmtEnumProc, + LCID Locale, + DWORD dwFlags +); + +extern HOOKDEF(BOOL, WINAPI, EnumTimeFormatsW, + TIMEFMT_ENUMPROCA lpTimeFmtEnumProc, + LCID Locale, + DWORD dwFlags +); + +extern HOOKDEF(NTSTATUS, WINAPI, NtCreateTransaction, + PHANDLE TransactionHandle, + ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes, + LPGUID Uow, + HANDLE TmHandle, + ULONG CreateOptions, + ULONG IsolationLevel, + ULONG IsolationFlags, + PLARGE_INTEGER Timeout, + PUNICODE_STRING Description +); + +extern HOOKDEF(NTSTATUS, WINAPI, NtOpenTransaction, + PHANDLE TransactionHandle, + ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes, + LPGUID Uow, + HANDLE TmHandle +); + +extern HOOKDEF(NTSTATUS, WINAPI, NtRollbackTransaction, + HANDLE TransactionHandle, + BOOLEAN Wait +); + +extern HOOKDEF(NTSTATUS, WINAPI, NtCommitTransaction, + HANDLE TransactionHandle, + BOOLEAN Wait +); + +extern HOOKDEF(BOOL, WINAPI, RtlSetCurrentTransaction, + _In_ HANDLE TransactionHandle +); + +extern HOOKDEF(NTSTATUS, WINAPI, NtYieldExecution, + VOID +); + +extern HOOKDEF(HRESULT, WINAPI, OleConvertOLESTREAMToIStorage, + IN LPOLESTREAM lpolestream, + OUT LPSTORAGE pstg, + IN const DVTARGETDEVICE *ptd +); + +extern HOOKDEF(BOOL, WINAPI, ChangeWindowMessageFilter, + UINT message, + DWORD dwFlag +); + +extern HOOKDEF(LPWSTR, WINAPI, rtcEnvironBstr, + struct envstruct *es +); + +extern HOOKDEF(BOOL, WINAPI, CryptImportKey, + HCRYPTPROV hProv, + const BYTE *pbData, + DWORD dwDataLen, + HCRYPTKEY hPubKey, + DWORD dwFlags, + HCRYPTKEY *phKey +); + +extern HOOKDEF(HANDLE, WINAPI, HeapCreate, + _In_ DWORD flOptions, + _In_ SIZE_T dwInitialSize, + _In_ SIZE_T dwMaximumSize +); + +extern HOOKDEF(HKL, WINAPI, GetKeyboardLayout, + _In_ DWORD idThread +); diff --git a/log.c b/log.c index cde260c..dbcc04b 100644 --- a/log.c +++ b/log.c @@ -980,7 +980,7 @@ void log_new_process() GetSystemTimeAsFileTime(&st); - loq(LOG_ID_PROCESS, "__notification__", "__process__", 1, 0, "iiiiu", + loq(LOG_ID_PROCESS, "__notification__", "__process__", 1, 0, "iiiis", "TimeLow", st.dwLowDateTime, "TimeHigh", st.dwHighDateTime, "ProcessIdentifier", GetCurrentProcessId(), diff --git a/lookup.c b/lookup.c index 7a69c61..0347bc3 100644 --- a/lookup.c +++ b/lookup.c @@ -33,6 +33,11 @@ void lookup_init(lookup_t *d) InitializeCriticalSection(&d->cs); } +void lookup_init_no_cs(lookup_t *d) +{ + d->root = NULL; +} + void lookup_free(lookup_t *d) { // TODO @@ -91,7 +96,6 @@ void *lookup_get_no_cs(lookup_t *d, ULONG_PTR id, unsigned int *size) *size = p->size; } data = p->data; - LEAVE(); return data; } } @@ -134,7 +138,6 @@ void lookup_del_no_cs(lookup_t *d, ULONG_PTR id) entry_t *t = p->next; free(d->root); d->root = t; - LEAVE(); return; } for (last = NULL; p != NULL; last = p, p = p->next) { diff --git a/lookup.h b/lookup.h index 15e58f3..edaadbd 100644 --- a/lookup.h +++ b/lookup.h @@ -36,6 +36,7 @@ void *lookup_add(lookup_t *d, ULONG_PTR id, unsigned int size); void *lookup_get(lookup_t *d, ULONG_PTR id, unsigned int *size); void lookup_del(lookup_t *d, ULONG_PTR id); +void lookup_init_no_cs(lookup_t *d); void *lookup_add_no_cs(lookup_t *d, ULONG_PTR id, unsigned int size); void *lookup_get_no_cs(lookup_t *d, ULONG_PTR id, unsigned int *size); void lookup_del_no_cs(lookup_t *d, ULONG_PTR id); diff --git a/misc.c b/misc.c index 25e5158..63cece3 100644 --- a/misc.c +++ b/misc.c @@ -19,6 +19,7 @@ along with this program. If not, see . #include #include #include "ntapi.h" +#include #include #include #include "misc.h" @@ -37,6 +38,7 @@ static _NtQueryObject pNtQueryObject; static _NtQueryKey pNtQueryKey; static _NtDelayExecution pNtDelayExecution; static _NtQuerySystemInformation pNtQuerySystemInformation; +static _NtUnmapViewOfSection pNtUnmapViewOfSection; _NtAllocateVirtualMemory pNtAllocateVirtualMemory; _NtProtectVirtualMemory pNtProtectVirtualMemory; _NtFreeVirtualMemory pNtFreeVirtualMemory; @@ -58,6 +60,7 @@ void resolve_runtime_apis(void) *(FARPROC *)&pNtFreeVirtualMemory = GetProcAddress(ntdllbase, "NtFreeVirtualMemory"); *(FARPROC *)&pLdrRegisterDllNotification = GetProcAddress(ntdllbase, "LdrRegisterDllNotification"); *(FARPROC *)&pRtlGenRandom = GetProcAddress(GetModuleHandle("advapi32"), "SystemFunction036"); + *(FARPROC *)&pNtUnmapViewOfSection = GetProcAddress(ntdllbase, "NtUnmapViewOfSection"); } ULONG_PTR g_our_dll_base; @@ -360,6 +363,19 @@ void perform_ascii_registry_fakery(PWCHAR keypath, LPVOID Data, ULONG DataLength // fake the manufacturer name if (!wcsicmp(keypath, L"HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Control\\SystemInformation\\SystemManufacturer")) replace_string_in_buf(Data, DataLength, "QEMU", "DELL"); + + if (!wcsicmp(keypath, L"HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Enum\\IDE\\") || + !wcsicmp(keypath, L"HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Enum\\SCSI\\")) { + replace_string_in_buf(Data, DataLength, "VMware", "Lenovo"); + replace_string_in_buf(Data, DataLength, "VMWar", "Lenov"); + replace_string_in_buf(Data, DataLength, "VBOX", "DELL"); + } + + if (!wcsicmp(keypath, L"HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Control\\DeviceClasses\\{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}")) { + replace_string_in_buf(Data, DataLength, "VMware", "Lenovo"); + replace_string_in_buf(Data, DataLength, "VMWar", "Lenov"); + replace_string_in_buf(Data, DataLength, "VBOX", "DELL"); + } } void perform_unicode_registry_fakery(PWCHAR keypath, LPVOID Data, ULONG DataLength) @@ -427,6 +443,19 @@ void perform_unicode_registry_fakery(PWCHAR keypath, LPVOID Data, ULONG DataLeng // fake the manufacturer name if (!wcsicmp(keypath, L"HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Control\\SystemInformation\\SystemManufacturer")) replace_wstring_in_buf(Data, DataLength / sizeof(wchar_t), L"QEMU", L"DELL"); + + if (!wcsicmp(keypath, L"HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Enum\\IDE\\") || + !wcsicmp(keypath, L"HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Enum\\SCSI\\")) { + replace_wstring_in_buf(Data, DataLength / sizeof(wchar_t), L"VMware", L"Lenovo"); + replace_wstring_in_buf(Data, DataLength / sizeof(wchar_t), L"VMWar", L"Lenov"); + replace_wstring_in_buf(Data, DataLength / sizeof(wchar_t), L"VBOX", L"DELL"); + } + + if (!wcsicmp(keypath, L"HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Control\\DeviceClasses\\{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}")) { + replace_wstring_in_buf(Data, DataLength / sizeof(wchar_t), L"VMware", L"Lenovo"); + replace_wstring_in_buf(Data, DataLength / sizeof(wchar_t), L"VMWar", L"Lenov"); + replace_wstring_in_buf(Data, DataLength / sizeof(wchar_t), L"VBOX", L"DELL"); + } } @@ -643,10 +672,9 @@ void add_all_dlls_to_dll_ranges(void) for (mod = (LDR_MODULE *)mod->InLoadOrderModuleList.Flink; mod->BaseAddress != NULL; mod = (LDR_MODULE *)mod->InLoadOrderModuleList.Flink) { - //if ((ULONG_PTR)mod->BaseAddress != base_of_dll_of_interest) + if ((ULONG_PTR)mod->BaseAddress != base_of_dll_of_interest) add_dll_range((ULONG_PTR)mod->BaseAddress, (ULONG_PTR)mod->BaseAddress + mod->SizeOfImage); } - } char *convert_address_to_dll_name_and_offset(ULONG_PTR addr, unsigned int *offset) @@ -655,10 +683,10 @@ char *convert_address_to_dll_name_and_offset(ULONG_PTR addr, unsigned int *offse if (addr >= g_our_dll_base && addr < (g_our_dll_base + g_our_dll_size)) { - char *buf = calloc(1, strlen("cuckoomon.dll") + 1); + char *buf = calloc(1, strlen("capemon.dll") + 1); if (buf == NULL) return NULL; - strcpy(buf, "cuckoomon.dll"); + strcpy(buf, "capemon.dll"); *offset = (unsigned int)(addr - g_our_dll_base); return buf; } @@ -1867,3 +1895,38 @@ BOOLEAN is_address_in_ntdll(ULONG_PTR address) return FALSE; } + +void prevent_module_reloading(PVOID *BaseAddress) { + // prevent hook evasion via mapping system libraries (e.g. ntdll.dll) from disk + // this still won't stop reading the file using NtReadFile and mapping it manually + wchar_t *whitelist[] = { + L"C:\\Windows\\System32\\ntdll.dll", + L"C:\\Windows\\SysWOW64\\ntdll.dll", + NULL + }; + + // get the file path for the mapped section + wchar_t *filepath = malloc(MAX_PATH * sizeof(wchar_t)); + GetMappedFileNameW(GetCurrentProcess(), *BaseAddress, filepath, MAX_PATH); + + // convert device path to an actual path + wchar_t *absolutepath = malloc(32768 * sizeof(wchar_t)); + ensure_absolute_unicode_path(absolutepath, filepath); + free(filepath); + + // check against the whitelist + for (int i = 0; whitelist[i]; i++) { + if (!wcsicmp(whitelist[i], absolutepath)) { + // is this a loaded module? + HMODULE address = GetModuleHandleW(absolutepath); + if (address != NULL) { + pipe("INFO:Sample attempted to remap module '%Z' at 0x%p, returning original module address instead: 0x%p", absolutepath, *BaseAddress, address); + pNtUnmapViewOfSection(GetCurrentProcess(), *BaseAddress); + *BaseAddress = (LPVOID)address; + } + break; + } + } + + free(absolutepath); +} diff --git a/misc.h b/misc.h index ecdfffa..da56844 100644 --- a/misc.h +++ b/misc.h @@ -46,8 +46,10 @@ typedef NTSTATUS(WINAPI *_NtQueryKey)( PULONG ResultLength); typedef NTSTATUS(WINAPI *_NtDelayExecution)( BOOLEAN Alertable, - PLARGE_INTEGER Interval - ); + PLARGE_INTEGER Interval); +typedef NTSTATUS(WINAPI *_NtUnmapViewOfSection)( + HANDLE ProcessHandle, + PVOID BaseAddress); typedef struct _LDR_DLL_LOADED_NOTIFICATION_DATA { ULONG Flags; @@ -160,7 +162,8 @@ void set_dll_of_interest(ULONG_PTR BaseAddress); PWCHAR get_dll_basename(PUNICODE_STRING library); void register_dll_notification_manually(PLDR_DLL_NOTIFICATION_FUNCTION notify); -extern wchar_t *our_process_path; +extern char *our_process_path; +extern wchar_t *our_process_path_w; BOOLEAN is_valid_address_range(ULONG_PTR start, DWORD len); @@ -200,3 +203,12 @@ wchar_t *ascii_to_unicode_dup(char *str); int is_stack_pivoted(void); LONG WINAPI cuckoomon_exception_handler(__in struct _EXCEPTION_POINTERS *ExceptionInfo); + +void prevent_module_reloading(PVOID *BaseAddress); +PVOID test_module_reloading(PVOID *BaseAddress); + +struct envstruct { + ULONG k; + ULONG nullval; + LPWSTR envstr; +}; \ No newline at end of file diff --git a/ntapi.h b/ntapi.h index 54750a4..46fa5af 100644 --- a/ntapi.h +++ b/ntapi.h @@ -59,6 +59,16 @@ typedef LONG NTSTATUS; #pragma warning( disable : 4996) #endif +#define Suspended 5 +#define OptionShutdownSystem 6 +// NTSTATUS +#define STATUS_INFO_LENGTH_MISMATCH 0xc0000004 +#define STATUS_CONFLICTING_ADDRESSES 0xc0000018 +#define STATUS_OBJECT_NAME_NOT_FOUND 0xc0000034 +#define STATUS_INVALID_DEVICE_REQUEST 0xc0000010 +#define STATUS_ACCESS_DENIED ((NTSTATUS) 0xc0000022) +#define STATUS_IMAGE_NOT_AT_BASE ((NTSTATUS) 0x40000003) + typedef struct _STRING { USHORT Length; USHORT MaximumLength; @@ -248,12 +258,6 @@ typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION { ULONG InterruptCount; } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; -#define Suspended 5 -#define OptionShutdownSystem 6 -#define STATUS_INFO_LENGTH_MISMATCH 0xc0000004 -#define STATUS_CONFLICTING_ADDRESSES 0xc0000018 -#define STATUS_OBJECT_NAME_NOT_FOUND 0xc0000034 -#define STATUS_INVALID_DEVICE_REQUEST 0xc0000010 typedef struct _INITIAL_TEB { PVOID StackBase; PVOID StackLimit; @@ -362,8 +366,6 @@ typedef enum _FILE_INFORMATION_CLASS { FileMaximumInformation } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS; -#define STATUS_ACCESS_DENIED ((NTSTATUS) 0xc0000022) - typedef struct _FILE_BASIC_INFORMATION { LARGE_INTEGER CreationTime; LARGE_INTEGER LastAccessTime; diff --git a/unhook.c b/unhook.c index 3ef7aa9..0454e35 100644 --- a/unhook.c +++ b/unhook.c @@ -30,8 +30,11 @@ along with this program. If not, see . extern void DoOutputDebugString(_In_ LPCTSTR lpOutputString, ...); extern void file_handle_terminate(); -extern int RoutineProcessDump(); +extern int DoProcessDump(PVOID CallerBase); extern BOOL ProcessDumped; +#ifdef CAPE_TRACE +extern BOOL StopTrace; +#endif static HANDLE g_unhook_thread_handle, g_watcher_thread_handle; @@ -254,18 +257,42 @@ static DWORD WINAPI _terminate_event_thread(LPVOID param) { hook_disable(); - while (1) { - WaitForSingleObject(g_terminate_event_handle, INFINITE); - if (g_config.procdump && !ProcessDumped) - { - DoOutputDebugString("Terminate Event: Attempting to dump process %d\n", GetCurrentProcessId()); - RoutineProcessDump(); - } - file_handle_terminate(); - log_flush(); - } + DWORD ProcessId = GetCurrentProcessId(); - return 0; + WaitForSingleObject(g_terminate_event_handle, INFINITE); + + CloseHandle(g_terminate_event_handle); + + if (g_config.procdump) { + if (!ProcessDumped) { + DoOutputDebugString("Terminate Event: Attempting to dump process %d\n", ProcessId); + DoProcessDump(NULL); + } + else + DoOutputDebugString("Terminate Event: Process %d has already been dumped(!)\n", ProcessId); + } +#ifdef CAPE_EXTRACTION + DoOutputDebugString("Terminate Event: Processing tracked regions before shutdown (process %d).\n", ProcessId); + ProcessTrackedRegions(); + ClearAllBreakpoints(); +#else + else + DoOutputDebugString("Terminate Event: Skipping dump of process %d\n", ProcessId); +#endif +#ifdef CAPE_TRACE + StopTrace = TRUE; +#endif + file_handle_terminate(); + g_terminate_event_handle = OpenEventA(EVENT_MODIFY_STATE, FALSE, g_config.terminate_event_name); + if (g_terminate_event_handle) { + SetEvent(g_terminate_event_handle); + CloseHandle(g_terminate_event_handle); + } + DoOutputDebugString("Terminate Event: CAPE shutdown complete for process %d\n", ProcessId); + log_flush(); + if (g_config.terminate_processes) + ExitProcess(0); + return 0; } DWORD g_terminate_event_thread_id; @@ -344,7 +371,7 @@ int procname_watch_init() if (g_procname_watch_thread_handle != NULL) return 0; - pipe("CRITICAL:Error initializing terminate event thread!"); + pipe("CRITICAL:Error initializing procname watch thread!"); return -1; }