summaryrefslogtreecommitdiffstats
path: root/win8
diff options
context:
space:
mode:
authorrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-28 05:16:59 +0000
committerrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-28 05:16:59 +0000
commit5be06e403789b537097560fef594000626a61997 (patch)
tree7921ffcc481aa118a901086229fda96519973757 /win8
parent96798670fd3a04b7bf820eb39c7fdbde25414e53 (diff)
downloadchromium_src-5be06e403789b537097560fef594000626a61997.zip
chromium_src-5be06e403789b537097560fef594000626a61997.tar.gz
chromium_src-5be06e403789b537097560fef594000626a61997.tar.bz2
Base: Remove Receive() from ScopedHandle.
In general, the OS API contract doesn't guarantee that output variables are not modified on failure, so a Reeceive pattern is fundamentally insecure. BUG=318531 TEST=current tests tbr'ing owners for the consumers. TBR=jvoung@chromium.org, thakis@chromium.org, sergeyu@chromium.org, grt@chromium.org, gene@chromium.org, youngki@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=237459 Review URL: https://codereview.chromium.org/71013004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237675 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'win8')
-rw-r--r--win8/delegate_execute/chrome_util.cc9
-rw-r--r--win8/delegate_execute/command_execute_impl.cc5
-rw-r--r--win8/test/metro_registration_helper.cc7
3 files changed, 11 insertions, 10 deletions
diff --git a/win8/delegate_execute/chrome_util.cc b/win8/delegate_execute/chrome_util.cc
index dec23f7..3695b33 100644
--- a/win8/delegate_execute/chrome_util.cc
+++ b/win8/delegate_execute/chrome_util.cc
@@ -103,7 +103,7 @@ void UpdateChromeIfNeeded(const base::FilePath& chrome_exe) {
if (IsBrowserRunning(chrome_exe) || !NewChromeExeExists(chrome_exe))
return;
- base::ProcessHandle process_handle = base::kNullProcessHandle;
+ base::win::ScopedHandle process_handle;
if (InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())) {
// Read the update command from the registry.
@@ -119,7 +119,6 @@ void UpdateChromeIfNeeded(const base::FilePath& chrome_exe) {
&process_handle)) {
AtlTrace("%hs. Failed to launch command to finalize update; "
"error %u.\n", __FUNCTION__, ::GetLastError());
- process_handle = base::kNullProcessHandle;
}
}
} else {
@@ -140,16 +139,16 @@ void UpdateChromeIfNeeded(const base::FilePath& chrome_exe) {
AtlTrace("%hs. Failed to launch command to finalize update; "
"hr=0x%X.\n", __FUNCTION__, hr);
} else {
- process_handle = reinterpret_cast<base::ProcessHandle>(handle);
+ process_handle.Set(reinterpret_cast<base::ProcessHandle>(handle));
}
}
}
// Wait for the update to complete and report the results.
- if (process_handle != base::kNullProcessHandle) {
+ if (process_handle.IsValid()) {
int exit_code = 0;
// WaitForExitCode will close the handle in all cases.
- if (!base::WaitForExitCode(process_handle, &exit_code)) {
+ if (!base::WaitForExitCode(process_handle.Take(), &exit_code)) {
AtlTrace("%hs. Failed to get result when finalizing update.\n",
__FUNCTION__);
} else if (exit_code != installer::RENAME_SUCCESSFUL) {
diff --git a/win8/delegate_execute/command_execute_impl.cc b/win8/delegate_execute/command_execute_impl.cc
index 5f6cc19..f52037b 100644
--- a/win8/delegate_execute/command_execute_impl.cc
+++ b/win8/delegate_execute/command_execute_impl.cc
@@ -487,12 +487,13 @@ HRESULT CommandExecuteImpl::LaunchDesktopChrome() {
AtlTrace("Formatted command line is %ls\n", command_line.c_str());
- base::win::ScopedProcessInformation proc_info;
+ PROCESS_INFORMATION temp_process_info = {};
BOOL ret = CreateProcess(chrome_exe_.value().c_str(),
const_cast<LPWSTR>(command_line.c_str()),
NULL, NULL, FALSE, 0, NULL, NULL, &start_info_,
- proc_info.Receive());
+ &temp_process_info);
if (ret) {
+ base::win::ScopedProcessInformation proc_info(temp_process_info);
AtlTrace("Process id is %d\n", proc_info.process_id());
AllowSetForegroundWindow(proc_info.process_id());
} else {
diff --git a/win8/test/metro_registration_helper.cc b/win8/test/metro_registration_helper.cc
index bcf5644..75319a9 100644
--- a/win8/test/metro_registration_helper.cc
+++ b/win8/test/metro_registration_helper.cc
@@ -54,11 +54,12 @@ bool RegisterTestDefaultBrowser() {
register_command.AppendArg("/RegServer");
base::win::ScopedHandle register_handle;
- if (base::LaunchProcess(register_command, base::LaunchOptions(),
- register_handle.Receive())) {
+ if (base::LaunchProcess(register_command.GetCommandLineString(),
+ base::LaunchOptions(),
+ &register_handle)) {
int ret = 0;
if (base::WaitForExitCodeWithTimeout(
- register_handle, &ret,
+ register_handle.Get(), &ret,
base::TimeDelta::FromSeconds(kRegistrationTimeoutSeconds))) {
if (ret == 0) {
return true;