Signed-off-by: Derek Lesho dlesho@codeweavers.com --- dlls/userenv/tests/userenv.c | 17 ++++++++++++++++- dlls/userenv/userenv_main.c | 3 +++ 2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/dlls/userenv/tests/userenv.c b/dlls/userenv/tests/userenv.c index a91edeef260..c7a6791e2be 100644 --- a/dlls/userenv/tests/userenv.c +++ b/dlls/userenv/tests/userenv.c @@ -78,7 +78,7 @@ static void test_create_env(void) BOOL r, is_wow64 = FALSE; HANDLE htok; WCHAR * env[4]; - char * st, systemroot[100]; + char * st, systemroot[100], programdata[100]; int i, j;
static const struct profile_item common_vars[] = { @@ -96,6 +96,7 @@ static void test_create_env(void) }; static const struct profile_item common_post_nt4_vars[] = { { "ALLUSERSPROFILE" }, + { "ProgramData" }, { "TEMP" }, { "TMP" }, { "CommonProgramFiles" }, @@ -119,6 +120,12 @@ static void test_create_env(void) r = SetEnvironmentVariableA("SystemRoot", "overwrite"); expect(TRUE, r);
+ r = GetEnvironmentVariableA("ProgramData", programdata, sizeof(programdata)); + ok(r != 0, "GetEnvironmentVariable failed (%d)\n", GetLastError()); + + r = SetEnvironmentVariableA("ProgramData", "overwrite"); + expect(TRUE, r); + if (0) { /* Crashes on NT4 */ @@ -151,12 +158,20 @@ static void test_create_env(void) r = SetEnvironmentVariableA("SystemRoot", systemroot); expect(TRUE, r);
+ r = SetEnvironmentVariableA("ProgramData", programdata); + expect(TRUE, r); + for(i=0; i<4; i++) { r = get_env(env[i], "SystemRoot", &st); ok(!strcmp(st, "SystemRoot=overwrite"), "%s\n", st); expect(TRUE, r); HeapFree(GetProcessHeap(), 0, st); + + r = get_env(env[i], "ProgramData", &st); + ok(strcmp(st, "ProgramData=overwrite"), "%s\n", st); + expect(TRUE, r); + HeapFree(GetProcessHeap(), 0, st); }
/* Test for common environment variables (NT4 and higher) */ diff --git a/dlls/userenv/userenv_main.c b/dlls/userenv/userenv_main.c index 87ace7d5c11..08dede60d35 100644 --- a/dlls/userenv/userenv_main.c +++ b/dlls/userenv/userenv_main.c @@ -243,7 +243,10 @@ BOOL WINAPI CreateEnvironmentBlock( LPVOID* lpEnvironment, }
if (get_reg_value(env, hkey, L"Public", buf, UNICODE_STRING_MAX_CHARS)) + { set_env_var(&env, L"ALLUSERSPROFILE", buf); + set_env_var(&env, L"ProgramData", buf); + } } else {