MiniDumpWriteDump (C#) produces zero length dump files for specific process

一个人想着一个人 提交于 2019-12-31 05:27:10

问题


  1. Executing MiniDumpWriteDump within the specific process provides healthy dump file.

  2. Executing MiniDumpWriteDump from external process, where hProcess and processId point to the mentioned specific process, provides a zero length dump file

  3. Same as #2 just pointing to FireFox for example provides healthy dump file

The specific process I am trying to dump is running with low privilege as far as I know, and my external process is being executed from Administrator CMD window.

[DllImport("dbghelp.dll",
            EntryPoint = "MiniDumpWriteDump",
            CallingConvention = CallingConvention.Winapi,
            CharSet = CharSet.Unicode,
            ExactSpelling = true,
            SetLastError = true)]
        private static extern bool MiniDumpWriteDump(IntPtr hProcess,
            uint processId,
            SafeHandle hFile,
            uint dumpType,
            IntPtr expParam,
            IntPtr userStreamParam,
            IntPtr callbackParam);

Notes:

  • I am flushing, closing and disposing correctly the file stream
  • MiniDumpWriteDump return false and GetLastWin32Error returns : -2147024597
  • The mentioned specific process (a dot net server project) has the same Security options as FireFox (the dump works on Notepad++ process for example).

回答1:


Ok.. found the solution for that..

The external process project was build for "AnyCPU" platform (and as it doesn't execute only-64 bit commands, it was running for 32-bit). Setting it to x64 made it possible to dump another 64 bit process.

And I would recommend to anyone who encounter this issue, to create separated projects, one for 32 bit and one for 64 bit.



来源:https://stackoverflow.com/questions/33868483/minidumpwritedump-c-produces-zero-length-dump-files-for-specific-process

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!