Skip to content

Commit ce0fefb

Browse files
committed
feat: rtti
1 parent 228082b commit ce0fefb

2 files changed

Lines changed: 85 additions & 0 deletions

File tree

include/REX/W32.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "REX/W32/KERNEL32.h"
2323
#include "REX/W32/NT.h"
2424
#include "REX/W32/OLE32.h"
25+
#include "REX/W32/RTTI.h"
2526
#include "REX/W32/SHELL32.h"
2627
#include "REX/W32/USER32.h"
2728
#include "REX/W32/VERSION.h"

include/REX/W32/RTTI.h

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#pragma once
2+
3+
#include "REX/TEnumSet.h"
4+
5+
namespace REX::W32
6+
{
7+
using RTTITypeDescriptor = std::type_info;
8+
9+
struct RTTIClassHierarchyDescriptor;
10+
11+
struct RTTIBaseClassDescriptor2
12+
{
13+
enum class Attribute : std::uint32_t
14+
{
15+
None = 0,
16+
NotVisible = 1 << 0,
17+
Ambiguous = 1 << 1,
18+
Private = 1 << 2,
19+
PrivateOrProtectedBase = 1 << 3,
20+
Virtual = 1 << 4,
21+
NonPolymorphic = 1 << 5,
22+
HasHierarchyDescriptor = 1 << 6
23+
};
24+
25+
struct PMD
26+
{
27+
// members
28+
std::int32_t mDisp; // 0x00
29+
std::int32_t pDisp; // 0x04
30+
std::int32_t vDisp; // 0x08
31+
};
32+
static_assert(sizeof(PMD) == 0xC);
33+
34+
// members
35+
RTTITypeDescriptor* typeDescriptor; // 0x00
36+
std::uint32_t numContainedBases; // 0x08
37+
PMD where; // 0x0C
38+
TEnumSet<Attribute> attributes; // 0x18
39+
const RTTIClassHierarchyDescriptor* classDescriptor; // 0x1C
40+
};
41+
static_assert(sizeof(RTTIBaseClassDescriptor) == 0x24);
42+
43+
struct RTTIBaseClassArray
44+
{
45+
const RTTIBaseClassDescriptor2* arrayOfBaseClassDescriptors[];
46+
};
47+
static_assert(sizeof(RTTIBaseClassArray) == 0x8);
48+
49+
struct RTTIClassHierarchyDescriptor
50+
{
51+
enum class Attribute : std::uint32_t
52+
{
53+
NoInheritance = 0,
54+
MultipleInheritance = 1 << 0,
55+
VirtualInheritance = 1 << 1,
56+
AmbiguousInheritance = 1 << 2
57+
};
58+
59+
// members
60+
std::uint32_t signature; // 0x00
61+
TEnumSet<Attribute> attributes; // 0x04
62+
std::uint32_t numBaseClasses; // 0x08
63+
const RTTIBaseClassDescriptor2* baseClassArray; // 0x0C
64+
};
65+
static_assert(sizeof(RTTIClassHierarchyDescriptor) == 0x14);
66+
67+
struct RTTICompleteObjectLocator
68+
{
69+
enum class Signature : std::uint32_t
70+
{
71+
x86 = 0,
72+
x64 = 1
73+
};
74+
75+
// members
76+
Signature signature; // 0x00
77+
std::uint32_t offset; // 0x04
78+
std::uint32_t ctorDispOffset; // 0x08
79+
RTTITypeDescriptor* typeDescriptor; // 0x0C
80+
const RTTIClassHierarchyDescriptor* classDescriptor; // 0x14
81+
const RTTICompleteObjectLocator* self; // 0x1C
82+
};
83+
static_assert(sizeof(RTTICompleteObjectLocator) == 0x24);
84+
}

0 commit comments

Comments
 (0)