Skip to content

Commit

Permalink
Merge pull request #18 from theXappy/fix-duplicate-key-exception
Browse files Browse the repository at this point in the history
Fix duplicate key exception in GetRemoteObject
  • Loading branch information
theXappy authored Oct 24, 2024
2 parents b31a34c + 18d810f commit cc32ecd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/ScubaDiver/MsvcDiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,20 @@ protected override string MakeObjectResponse(ScubaDiverMessage arg)

try
{
// Check if the object is already frozen
if (_freezer.IsFrozen(objAddr))
{
Logger.Debug($"[MsvcDiver][MakeObjectResponse] Object at 0x{objAddr:X16} is already frozen.");
ObjectDump alreadyFrozenObjDump = new ObjectDump()
{
Type = typeName,
RetrivalAddress = objAddr,
PinnedAddress = objAddr,
HashCode = 0x0bad0bad
};
return JsonConvert.SerializeObject(alreadyFrozenObjDump);
}

// TODO: Wrong for x86
long vftable = Marshal.ReadInt64(new IntPtr((long)objAddr));
Rtti.TypeInfo typeInfo = ResolveTypeFromVftableAddress((nuint)vftable);
Expand Down
7 changes: 7 additions & 0 deletions src/ScubaDiver/MsvcFrozenItemsCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ public ulong Pin(ulong objAddress)
}
}

public bool IsFrozen(ulong objAddress)
{
lock (_lock)
{
return _frozenItemsToDestructors.ContainsKey(objAddress);
}
}

/// <summary>
/// Unpins an object
Expand Down

0 comments on commit cc32ecd

Please sign in to comment.