Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: base/base_paths_win.cc

Issue 1013463003: Update from https://crrev.com/320931 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/base_paths_win.h ('k') | base/compiler_specific.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/base_paths_win.cc
diff --git a/base/base_paths_win.cc b/base/base_paths_win.cc
index 5bef3106aaf010f8f50029a1a580a1d3bd20865a..4ecb59d4dec1f5cdd64e3c61abaa72227676bad2 100644
--- a/base/base_paths_win.cc
+++ b/base/base_paths_win.cc
@@ -6,8 +6,10 @@
#include <shlobj.h>
#include "base/base_paths.h"
+#include "base/environment.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
+#include "base/strings/utf_string_conversions.h"
#include "base/win/scoped_co_mem.h"
#include "base/win/windows_version.h"
@@ -65,6 +67,27 @@ bool PathProviderWin(int key, FilePath* result) {
return false;
cur = FilePath(system_buffer);
break;
+ case base::DIR_PROGRAM_FILES6432:
+#if !defined(_WIN64)
+ if (base::win::OSInfo::GetInstance()->wow64_status() ==
+ base::win::OSInfo::WOW64_ENABLED) {
+ scoped_ptr<base::Environment> env(base::Environment::Create());
+ std::string programfiles_w6432;
+ // 32-bit process running in WOW64 sets ProgramW6432 environment
+ // variable. See
+ // https://msdn.microsoft.com/library/windows/desktop/aa384274.aspx.
+ if (!env->GetVar("ProgramW6432", &programfiles_w6432))
+ return false;
+ // GetVar returns UTF8 - convert back to Wide.
+ cur = FilePath(UTF8ToWide(programfiles_w6432));
+ break;
+ }
+#endif
+ if (FAILED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL,
+ SHGFP_TYPE_CURRENT, system_buffer)))
+ return false;
+ cur = FilePath(system_buffer);
+ break;
case base::DIR_IE_INTERNET_CACHE:
if (FAILED(SHGetFolderPath(NULL, CSIDL_INTERNET_CACHE, NULL,
SHGFP_TYPE_CURRENT, system_buffer)))
« no previous file with comments | « base/base_paths_win.h ('k') | base/compiler_specific.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698