Signed-off-by: Zebediah Figura z.figura12@gmail.com --- See my comment from v1...
dlls/ntdll/env.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/env.c b/dlls/ntdll/env.c index 3acf7f52d5b..452b10b0582 100644 --- a/dlls/ntdll/env.c +++ b/dlls/ntdll/env.c @@ -996,10 +996,26 @@ NTSTATUS WINAPI RtlQueryEnvironmentVariable_U(PWSTR env, */ void WINAPI RtlSetCurrentEnvironment(PWSTR new_env, PWSTR* old_env) { - WCHAR *prev; + static const WCHAR wineW[] = {'W','I','N','E'}; + WCHAR *prev, *p;
TRACE("(%p %p)\n", new_env, old_env);
+ /* ensure that special Wine-internal variables are still defined */ + + for (p = new_env; *p; p += wcslen( p ) + 1) + { + if (!wcsncmp( p, wineW, 4 )) + { + const WCHAR *value = wcschr( p, '=' ) + 1; + UNICODE_STRING var_string, value_string; + var_string.Buffer = p; + var_string.Length = (value - 1 - p) * sizeof(WCHAR); + RtlInitUnicodeString( &value_string, value ); + RtlSetEnvironmentVariable( &new_env, &var_string, &value_string ); + } + } + RtlAcquirePebLock();
prev = NtCurrentTeb()->Peb->ProcessParameters->Environment;