Commit c29621ff authored by Derek Lesho's avatar Derek Lesho Committed by Alexandre Julliard

userenv: Set ProgramData in CreateEnvironmentBlock.

parent ccf7b445
......@@ -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) */
......
......@@ -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
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment