OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <windows.h> | 5 #include <windows.h> |
6 #include <shlobj.h> | 6 #include <shlobj.h> |
7 | 7 |
8 #include "base/base_paths.h" | 8 #include "base/base_paths.h" |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 case base::DIR_PROGRAM_FILES: | 63 case base::DIR_PROGRAM_FILES: |
64 if (FAILED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, | 64 if (FAILED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, |
65 SHGFP_TYPE_CURRENT, system_buffer))) | 65 SHGFP_TYPE_CURRENT, system_buffer))) |
66 return false; | 66 return false; |
67 cur = FilePath(system_buffer); | 67 cur = FilePath(system_buffer); |
68 break; | 68 break; |
69 case base::DIR_PROGRAM_FILES6432: | 69 case base::DIR_PROGRAM_FILES6432: |
70 #if !defined(_WIN64) | 70 #if !defined(_WIN64) |
71 if (base::win::OSInfo::GetInstance()->wow64_status() == | 71 if (base::win::OSInfo::GetInstance()->wow64_status() == |
72 base::win::OSInfo::WOW64_ENABLED) { | 72 base::win::OSInfo::WOW64_ENABLED) { |
73 scoped_ptr<base::Environment> env(base::Environment::Create()); | 73 std::unique_ptr<base::Environment> env(base::Environment::Create()); |
74 std::string programfiles_w6432; | 74 std::string programfiles_w6432; |
75 // 32-bit process running in WOW64 sets ProgramW6432 environment | 75 // 32-bit process running in WOW64 sets ProgramW6432 environment |
76 // variable. See | 76 // variable. See |
77 // https://msdn.microsoft.com/library/windows/desktop/aa384274.aspx. | 77 // https://msdn.microsoft.com/library/windows/desktop/aa384274.aspx. |
78 if (!env->GetVar("ProgramW6432", &programfiles_w6432)) | 78 if (!env->GetVar("ProgramW6432", &programfiles_w6432)) |
79 return false; | 79 return false; |
80 // GetVar returns UTF8 - convert back to Wide. | 80 // GetVar returns UTF8 - convert back to Wide. |
81 cur = FilePath(UTF8ToWide(programfiles_w6432)); | 81 cur = FilePath(UTF8ToWide(programfiles_w6432)); |
82 break; | 82 break; |
83 } | 83 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 break; | 185 break; |
186 default: | 186 default: |
187 return false; | 187 return false; |
188 } | 188 } |
189 | 189 |
190 *result = cur; | 190 *result = cur; |
191 return true; | 191 return true; |
192 } | 192 } |
193 | 193 |
194 } // namespace base | 194 } // namespace base |
OLD | NEW |