I have written an app to generate a minidump on an external process. This will be ultimately be called by our test harness on processs that take too long to execute its unit tests. Or for a process that hung while executing unit tests. (i.e. timed out)
So I would like to create a minidump before terminating the process.
So I wrote a handy little command line tool to do that. It takes as its (only) parameter the full path name of the executable. Fine so far.
I have all the plumbing in place for the code, and everything sort of works with no problems. But the problem is my minidump file is completely empty. Get Last error tells me this:
<blockquote>
failed with error -2147024597: Only part of a ReadProcessMemory or WriteProcessMemory request was completed.
</blockquote>
I am aware that MSDN says this about the handle to the process that I pass in to the MiniDumpWriteDump.
<blockquote>
This handle must have PROCESS_QUERY_INFORMATION and PROCESS_VM_READ access to the process...
</blockquote>
Im not sure how to alter that for the target process. Ive lookekd at SetSecurityInfo, but the examples are pretty incomplete. So before I dive deeper into that I thought I would ask if anyone have any idea what Im doing wrong here. Is this totally impossible?
EDIT:
I tried this on a different application than the one I originally was running it on. And this seems to work just fine on the other app (Notepad++).
Ok, further testing shows this works very well now. So it looks like the problem is resolved.
<a rel="nofollow http://www.idigitalhouse.com/Blog/wp-content/uploads/2010/08/getminidump.zip source code link
View the full article
So I would like to create a minidump before terminating the process.
So I wrote a handy little command line tool to do that. It takes as its (only) parameter the full path name of the executable. Fine so far.
I have all the plumbing in place for the code, and everything sort of works with no problems. But the problem is my minidump file is completely empty. Get Last error tells me this:
<blockquote>
failed with error -2147024597: Only part of a ReadProcessMemory or WriteProcessMemory request was completed.
</blockquote>
I am aware that MSDN says this about the handle to the process that I pass in to the MiniDumpWriteDump.
<blockquote>
This handle must have PROCESS_QUERY_INFORMATION and PROCESS_VM_READ access to the process...
</blockquote>
Im not sure how to alter that for the target process. Ive lookekd at SetSecurityInfo, but the examples are pretty incomplete. So before I dive deeper into that I thought I would ask if anyone have any idea what Im doing wrong here. Is this totally impossible?
EDIT:
I tried this on a different application than the one I originally was running it on. And this seems to work just fine on the other app (Notepad++).
Ok, further testing shows this works very well now. So it looks like the problem is resolved.
<a rel="nofollow http://www.idigitalhouse.com/Blog/wp-content/uploads/2010/08/getminidump.zip source code link
View the full article