| 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 "chrome_frame/chrome_launcher.h" | 5 #include "chrome_frame/chrome_launcher.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 #include <shlwapi.h> | 9 #include <shlwapi.h> |
| 10 | 10 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 // Used for basic checks since CreateProcess doesn't support command lines | 158 // Used for basic checks since CreateProcess doesn't support command lines |
| 159 // longer than 0x8000 characters. If we surpass that length, we do not add the | 159 // longer than 0x8000 characters. If we surpass that length, we do not add the |
| 160 // additional parameters. Because we need to add a space before the | 160 // additional parameters. Because we need to add a space before the |
| 161 // extra parameters, we use 0x7fff and not 0x8000. | 161 // extra parameters, we use 0x7fff and not 0x8000. |
| 162 const size_t kMaxChars = 0x7FFF - command_line->size(); | 162 const size_t kMaxChars = 0x7FFF - command_line->size(); |
| 163 HKEY key; | 163 HKEY key; |
| 164 LONG result; | 164 LONG result; |
| 165 bool found = false; | 165 bool found = false; |
| 166 for (int i = 0; !found && i < arraysize(kRootKeys); ++i) { | 166 for (int i = 0; !found && i < arraysize(kRootKeys); ++i) { |
| 167 result = ::RegOpenKeyExW(kRootKeys[i], policy::kRegistryMandatorySubKey, 0, | 167 result = ::RegOpenKeyExW(kRootKeys[i], policy::kRegistryChromePolicyKey, 0, |
| 168 KEY_QUERY_VALUE, &key); | 168 KEY_QUERY_VALUE, &key); |
| 169 if (result == ERROR_SUCCESS) { | 169 if (result == ERROR_SUCCESS) { |
| 170 DWORD size = 0; | 170 DWORD size = 0; |
| 171 DWORD type = 0; | 171 DWORD type = 0; |
| 172 result = RegQueryValueExW(key, launch_params_value_name.c_str(), | 172 result = RegQueryValueExW(key, launch_params_value_name.c_str(), |
| 173 0, &type, NULL, &size); | 173 0, &type, NULL, &size); |
| 174 if (result == ERROR_SUCCESS && type == REG_SZ && size > 0 && | 174 if (result == ERROR_SUCCESS && type == REG_SZ && size > 0 && |
| 175 (size / sizeof(wchar_t)) < kMaxChars) { | 175 (size / sizeof(wchar_t)) < kMaxChars) { |
| 176 // This size includes any terminating null character or characters | 176 // This size includes any terminating null character or characters |
| 177 // unless the data was stored without them, so for safety we allocate | 177 // unless the data was stored without them, so for safety we allocate |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 if (PathFileExists(cur_path)) { | 259 if (PathFileExists(cur_path)) { |
| 260 *chrome_path = cur_path; | 260 *chrome_path = cur_path; |
| 261 success = true; | 261 success = true; |
| 262 } | 262 } |
| 263 } | 263 } |
| 264 | 264 |
| 265 return success; | 265 return success; |
| 266 } | 266 } |
| 267 | 267 |
| 268 } // namespace chrome_launcher | 268 } // namespace chrome_launcher |
| OLD | NEW |