userenv: Set ProgramData in CreateEnvironmentBlock.

Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Derek Lesho 2022-02-03 17:09:08 -05:00 committed by Alexandre Julliard
parent ccf7b4459b
commit c29621ff70
2 changed files with 19 additions and 1 deletions

View File

@ -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) */

View File

@ -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
{