1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-08 03:45:57 +00:00

userenv: Fix setting ALLUSERSPROFILE and ProgramData in CreateEnvironmentBlock.

This syncs the code with dlls/ntdll/unix/env.c add_registry_environment.
It fixes ALLUSERSPROFILE and ProgramData environment variables value
in services.
This commit is contained in:
Piotr Caban 2023-07-25 12:56:57 +02:00 committed by Alexandre Julliard
parent 9b400f3f3e
commit 94812b1265
2 changed files with 6 additions and 3 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], programdata[100];
char * st, systemroot[100], programdata[100], allusersprofile[100];
int i, j;
static const struct profile_item common_vars[] = {
@ -186,7 +186,7 @@ static void test_create_env(void)
}
/* Test for common environment variables (post NT4) */
if (!GetEnvironmentVariableA("ALLUSERSPROFILE", NULL, 0))
if (!GetEnvironmentVariableA("ALLUSERSPROFILE", allusersprofile, sizeof(allusersprofile)))
{
win_skip("Some environment variables are not present on NT4\n");
}
@ -198,6 +198,9 @@ static void test_create_env(void)
{
r = get_env(env[j], common_post_nt4_vars[i].name, &st);
expect_env(TRUE, r, common_post_nt4_vars[i].name);
if (!strcmp(common_post_nt4_vars[i].name, "ALLUSERSPROFILE") ||
!strcmp(common_post_nt4_vars[i].name, "ProgramData"))
ok(!strcmp(st + strlen(common_post_nt4_vars[i].name) + 1, allusersprofile), "%s\n", st);
if (r) HeapFree(GetProcessHeap(), 0, st);
}
}

View File

@ -242,7 +242,7 @@ BOOL WINAPI CreateEnvironmentBlock( LPVOID* lpEnvironment,
profiles_dir[len] = '\0';
}
if (get_reg_value(env, hkey, L"Public", buf, UNICODE_STRING_MAX_CHARS))
if (get_reg_value(env, hkey, L"ProgramData", buf, UNICODE_STRING_MAX_CHARS))
{
set_env_var(&env, L"ALLUSERSPROFILE", buf);
set_env_var(&env, L"ProgramData", buf);