If you create a new process without adding the environment block (by calling CreateEnvironmentBlock) the new process may fail to call Shellexecute and some other functions. Don’t think that the enviroment variables aren’t that important.
Find out more about CreateProcess in the post about “CreateProcess in full glory“.
2 Responses
Joe White
15|May|2008 1According to the docs, if you pass NULL for lpEnvironment, then the new process uses the environment of the calling process. How would that cause ShellExecute to fail? More details, please!
Christian Wimmer
15|May|2008 2Especially if the process is a SYSTEM process, this leads to problems since the environment of the SYSTEM has unusual sets in it. I once used a SYSTEM environment accidently and created a command line prompt. However some application failed with a terrible exception – including a known pdf reader.
I wrote “may” because this strange problem did not always happen.
But yes, I should have told about the SYSTEM process.
Leave a reply
You must be logged in to post a comment.