1
0
Fork 0

DBG: added struct alignment check for TitanEngine + updated TitanEngine

This commit is contained in:
Mr. eXoDia 2014-12-08 15:22:51 +01:00
parent 7353c57278
commit 8afd1d4bf4
6 changed files with 70 additions and 65 deletions

View File

@ -35,6 +35,9 @@ typedef struct DECLSPEC_ALIGN(16) _M128A
#define UE_STRUCT_HOOK_ENTRY 11 #define UE_STRUCT_HOOK_ENTRY 11
#define UE_STRUCT_FILE_STATUS_INFO 12 #define UE_STRUCT_FILE_STATUS_INFO 12
#define UE_STRUCT_FILE_FIX_INFO 13 #define UE_STRUCT_FILE_FIX_INFO 13
#define UE_STRUCT_X87FPUREGISTER 14
#define UE_STRUCT_X87FPU 15
#define UE_STRUCT_TITAN_ENGINE_CONTEXT 16
#define UE_ACCESS_READ 0 #define UE_ACCESS_READ 0
#define UE_ACCESS_WRITE 1 #define UE_ACCESS_WRITE 1
@ -326,71 +329,6 @@ typedef struct DECLSPEC_ALIGN(16) _M128A
#define CONTEXT_EXTENDED_REGISTERS 0 #define CONTEXT_EXTENDED_REGISTERS 0
#endif #endif
typedef struct
{
BYTE data[10];
int st_value;
int tag;
} x87FPURegister_t;
typedef struct
{
WORD ControlWord;
WORD StatusWord;
WORD TagWord;
DWORD ErrorOffset;
DWORD ErrorSelector;
DWORD DataOffset;
DWORD DataSelector;
DWORD Cr0NpxState;
} x87FPU_t;
typedef struct
{
ULONG_PTR cax;
ULONG_PTR ccx;
ULONG_PTR cdx;
ULONG_PTR cbx;
ULONG_PTR csp;
ULONG_PTR cbp;
ULONG_PTR csi;
ULONG_PTR cdi;
#ifdef _WIN64
ULONG_PTR r8;
ULONG_PTR r9;
ULONG_PTR r10;
ULONG_PTR r11;
ULONG_PTR r12;
ULONG_PTR r13;
ULONG_PTR r14;
ULONG_PTR r15;
#endif //_WIN64
ULONG_PTR cip;
ULONG_PTR eflags;
unsigned short gs;
unsigned short fs;
unsigned short es;
unsigned short ds;
unsigned short cs;
unsigned short ss;
ULONG_PTR dr0;
ULONG_PTR dr1;
ULONG_PTR dr2;
ULONG_PTR dr3;
ULONG_PTR dr6;
ULONG_PTR dr7;
BYTE RegisterArea[80];
x87FPU_t x87fpu;
DWORD MxCsr;
#ifdef _WIN64
M128A XmmRegisters[16];
BYTE YmmRegisters[32 * 16];
#else // x86
M128A XmmRegisters[8];
BYTE YmmRegisters[32 * 8];
#endif
} TITAN_ENGINE_CONTEXT_t;
typedef struct typedef struct
{ {
DWORD PE32Offset; DWORD PE32Offset;
@ -656,6 +594,71 @@ typedef struct
DWORD OriginalCOMTableSize; DWORD OriginalCOMTableSize;
} FILE_FIX_INFO, *PFILE_FIX_INFO; } FILE_FIX_INFO, *PFILE_FIX_INFO;
typedef struct
{
BYTE data[10];
int st_value;
int tag;
} x87FPURegister_t;
typedef struct
{
WORD ControlWord;
WORD StatusWord;
WORD TagWord;
DWORD ErrorOffset;
DWORD ErrorSelector;
DWORD DataOffset;
DWORD DataSelector;
DWORD Cr0NpxState;
} x87FPU_t;
typedef struct
{
ULONG_PTR cax;
ULONG_PTR ccx;
ULONG_PTR cdx;
ULONG_PTR cbx;
ULONG_PTR csp;
ULONG_PTR cbp;
ULONG_PTR csi;
ULONG_PTR cdi;
#ifdef _WIN64
ULONG_PTR r8;
ULONG_PTR r9;
ULONG_PTR r10;
ULONG_PTR r11;
ULONG_PTR r12;
ULONG_PTR r13;
ULONG_PTR r14;
ULONG_PTR r15;
#endif //_WIN64
ULONG_PTR cip;
ULONG_PTR eflags;
unsigned short gs;
unsigned short fs;
unsigned short es;
unsigned short ds;
unsigned short cs;
unsigned short ss;
ULONG_PTR dr0;
ULONG_PTR dr1;
ULONG_PTR dr2;
ULONG_PTR dr3;
ULONG_PTR dr6;
ULONG_PTR dr7;
BYTE RegisterArea[80];
x87FPU_t x87fpu;
DWORD MxCsr;
#ifdef _WIN64
M128A XmmRegisters[16];
BYTE YmmRegisters[32 * 16];
#else // x86
M128A XmmRegisters[8];
BYTE YmmRegisters[32 * 8];
#endif
} TITAN_ENGINE_CONTEXT_t;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {

View File

@ -228,6 +228,8 @@ static void efree_json(void* ptr)
extern "C" DLL_EXPORT const char* _dbg_dbginit() extern "C" DLL_EXPORT const char* _dbg_dbginit()
{ {
if(!EngineCheckStructAlignment(UE_STRUCT_TITAN_ENGINE_CONTEXT, sizeof(TITAN_ENGINE_CONTEXT_t)))
return "Invalid TITAN_ENGINE_CONTEXT_t alignment!";
dbginit(); dbginit();
dbgfunctionsinit(); dbgfunctionsinit();
json_set_alloc_funcs(emalloc_json, efree_json); json_set_alloc_funcs(emalloc_json, efree_json);