I am trying to get minidump information about handles of some process.
I am getting a List of handles of type MINIDUMP_HANDLE_DESCRIPTOR_2
and I am trying to read the info about the handle which I can access with ObjectInfoRva
.
However, I always get this exception:
System.ArgumentException occurred HResult=-2147024809 Message=Not enough space available in the buffer. Source=mscorlib
That's my method
public unsafe DbgHelp.MINIDUMP_HANDLE_OBJECT_INFORMATION ReadInfo(uint rva)
{
try
{
DbgHelp.MINIDUMP_HANDLE_OBJECT_INFORMATION result = default(DbgHelp.MINIDUMP_HANDLE_OBJECT_INFORMATION);
byte* baseOfView = null;
_safeMemoryMappedViewHandle.AcquirePointer(ref baseOfView);
IntPtr position = new IntPtr(baseOfView + rva);
result = _safeMemoryMappedViewHandle.Read<DbgHelp.MINIDUMP_HANDLE_OBJECT_INFORMATION>((ulong)position);
return result;
}
finally
{
_safeMemoryMappedViewHandle.ReleasePointer();
}
}
MINIDUMP_HANDLE_DESCRIPTOR_2
declaration:
public struct MINIDUMP_HANDLE_DESCRIPTOR_2
{
public UInt64 Handle;
public uint TypeNameRva;
public uint ObjectNameRva;
public UInt32 Attributes;
public UInt32 GrantedAccess;
public UInt32 HandleCount;
public UInt32 PointerCount;
public uint ObjectInfoRva;
public UInt32 Reserved0;
}
The _safeMemoryMappedViewHandle
is initialized - that's how I've got the handles list in the first place.
What am I doing wrong?