From 7faecbe7ff1a337b3f3c2b4cedef99e639e870a6 Mon Sep 17 00:00:00 2001 From: ergrelet Date: Fri, 22 Mar 2024 00:59:04 +0100 Subject: [PATCH] Fix raw primitive flavor, use raw primitive flavor as default for resymc --- resym_core/src/pdb_types/primitive_types.rs | 8 ++--- ..._dumping__module_dumping_by_index_raw.snap | 4 +-- ...econstruction_raw_access_specifiers-0.snap | 18 +++++----- ...econstruction_raw_access_specifiers-1.snap | 6 ++-- ...construction_raw_access_specifiers-10.snap | 28 +++++++-------- ...construction_raw_access_specifiers-11.snap | 12 +++---- ...construction_raw_access_specifiers-12.snap | 4 +-- ...construction_raw_access_specifiers-13.snap | 4 +-- ...construction_raw_access_specifiers-14.snap | 4 +-- ...construction_raw_access_specifiers-15.snap | 14 ++++---- ...construction_raw_access_specifiers-17.snap | 8 ++--- ...econstruction_raw_access_specifiers-2.snap | 8 ++--- ...construction_raw_access_specifiers-21.snap | 4 +-- ...construction_raw_access_specifiers-22.snap | 16 ++++----- ...construction_raw_access_specifiers-23.snap | 2 +- ...econstruction_raw_access_specifiers-4.snap | 18 +++++----- ...econstruction_raw_access_specifiers-5.snap | 20 +++++------ ...econstruction_raw_access_specifiers-6.snap | 4 +-- ...econstruction_raw_access_specifiers-8.snap | 34 +++++++++---------- ...econstruction_raw_access_specifiers-9.snap | 20 +++++------ resymc/src/main.rs | 12 ++++--- 21 files changed, 108 insertions(+), 140 deletions(-) diff --git a/resym_core/src/pdb_types/primitive_types.rs b/resym_core/src/pdb_types/primitive_types.rs index 438d619..8968ec0 100644 --- a/resym_core/src/pdb_types/primitive_types.rs +++ b/resym_core/src/pdb_types/primitive_types.rs @@ -171,10 +171,10 @@ fn primitive_kind_as_str_raw( pdb::PrimitiveKind::I16 | pdb::PrimitiveKind::Short => Ok("short"), pdb::PrimitiveKind::U16 | pdb::PrimitiveKind::UShort => Ok("unsigned short"), - pdb::PrimitiveKind::I32 | pdb::PrimitiveKind::Long => Ok("long"), - pdb::PrimitiveKind::U32 | pdb::PrimitiveKind::ULong => Ok("unsigned long"), - pdb::PrimitiveKind::I64 | pdb::PrimitiveKind::Quad => Ok("__int64"), - pdb::PrimitiveKind::U64 | pdb::PrimitiveKind::UQuad => Ok("unsigned __int64"), + pdb::PrimitiveKind::I32 | pdb::PrimitiveKind::Long => Ok("int"), + pdb::PrimitiveKind::U32 | pdb::PrimitiveKind::ULong => Ok("unsigned int"), + pdb::PrimitiveKind::I64 | pdb::PrimitiveKind::Quad => Ok("long long int"), + pdb::PrimitiveKind::U64 | pdb::PrimitiveKind::UQuad => Ok("unsigned long long int"), pdb::PrimitiveKind::F32 => Ok("float"), pdb::PrimitiveKind::F64 => Ok("double"), diff --git a/resym_core/tests/snapshots/module_dumping__module_dumping_by_index_raw.snap b/resym_core/tests/snapshots/module_dumping__module_dumping_by_index_raw.snap index 7392ae5..2a91309 100644 --- a/resym_core/tests/snapshots/module_dumping__module_dumping_by_index_raw.snap +++ b/resym_core/tests/snapshots/module_dumping__module_dumping_by_index_raw.snap @@ -5,6 +5,6 @@ expression: module_dump using namespace std; using PUWSTR_C = const wchar_t*; using TP_CALLBACK_ENVIRON_V3 = _TP_CALLBACK_ENVIRON_V3; -unsigned __int64* (__local_stdio_scanf_options)(); // CodeSize=8 -unsigned __int64 _OptionsStorage; +unsigned long long int* (__local_stdio_scanf_options)(); // CodeSize=8 +unsigned long long int _OptionsStorage; void (__scrt_initialize_default_local_stdio_options)(); // CodeSize=69 diff --git a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-0.snap b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-0.snap index 78abcc8..0774ffe 100644 --- a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-0.snap +++ b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-0.snap @@ -2,7 +2,6 @@ source: resym_core/tests/type_reconstruction.rs expression: reconstructed_type --- - struct resym_test::PrimitiveTypesTest { /* Size=0x70 */ /* 0x0000 */ public: bool b1; /* 0x0001 */ public: char c1; @@ -13,18 +12,17 @@ struct resym_test::PrimitiveTypesTest { /* Size=0x70 */ /* 0x000c */ public: wchar_t w1; /* 0x000e */ public: unsigned short i1; /* 0x0010 */ public: short i2; - /* 0x0014 */ public: unsigned long i3; - /* 0x0018 */ public: long i4; - /* 0x001c */ public: unsigned long i5; - /* 0x0020 */ public: long i6; - /* 0x0028 */ public: unsigned __int64 i7; - /* 0x0030 */ public: __int64 i8; - /* 0x0038 */ public: unsigned __int64 i9; - /* 0x0040 */ public: __int64 i10; + /* 0x0014 */ public: unsigned int i3; + /* 0x0018 */ public: int i4; + /* 0x001c */ public: unsigned int i5; + /* 0x0020 */ public: int i6; + /* 0x0028 */ public: unsigned long long int i7; + /* 0x0030 */ public: long long int i8; + /* 0x0038 */ public: unsigned long long int i9; + /* 0x0040 */ public: long long int i10; /* 0x0048 */ public: float f1; /* 0x0050 */ public: double f2; /* 0x0058 */ public: double f3; /* 0x0060 */ public: double f4; /* 0x0068 */ public: long hres; }; - diff --git a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-1.snap b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-1.snap index 1595c70..7f7b3ac 100644 --- a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-1.snap +++ b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-1.snap @@ -2,13 +2,11 @@ source: resym_core/tests/type_reconstruction.rs expression: reconstructed_type --- - struct resym_test::ArrayTest { /* Size=0x5418 */ /* 0x0000 */ public: char array1[64]; - /* 0x0040 */ public: long array2[64]; + /* 0x0040 */ public: int array2[64]; /* 0x0140 */ public: resym_test::PrimitiveTypesTest array3[64]; /* 0x1d40 */ public: char array4[1][2][3][4][5]; - /* 0x1db8 */ public: long array5[1][2][3][4][5]; + /* 0x1db8 */ public: int array5[1][2][3][4][5]; /* 0x1f98 */ public: resym_test::PrimitiveTypesTest array6[1][2][3][4][5]; }; - diff --git a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-10.snap b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-10.snap index 65052cc..df58bee 100644 --- a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-10.snap +++ b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-10.snap @@ -2,30 +2,28 @@ source: resym_core/tests/type_reconstruction.rs expression: reconstructed_type --- - struct resym_test::StructUnnamedUdtTest3 { /* Size=0x40 */ - /* 0x0000 */ public: unsigned __int64 Before; + /* 0x0000 */ public: unsigned long long int Before; union { struct { - /* 0x0008 */ public: unsigned __int64 u1; - /* 0x0010 */ public: unsigned __int64 u2; + /* 0x0008 */ public: unsigned long long int u1; + /* 0x0010 */ public: unsigned long long int u2; }; struct { - /* 0x0008 */ public: unsigned __int64* p1; - /* 0x0010 */ public: unsigned __int64* p2; - /* 0x0018 */ public: unsigned __int64* p3; - /* 0x0020 */ public: unsigned __int64* p4; + /* 0x0008 */ public: unsigned long long int* p1; + /* 0x0010 */ public: unsigned long long int* p2; + /* 0x0018 */ public: unsigned long long int* p3; + /* 0x0020 */ public: unsigned long long int* p4; }; struct { - /* 0x0008 */ public: unsigned __int64* p5; - /* 0x0010 */ public: unsigned __int64* p6; + /* 0x0008 */ public: unsigned long long int* p5; + /* 0x0010 */ public: unsigned long long int* p6; }; }; - /* 0x0028 */ public: unsigned __int64 Middle; + /* 0x0028 */ public: unsigned long long int Middle; union { - /* 0x0030 */ public: unsigned __int64 u3; - /* 0x0030 */ public: unsigned __int64* p7; + /* 0x0030 */ public: unsigned long long int u3; + /* 0x0030 */ public: unsigned long long int* p7; }; - /* 0x0038 */ public: unsigned __int64 After; + /* 0x0038 */ public: unsigned long long int After; }; - diff --git a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-11.snap b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-11.snap index 31c6679..f8d9086 100644 --- a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-11.snap +++ b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-11.snap @@ -2,17 +2,15 @@ source: resym_core/tests/type_reconstruction.rs expression: reconstructed_type --- - union resym_test::UnionUnnamedUdtTest1 { /* Size=0x70 */ struct { - /* 0x0000 */ public: unsigned long i1; - /* 0x0004 */ public: unsigned long i2; + /* 0x0000 */ public: unsigned int i1; + /* 0x0004 */ public: unsigned int i2; }; /* 0x0000 */ public: resym_test::PrimitiveTypesTest s1; - /* 0x0000 */ public: unsigned __int64 QuadPart; + /* 0x0000 */ public: unsigned long long int QuadPart; struct { - /* 0x0000 */ public: unsigned long i11; - /* 0x0004 */ public: unsigned long i22; + /* 0x0000 */ public: unsigned int i11; + /* 0x0004 */ public: unsigned int i22; }; }; - diff --git a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-12.snap b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-12.snap index 883dcee..be82350 100644 --- a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-12.snap +++ b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-12.snap @@ -2,15 +2,13 @@ source: resym_core/tests/type_reconstruction.rs expression: reconstructed_type --- - class resym_test::PureVirtualClassSpecialized : public resym_test::PureVirtualClass { /* Size=0x8 */ /* 0x0000: fields for resym_test::PureVirtualClass */ - private: long OtherMethod(); + private: int OtherMethod(); public: PureVirtualClassSpecialized(resym_test::PureVirtualClassSpecialized&); public: PureVirtualClassSpecialized(const resym_test::PureVirtualClassSpecialized&); public: PureVirtualClassSpecialized(); public: resym_test::PureVirtualClassSpecialized& operator=(resym_test::PureVirtualClassSpecialized&); public: resym_test::PureVirtualClassSpecialized& operator=(const resym_test::PureVirtualClassSpecialized&); }; - diff --git a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-13.snap b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-13.snap index ad3f728..9ed9119 100644 --- a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-13.snap +++ b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-13.snap @@ -2,15 +2,13 @@ source: resym_core/tests/type_reconstruction.rs expression: reconstructed_type --- - class resym_test::InterfaceImplClass : public resym_test::PureVirtualClass { /* Size=0x8 */ /* 0x0000: fields for resym_test::PureVirtualClass */ - private: virtual long InterfaceVirtual(); + private: virtual int InterfaceVirtual(); public: InterfaceImplClass(resym_test::InterfaceImplClass&); public: InterfaceImplClass(const resym_test::InterfaceImplClass&); public: InterfaceImplClass(); public: resym_test::InterfaceImplClass& operator=(resym_test::InterfaceImplClass&); public: resym_test::InterfaceImplClass& operator=(const resym_test::InterfaceImplClass&); }; - diff --git a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-14.snap b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-14.snap index ca9423b..08dd957 100644 --- a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-14.snap +++ b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-14.snap @@ -2,15 +2,13 @@ source: resym_core/tests/type_reconstruction.rs expression: reconstructed_type --- - class resym_test::SpecializedInterfaceImplClass : public resym_test::PureVirtualClassSpecialized { /* Size=0x8 */ /* 0x0000: fields for resym_test::PureVirtualClassSpecialized */ - private: virtual long InterfaceVirtual(); + private: virtual int InterfaceVirtual(); public: SpecializedInterfaceImplClass(resym_test::SpecializedInterfaceImplClass&); public: SpecializedInterfaceImplClass(const resym_test::SpecializedInterfaceImplClass&); public: SpecializedInterfaceImplClass(); public: resym_test::SpecializedInterfaceImplClass& operator=(resym_test::SpecializedInterfaceImplClass&); public: resym_test::SpecializedInterfaceImplClass& operator=(const resym_test::SpecializedInterfaceImplClass&); }; - diff --git a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-15.snap b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-15.snap index a7b94dd..76a8de4 100644 --- a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-15.snap +++ b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-15.snap @@ -2,20 +2,18 @@ source: resym_core/tests/type_reconstruction.rs expression: reconstructed_type --- - class resym_test::ClassWithRefsAndStaticsTest { /* Size=0x40 */ - /* 0x0000 */ private: long& iref; - /* 0x0008 */ private: const long& ciref; - /* 0x0010 */ private: long* iptr; - /* 0x0018 */ private: const long* ciptr; + /* 0x0000 */ private: int& iref; + /* 0x0008 */ private: const int& ciref; + /* 0x0010 */ private: int* iptr; + /* 0x0018 */ private: const int* ciptr; /* 0x0020 */ private: bool& bref; /* 0x0028 */ private: const bool& cbref; /* 0x0030 */ private: bool* bptr; /* 0x0038 */ private: const bool* cbptr; - private: static long sint; + private: static int sint; private: static bool sbool; public: ClassWithRefsAndStaticsTest(); - public: void __autoclassinit2(unsigned __int64); + public: void __autoclassinit2(unsigned long long int); }; - diff --git a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-17.snap b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-17.snap index 5ca816f..3c7de57 100644 --- a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-17.snap +++ b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-17.snap @@ -2,10 +2,8 @@ source: resym_core/tests/type_reconstruction.rs expression: reconstructed_type --- - union resym_test::BitFieldsTest3 { /* Size=0x4 */ - /* 0x0000 */ public: unsigned long b1 : 1; /* BitPos=0 */ - /* 0x0000 */ public: unsigned long b2 : 1; /* BitPos=0 */ - /* 0x0000 */ public: unsigned long b3 : 30; /* BitPos=0 */ + /* 0x0000 */ public: unsigned int b1 : 1; /* BitPos=0 */ + /* 0x0000 */ public: unsigned int b2 : 1; /* BitPos=0 */ + /* 0x0000 */ public: unsigned int b3 : 30; /* BitPos=0 */ }; - diff --git a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-2.snap b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-2.snap index 4d6d8b7..163fa8f 100644 --- a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-2.snap +++ b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-2.snap @@ -2,10 +2,8 @@ source: resym_core/tests/type_reconstruction.rs expression: reconstructed_type --- - struct resym_test::BitFieldsTest1 { /* Size=0x4 */ - /* 0x0000 */ public: unsigned long b1 : 1; /* BitPos=0 */ - /* 0x0000 */ public: unsigned long b2 : 1; /* BitPos=1 */ - /* 0x0000 */ public: unsigned long b3 : 30; /* BitPos=2 */ + /* 0x0000 */ public: unsigned int b1 : 1; /* BitPos=0 */ + /* 0x0000 */ public: unsigned int b2 : 1; /* BitPos=1 */ + /* 0x0000 */ public: unsigned int b3 : 30; /* BitPos=2 */ }; - diff --git a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-21.snap b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-21.snap index 874e355..2d6102b 100644 --- a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-21.snap +++ b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-21.snap @@ -2,10 +2,8 @@ source: resym_core/tests/type_reconstruction.rs expression: reconstructed_type --- - struct resym_test::BitFieldsTest7 { /* Size=0x8 */ /* 0x0000 */ public: unsigned short b1 : 3; /* BitPos=0 */ /* 0x0000 */ unsigned short : 0; /* BitPos=3 */ - /* 0x0004 */ public: unsigned long b2 : 3; /* BitPos=0 */ + /* 0x0004 */ public: unsigned int b2 : 3; /* BitPos=0 */ }; - diff --git a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-22.snap b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-22.snap index c5e3820..d0a8109 100644 --- a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-22.snap +++ b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-22.snap @@ -2,7 +2,6 @@ source: resym_core/tests/type_reconstruction.rs expression: reconstructed_type --- - struct resym_test::NestedStructUnionRegression1 { /* Size=0x78 */ /* 0x0000 */ public: _LIST_ENTRY TransactionListEntry; /* 0x0010 */ public: resym_test::_CM_INTENT_LOCK* KCBLock; @@ -10,27 +9,27 @@ struct resym_test::NestedStructUnionRegression1 { /* Size=0x78 */ /* 0x0020 */ public: _LIST_ENTRY KCBListEntry; /* 0x0030 */ public: resym_test::_CM_KEY_CONTROL_BLOCK* KeyControlBlock; /* 0x0038 */ public: resym_test::_CM_TRANS* Transaction; - /* 0x0040 */ public: unsigned long UoWState; + /* 0x0040 */ public: unsigned int UoWState; /* 0x0044 */ public: resym_test::UoWActionType ActionType; /* 0x0048 */ public: resym_test::HSTORAGE_TYPE StorageType; /* 0x0050 */ public: resym_test::_CM_KCB_UOW* ParentUoW; union { /* 0x0058 */ public: resym_test::_CM_KEY_CONTROL_BLOCK* ChildKCB; - /* 0x0058 */ public: unsigned long VolatileKeyCell; + /* 0x0058 */ public: unsigned int VolatileKeyCell; struct { - /* 0x0058 */ public: unsigned long OldValueCell; - /* 0x005c */ public: unsigned long NewValueCell; + /* 0x0058 */ public: unsigned int OldValueCell; + /* 0x005c */ public: unsigned int NewValueCell; }; - /* 0x0058 */ public: unsigned long UserFlags; + /* 0x0058 */ public: unsigned int UserFlags; /* 0x0058 */ public: _LARGE_INTEGER LastWriteTime; - /* 0x0058 */ public: unsigned long TxSecurityCell; + /* 0x0058 */ public: unsigned int TxSecurityCell; struct { /* 0x0058 */ public: resym_test::_CM_KEY_CONTROL_BLOCK* OldChildKCB; /* 0x0060 */ public: resym_test::_CM_KEY_CONTROL_BLOCK* NewChildKCB; }; struct { /* 0x0058 */ public: resym_test::_CM_KEY_CONTROL_BLOCK* OtherChildKCB; - /* 0x0060 */ public: unsigned long ThisVolatileKeyCell; + /* 0x0060 */ public: unsigned int ThisVolatileKeyCell; }; }; union { @@ -44,4 +43,3 @@ struct resym_test::NestedStructUnionRegression1 { /* Size=0x78 */ /* 0x0070 */ public: resym_test::_CMP_DISCARD_AND_REPLACE_KCB_CONTEXT* DiscardReplaceContext; }; }; - diff --git a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-23.snap b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-23.snap index 8bde86c..68948c1 100644 --- a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-23.snap +++ b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-23.snap @@ -4,5 +4,5 @@ expression: reconstructed_type --- struct resym_test::NtdllRegression1 { /* Size=0xe8 */ /* 0x0000 */ public: void (* KernelRoutine)(resym_test::_KAPC*, void (**)(void*, void*, void*), void**, void**, void**); - /* 0x0008 */ public: long (* MajorFunction[28])(resym_test::_DEVICE_OBJECT*, resym_test::_IRP*); + /* 0x0008 */ public: int (* MajorFunction[28])(resym_test::_DEVICE_OBJECT*, resym_test::_IRP*); }; diff --git a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-4.snap b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-4.snap index b4161b7..111ed32 100644 --- a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-4.snap +++ b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-4.snap @@ -2,13 +2,12 @@ source: resym_core/tests/type_reconstruction.rs expression: reconstructed_type --- - union resym_test::UnionTest { /* Size=0x8 */ /* 0x0000 */ public: unsigned char u1; /* 0x0000 */ public: unsigned short u2; - /* 0x0000 */ public: unsigned long u3; - /* 0x0000 */ public: unsigned __int64 u4; - public: static unsigned __int64 su5; + /* 0x0000 */ public: unsigned int u3; + /* 0x0000 */ public: unsigned long long int u4; + public: static unsigned long long int su5; public: UnionTest(); public: ~UnionTest(); @@ -16,11 +15,10 @@ union resym_test::UnionTest { /* Size=0x8 */ public: void* ConstMethod() const; public: void* VolatileMethod() volatile; public: void* ConstVolatileMethod() const volatile; - public: void (*ReturnFuncPointerMethod())(long); - public: void* __vecDelDtor(unsigned long); + public: void (*ReturnFuncPointerMethod())(int); + public: void* __vecDelDtor(unsigned int); - public: static long Magic(); - public: static long MagicVar1(...); - public: static long MagicVar2(long, ...); + public: static int Magic(); + public: static int MagicVar1(...); + public: static int MagicVar2(int, ...); }; - diff --git a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-5.snap b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-5.snap index 98ff3a1..65a94c9 100644 --- a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-5.snap +++ b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-5.snap @@ -2,13 +2,12 @@ source: resym_core/tests/type_reconstruction.rs expression: reconstructed_type --- - struct resym_test::StructTest { /* Size=0x18 */ /* 0x0008 */ public: unsigned char u1; /* 0x000a */ public: unsigned short u2; - /* 0x000c */ public: unsigned long u3; - /* 0x0010 */ public: unsigned __int64 u4; - public: static unsigned __int64 su5; + /* 0x000c */ public: unsigned int u3; + /* 0x0010 */ public: unsigned long long int u4; + public: static unsigned long long int su5; public: StructTest(const resym_test::StructTest&); public: StructTest(); @@ -17,13 +16,12 @@ struct resym_test::StructTest { /* Size=0x18 */ public: void* ConstMethod() const; public: void* VolatileMethod() volatile; public: void* ConstVolatileMethod() const volatile; - public: void (*ReturnFuncPointerMethod())(long); - public: virtual long Virtual(); + public: void (*ReturnFuncPointerMethod())(int); + public: virtual int Virtual(); public: resym_test::StructTest& operator=(const resym_test::StructTest&); - public: void* __vecDelDtor(unsigned long); + public: void* __vecDelDtor(unsigned int); - public: static long Magic(); - public: static long MagicVar1(...); - public: static long MagicVar2(long, ...); + public: static int Magic(); + public: static int MagicVar1(...); + public: static int MagicVar2(int, ...); }; - diff --git a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-6.snap b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-6.snap index eb39ea9..1271955 100644 --- a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-6.snap +++ b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-6.snap @@ -2,10 +2,8 @@ source: resym_core/tests/type_reconstruction.rs expression: reconstructed_type --- - -enum resym_test::EnumTest1 : long { +enum resym_test::EnumTest1 : int { kEnumTest1Val1 = 0x0000, kEnumTest1Val2 = 0x0001, kEnumTest1Val3 = 0x0002, }; - diff --git a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-8.snap b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-8.snap index 122d72a..d471ed0 100644 --- a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-8.snap +++ b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-8.snap @@ -2,43 +2,41 @@ source: resym_core/tests/type_reconstruction.rs expression: reconstructed_type --- - struct resym_test::StructUnnamedUdtTest1 { /* Size=0xa0 */ union { struct { - /* 0x0000 */ public: unsigned long i1; - /* 0x0004 */ public: unsigned long i2; + /* 0x0000 */ public: unsigned int i1; + /* 0x0004 */ public: unsigned int i2; union { - /* 0x0008 */ public: unsigned long i3; - /* 0x0008 */ public: unsigned long i4; + /* 0x0008 */ public: unsigned int i3; + /* 0x0008 */ public: unsigned int i4; }; }; - /* 0x0000 */ public: unsigned long i5; + /* 0x0000 */ public: unsigned int i5; struct { - /* 0x0000 */ public: unsigned long i21; - /* 0x0004 */ public: unsigned long i22; - /* 0x0008 */ public: unsigned long i23; + /* 0x0000 */ public: unsigned int i21; + /* 0x0004 */ public: unsigned int i22; + /* 0x0008 */ public: unsigned int i23; }; /* 0x0000 */ public: resym_test::PrimitiveTypesTest s1; - /* 0x0000 */ public: unsigned __int64 QuadPart; + /* 0x0000 */ public: unsigned long long int QuadPart; }; - /* 0x0070 */ public: unsigned __int64 QuadPart2; - /* 0x0078 */ public: unsigned __int64 QuadPart3; + /* 0x0070 */ public: unsigned long long int QuadPart2; + /* 0x0078 */ public: unsigned long long int QuadPart3; union { - /* 0x0080 */ public: unsigned long Reserved; + /* 0x0080 */ public: unsigned int Reserved; struct { /* 0x0080 */ public: unsigned char Type; /* 0x0081 */ public: unsigned char Reserved1; /* 0x0082 */ public: unsigned short Reserved2; }; }; - /* 0x0084 */ public: long i6; - /* 0x0088 */ public: long i7; + /* 0x0084 */ public: int i6; + /* 0x0088 */ public: int i7; union { /* 0x0090 */ public: void* c1; /* 0x0090 */ public: char c2; }; - /* 0x0098 */ public: long i8; - /* 0x009c */ public: long i9; + /* 0x0098 */ public: int i8; + /* 0x009c */ public: int i9; }; - diff --git a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-9.snap b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-9.snap index d52da34..e78d0ec 100644 --- a/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-9.snap +++ b/resym_core/tests/snapshots/type_reconstruction__type_reconstruction_raw_access_specifiers-9.snap @@ -2,24 +2,22 @@ source: resym_core/tests/type_reconstruction.rs expression: reconstructed_type --- - struct resym_test::StructUnnamedUdtTest2 { /* Size=0x30 */ - /* 0x0000 */ public: unsigned __int64 Before; + /* 0x0000 */ public: unsigned long long int Before; union { struct { - /* 0x0008 */ public: unsigned __int64 u1; - /* 0x0010 */ public: unsigned __int64 u2; + /* 0x0008 */ public: unsigned long long int u1; + /* 0x0010 */ public: unsigned long long int u2; }; struct { - /* 0x0008 */ public: unsigned __int64* p1; - /* 0x0010 */ public: unsigned __int64* p2; + /* 0x0008 */ public: unsigned long long int* p1; + /* 0x0010 */ public: unsigned long long int* p2; }; }; - /* 0x0018 */ public: unsigned __int64 Middle; + /* 0x0018 */ public: unsigned long long int Middle; union { - /* 0x0020 */ public: unsigned __int64 u3; - /* 0x0020 */ public: unsigned __int64* p3; + /* 0x0020 */ public: unsigned long long int u3; + /* 0x0020 */ public: unsigned long long int* p3; }; - /* 0x0028 */ public: unsigned __int64 After; + /* 0x0028 */ public: unsigned long long int After; }; - diff --git a/resymc/src/main.rs b/resymc/src/main.rs index 0ca8483..b498ff4 100644 --- a/resymc/src/main.rs +++ b/resymc/src/main.rs @@ -10,6 +10,8 @@ use structopt::StructOpt; use crate::resymc_app::ResymcApp; use crate::resymc_options::ResymcOptions; +const DEFAULT_PRIMITIVE_FLAVOR: PrimitiveReconstructionFlavor = PrimitiveReconstructionFlavor::Raw; + fn main() -> Result<()> { env_logger::init(); let app = ResymcApp::new()?; @@ -42,7 +44,7 @@ fn main() -> Result<()> { } => app.dump_types_command( pdb_path, Some(type_name), - primitive_types_flavor.unwrap_or(PrimitiveReconstructionFlavor::Portable), + primitive_types_flavor.unwrap_or(DEFAULT_PRIMITIVE_FLAVOR), print_header, print_dependencies, print_access_specifiers, @@ -59,7 +61,7 @@ fn main() -> Result<()> { } => app.dump_types_command( pdb_path, None, - primitive_types_flavor.unwrap_or(PrimitiveReconstructionFlavor::Portable), + primitive_types_flavor.unwrap_or(DEFAULT_PRIMITIVE_FLAVOR), print_header, false, print_access_specifiers, @@ -80,7 +82,7 @@ fn main() -> Result<()> { from_pdb_path, to_pdb_path, type_name, - primitive_types_flavor.unwrap_or(PrimitiveReconstructionFlavor::Portable), + primitive_types_flavor.unwrap_or(DEFAULT_PRIMITIVE_FLAVOR), print_header, print_dependencies, print_access_specifiers, @@ -110,7 +112,7 @@ fn main() -> Result<()> { } => app.dump_module_command( pdb_path, module_id, - primitive_types_flavor.unwrap_or(PrimitiveReconstructionFlavor::Portable), + primitive_types_flavor.unwrap_or(DEFAULT_PRIMITIVE_FLAVOR), print_header, highlight_syntax, output_file_path, @@ -127,7 +129,7 @@ fn main() -> Result<()> { from_pdb_path, to_pdb_path, module_path, - primitive_types_flavor.unwrap_or(PrimitiveReconstructionFlavor::Portable), + primitive_types_flavor.unwrap_or(DEFAULT_PRIMITIVE_FLAVOR), print_header, highlight_syntax, output_file_path,