Description
We have to implement shell32!RegenerateUserEnvironment function to improve compatibility.
Every process has an environment block that contains a set of environment variables and their values. There are two types of environment variables: user environment variables (set for each user) and system environment variables (set for everyone).
Each environment block contains the environment variables in the following format:
Var1=Value1\0
|
Var2=Value2\0
|
Var3=Value3\0
|
...
|
VarN=ValueN\0\0
|
If the system environment variables were changed, then WM_SETTINGCHANGE message will be notified to each windows. When Explorer receives WM_SETTINGCHANGE, Explorer calls shell32!RegenerateUserEnvironment to reload its environment variables.
BOOL WINAPI RegenerateUserEnvironment(LPVOID *lpEnvironment, BOOL bUpdateSelf); |
The 1st argument of RegenerateUserEnvironment function is a pointer to a Unicode environment block. If the 2nd argument bUpdateSelf was TRUE, then the environment of the current process will be also reloaded.
RegenerateUserEnvironment updates the return value of GetEnvironmentStrings function. The return value of GetEnvironmentStrings is an ANSI environment block.
I created a test program: EnvTest.zip
Attachments
Issue Links
- blocks
-
CORE-1459 shell32: changing environment variables requires restart
- Resolved