Essentially, I would like to create a new process and define the environment for it from the parent process. I would like to use CreateProcessW and pass a (modified) UNICODE environment into lpEnvironment, but I’m not sure what the content should look like compared to an ANSII environment block.
The only documentation I really found is on MSDN:
Note that an ANSI environment block is
terminated by two zero bytes: one for
the last string, one more to terminate
the block. A Unicode environment block
is terminated by four zero bytes: two
for the last string, two more to
terminate the block.
Now I tried to
- call
GetEnvironmentStringsand pass it on to the child process - call
GetEnvironmentStringsWand pass it to the child process - modify these blocks with my additional environment strings and pass it on
non of them work
I really only could set lpEnvironment to NULL to get it to work, but now I would have to change & revert my parents processing environment – is that the way to go here?
(I also did set CREATE_UNICODE_ENVIRONMENT)
Could anyone please tell me what is so special about UNICODE environment blocks – it did work, when I just use ASCII stuff and call CreateProcessA()…
I have no idea what you are doing wrong without code. But this works:
Perhaps that will give you an idea of what you are doing wrong.