title: How can I watch a process and produce a minidump when it crashes (like PROCDUMP)?
body: <p>I've found a number of posts on how to create a crash dump manually when required, but what I would like to do is ensure that a crash dump is produced when a monitored application crashes.</p>
  
  <p>The TechNet PROCDUMP tool can do this perfectly. What I would like to know is how I can write some code to do the same thing in a management program of my own so that I only create a dump file when an exception occurs.</p>
  
  <p>My program is a service app that knows the process IDs of the programs I wish to monitor. </p>
  
  <p>Just to clarify, I want to mimic what this call to PROCDUMP would do:</p>
  
  <p>procdump -e someprocess.exe -w</p>
  
  <p>Theoretically Windows should be able to do this job for me with DrWatson. The problem I have is that I have about 200 customer systems running that are claiming our application crashes randomly. Dr Watson doesn't seem to be confirming the fact that our applications are crashing so I've decided that I'd rather have the crash dump generation controlled by our own software.</p>
  
  <p>I have managed to get my own applications to create their own dumps using __try/except and MiniDumpWriteDump() with the MiniDumpWithFullMemory type.. but I can't look at local variables etc with WinDbg, so I'm guessing this is because it has been triggered from within the application itself.. so.. another reason I would like a monitor/management type of application to do the job.</p>
  
  <p>At the very least.. how can one application react to another application crashing? Do you have to install some sort of debug hook or pretend that the management program is actually a custom debugger?</p>
  
  <p>Cheers</p>