Skip to content

Commit

Permalink
Fix raw primitive flavor, use raw primitive flavor as default for resymc
Browse files Browse the repository at this point in the history
  • Loading branch information
ergrelet committed Mar 22, 2024
1 parent 263b53e commit 7faecbe
Show file tree
Hide file tree
Showing 21 changed files with 108 additions and 140 deletions.
8 changes: 4 additions & 4 deletions resym_core/src/pdb_types/primitive_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
};

Original file line number Diff line number Diff line change
Expand Up @@ -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];
};

Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};

Original file line number Diff line number Diff line change
Expand Up @@ -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&);
};

Original file line number Diff line number Diff line change
Expand Up @@ -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&);
};

Original file line number Diff line number Diff line change
Expand Up @@ -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&);
};

Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Original file line number Diff line number Diff line change
Expand Up @@ -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 */
};

Original file line number Diff line number Diff line change
Expand Up @@ -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 */
};

Original file line number Diff line number Diff line change
Expand Up @@ -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 */
};

Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,34 @@
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;
/* 0x0018 */ public: resym_test::_CM_INTENT_LOCK* KeyLock;
/* 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 {
Expand All @@ -44,4 +43,3 @@ struct resym_test::NestedStructUnionRegression1 { /* Size=0x78 */
/* 0x0070 */ public: resym_test::_CMP_DISCARD_AND_REPLACE_KCB_CONTEXT* DiscardReplaceContext;
};
};

Original file line number Diff line number Diff line change
Expand Up @@ -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*);
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,23 @@
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();
public: void* GetPtr();
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, ...);
};

Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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, ...);
};

Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Loading

0 comments on commit 7faecbe

Please sign in to comment.