Issue
I've been trying to make any progress I can in porting a company product written and heavily leaning on Unix, into a Windows compatible build. It's not going so well. I have two different development branches with two different problems. In this problem, I have to port what is essentially a wrapper for the Unix clearenv()
function, which completely clears all user environment variables from the table. Probably for security reasons, I could not find an equivalent to clearenv()
for Windows, and the one solution I found/came up with, would wipe away all environment variables in the process, including system variables. I want a solution that would get rid of all user environment variables, but not touch system ones.
I know it may be a dumb thing to do, but it's in the code, so I have to try to port it.
Also, if it helps, I'm compiling under MinGW
Solution
From the documentation for CreateEnvironmentBlock:
hToken [in, optional] [...] If this parameter is NULL, the returned environment block contains system variables only.
It will still be a bit messy to go through the process environment block and change it to match the "system only" block that this function returns, but at least you'll have the necessary information.
Answered By - Harry Johnston Answer Checked By - Senaida (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.