title: CreateProcess STATUS_DLL_NOT_FOUND - which dll?
body: <p>I have a process which calls <code>CreateProcess</code>. It appears that <code>CreateProcess</code> returns nonzero indicating success. However, the HANDLE to the process then gets immediately set, indicating the process has exited. When I call <code>GetExitCodeProcess</code>, <code>STATUS_DLL_NOT_FOUND</code> is then returned.</p>
  
  <p>I understand that a DLL is missing. I even know exactly which one. However, what I don't understand is how to figure that out programmatically.</p>
  
  <p>I noticed that Windows will present a dialog saying that the process failed to start because it couldn't find the specified DLL (screenshot: <a href="http://www.mediafire.com/view/?kd9ddq0e2dlvlb9" rel="noreferrer">http://www.mediafire.com/view/?kd9ddq0e2dlvlb9</a> ). In the dialog, Windows specifies which DLL is missing. However, I find no way to get that information myself programmatically.</p>
  
  <p>If a process fails to start and would return <code>STATUS_DLL_NOT_FOUND</code>, how do I programmatically retrieve the library name to which the target process was linked which couldn't be found? That way I can automatically record in an error report what DLL appears to be missing or corrupt in a given installation.</p>