+ lError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
+ L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
+ 0,
+ KEY_READ,
+ &hKey);
+ if (lError == ERROR_SUCCESS)
+ {
+ Length = 1024 * sizeof(WCHAR);
+ lError = RegQueryValueExW(hKey,
+ L"ProgramFilesDir",
+ NULL,
+ &dwType,
+ (LPBYTE)szValue,
+ &Length);
+ if (lError == ERROR_SUCCESS)
+ {
+ SetUserEnvironmentVariable(lpEnvironment,
+ L"ProgramFiles",
+ szValue,
+ FALSE);
+ }
+
+ Length = 1024 * sizeof(WCHAR);
+ lError = RegQueryValueExW(hKey,
+ L"CommonFilesDir",
+ NULL,
+ &dwType,
+ (LPBYTE)szValue,
+ &Length);
+ if (lError == ERROR_SUCCESS)
+ {
+ SetUserEnvironmentVariable(lpEnvironment,
+ L"CommonProgramFiles",
+ szValue,
+ FALSE);
+ }
+
+ RegCloseKey(hKey);
+ }
+
+ if (hToken == NULL)
+ return TRUE;
+
+ hKeyUser = GetCurrentUserKey(hToken);
+ if (hKeyUser == NULL)
+ {
+ DPRINT1("GetCurrentUserKey() failed\n");
+ RtlDestroyEnvironment(*lpEnvironment);
+ return FALSE;
+ }
+