title: CreateProcess() seems unaffected by lpCurrentDirectory
body: <p>I'm currently trying to start a process using CreateProcess() API :
  <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx</a></p>
  
  <p>The main issue I'm getting is that the child process seems to be launched with the working directory of the parent process, <em>regardless of what is indicated into the <strong>lpCurrentDirectory</strong> parameter</em>.</p>
  
  <p>To give a bit more details : lpCurrentDirectory seems to work for simple command-line programs, but for more complex ones (think GUI), it seems not taken into consideration, since all ressource dependencies are searched from the calling directory process.</p>
  
  <p>I could try to switch the calling process working directory back &amp; forth, but a second issue is that the called process is not located into the target directory. For the time being, it is located into the same directory as the calling process, although it could change in the future. When I'm trying to call a child process located into a different directory than the parent one, for some reason, it fails. I've checked the directory structure multiple times, to no avail up to now.</p>
  
  <p>I've been looking around (including into S.O.) and although some people seem to complain about the same issue, I have not found a usable work around for now. Note, for example, that I can't use ShellExec instead, it has to be CreateProcess().</p>
  
  <p>In case it does matter, my current test system is Windows Seven 64 bits. The software is supposed to work on a wider range of OS, from XP to Seven, 32 &amp; 64 bits (I guess W8 is out of scope for now).</p>
  
  <p><strong>[Edit]</strong> I've been able to find a solution to call a child process outside of the calling process working directory. I was using lpApplicationName for that, which is fine, but apparently does not need to be quoted, even with complex names involving space characters.</p>
  
  <p>This allowed me to test the idea of modifying the working directory of the calling process (using <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa365530%28v=vs.85%29.aspx" rel="nofollow">SetCurrentDirectory()</a>) <em>before</em> invoking CreateProcess(). To my surprise, it did not work : the working directory is in fact the directory specified into  the full path of lpApplicationName, regardless of whatever has been set to the parent's working directory thanks to SetCurrentDirectory() (and verified using GetCurrentDirectory())</p>
  
  <p>This is a problem in my case, since I want the process to run into another selected directory (both specified into lpCurrentDirectory parameter, and with a call to SetCurrentDirectory() before CreateProcess()).</p>