From 2e0e9d55c7385a2a97c1d266364c59d004142398 Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Sun, 26 Apr 2015 01:06:08 +0200 Subject: [PATCH] DBG: completely removed BeaEngine --- release.bat | 2 - x64_dbg_dbg/BeaEngine/BeaEngine.h | 392 ------------------------ x64_dbg_dbg/BeaEngine/BeaEngine.lib | Bin 2142 -> 0 bytes x64_dbg_dbg/BeaEngine/BeaEngine_64.lib | Bin 2136 -> 0 bytes x64_dbg_dbg/BeaEngine/basic_types.h | 272 ---------------- x64_dbg_dbg/BeaEngine/export.h | 173 ----------- x64_dbg_dbg/BeaEngine/libBeaEngine.a | Bin 3638 -> 0 bytes x64_dbg_dbg/BeaEngine/libBeaEngine_64.a | Bin 3676 -> 0 bytes x64_dbg_dbg/BeaEngine/macros.h | 41 --- x64_dbg_dbg/_exports.cpp | 19 +- x64_dbg_dbg/capstone_wrapper.cpp | 13 +- x64_dbg_dbg/capstone_wrapper.h | 1 + x64_dbg_dbg/disasm_fast.cpp | 125 ++++---- x64_dbg_dbg/disasm_fast.h | 4 +- x64_dbg_dbg/instruction.cpp | 32 +- x64_dbg_dbg/reference.cpp | 25 +- x64_dbg_dbg/reference.h | 2 +- x64_dbg_dbg/stackinfo.cpp | 8 - x64_dbg_dbg/x64_dbg_dbg.vcxproj | 12 +- x64_dbg_dbg/x64_dbg_dbg.vcxproj.filters | 15 - 20 files changed, 101 insertions(+), 1035 deletions(-) delete mode 100644 x64_dbg_dbg/BeaEngine/BeaEngine.h delete mode 100644 x64_dbg_dbg/BeaEngine/BeaEngine.lib delete mode 100644 x64_dbg_dbg/BeaEngine/BeaEngine_64.lib delete mode 100644 x64_dbg_dbg/BeaEngine/basic_types.h delete mode 100644 x64_dbg_dbg/BeaEngine/export.h delete mode 100644 x64_dbg_dbg/BeaEngine/libBeaEngine.a delete mode 100644 x64_dbg_dbg/BeaEngine/libBeaEngine_64.a delete mode 100644 x64_dbg_dbg/BeaEngine/macros.h diff --git a/release.bat b/release.bat index fe7965f6..3b6c1c74 100644 --- a/release.bat +++ b/release.bat @@ -58,7 +58,6 @@ copy help\x64dbg.chm %RELEASEDIR%\help echo pluginsdk mkdir %RELEASEDIR%\pluginsdk -mkdir %RELEASEDIR%\pluginsdk\BeaEngine mkdir %RELEASEDIR%\pluginsdk\capstone mkdir %RELEASEDIR%\pluginsdk\dbghelp mkdir %RELEASEDIR%\pluginsdk\DeviceNameResolver @@ -69,7 +68,6 @@ mkdir %RELEASEDIR%\pluginsdk\XEDParse mkdir %RELEASEDIR%\pluginsdk\yara mkdir %RELEASEDIR%\pluginsdk\yara\yara -xcopy x64_dbg_dbg\BeaEngine %RELEASEDIR%\pluginsdk\BeaEngine /S /Y xcopy x64_dbg_dbg\capstone %RELEASEDIR%\pluginsdk\capstone /S /Y xcopy x64_dbg_dbg\dbghelp %RELEASEDIR%\pluginsdk\dbghelp /S /Y xcopy x64_dbg_dbg\DeviceNameResolver %RELEASEDIR%\pluginsdk\DeviceNameResolver /S /Y diff --git a/x64_dbg_dbg/BeaEngine/BeaEngine.h b/x64_dbg_dbg/BeaEngine/BeaEngine.h deleted file mode 100644 index 3f94a5fb..00000000 --- a/x64_dbg_dbg/BeaEngine/BeaEngine.h +++ /dev/null @@ -1,392 +0,0 @@ -#ifndef _BEA_ENGINE_ -#define _BEA_ENGINE_ -#if defined(__cplusplus) && defined(__BORLANDC__) -namespace BeaEngine -{ -#endif - -#include "macros.h" -#include "export.h" -#include "basic_types.h" - -#if !defined(BEA_ENGINE_STATIC) -#if defined(BUILD_BEA_ENGINE_DLL) -#define BEA_API bea__api_export__ -#else -#define BEA_API bea__api_import__ -#endif -#else -#define BEA_API -#endif - - -#define INSTRUCT_LENGTH 64 - -#pragma pack(1) -typedef struct -{ - UInt8 W_; - UInt8 R_; - UInt8 X_; - UInt8 B_; - UInt8 state; -} REX_Struct ; -#pragma pack() - -#pragma pack(1) -typedef struct -{ - int Number; - int NbUndefined; - UInt8 LockPrefix; - UInt8 OperandSize; - UInt8 AddressSize; - UInt8 RepnePrefix; - UInt8 RepPrefix; - UInt8 FSPrefix; - UInt8 SSPrefix; - UInt8 GSPrefix; - UInt8 ESPrefix; - UInt8 CSPrefix; - UInt8 DSPrefix; - UInt8 BranchTaken; - UInt8 BranchNotTaken; - REX_Struct REX; - char alignment[2]; -} PREFIXINFO ; -#pragma pack() - -#pragma pack(1) -typedef struct -{ - UInt8 OF_; - UInt8 SF_; - UInt8 ZF_; - UInt8 AF_; - UInt8 PF_; - UInt8 CF_; - UInt8 TF_; - UInt8 IF_; - UInt8 DF_; - UInt8 NT_; - UInt8 RF_; - UInt8 alignment; -} EFLStruct ; -#pragma pack() - -#pragma pack(4) -typedef struct -{ - Int32 BaseRegister; - Int32 IndexRegister; - Int32 Scale; - Int64 Displacement; -} MEMORYTYPE ; -#pragma pack() - - -#pragma pack(1) -typedef struct -{ - Int32 Category; //INSTRUCTION_TYPE - Int32 Opcode; - char Mnemonic[16]; - Int32 BranchType; //BRANCH_TYPE - EFLStruct Flags; - UInt64 AddrValue; - Int64 Immediat; - UInt32 ImplicitModifiedRegs; -} INSTRTYPE; -#pragma pack() - -#pragma pack(1) -typedef struct -{ - char ArgMnemonic[64]; - Int32 ArgType; //ARGUMENTS_TYPE - Int32 ArgSize; - Int32 ArgPosition; - UInt32 AccessMode; - MEMORYTYPE Memory; - UInt32 SegmentReg; -} ARGTYPE; -#pragma pack() - -/* reserved structure used for thread-safety */ -/* unusable by customer */ -#pragma pack(1) -typedef struct -{ - UIntPtr EIP_; - UInt64 EIP_VA; - UIntPtr EIP_REAL; - Int32 OriginalOperandSize; - Int32 OperandSize; - Int32 MemDecoration; - Int32 AddressSize; - Int32 MOD_; - Int32 RM_; - Int32 INDEX_; - Int32 SCALE_; - Int32 BASE_; - Int32 MMX_; - Int32 SSE_; - Int32 CR_; - Int32 DR_; - Int32 SEG_; - Int32 REGOPCODE; - UInt32 DECALAGE_EIP; - Int32 FORMATNUMBER; - Int32 SYNTAX_; - UInt64 EndOfBlock; - Int32 RelativeAddress; - UInt32 Architecture; - Int32 ImmediatSize; - Int32 NB_PREFIX; - Int32 PrefRepe; - Int32 PrefRepne; - UInt32 SEGMENTREGS; - UInt32 SEGMENTFS; - Int32 third_arg; - Int32 TAB_; - Int32 ERROR_OPCODE; - REX_Struct REX; - Int32 OutOfBlock; -} InternalDatas; -#pragma pack() - -/* ************** main structure ************ */ -#pragma pack(1) -typedef struct _Disasm -{ - UIntPtr EIP; - UInt64 VirtualAddr; - UInt32 SecurityBlock; - char CompleteInstr[INSTRUCT_LENGTH]; - UInt32 Archi; - UInt64 Options; - INSTRTYPE Instruction; - ARGTYPE Argument1; - ARGTYPE Argument2; - ARGTYPE Argument3; - PREFIXINFO Prefix; - InternalDatas Reserved_; -} DISASM, *PDISASM, *LPDISASM; -#pragma pack() - -#define ESReg 1 -#define DSReg 2 -#define FSReg 3 -#define GSReg 4 -#define CSReg 5 -#define SSReg 6 - -#define InvalidPrefix 4 -#define SuperfluousPrefix 2 -#define NotUsedPrefix 0 -#define MandatoryPrefix 8 -#define InUsePrefix 1 - -#define LowPosition 0 -#define HighPosition 1 - -enum INSTRUCTION_TYPE -{ - GENERAL_PURPOSE_INSTRUCTION = 0x10000, - FPU_INSTRUCTION = 0x20000, - MMX_INSTRUCTION = 0x40000, - SSE_INSTRUCTION = 0x80000, - SSE2_INSTRUCTION = 0x100000, - SSE3_INSTRUCTION = 0x200000, - SSSE3_INSTRUCTION = 0x400000, - SSE41_INSTRUCTION = 0x800000, - SSE42_INSTRUCTION = 0x1000000, - SYSTEM_INSTRUCTION = 0x2000000, - VM_INSTRUCTION = 0x4000000, - UNDOCUMENTED_INSTRUCTION = 0x8000000, - AMD_INSTRUCTION = 0x10000000, - ILLEGAL_INSTRUCTION = 0x20000000, - AES_INSTRUCTION = 0x40000000, - CLMUL_INSTRUCTION = (int)0x80000000, - - - DATA_TRANSFER = 0x1, - ARITHMETIC_INSTRUCTION, - LOGICAL_INSTRUCTION, - SHIFT_ROTATE, - BIT_UInt8, - CONTROL_TRANSFER, - STRING_INSTRUCTION, - InOutINSTRUCTION, - ENTER_LEAVE_INSTRUCTION, - FLAG_CONTROL_INSTRUCTION, - SEGMENT_REGISTER, - MISCELLANEOUS_INSTRUCTION, - COMPARISON_INSTRUCTION, - LOGARITHMIC_INSTRUCTION, - TRIGONOMETRIC_INSTRUCTION, - UNSUPPORTED_INSTRUCTION, - LOAD_CONSTANTS, - FPUCONTROL, - STATE_MANAGEMENT, - CONVERSION_INSTRUCTION, - SHUFFLE_UNPACK, - PACKED_SINGLE_PRECISION, - SIMD128bits, - SIMD64bits, - CACHEABILITY_CONTROL, - FP_INTEGER_CONVERSION, - SPECIALIZED_128bits, - SIMD_FP_PACKED, - SIMD_FP_HORIZONTAL , - AGENT_SYNCHRONISATION, - PACKED_ALIGN_RIGHT , - PACKED_SIGN, - PACKED_BLENDING_INSTRUCTION, - PACKED_TEST, - PACKED_MINMAX, - HORIZONTAL_SEARCH, - PACKED_EQUALITY, - STREAMING_LOAD, - INSERTION_EXTRACTION, - DOT_PRODUCT, - SAD_INSTRUCTION, - ACCELERATOR_INSTRUCTION, /* crc32, popcnt (sse4.2) */ - ROUND_INSTRUCTION -}; - -enum EFLAGS_STATES -{ - TE_ = 1, - MO_ = 2, - RE_ = 4, - SE_ = 8, - UN_ = 0x10, - PR_ = 0x20 -}; - -enum BRANCH_TYPE -{ - //JO vs JNO - JO = 1, - JNO = -1, - //JC=JB=JNAE vs JNC=JNB=JAE - JC = 2, - JB = 2, - JNAE = 2, - JNC = -2, - JNB = -2, - JAE = -2, - //JE=JZ vs JNE=JNZ - JE = 3, - JZ = 3, - JNE = -3, - JNZ = -3, - //JA=JNBE vs JNA=JBE - JA = 4, - JNBE = 4, - JNA = -4, - JBE = -4, - //JS vs JNS - JS = 5, - JNS = -5, - //JP=JPE vs JNP=JPO - JP = 6, - JPE = 6, - JNP = -6, - JPO = -6, - //JL=JNGE vs JNL=JGE - JL = 7, - JNGE = 7, - JNL = -7, - JGE = -7, - //JG=JNLE vs JNG=JLE - JG = 8, - JNLE = 8, - JNG = -8, - JLE = -8, - //others - JECXZ = 9, - JmpType = 10, - CallType = 11, - RetType = 12, -}; - -enum ARGUMENTS_TYPE -{ - NO_ARGUMENT = 0x10000000, - REGISTER_TYPE = 0x20000000, - MEMORY_TYPE = 0x40000000, - CONSTANT_TYPE = (int)0x80000000, - - MMX_REG = 0x10000, - GENERAL_REG = 0x20000, - FPU_REG = 0x40000, - SSE_REG = 0x80000, - CR_REG = 0x100000, - DR_REG = 0x200000, - SPECIAL_REG = 0x400000, - MEMORY_MANAGEMENT_REG = 0x800000, - SEGMENT_REG = 0x1000000, - - RELATIVE_ = 0x4000000, - ABSOLUTE_ = 0x8000000, - - READ = 0x1, - WRITE = 0x2, - - REG0 = 0x1, - REG1 = 0x2, - REG2 = 0x4, - REG3 = 0x8, - REG4 = 0x10, - REG5 = 0x20, - REG6 = 0x40, - REG7 = 0x80, - REG8 = 0x100, - REG9 = 0x200, - REG10 = 0x400, - REG11 = 0x800, - REG12 = 0x1000, - REG13 = 0x2000, - REG14 = 0x4000, - REG15 = 0x8000 -}; - -enum SPECIAL_INFO -{ - UNKNOWN_OPCODE = -1, - OUT_OF_BLOCK = 0, - - /* === mask = 0xff */ - NoTabulation = 0x00000000, - Tabulation = 0x00000001, - - /* === mask = 0xff00 */ - MasmSyntax = 0x00000000, - GoAsmSyntax = 0x00000100, - NasmSyntax = 0x00000200, - ATSyntax = 0x00000400, - - /* === mask = 0xff0000 */ - PrefixedNumeral = 0x00010000, - SuffixedNumeral = 0x00020000, - NoformatNumeral = 0x00030000, - CleanNumeral = 0x00000000, - - /* === mask = 0xff000000 */ - ShowSegmentRegs = 0x01000000 -}; - -#ifdef __cplusplus -extern "C" -#endif - -BEA_API int __bea_callspec__ Disasm(LPDISASM pDisAsm); -BEA_API const__ char* __bea_callspec__ BeaEngineVersion(void); -BEA_API const__ char* __bea_callspec__ BeaEngineRevision(void); -#if defined(__cplusplus) && defined(__BORLANDC__) -}; -using namespace BeaEngine; -#endif -#endif diff --git a/x64_dbg_dbg/BeaEngine/BeaEngine.lib b/x64_dbg_dbg/BeaEngine/BeaEngine.lib deleted file mode 100644 index 7d789084f2a761506c7c982d55ccd23e76595eea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2142 zcmcIl&2G~`5dQ2WO^Nu4pvt8}xTq3v3272T5eT_$DiJkJD>u#6HA!eKH9txU2QF~z zfk&Wc9)e5WfCC2}fS2g4%-FkjoVq1JVWr)jnH}%!e)G+G>6P7Y9KB9G)xvG1uv&Po z>o0P}ustW#d_hVFDF8PBwGPBjfy59g;z(c)3REG*B5!v20{%h&3D~Ql z8pF^B##bbN9SEU`-+PT8IZr>#s^d(uWb;!*m5K-?gcqgOj?TULx#Xd4=ikd$b)FS7w}SO zJgKPDIQv3Qg)Th-WAb`_gfXhinD6cZ`Iym+X}U|nFv6IEv@&D9Nkz=e7>43MFkzDH z-lx!4K8{o4wmOQNS82Z}fS2lM+^(rKT|nfLm@93xjZ|7u+L^dNr6T4T<2wna4=D63 z->-roqsD(jF4Ky_Z`hK1!}+M!Jd`+0&3~W%V-YoqsL;C^`~cD9p7<$*_QfAkm$aP# diff --git a/x64_dbg_dbg/BeaEngine/BeaEngine_64.lib b/x64_dbg_dbg/BeaEngine/BeaEngine_64.lib deleted file mode 100644 index 63ead365d7f2fdb71489e7c4718e72ec2e1f89b1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2136 zcmcIlOHUL*5dQWBy794D@kETHAyF^uun)v&%m7Q`!m^NI;W~^vD@?*ZvWp%Ji3tZz z{scMu2e^6RALz}a2QQxa16VcF-Lp^KHPA_QcU9L+Re$y92QTebW$#t|sn$JaGxM2e zxj9{*@0RO=O{cSBw-X0&9SE-g(L*413QQ&i9ns2k&SY7IwT*SNY~`0Xm(0ROdEK-Y ztM+nz*R5A!S*5LFv0nurm5#4be!W#%wekz)1*j9V`rd83jXM3stu=$cD!J0!uC@j# zN^#z8+wGe8jbO&cCKF&YLEx-}fx{?p8UvD(z!A|o5rKv%VwgY(VX=!0xKp3+%E|x2 za~MQDa*2p97A8lDMatRVC&>PlK{fFI`)A*la@zQwE0H#O9&#g8qm*#-kcEQ7HvXgPwKJUfObZ~!ju;q;HH9} zFZBp_5)?LkXH^=U_|qrJHMi1gv>R^^w8!QXtyn0ndZ#_p4dU4qCJsCA5;Rjz(5}l4 zj7p={B!8z*KI7t|^BYp8RAG|WHUQ7%Jt^@n=vxvxS=OPCpmcJ9gyj!;5`+H^ybv5O zVQkZU`NbRWy7UMclg_0(GA8V0%vaArc5`sXIR25EJ2ECCg`6>8BqLVNm@CSJQKEZ~ z+!)#r$Hwis?AkkVS!qAXfFJ6?xc#NlauO=8RIaqnVZe};mX&hW`ym;zvfdToI|{b< z$%V`8V=^fk!z?Hx=H+I!! QhuFJI_W0EjFGG)&KUbx<8vp - * @date Thu Dec 24 19:31:22 2009 - * - * @brief Definitions of fixed-size integer types for various platforms - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -#ifndef __BEA_BASIC_TYPES_HPP__ -#define __BEA_BASIC_TYPES_HPP__ - -#include - -#if defined(__GNUC__) || defined (__INTEL_COMPILER) || defined(__LCC__) || defined(__POCC__) -#include -#endif - -#if defined(_MSC_VER) && !defined(__BORLANDC__) -/* -* Windows/Visual C++ -*/ -typedef signed char Int8; -typedef unsigned char UInt8; -typedef signed short Int16; -typedef unsigned short UInt16; -typedef signed int Int32; -typedef unsigned int UInt32; -typedef signed __int64 Int64; -typedef unsigned __int64 UInt64; -#if defined(_WIN64) -#define BEA_PTR_IS_64_BIT 1 -typedef signed __int64 IntPtr; -typedef unsigned __int64 UIntPtr; -#else -typedef signed long IntPtr; -typedef size_t UIntPtr; -#endif -#define BEA_HAVE_INT64 1 -#elif defined(__POCC__) -/* -* PellesC -*/ -typedef signed char Int8; -typedef unsigned char UInt8; -typedef signed short Int16; -typedef unsigned short UInt16; -typedef signed int Int32; -typedef unsigned int UInt32; -typedef signed long long Int64; -typedef unsigned long long UInt64; -#if defined(_WIN64) -#define BEA_PTR_IS_64_BIT 1 -typedef signed long long IntPtr; -typedef unsigned long long UIntPtr; -#else -typedef signed long IntPtr; -typedef size_t UIntPtr; -#endif -#define BEA_HAVE_INT64 1 -#elif defined(__GNUC__) || defined(__LCC__) -/* -* Unix/GCC -*/ -typedef signed char Int8; -typedef unsigned char UInt8; -typedef signed short Int16; -typedef unsigned short UInt16; -typedef signed int Int32; -typedef unsigned int UInt32; -typedef intptr_t IntPtr; -typedef uintptr_t UIntPtr; -#if defined(__LP64__) -#define BEA_PTR_IS_64_BIT 1 -#define BEA_LONG_IS_64_BIT 1 -typedef signed long Int64; -typedef unsigned long UInt64; -#else -#if defined (__INTEL_COMPILER) || defined (__ICC) || defined (_ICC) -typedef __int64 Int64; -typedef unsigned __int64 UInt64; -#else -typedef signed long long Int64; -typedef unsigned long long UInt64; -#endif -#endif -#define BEA_HAVE_INT64 1 -#elif defined(__DECCXX) -/* -* Compaq C++ -*/ -typedef signed char Int8; -typedef unsigned char UInt8; -typedef signed short Int16; -typedef unsigned short UInt16; -typedef signed int Int32; -typedef unsigned int UInt32; -typedef signed __int64 Int64; -typedef unsigned __int64 UInt64; -#if defined(__VMS) -#if defined(__32BITS) -typedef signed long IntPtr; -typedef unsigned long UIntPtr; -#else -typedef Int64 IntPtr; -typedef UInt64 UIntPtr; -#define BEA_PTR_IS_64_BIT 1 -#endif -#else -typedef signed long IntPtr; -typedef unsigned long UIntPtr; -#define BEA_PTR_IS_64_BIT 1 -#define BEA_LONG_IS_64_BIT 1 -#endif -#define BEA_HAVE_INT64 1 -#elif defined(__HP_aCC) -/* -* HP Ansi C++ -*/ -typedef signed char Int8; -typedef unsigned char UInt8; -typedef signed short Int16; -typedef unsigned short UInt16; -typedef signed int Int32; -typedef unsigned int UInt32; -typedef signed long IntPtr; -typedef unsigned long UIntPtr; -#if defined(__LP64__) -#define BEA_PTR_IS_64_BIT 1 -#define BEA_LONG_IS_64_BIT 1 -typedef signed long Int64; -typedef unsigned long UInt64; -#else -typedef signed long long Int64; -typedef unsigned long long UInt64; -#endif -#define BEA_HAVE_INT64 1 -#elif defined(__SUNPRO_CC) || defined(__SUNPRO_C) -/* -* SUN Forte C++ -*/ -typedef signed char Int8; -typedef unsigned char UInt8; -typedef signed short Int16; -typedef unsigned short UInt16; -typedef signed int Int32; -typedef unsigned int UInt32; -typedef signed long IntPtr; -typedef unsigned long UIntPtr; -#if defined(__sparcv9) -#define BEA_PTR_IS_64_BIT 1 -#define BEA_LONG_IS_64_BIT 1 -typedef signed long Int64; -typedef unsigned long UInt64; -#else -typedef signed long long Int64; -typedef unsigned long long UInt64; -#endif -#define BEA_HAVE_INT64 1 -#elif defined(__IBMCPP__) -/* -* IBM XL C++ -*/ -typedef signed char Int8; -typedef unsigned char UInt8; -typedef signed short Int16; -typedef unsigned short UInt16; -typedef signed int Int32; -typedef unsigned int UInt32; -typedef signed long IntPtr; -typedef unsigned long UIntPtr; -#if defined(__64BIT__) -#define BEA_PTR_IS_64_BIT 1 -#define BEA_LONG_IS_64_BIT 1 -typedef signed long Int64; -typedef unsigned long UInt64; -#else -typedef signed long long Int64; -typedef unsigned long long UInt64; -#endif -#define BEA_HAVE_INT64 1 -#elif defined(__BORLANDC__) -/* -* Borland C/C++ -*/ -typedef signed char Int8; -typedef unsigned char UInt8; -typedef signed short Int16; -typedef unsigned short UInt16; -typedef signed int Int32; -typedef unsigned int UInt32; -typedef unsigned __int64 Int64; -typedef signed __int64 UInt64; -typedef signed long IntPtr; -typedef unsigned long UIntPtr; -#define BEA_HAVE_INT64 1 -#elif defined(__WATCOMC__) -/* -* Watcom C/C++ -*/ -typedef signed char Int8; -typedef unsigned char UInt8; -typedef signed short Int16; -typedef unsigned short UInt16; -typedef signed int Int32; -typedef unsigned int UInt32; -typedef unsigned __int64 Int64; -typedef signed __int64 UInt64; -#define BEA_HAVE_INT64 1 -typedef size_t UIntPtr; -#elif defined(__sgi) -/* -* MIPSpro C++ -*/ -typedef signed char Int8; -typedef unsigned char UInt8; -typedef signed short Int16; -typedef unsigned short UInt16; -typedef signed int Int32; -typedef unsigned int UInt32; -typedef signed long IntPtr; -typedef unsigned long UIntPtr; -#if _MIPS_SZLONG == 64 -#define BEA_PTR_IS_64_BIT 1 -#define BEA_LONG_IS_64_BIT 1 -typedef signed long Int64; -typedef unsigned long UInt64; -#else -typedef signed long long Int64; -typedef unsigned long long UInt64; -#endif -#define BEA_HAVE_INT64 1 -#endif - -#if defined(_MSC_VER) || defined(__BORLANDC__) -#define W64LIT(x) x##ui64 -#else -#define W64LIT(x) x##ULL -#endif - - -#ifndef C_STATIC_ASSERT -#define C_STATIC_ASSERT(tag_name, x) \ - typedef int cache_static_assert_ ## tag_name[(x) * 2-1] -#endif - -C_STATIC_ASSERT(sizeof_Int8 , (sizeof(Int8) == 1)); -C_STATIC_ASSERT(sizeof_UInt8, (sizeof(UInt8) == 1)); - -C_STATIC_ASSERT(sizeof_Int16 , (sizeof(Int16) == 2)); -C_STATIC_ASSERT(sizeof_UInt16, (sizeof(UInt16) == 2)); - -C_STATIC_ASSERT(sizeof_Int32 , (sizeof(Int32) == 4)); -C_STATIC_ASSERT(sizeof_UInt32, (sizeof(UInt32) == 4)); - -C_STATIC_ASSERT(sizeof_Int64 , (sizeof(Int64) == 8)); -C_STATIC_ASSERT(sizeof_UInt64, (sizeof(UInt64) == 8)); - -#endif diff --git a/x64_dbg_dbg/BeaEngine/export.h b/x64_dbg_dbg/BeaEngine/export.h deleted file mode 100644 index 6abe0ec6..00000000 --- a/x64_dbg_dbg/BeaEngine/export.h +++ /dev/null @@ -1,173 +0,0 @@ -/** - * @file export.h - * @author igor.gutnik@gmail.com - * @date Mon Sep 22 09:28:54 2008 - * - * @brief This file sets things up for C dynamic library function definitions and - * static inlined functions - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -#ifndef __BEA_EXPORT_H__ -#define __BEA_EXPORT_H__ - - -/* Set up for C function definitions, even when using C++ */ - -#ifdef __cplusplus -#define CPP_VISIBLE_BEGIN extern "C" { -#define CPP_VISIBLE_END } -#else -#define CPP_VISIBLE_BEGIN -#define CPP_VISIBLE_END -#endif - -#if defined(_MSC_VER) -#pragma warning( disable: 4251 ) -#endif - -/* Some compilers use a special export keyword */ -#ifndef bea__api_export__ -# if defined(__BEOS__) -# if defined(__GNUC__) -# define bea__api_export__ __declspec(dllexport) -# else -# define bea__api_export__ __declspec(export) -# endif -# elif defined(_WIN32) || defined(_WIN64) -# ifdef __BORLANDC__ -# define bea__api_export__ __declspec(dllexport) -# define bea__api_import__ __declspec(dllimport) -# elif defined(__WATCOMC__) -# define bea__api_export__ __declspec(dllexport) -# define bea__api_import__ -# else -# define bea__api_export__ __declspec(dllexport) -# define bea__api_import__ __declspec(dllimport) -# endif -# elif defined(__OS2__) -# ifdef __WATCOMC__ -# define bea__api_export__ __declspec(dllexport) -# define bea__api_import__ -# else -# define bea__api_export__ -# define bea__api_import__ -# endif -# else -# if defined(_WIN32) && defined(__GNUC__) && __GNUC__ >= 4 -# define bea__api_export__ __attribubea__ ((visibility("default"))) -# define bea__api_import__ __attribubea__ ((visibility("default"))) -# else -# define bea__api_export__ -# define bea__api_import__ -# endif -# endif -#endif - -/* Use C calling convention by default*/ - -#ifndef __bea_callspec__ -#if defined(BEA_USE_STDCALL) -#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32) || defined(_WIN64) -#if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__) || defined(__POCC__) -#define __bea_callspec__ __stdcall -#else -#define __bea_callspec__ -#endif -#else -#ifdef __OS2__ -#define __bea_callspec__ _System -#else -#define __bea_callspec__ -#endif -#endif -#else -#define __bea_callspec__ -#endif -#endif - -#ifdef __SYMBIAN32__ -# ifndef EKA2 -# undef bea__api_export__ -# undef bea__api_import__ -# define bea__api_export__ -# define bea__api_import__ -# elif !defined(__WINS__) -# undef bea__api_export__ -# undef bea__api_import__ -# define bea__api_export__ __declspec(dllexport) -# define bea__api_import__ __declspec(dllexport) -# endif /* !EKA2 */ -#endif /* __SYMBIAN32__ */ - - -#if defined(__GNUC__) && (__GNUC__ > 2) -#define BEA_EXPECT_CONDITIONAL(c) (__builtin_expect((c), 1)) -#define BEA_UNEXPECT_CONDITIONAL(c) (__builtin_expect((c), 0)) -#else -#define BEA_EXPECT_CONDITIONAL(c) (c) -#define BEA_UNEXPECT_CONDITIONAL(c) (c) -#endif - - -/* Set up compiler-specific options for inlining functions */ -#ifndef BEA_HAS_INLINE -#if defined(__GNUC__) || defined(__POCC__) || defined(__WATCOMC__) || defined(__SUNPRO_C) -#define BEA_HAS_INLINE -#else -/* Add any special compiler-specific cases here */ -#if defined(_MSC_VER) || defined(__BORLANDC__) || \ - defined(__DMC__) || defined(__SC__) || \ - defined(__WATCOMC__) || defined(__LCC__) || \ - defined(__DECC) || defined(__EABI__) -#ifndef __inline__ -#define __inline__ __inline -#endif -#define BEA_HAS_INLINE -#else -#if !defined(__MRC__) && !defined(_SGI_SOURCE) -#ifndef __inline__ -#define __inline__ inline -#endif -#define BEA_HAS_INLINE -#endif /* Not a funky compiler */ -#endif /* Visual C++ */ -#endif /* GNU C */ -#endif /* CACHE_HAS_INLINE */ - -/* If inlining isn't supported, remove "__inline__", turning static - inlined functions into static functions (resulting in code bloat - in all files which include the offending header files) -*/ -#ifndef BEA_HAS_INLINE -#define __inline__ -#endif - -/* fix a bug with gcc under windows */ - -#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32) || defined(_WIN64) -#if defined(__MINGW32__) -#define const__ -#else -#define const__ const -#endif -#else -#define const__ const -#endif - - - -#endif diff --git a/x64_dbg_dbg/BeaEngine/libBeaEngine.a b/x64_dbg_dbg/BeaEngine/libBeaEngine.a deleted file mode 100644 index a25284efe1e3d3246b752ddf1beaaa4283961b16..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3638 zcmeH~OK;Oa5XZ-H+k~_{gb*O$V5A~(K*mX1CzUExAwV2@La0X^mpHXanxZB=4jef2 z1N0;HL-2VhGqVqG;&l^{TB#B%Wgj#D?s{i`J9Zy$#YZ307xm}fWNECmo2|7VXtg{q zV3%2YUSm^?J+D&-fEs{P0dS82mfnhA?H8Kyw~V&s<0u+rdoPpt^>9BMCQ%$^!}uV9 zC`yyKJLQAuRW^!82k6ZXK1X__|9m$&8fAw= z2*NP*yp484hN@HFah7oN0FNAio7`J;{BiPq%>DApgP`Mg<8fRrVb3-Mr~ck(G(!eI zNte-ttLsX;fSm<=F0=4_Lbsvpq^p(dT1s~dJ1Z8Q^6QxU-N68jelHs&()s%gVBhJ* zePxh#GgdUUJ2gMa%s3%pc8w7uw@hQihxY6`R8JNeLypZNy3WyXTnDa-?P_ zO$8oeU2+HNL}2)7`9ce6DkE9yU`>P$Aj3NAQH0iUv0YXX3w`9S%US!~S5V%TgK zSp0#HHH*df#u;8Fiyw@2&toyQ>k2F$*>##l$}{t_=z#tXP+w_Rgh`@I5l8_M1l}bx zmYhjn7`Vophiz2YvZT~vw|(wvUV}M#UCY0{cN}r6|MR-~PrO3TtNxeZYUEG?u*mB@ Z=F;RfkQQnx@CNIgSH0zFU=4?j*gwMs$AbU> diff --git a/x64_dbg_dbg/BeaEngine/libBeaEngine_64.a b/x64_dbg_dbg/BeaEngine/libBeaEngine_64.a deleted file mode 100644 index fef9e28c681b47f6bb3ffef13e233af74c6b2488..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3676 zcmeH~OK;Oa5XUERTS_P|sUQvr8L1qQD&xG|AR!bXKpZPnaY8sQaca{ft&;E%;?M)? zi9@66BR&HX3A=za9G^2knGwce_2)LqwW z*|y75W^3Ek7EZ8rDgdwyP{Pjo0kE_se#^hmjlU~D>F4|Xc>7rxycq7p!_fB{e&EN$ zU=V^Ig+Vtv3(wBVdCs1yD!>z z6+_{9w%vSO)BEloF5#X5)^O|Bd9(=5B>XbradBhAX2#KJu$rS&^Qza8ce?#PI-OqJ59Q?V6M&sk zFW6NM={I9WOITCukj#u%xkzKg$|}+raav#vMIdc5mK>u+oU%%V8jcT9V3n?=Zz8W~ z4KmV{;U2cdZvwIyorOiOnPt(#*io)9`~RB78b1a$tMoMZTz6z%DK~j6D!thoI?c8@ zug0WPh!cxyqw?=#02Zp&X4f4ZTV9akwiy%ttEHw8?WIn4>EQrub4! z6EmxUc;*b#ELL<{dT!OIsh4>1Zx}}Uu;g(} zZ{s@7Z%Ll0v%#ISreX~=>IAKjX9r2G)HRTz)WF5w8S6r#OV!jCYNC9d=9u=;M$IT+ zN5N;KIJ}Y?>B7!FK6yY_M@NY-8I{%d6J3;9T1#a6GL8f-f(*QrTxaTVw(5czJFc-H z$>J!{3YPLD^;3Cx=P4d}kCbuCcwTXq5Il-!2B7y$cy8iISs5PUFm*&I!nK0cm8q=G zOJyBD_iUX?_fSyz9kVct%C|-~&y&iYvF>S9?&s?=RDR9ZX)3AeoR!KF=<|U(!CeqK zi8#d~1xB!Vi`-}lo$JEEExv=;XLc-b&AJQD!HQdVZf=v4`G0QpiTAI#HL|GxIb4jY fN+4#rz0G`@+&a=jT^U|ts{z$Jo&q=V7m)i0{OQXK diff --git a/x64_dbg_dbg/BeaEngine/macros.h b/x64_dbg_dbg/BeaEngine/macros.h deleted file mode 100644 index 48940b00..00000000 --- a/x64_dbg_dbg/BeaEngine/macros.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef __BEAENGINE_MACROS_H__ -#define __BEAENGINE_MACROS_H__ -/* -============================================================================ - Compiler Silencing macros - - Some compilers complain about parameters that are not used. This macro - should keep them quiet. - ============================================================================ - */ - -# if defined (__GNUC__) && ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))) -# define BEA_UNUSED_ARG(a) (void) (a) -#elif defined (ghs) || defined (__GNUC__) || defined (__hpux) || defined (__sgi) || defined (__DECCXX) || defined (__rational__) || defined (__USLC__) || defined (BEA__RM544) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) || defined(__BORLANDC__) -/* - Some compilers complain about "statement with no effect" with (a). - This eliminates the warnings, and no code is generated for the null - conditional statement. Note, that may only be true if -O is enabled, - such as with GreenHills (ghs) 1.8.8. - */ - -# define BEA_UNUSED_ARG(a) do {/* null */} while (&a == 0) -#elif defined (__DMC__) -#if defined(__cplusplus) -#define BEA_UNUSED_ID(identifier) -template -inline void BEA_UNUSED_ARG(const T & BEA_UNUSED_ID(t)) { } -#else -#define BEA_UNUSED_ARG(a) -#endif -#else /* ghs || __GNUC__ || ..... */ -# define BEA_UNUSED_ARG(a) (a) -#endif /* ghs || __GNUC__ || ..... */ - -#if defined (_MSC_VER) || defined(__sgi) || defined (ghs) || defined (__DECCXX) || defined(__BORLANDC__) || defined (BEA_RM544) || defined (__USLC__) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) || (defined (__HP_aCC) && (__HP_aCC >= 60500)) -# define BEA_NOTREACHED(a) -#else /* __sgi || ghs || ..... */ -# define BEA_NOTREACHED(a) a -#endif /* __sgi || ghs || ..... */ - -#endif /* __BEAENGINE_MACROS_H__ */ diff --git a/x64_dbg_dbg/_exports.cpp b/x64_dbg_dbg/_exports.cpp index 3abb5001..ec9d89cb 100644 --- a/x64_dbg_dbg/_exports.cpp +++ b/x64_dbg_dbg/_exports.cpp @@ -794,23 +794,10 @@ extern "C" DLL_EXPORT uint _dbg_sendmessage(DBGMSG type, void* param1, void* par { if(!param1 or !param2) return 0; - unsigned char data[16]; - if(!MemRead(param1, data, sizeof(data), 0)) - return 0; - DISASM disasm; - memset(&disasm, 0, sizeof(disasm)); -#ifdef _WIN64 - disasm.Archi = 64; -#endif // _WIN64 - disasm.EIP = (UIntPtr)data; - disasm.VirtualAddr = (UInt64)param1; - int len = Disasm(&disasm); - if(len == UNKNOWN_OPCODE) - len = 1; - uint i = 0; BASIC_INSTRUCTION_INFO* basicinfo = (BASIC_INSTRUCTION_INFO*)param2; - fillbasicinfo(&disasm, basicinfo); - basicinfo->size = len; + if(!disasmfast((uint)param1, basicinfo)) + basicinfo->size = 1; + return 0; } break; diff --git a/x64_dbg_dbg/capstone_wrapper.cpp b/x64_dbg_dbg/capstone_wrapper.cpp index 0484c1f9..949051d7 100644 --- a/x64_dbg_dbg/capstone_wrapper.cpp +++ b/x64_dbg_dbg/capstone_wrapper.cpp @@ -79,7 +79,10 @@ String Capstone::OperandText(int opindex) case X86_OP_IMM: { - sprintf_s(temp, "%"fext"X", op.imm); + if(InGroup(CS_GRP_JUMP) || InGroup(CS_GRP_CALL)) + sprintf_s(temp, "%"fext"X", op.imm + mInstr->size); + else + sprintf_s(temp, "%"fext"X", op.imm); result = temp; } break; @@ -160,4 +163,12 @@ bool Capstone::IsFilling() x86_insn Capstone::GetId() { return (x86_insn)mInstr->id; +} + +String Capstone::InstructionText() +{ + String result = mInstr->mnemonic; + result += " "; + result += mInstr->op_str; + return result; } \ No newline at end of file diff --git a/x64_dbg_dbg/capstone_wrapper.h b/x64_dbg_dbg/capstone_wrapper.h index 3faf9199..7d5380ba 100644 --- a/x64_dbg_dbg/capstone_wrapper.h +++ b/x64_dbg_dbg/capstone_wrapper.h @@ -23,6 +23,7 @@ public: const cs_x86 & x86(); bool IsFilling(); x86_insn GetId(); + String InstructionText(); private: csh mHandle; diff --git a/x64_dbg_dbg/disasm_fast.cpp b/x64_dbg_dbg/disasm_fast.cpp index 2af0da12..1ce15c0c 100644 --- a/x64_dbg_dbg/disasm_fast.cpp +++ b/x64_dbg_dbg/disasm_fast.cpp @@ -24,79 +24,64 @@ static MEMORY_SIZE argsize2memsize(int argsize) return size_byte; } -void fillbasicinfo(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo) +void fillbasicinfo(Capstone* cp, BASIC_INSTRUCTION_INFO* basicinfo) { //zero basicinfo memset(basicinfo, 0, sizeof(BASIC_INSTRUCTION_INFO)); //copy instruction text - strcpy_s(basicinfo->instruction, disasm->CompleteInstr); - //find immidiat - if(disasm->Instruction.BranchType == 0) //no branch - { - if((disasm->Argument1.ArgType & CONSTANT_TYPE) == CONSTANT_TYPE) - { - basicinfo->type |= TYPE_VALUE; - basicinfo->value.value = (ULONG_PTR)disasm->Instruction.Immediat; - basicinfo->value.size = argsize2memsize(disasm->Argument1.ArgSize); - } - else if((disasm->Argument2.ArgType & CONSTANT_TYPE) == CONSTANT_TYPE) - { - basicinfo->type |= TYPE_VALUE; - basicinfo->value.value = (ULONG_PTR)disasm->Instruction.Immediat; - basicinfo->value.size = argsize2memsize(disasm->Argument2.ArgSize); - } - } - else //branch + strcpy_s(basicinfo->instruction, cp->InstructionText().c_str()); + //instruction size + basicinfo->size = cp->Size(); + //branch/call info + if(cp->InGroup(CS_GRP_CALL)) { basicinfo->branch = true; - if(disasm->Instruction.BranchType == CallType) - basicinfo->call = true; - if(disasm->Instruction.BranchType == RetType) - basicinfo->branch = false; + basicinfo->call = true; } - //find memory displacement - if((disasm->Argument1.ArgType & MEMORY_TYPE) == MEMORY_TYPE) + else if(cp->InGroup(CS_GRP_JUMP)) { - if(disasm->Argument1.Memory.Displacement) + basicinfo->branch = true; + } + //handle operands + for(int i = 0; i < cp->x86().op_count; i++) + { + const cs_x86_op & op = cp->x86().operands[i]; + switch(op.type) { - basicinfo->type |= TYPE_MEMORY; - basicinfo->memory.value = (ULONG_PTR)disasm->Argument1.Memory.Displacement; - strcpy_s(basicinfo->memory.mnemonic, disasm->Argument1.ArgMnemonic); + case CS_OP_IMM: + { + if(basicinfo->branch) + { + basicinfo->type |= TYPE_ADDR; + basicinfo->addr = (duint)op.imm; + basicinfo->value.value = (duint)op.imm + basicinfo->size; + } + else + { + basicinfo->type |= TYPE_VALUE; + basicinfo->value.size = (VALUE_SIZE)op.size; + basicinfo->value.value = (duint)op.imm; + } } - basicinfo->memory.size = argsize2memsize(disasm->Argument1.ArgSize); - } - if((disasm->Argument2.ArgType & MEMORY_TYPE) == MEMORY_TYPE) - { - if(disasm->Argument2.Memory.Displacement) + break; + + case CS_OP_MEM: { - basicinfo->type |= TYPE_MEMORY; - basicinfo->memory.value = (ULONG_PTR)disasm->Argument2.Memory.Displacement; - strcpy_s(basicinfo->memory.mnemonic, disasm->Argument2.ArgMnemonic); + const x86_op_mem & mem = op.mem; + strcpy_s(basicinfo->memory.mnemonic, cp->InstructionText().c_str()); + basicinfo->memory.size = (MEMORY_SIZE)op.size; + if(op.mem.base == X86_REG_RIP) //rip-relative + { + basicinfo->memory.value = (ULONG_PTR)(cp->GetInstr()->address + op.mem.disp + basicinfo->size); + basicinfo->type |= TYPE_MEMORY; + } + else if(mem.disp) + { + basicinfo->type |= TYPE_MEMORY; + basicinfo->memory.value = (ULONG_PTR)mem.disp; + } } - basicinfo->memory.size = argsize2memsize(disasm->Argument2.ArgSize); - } - //find address value - if(disasm->Instruction.BranchType && disasm->Instruction.AddrValue) - { - basicinfo->type |= TYPE_ADDR; - basicinfo->addr = (ULONG_PTR)disasm->Instruction.AddrValue; - } - //rip-relative (non-branch) - if(disasm->Instruction.BranchType == 0) - { - if((disasm->Argument1.ArgType & RELATIVE_) == RELATIVE_) - { - basicinfo->type |= TYPE_MEMORY; - basicinfo->memory.value = (ULONG_PTR)disasm->Instruction.AddrValue; - strcpy_s(basicinfo->memory.mnemonic, disasm->Argument1.ArgMnemonic); - basicinfo->memory.size = argsize2memsize(disasm->Argument1.ArgSize); - } - else if((disasm->Argument2.ArgType & RELATIVE_) == RELATIVE_) - { - basicinfo->type |= TYPE_MEMORY; - basicinfo->memory.value = (ULONG_PTR)disasm->Instruction.AddrValue; - strcpy_s(basicinfo->memory.mnemonic, disasm->Argument2.ArgMnemonic); - basicinfo->memory.size = argsize2memsize(disasm->Argument2.ArgSize); + break; } } } @@ -105,18 +90,14 @@ bool disasmfast(unsigned char* data, uint addr, BASIC_INSTRUCTION_INFO* basicinf { if(!data or !basicinfo) return false; - DISASM disasm; - memset(&disasm, 0, sizeof(disasm)); -#ifdef _WIN64 - disasm.Archi = 64; -#endif // _WIN64 - disasm.EIP = (UIntPtr)data; - disasm.VirtualAddr = (UInt64)addr; - int len = Disasm(&disasm); - if(len == UNKNOWN_OPCODE) + Capstone cp; + if(!cp.Disassemble(addr, data, MAX_DISASM_BUFFER)) + { + strcpy_s(basicinfo->instruction, "???"); + basicinfo->size = 1; return false; - fillbasicinfo(&disasm, basicinfo); - basicinfo->size = len; + } + fillbasicinfo(&cp, basicinfo); return true; } diff --git a/x64_dbg_dbg/disasm_fast.h b/x64_dbg_dbg/disasm_fast.h index 10e19325..1d087788 100644 --- a/x64_dbg_dbg/disasm_fast.h +++ b/x64_dbg_dbg/disasm_fast.h @@ -2,9 +2,9 @@ #define _DISASM_FAST_H #include "_global.h" -#include "BeaEngine\BeaEngine.h" +#include "capstone_wrapper.h" -void fillbasicinfo(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo); +void fillbasicinfo(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo); bool disasmfast(uint addr, BASIC_INSTRUCTION_INFO* basicinfo); bool disasmfast(unsigned char* data, uint addr, BASIC_INSTRUCTION_INFO* basicinfo); diff --git a/x64_dbg_dbg/instruction.cpp b/x64_dbg_dbg/instruction.cpp index 72f45acc..6f498359 100644 --- a/x64_dbg_dbg/instruction.cpp +++ b/x64_dbg_dbg/instruction.cpp @@ -812,7 +812,7 @@ struct VALUERANGE uint end; }; -static bool cbRefFind(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo) +static bool cbRefFind(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo) { if(!disasm || !basicinfo) //initialize { @@ -847,14 +847,14 @@ static bool cbRefFind(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO if(found) { char addrText[20] = ""; - sprintf(addrText, "%p", disasm->VirtualAddr); + sprintf(addrText, "%p", disasm->Address()); GuiReferenceSetRowCount(refinfo->refcount + 1); GuiReferenceSetCellContent(refinfo->refcount, 0, addrText); char disassembly[GUI_MAX_DISASSEMBLY_SIZE] = ""; - if(GuiGetDisassembly((duint)disasm->VirtualAddr, disassembly)) + if(GuiGetDisassembly((duint)disasm->Address(), disassembly)) GuiReferenceSetCellContent(refinfo->refcount, 1, disassembly); else - GuiReferenceSetCellContent(refinfo->refcount, 1, disasm->CompleteInstr); + GuiReferenceSetCellContent(refinfo->refcount, 1, disasm->InstructionText().c_str()); } return found; } @@ -905,7 +905,7 @@ CMDRESULT cbInstrRefFindRange(int argc, char* argv[]) return STATUS_CONTINUE; } -bool cbRefStr(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo) +bool cbRefStr(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo) { if(!disasm || !basicinfo) //initialize { @@ -935,14 +935,14 @@ bool cbRefStr(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinf if(found) { char addrText[20] = ""; - sprintf(addrText, "%p", disasm->VirtualAddr); + sprintf(addrText, "%p", disasm->Address()); GuiReferenceSetRowCount(refinfo->refcount + 1); GuiReferenceSetCellContent(refinfo->refcount, 0, addrText); char disassembly[4096] = ""; - if(GuiGetDisassembly((duint)disasm->VirtualAddr, disassembly)) + if(GuiGetDisassembly((duint)disasm->Address(), disassembly)) GuiReferenceSetCellContent(refinfo->refcount, 1, disassembly); else - GuiReferenceSetCellContent(refinfo->refcount, 1, disasm->CompleteInstr); + GuiReferenceSetCellContent(refinfo->refcount, 1, disasm->InstructionText().c_str()); char dispString[1024] = ""; if(strtype == str_ascii) sprintf(dispString, "\"%s\"", string); @@ -1233,7 +1233,7 @@ CMDRESULT cbInstrFindAll(int argc, char* argv[]) return STATUS_CONTINUE; } -static bool cbModCallFind(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo) +static bool cbModCallFind(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo) { if(!disasm || !basicinfo) //initialize { @@ -1253,14 +1253,14 @@ static bool cbModCallFind(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REF if(found) { char addrText[20] = ""; - sprintf(addrText, "%p", disasm->VirtualAddr); + sprintf(addrText, "%p", disasm->Address()); GuiReferenceSetRowCount(refinfo->refcount + 1); GuiReferenceSetCellContent(refinfo->refcount, 0, addrText); char disassembly[GUI_MAX_DISASSEMBLY_SIZE] = ""; - if(GuiGetDisassembly((duint)disasm->VirtualAddr, disassembly)) + if(GuiGetDisassembly((duint)disasm->Address(), disassembly)) GuiReferenceSetCellContent(refinfo->refcount, 1, disassembly); else - GuiReferenceSetCellContent(refinfo->refcount, 1, disasm->CompleteInstr); + GuiReferenceSetCellContent(refinfo->refcount, 1, disasm->InstructionText().c_str()); } return found; } @@ -1488,7 +1488,7 @@ CMDRESULT cbInstrSleep(int argc, char* argv[]) return STATUS_CONTINUE; } -static bool cbFindAsm(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo) +static bool cbFindAsm(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo) { if(!disasm || !basicinfo) //initialize { @@ -1503,14 +1503,14 @@ static bool cbFindAsm(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO if(found) { char addrText[20] = ""; - sprintf(addrText, "%p", disasm->VirtualAddr); + sprintf(addrText, "%p", disasm->Address()); GuiReferenceSetRowCount(refinfo->refcount + 1); GuiReferenceSetCellContent(refinfo->refcount, 0, addrText); char disassembly[GUI_MAX_DISASSEMBLY_SIZE] = ""; - if(GuiGetDisassembly((duint)disasm->VirtualAddr, disassembly)) + if(GuiGetDisassembly((duint)disasm->Address(), disassembly)) GuiReferenceSetCellContent(refinfo->refcount, 1, disassembly); else - GuiReferenceSetCellContent(refinfo->refcount, 1, disasm->CompleteInstr); + GuiReferenceSetCellContent(refinfo->refcount, 1, disasm->InstructionText().c_str()); } return found; } diff --git a/x64_dbg_dbg/reference.cpp b/x64_dbg_dbg/reference.cpp index 11ca2bff..6a062faa 100644 --- a/x64_dbg_dbg/reference.cpp +++ b/x64_dbg_dbg/reference.cpp @@ -59,14 +59,8 @@ int RefFind(uint Address, uint Size, CBREF Callback, void* UserData, bool Silent sprintf_s(fullName, "%s (%p)", Name, scanStart); // Initialize the disassembler - DISASM disasm; - memset(&disasm, 0, sizeof(disasm)); - -#ifdef _WIN64 - disasm.Archi = 64; -#endif // _WIN64 - disasm.EIP = (UIntPtr)data; - disasm.VirtualAddr = (UInt64)scanStart; + Capstone cp; + unsigned char* dataptr = data(); // Allow an "initialization" notice REFINFO refInfo; @@ -90,16 +84,15 @@ int RefFind(uint Address, uint Size, CBREF Callback, void* UserData, bool Silent } // Disassemble the instruction - int len = Disasm(&disasm); - - if(len != UNKNOWN_OPCODE) + int len; + if(cp.Disassemble(scanStart, dataptr, MAX_DISASM_BUFFER)) { BASIC_INSTRUCTION_INFO basicinfo; - fillbasicinfo(&disasm, &basicinfo); - basicinfo.size = len; + fillbasicinfo(&cp, &basicinfo); - if(Callback(&disasm, &basicinfo, &refInfo)) + if(Callback(&cp, &basicinfo, &refInfo)) refInfo.refcount++; + len = cp.Size(); } else { @@ -107,8 +100,8 @@ int RefFind(uint Address, uint Size, CBREF Callback, void* UserData, bool Silent len = 1; } - disasm.EIP += len; - disasm.VirtualAddr += len; + dataptr += len; + scanStart += len; i += len; } diff --git a/x64_dbg_dbg/reference.h b/x64_dbg_dbg/reference.h index f7a9a48b..69023120 100644 --- a/x64_dbg_dbg/reference.h +++ b/x64_dbg_dbg/reference.h @@ -11,6 +11,6 @@ struct REFINFO }; // Reference callback typedef -typedef bool (*CBREF)(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo); +typedef bool (*CBREF)(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo); int RefFind(uint Address, uint Size, CBREF Callback, void* UserData, bool Silent, const char* Name); \ No newline at end of file diff --git a/x64_dbg_dbg/stackinfo.cpp b/x64_dbg_dbg/stackinfo.cpp index 168c9c25..a8a71782 100644 --- a/x64_dbg_dbg/stackinfo.cpp +++ b/x64_dbg_dbg/stackinfo.cpp @@ -31,14 +31,6 @@ bool stackcommentget(uint addr, STACK_COMMENT* comment) uint prev = disasmback(disasmData, 0, sizeof(disasmData), data - readStart, 1); uint previousInstr = readStart + prev; - DISASM disasm; - disasm.Options = NoformatNumeral | ShowSegmentRegs; -#ifdef _WIN64 - disasm.Archi = 64; -#endif // _WIN64 - disasm.VirtualAddr = previousInstr; - disasm.EIP = (UIntPtr)(disasmData + prev); - int len = Disasm(&disasm); BASIC_INSTRUCTION_INFO basicinfo; bool valid = disasmfast(disasmData + prev, previousInstr, &basicinfo); if(valid && basicinfo.call) //call diff --git a/x64_dbg_dbg/x64_dbg_dbg.vcxproj b/x64_dbg_dbg/x64_dbg_dbg.vcxproj index bbb62f5f..b1e92474 100644 --- a/x64_dbg_dbg/x64_dbg_dbg.vcxproj +++ b/x64_dbg_dbg/x64_dbg_dbg.vcxproj @@ -68,10 +68,6 @@ - - - - @@ -254,7 +250,7 @@ Windows true true - capstone\capstone_x86.lib;yara\yara_x86.lib;lz4\lz4_x86.lib;jansson\jansson_x86.lib;DeviceNameResolver\DeviceNameResolver_x86.lib;XEDParse\XEDParse_x86.lib;$(SolutionDir)bin\x32\x32bridge.lib;dbghelp\dbghelp_x86.lib;TitanEngine\TitanEngine_x86.lib;BeaEngine\BeaEngine.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) + capstone\capstone_x86.lib;yara\yara_x86.lib;lz4\lz4_x86.lib;jansson\jansson_x86.lib;DeviceNameResolver\DeviceNameResolver_x86.lib;XEDParse\XEDParse_x86.lib;$(SolutionDir)bin\x32\x32bridge.lib;dbghelp\dbghelp_x86.lib;TitanEngine\TitanEngine_x86.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) @@ -275,7 +271,7 @@ Windows false false - capstone\capstone_x86.lib;yara\yara_x86.lib;lz4\lz4_x86.lib;jansson\jansson_x86.lib;DeviceNameResolver\DeviceNameResolver_x86.lib;XEDParse\XEDParse_x86.lib;$(SolutionDir)bin\x32\x32bridge.lib;dbghelp\dbghelp_x86.lib;TitanEngine\TitanEngine_x86.lib;BeaEngine\BeaEngine.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) + capstone\capstone_x86.lib;yara\yara_x86.lib;lz4\lz4_x86.lib;jansson\jansson_x86.lib;DeviceNameResolver\DeviceNameResolver_x86.lib;XEDParse\XEDParse_x86.lib;$(SolutionDir)bin\x32\x32bridge.lib;dbghelp\dbghelp_x86.lib;TitanEngine\TitanEngine_x86.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) @@ -302,7 +298,7 @@ Windows true true - capstone\capstone_x64.lib;yara\yara_x64.lib;lz4\lz4_x64.lib;jansson\jansson_x64.lib;DeviceNameResolver\DeviceNameResolver_x64.lib;XEDParse\XEDParse_x64.lib;$(SolutionDir)bin\x64\x64bridge.lib;dbghelp\dbghelp_x64.lib;TitanEngine\TitanEngine_x64.lib;BeaEngine\BeaEngine_64.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) + capstone\capstone_x64.lib;yara\yara_x64.lib;lz4\lz4_x64.lib;jansson\jansson_x64.lib;DeviceNameResolver\DeviceNameResolver_x64.lib;XEDParse\XEDParse_x64.lib;$(SolutionDir)bin\x64\x64bridge.lib;dbghelp\dbghelp_x64.lib;TitanEngine\TitanEngine_x64.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) @@ -326,7 +322,7 @@ Windows false false - capstone\capstone_x64.lib;yara\yara_x64.lib;lz4\lz4_x64.lib;jansson\jansson_x64.lib;DeviceNameResolver\DeviceNameResolver_x64.lib;XEDParse\XEDParse_x64.lib;$(SolutionDir)bin\x64\x64bridge.lib;dbghelp\dbghelp_x64.lib;TitanEngine\TitanEngine_x64.lib;BeaEngine\BeaEngine_64.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) + capstone\capstone_x64.lib;yara\yara_x64.lib;lz4\lz4_x64.lib;jansson\jansson_x64.lib;DeviceNameResolver\DeviceNameResolver_x64.lib;XEDParse\XEDParse_x64.lib;$(SolutionDir)bin\x64\x64bridge.lib;dbghelp\dbghelp_x64.lib;TitanEngine\TitanEngine_x64.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) diff --git a/x64_dbg_dbg/x64_dbg_dbg.vcxproj.filters b/x64_dbg_dbg/x64_dbg_dbg.vcxproj.filters index 49e65c8a..bb970c8d 100644 --- a/x64_dbg_dbg/x64_dbg_dbg.vcxproj.filters +++ b/x64_dbg_dbg/x64_dbg_dbg.vcxproj.filters @@ -40,9 +40,6 @@ {6b85ff77-8866-4618-9d46-006d8c349f8f} - - {6028af23-e8de-4db7-b1c7-bee2b5a4402b} - {5623fb24-3b6d-49a6-a0d3-1cfcc46f87bd} @@ -224,18 +221,6 @@ Header Files - - Header Files\Third Party\BeaEngine - - - Header Files\Third Party\BeaEngine - - - Header Files\Third Party\BeaEngine - - - Header Files\Third Party\BeaEngine - Header Files\Third Party\dbghelp