Skip to content

Commit 03d9757

Browse files
nullableVoidPtremesare
authored andcommitted
MSVC RTTI: Define attribute enumerations for Base Class Descriptors and Class Hierarchy Descriptors
1 parent 9fad830 commit 03d9757

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

plugins/msvc_rtti/rtti.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ Ref<Type> BaseClassDescriptorType(BinaryView *view, BNPointerBaseType ptrBaseTy)
141141

142142
if (typeCache == nullptr)
143143
{
144+
Ref<Architecture> arch = view->GetDefaultArchitecture();
144145
Ref<Type> uintType = Type::IntegerType(4, false);
145146

146147
StructureBuilder baseClassDescriptorBuilder;
@@ -151,7 +152,17 @@ Ref<Type> BaseClassDescriptorType(BinaryView *view, BNPointerBaseType ptrBaseTy)
151152
baseClassDescriptorBuilder.AddMember(pTypeDescType, "pTypeDescriptor");
152153
baseClassDescriptorBuilder.AddMember(uintType, "numContainedBases");
153154
baseClassDescriptorBuilder.AddMember(GetPMDType(view), "where");
154-
baseClassDescriptorBuilder.AddMember(uintType, "attributes");
155+
Ref<Enumeration> attrEnum = EnumerationBuilder()
156+
.AddMemberWithValue("BCD_NOT_VISIBLE", 0x01)
157+
.AddMemberWithValue("BCD_AMBIGUOUS", 0x02)
158+
.AddMemberWithValue("BCD_PRIVORPROTBASE", 0x04)
159+
.AddMemberWithValue("BCD_PRIVORPROTINCOMPOBJ", 0x08)
160+
.AddMemberWithValue("BCD_VBOFCONTOBJ", 0x10)
161+
.AddMemberWithValue("BCD_NONPOLYMORPHIC", 0x20)
162+
.AddMemberWithValue("BCD_HASPCHD", 0x40)
163+
.Finalize();
164+
Ref<Type> attrType = Type::EnumerationType(arch, attrEnum, 4);
165+
baseClassDescriptorBuilder.AddMember(attrType, "attributes");
155166
Ref<Type> pClassDescType = TypeBuilder::PointerType(4, ClassHierarchyDescriptorType(view, ptrBaseTy))
156167
.SetPointerBase(ptrBaseTy, 0)
157168
.Finalize();
@@ -185,11 +196,18 @@ Ref<Type> ClassHierarchyDescriptorType(BinaryView *view, BNPointerBaseType ptrBa
185196

186197
if (typeCache == nullptr)
187198
{
199+
Ref<Architecture> arch = view->GetDefaultArchitecture();
188200
Ref<Type> uintType = Type::IntegerType(4, false);
189201

190202
StructureBuilder classHierarchyDescriptorBuilder;
191203
classHierarchyDescriptorBuilder.AddMember(uintType, "signature");
192-
classHierarchyDescriptorBuilder.AddMember(uintType, "attributes");
204+
Ref<Enumeration> attrEnum = EnumerationBuilder()
205+
.AddMemberWithValue("CHD_MULTINH", 0x01)
206+
.AddMemberWithValue("CHD_VIRTINH", 0x02)
207+
.AddMemberWithValue("CHD_AMBIGUOUS", 0x04)
208+
.Finalize();
209+
Ref<Type> attrType = Type::EnumerationType(arch, attrEnum, 4);
210+
classHierarchyDescriptorBuilder.AddMember(attrType, "attributes");
193211
classHierarchyDescriptorBuilder.AddMember(uintType, "numBaseClasses");
194212
Ref<Type> pBaseClassArrayType = TypeBuilder::PointerType(4, Type::VoidType())
195213
.SetPointerBase(ptrBaseTy, 0)

0 commit comments

Comments
 (0)