Skip to content

Commit 2641259

Browse files
committed
Added heap category.
1 parent d07a431 commit 2641259

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

Memory/NodeDissector.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ public static Type GuessType(BaseHexNode node, MemoryBuffer memory)
4343
var data32 = memory.ReadObject<UInt32FloatData>(offset);
4444

4545
var raw = memory.ReadBytes(offset, node.MemorySize);
46-
if (raw.InterpretAsUTF8().IsLikelyPrintableData() >= 0.5f)
46+
if (raw.InterpretAsUTF8().IsLikelyPrintableData() >= 0.75f)
4747
{
4848
return typeof(UTF8TextNode);
4949
}
50-
else if (raw.InterpretAsUTF16().IsLikelyPrintableData() >= 0.5f)
50+
else if (raw.InterpretAsUTF16().IsLikelyPrintableData() >= 0.75f)
5151
{
5252
return typeof(UTF16TextNode);
5353
}
@@ -120,7 +120,7 @@ private static Type GuessPointerType(IntPtr address, MemoryBuffer memory)
120120
{
121121
return typeof(FunctionPtrNode);
122122
}
123-
else if (section.Category == RemoteProcess.SectionCategory.DATA) // If the section contains data, it is at least a pointer to a class or something.
123+
else if (section.Category == RemoteProcess.SectionCategory.DATA || section.Category == RemoteProcess.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.
126126
bool valid = true;
@@ -140,11 +140,11 @@ private static Type GuessPointerType(IntPtr address, MemoryBuffer memory)
140140

141141
// Check if it is a string.
142142
var data = memory.Process.ReadRemoteMemory(address, IntPtr.Size * 2);
143-
if (data.Take(IntPtr.Size).InterpretAsUTF8().IsLikelyPrintableData() >= 0.5f)
143+
if (data.Take(IntPtr.Size).InterpretAsUTF8().IsLikelyPrintableData() >= 07.5f)
144144
{
145145
return typeof(UTF8TextPtrNode);
146146
}
147-
else if (data.InterpretAsUTF16().IsLikelyPrintableData() >= 0.5f)
147+
else if (data.InterpretAsUTF16().IsLikelyPrintableData() >= 0.75f)
148148
{
149149
return typeof(UTF16TextPtrNode);
150150
}

Memory/RemoteProcess.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ public enum SectionCategory
4242
{
4343
Unknown,
4444
CODE,
45-
DATA
45+
DATA,
46+
HEAP
4647
}
4748

4849
public class Section
@@ -407,11 +408,12 @@ public string GetNamedAddress(IntPtr address)
407408
var section = GetSectionToPointer(address);
408409
if (section != null)
409410
{
410-
if (section.Category != SectionCategory.Unknown)
411+
if (section.Category == SectionCategory.CODE || section.Category == SectionCategory.DATA)
411412
{
413+
// Code and Data sections belong to a module.
412414
return $"<{section.Category}>{section.ModuleName}.{address.ToString("X")}";
413415
}
414-
else if (section.Type == NativeMethods.TypeEnum.MEM_PRIVATE)
416+
else if (section.Category == SectionCategory.HEAP)
415417
{
416418
return $"<HEAP>{address.ToString("X")}";
417419
}
@@ -466,7 +468,8 @@ public Task UpdateProcessInformationsAsync()
466468
Protection = protection,
467469
Type = type,
468470
ModulePath = modulePath,
469-
ModuleName = Path.GetFileName(modulePath)
471+
ModuleName = Path.GetFileName(modulePath),
472+
Category = type == NativeMethods.TypeEnum.MEM_PRIVATE ? SectionCategory.HEAP : SectionCategory.Unknown
470473
};
471474
switch (section.Name)
472475
{

0 commit comments

Comments
 (0)