Commit 99dc0e0e authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

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

parent 6a079faf
......@@ -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" }
};
......
......@@ -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);
......
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