From ff37bc98d5ecb78d60e5b2abb141b840f3eb57dc Mon Sep 17 00:00:00 2001 From: Iizerd Date: Sat, 25 Dec 2021 23:38:49 -0800 Subject: [PATCH] xD --- CodeVirtualizer/Main.cpp | 7 ++++--- CodeVirtualizer/XedWrap.cpp | 7 +++++++ CodeVirtualizer/XedWrap.h | 4 ++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CodeVirtualizer/Main.cpp b/CodeVirtualizer/Main.cpp index 60babcd..3eec1d0 100644 --- a/CodeVirtualizer/Main.cpp +++ b/CodeVirtualizer/Main.cpp @@ -187,12 +187,13 @@ UCHAR IsEvenCode[]{ int main() { - XedTablesInit(); + XedGlobalInit(); srand(time(NULL)); UCHAR TestCode[] = { 0x48, 0x8B, 0x84, 0xD1, 0xF0, 0x06, 0x00, 0x00 }; // { 0x48, 0x89, 0xC8 }; XED_DECODED_INST DecodedInst; - XedDecodedInstZero(&DecodedInst); - XedDecodedInstSetMode(&DecodedInst, XED_MACHINE_MODE_LONG_64, XED_ADDRESS_WIDTH_64b); + XedDecodedInstZeroSetMode(&DecodedInst, &XedGlobalMachineState); + //XedDecodedInstZero(&DecodedInst); + //XedDecodedInstSetMode(&DecodedInst, XED_MACHINE_MODE_LONG_64, XED_ADDRESS_WIDTH_64b); XED_ERROR_ENUM Err = XedDecode(&DecodedInst, TestCode, sizeof(TestCode)); if (Err != XED_ERROR_NONE) { diff --git a/CodeVirtualizer/XedWrap.cpp b/CodeVirtualizer/XedWrap.cpp index 249f122..212c848 100644 --- a/CodeVirtualizer/XedWrap.cpp +++ b/CodeVirtualizer/XedWrap.cpp @@ -1,2 +1,9 @@ #include "XedWrap.h" +VOID XedInit() +{ + XedTablesInit(); + XedGlobalMachineState; + XedGlobalMachineState.mmode = XED_MACHINE_MODE_LONG_64; + XedGlobalMachineState.stack_addr_width = XED_ADDRESS_WIDTH_64b; +} \ No newline at end of file diff --git a/CodeVirtualizer/XedWrap.h b/CodeVirtualizer/XedWrap.h index f3a8e2f..3bc5c91 100644 --- a/CodeVirtualizer/XedWrap.h +++ b/CodeVirtualizer/XedWrap.h @@ -90,4 +90,8 @@ extern "C" #define XedReg xed_reg #define XedDisp xed_disp +inline XED_STATE XedGlobalMachineState; + +VOID XedInit(); + #endif \ No newline at end of file