userenv: Set the ProgramFiles(x86) and CommonProgramFiles(x86) environment variables.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-11-05 21:48:57 -06:00 committed by Alexandre Julliard
parent 6a079faf70
commit 99dc0e0eeb
2 changed files with 28 additions and 8 deletions

View File

@ -104,6 +104,8 @@ static void test_create_env(void)
{ "USERPROFILE" }
};
static const struct profile_item common_win64_vars[] = {
{ "ProgramFiles(x86)" },
{ "CommonProgramFiles(x86)" },
{ "ProgramW6432" },
{ "CommonProgramW6432" }
};

View File

@ -171,11 +171,20 @@ static void set_wow64_environment(WCHAR **env)
RtlSetEnvironmentVariable(env, &nameW, &valueW);
}
}
if (is_wow64 && get_reg_value(*env, hkey, L"ProgramFilesDir (x86)", buf, sizeof(buf)))
if (get_reg_value(*env, hkey, L"ProgramFilesDir (x86)", buf, sizeof(buf)))
{
RtlInitUnicodeString(&nameW, L"ProgramFiles");
RtlInitUnicodeString(&valueW, buf);
RtlSetEnvironmentVariable(env, &nameW, &valueW);
if (is_win64 || is_wow64)
{
RtlInitUnicodeString(&nameW, L"ProgramFiles(x86)");
RtlInitUnicodeString(&valueW, buf);
RtlSetEnvironmentVariable(env, &nameW, &valueW);
}
if (is_wow64)
{
RtlInitUnicodeString(&nameW, L"ProgramFiles");
RtlInitUnicodeString(&valueW, buf);
RtlSetEnvironmentVariable(env, &nameW, &valueW);
}
}
/* set the CommonProgramFiles variables */
@ -195,11 +204,20 @@ static void set_wow64_environment(WCHAR **env)
RtlSetEnvironmentVariable(env, &nameW, &valueW);
}
}
if (is_wow64 && get_reg_value(*env, hkey, L"CommonFilesDir (x86)", buf, sizeof(buf)))
if (get_reg_value(*env, hkey, L"CommonFilesDir (x86)", buf, sizeof(buf)))
{
RtlInitUnicodeString(&nameW, L"CommonProgramFiles");
RtlInitUnicodeString(&valueW, buf);
RtlSetEnvironmentVariable(env, &nameW, &valueW);
if (is_win64 || is_wow64)
{
RtlInitUnicodeString(&nameW, L"CommonProgramFiles(x86)");
RtlInitUnicodeString(&valueW, buf);
RtlSetEnvironmentVariable(env, &nameW, &valueW);
}
if (is_wow64)
{
RtlInitUnicodeString(&nameW, L"CommonProgramFiles");
RtlInitUnicodeString(&valueW, buf);
RtlSetEnvironmentVariable(env, &nameW, &valueW);
}
}
RegCloseKey(hkey);