المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Read Minidumps through Native Code



C# Programming
07-12-2013, 04:06 AM
I am revisiting a project that I have wanted to do for a long time. I am trying to read Minidumps much like BlueScreenView just with C# code. I was pointed to using

[DllImport("dbghelp.dll", SetLastError = true)] public static extern bool MiniDumpReadDumpStream(IntPtr BaseOfDump, int StreamNumber, ref MINIDUMP_DIRECTORY Dir, ref IntPtr StreamPointer, ref UInt32 StreamSize);
And after much digging, I found this
http://www.symbolsource.org/Public/Metadata/NuGet/Project/Microsoft.Samples.Debugging.CorApi/1.4.0.0/Release/Default/Microsoft.Samples.Debugging.Native/Microsoft.Samples.Debugging.Native/DumpReader.cs[ (http://www.symbolsource.org/Public/Metadata/NuGet/Project/Microsoft.Samples.Debugging.CorApi/1.4.0.0/Release/Default/Microsoft.Samples.Debugging.Native/Microsoft.Samples.Debugging.Native/DumpReader.cs)]

But I am having an issue with being able to pass in a string to the DumpReader and then read the return value. It appears that I need to pass a targetaddress and the length to the ReadMemory but I am getting an exception. I am very new to the whole native code thing. I like my .Net Libraries.

From DumpReader.CS
public byte[] ReadMemory(ulong targetAddress, int length) { byte[] buffer = new byte[length]; ReadMemory(targetAddress, buffer); return buffer; }
From My Code:
DumpReader dr = new DumpReader(PathToDump); dr.ReadMemory(??, ??);