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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 case base::DIR_PROGRAM_FILES: | 66 case base::DIR_PROGRAM_FILES: |
67 if (FAILED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, | 67 if (FAILED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, |
68 SHGFP_TYPE_CURRENT, system_buffer))) | 68 SHGFP_TYPE_CURRENT, system_buffer))) |
69 return false; | 69 return false; |
70 cur = FilePath(system_buffer); | 70 cur = FilePath(system_buffer); |
71 break; | 71 break; |
72 case base::DIR_PROGRAM_FILES6432: | 72 case base::DIR_PROGRAM_FILES6432: |
73 #if !defined(_WIN64) | 73 #if !defined(_WIN64) |
74 if (base::win::OSInfo::GetInstance()->wow64_status() == | 74 if (base::win::OSInfo::GetInstance()->wow64_status() == |
75 base::win::OSInfo::WOW64_ENABLED) { | 75 base::win::OSInfo::WOW64_ENABLED) { |
76 scoped_ptr<base::Environment> env(base::Environment::Create()); | 76 std::unique_ptr<base::Environment> env(base::Environment::Create()); |
77 std::string programfiles_w6432; | 77 std::string programfiles_w6432; |
78 // 32-bit process running in WOW64 sets ProgramW6432 environment | 78 // 32-bit process running in WOW64 sets ProgramW6432 environment |
79 // variable. See | 79 // variable. See |
80 // https://msdn.microsoft.com/library/windows/desktop/aa384274.aspx. | 80 // https://msdn.microsoft.com/library/windows/desktop/aa384274.aspx. |
81 if (!env->GetVar("ProgramW6432", &programfiles_w6432)) | 81 if (!env->GetVar("ProgramW6432", &programfiles_w6432)) |
82 return false; | 82 return false; |
83 // GetVar returns UTF8 - convert back to Wide. | 83 // GetVar returns UTF8 - convert back to Wide. |
84 cur = FilePath(UTF8ToWide(programfiles_w6432)); | 84 cur = FilePath(UTF8ToWide(programfiles_w6432)); |
85 break; | 85 break; |
86 } | 86 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 break; | 188 break; |
189 default: | 189 default: |
190 return false; | 190 return false; |
191 } | 191 } |
192 | 192 |
193 *result = cur; | 193 *result = cur; |
194 return true; | 194 return true; |
195 } | 195 } |
196 | 196 |
197 } // namespace base | 197 } // namespace base |
OLD | NEW |