Skip to content

Commit bf6b42c

Browse files
committed
Fixed VMT detection (fixed #46).
1 parent 4601141 commit bf6b42c

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

ReClass.NET/Memory/NodeDissector.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,10 @@ private static Type GuessPointerType(IntPtr address, MemoryBuffer memory)
123123
if (section.Category == SectionCategory.DATA || section.Category == SectionCategory.HEAP) // If the section contains data, it is at least a pointer to a class or something.
124124
{
125125
// Check if it is a vtable. Check if the first 3 values are pointers to a code section.
126-
bool valid = true;
127-
for (var i = 0; i < 3; ++i)
128-
{
129-
var pointee = memory.Process.ReadRemoteIntPtr(address);
130-
if (memory.Process.GetSectionToPointer(pointee)?.Category != SectionCategory.CODE)
131-
{
132-
valid = false;
133-
break;
134-
}
135-
}
136-
if (valid)
126+
var possibleVmt = memory.Process.ReadRemoteObject<ThreePointersData>(address);
127+
if (memory.Process.GetSectionToPointer(possibleVmt.Pointer1)?.Category == SectionCategory.CODE
128+
&& memory.Process.GetSectionToPointer(possibleVmt.Pointer2)?.Category == SectionCategory.CODE
129+
&& memory.Process.GetSectionToPointer(possibleVmt.Pointer3)?.Category == SectionCategory.CODE)
137130
{
138131
return typeof(VTableNode);
139132
}

ReClass.NET/Memory/UnionDataType.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,12 @@ public struct UInt64FloatDoubleData
6969
[FieldOffset(0)]
7070
public double DoubleValue;
7171
}
72+
73+
[StructLayout(LayoutKind.Sequential)]
74+
public struct ThreePointersData
75+
{
76+
public IntPtr Pointer1;
77+
public IntPtr Pointer2;
78+
public IntPtr Pointer3;
79+
}
7280
}

0 commit comments

Comments
 (0)