Exemplo n.º 1
0
 private static extern bool MiniDumpWriteDump(
     IntPtr hProcess,
     uint processId,
     SafeHandle hFile,
     uint dumpType,
     ref MiniDumpExceptionInformation expParam,
     IntPtr userStreamParam,
     IntPtr callbackParam);
Exemplo n.º 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));
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
 static extern bool MiniDumpWriteDump(IntPtr hProcess, uint processId, SafeHandle hFile, uint dumpType, ref MiniDumpExceptionInformation expParam, IntPtr userStreamParam, IntPtr callbackParam);