コード例 #1
0
ファイル: DumpWriter.cs プロジェクト: hglee/NBug
 private static extern bool MiniDumpWriteDump(
     IntPtr hProcess,
     uint processId,
     SafeHandle hFile,
     uint dumpType,
     ref MiniDumpExceptionInformation expParam,
     IntPtr userStreamParam,
     IntPtr callbackParam);
コード例 #2
0
        public static bool Write(SafeHandle fileHandle, Option options)
        {
            var currentProcess       = Process.GetCurrentProcess();
            var currentProcessHandle = currentProcess.Handle;
            var currentProcessId     = (uint)currentProcess.Id;
            var exp = new MiniDumpExceptionInformation()
            {
                ThreadId          = GetCurrentThreadId(),
                ClientPointers    = false,
                ExceptionPointers = IntPtr.Zero
            };

            return(MiniDumpWriteDump(currentProcessHandle, currentProcessId, fileHandle, (uint)options, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero));
        }
コード例 #3
0
        public static bool dumpSelf(string dumpFile)
        {
            IntPtr hProcess = Process.GetCurrentProcess().Handle;
            uint   PID      = (uint)Process.GetCurrentProcess().Id;

            // Create a crash dump, which we will then pass to windbg for analysis.
            using (FileStream foo = File.OpenWrite(dumpFile))
            {
                MiniDumpExceptionInformation exp = new MiniDumpExceptionInformation();

                exp.ThreadId       = 0xffffffff;
                exp.ClientPointers = false;

                if (!MiniDumpWriteDump(hProcess, PID, foo.SafeFileHandle, Option.WithFullMemory, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero))
                {
                    throw new Exception("unable to dump - GLE " + Marshal.GetLastWin32Error());
                }
            }

            return(true);
        }
コード例 #4
0
 static extern bool MiniDumpWriteDump(IntPtr hProcess, uint processId, SafeHandle hFile, uint dumpType, ref MiniDumpExceptionInformation expParam, IntPtr userStreamParam, IntPtr callbackParam);