fix: use SafeMemory for Util.DumpMemory

This commit is contained in:
goat 2021-05-01 22:18:15 +02:00
parent 7d30a60a5e
commit 44551d43ae
No known key found for this signature in database
GPG key ID: F18F057873895461

View file

@ -50,9 +50,15 @@ namespace Dalamud
/// <param name="len">The length to read.</param> /// <param name="len">The length to read.</param>
public static void DumpMemory(IntPtr offset, int len = 512) public static void DumpMemory(IntPtr offset, int len = 512)
{ {
var data = new byte[len]; try
Marshal.Copy(offset, data, 0, len); {
Log.Information(ByteArrayToHex(data)); SafeMemory.ReadBytes(offset, len, out var data);
Log.Information(ByteArrayToHex(data));
}
catch (Exception ex)
{
Log.Error(ex, "Read failed");
}
} }
/// <summary> /// <summary>