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