Skip to content

Commit

Permalink
Added class info for indirect pointers.
Browse files Browse the repository at this point in the history
  • Loading branch information
KN4CK3R committed Nov 25, 2016
1 parent db81c4c commit aadbde8
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
44 changes: 43 additions & 1 deletion FrostbitePluginExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,44 @@ public override void Terminate()
class FrostBiteNodeInfoReader : INodeInfoReader
{
public string ReadNodeInfo(BaseNode node, IntPtr value, MemoryBuffer memory)
{
// 1. try the direct value
var info = ReadPtrInfo(value, memory);
if (!string.IsNullOrEmpty(info))
{
return info;
}

// 2. try indirect pointer
var indirectPtr = memory.Process.ReadRemoteObject<IntPtr>(value);
if (indirectPtr.MayBeValid())
{
info = ReadPtrInfo(indirectPtr, memory);
if (!string.IsNullOrEmpty(info))
{
return $"Ptr -> {info}";
}

// 3. try weak pointer
var weakTempPtr = indirectPtr - IntPtr.Size;
if (weakTempPtr.MayBeValid())
{
var weakPtr = memory.Process.ReadRemoteObject<IntPtr>(weakTempPtr);
if (weakPtr.MayBeValid())
{
info = ReadPtrInfo(weakPtr, memory);
if (!string.IsNullOrEmpty(info))
{
return $"WeakPtr -> {info}";
}
}
}
}

return null;
}

private string ReadPtrInfo(IntPtr value, MemoryBuffer memory)
{
var getTypeFnPtr = memory.Process.ReadRemoteObject<IntPtr>(value);
if (getTypeFnPtr.MayBeValid())
Expand All @@ -85,7 +123,11 @@ public string ReadNodeInfo(BaseNode node, IntPtr value, MemoryBuffer memory)
var namePtr = memory.Process.ReadRemoteObject<IntPtr>(typeInfoDataPtr);
if (namePtr.MayBeValid())
{
return memory.Process.ReadRemoteString(Encoding.UTF8, namePtr, 64);
var info = memory.Process.ReadRemoteUTF8StringUntilFirstNullCharacter(namePtr, 64);
if (info.Length > 0 && info[0].IsPrintable())
{
return info;
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]

0 comments on commit aadbde8

Please sign in to comment.