summaryrefslogtreecommitdiffstats
path: root/cloud_print
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 /cloud_print
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 'cloud_print')
-rw-r--r--cloud_print/service/win/chrome_launcher.cc13
-rw-r--r--cloud_print/virtual_driver/win/install/setup.cc9
2 files changed, 12 insertions, 10 deletions
diff --git a/cloud_print/service/win/chrome_launcher.cc b/cloud_print/service/win/chrome_launcher.cc
index 51501df..35d760e 100644
--- a/cloud_print/service/win/chrome_launcher.cc
+++ b/cloud_print/service/win/chrome_launcher.cc
@@ -67,22 +67,23 @@ void CloseChrome(HANDLE process, DWORD thread_id) {
}
bool LaunchProcess(const CommandLine& cmdline,
- base::ProcessHandle* process_handle,
+ base::win::ScopedHandle* process_handle,
DWORD* thread_id) {
STARTUPINFO startup_info = {};
startup_info.cb = sizeof(startup_info);
startup_info.dwFlags = STARTF_USESHOWWINDOW;
startup_info.wShowWindow = SW_SHOW;
- base::win::ScopedProcessInformation process_info;
+ PROCESS_INFORMATION temp_process_info = {};
if (!CreateProcess(NULL,
const_cast<wchar_t*>(cmdline.GetCommandLineString().c_str()), NULL, NULL,
- FALSE, 0, NULL, NULL, &startup_info, process_info.Receive())) {
+ FALSE, 0, NULL, NULL, &startup_info, &temp_process_info)) {
return false;
}
+ base::win::ScopedProcessInformation process_info(temp_process_info);
if (process_handle)
- *process_handle = process_info.TakeProcessHandle();
+ process_handle->Set(process_info.TakeProcessHandle());
if (thread_id)
*thread_id = process_info.thread_id();
@@ -240,7 +241,7 @@ void ChromeLauncher::Run() {
base::win::ScopedHandle chrome_handle;
base::Time started = base::Time::Now();
DWORD thread_id = 0;
- LaunchProcess(cmd, chrome_handle.Receive(), &thread_id);
+ LaunchProcess(cmd, &chrome_handle, &thread_id);
HANDLE handles[] = {stop_event_.handle(), chrome_handle};
DWORD wait_result = WAIT_TIMEOUT;
@@ -317,7 +318,7 @@ std::string ChromeLauncher::CreateServiceStateFile(
base::win::ScopedHandle chrome_handle;
DWORD thread_id = 0;
- if (!LaunchProcess(cmd, chrome_handle.Receive(), &thread_id)) {
+ if (!LaunchProcess(cmd, &chrome_handle, &thread_id)) {
LOG(ERROR) << "Unable to launch Chrome.";
return result;
}
diff --git a/cloud_print/virtual_driver/win/install/setup.cc b/cloud_print/virtual_driver/win/install/setup.cc
index 6e0df24..1c87ca2 100644
--- a/cloud_print/virtual_driver/win/install/setup.cc
+++ b/cloud_print/virtual_driver/win/install/setup.cc
@@ -97,7 +97,7 @@ void SpoolerServiceCommand(const char* command) {
base::LaunchOptions options;
options.wait = true;
options.start_hidden = true;
- LOG(INFO) << command_line.GetCommandLineString();
+ VLOG(0) << command_line.GetCommandLineString();
base::LaunchProcess(command_line, options, NULL);
}
@@ -140,7 +140,8 @@ HRESULT RegisterPortMonitor(bool install, const base::FilePath& install_path) {
options.wait = true;
base::win::ScopedHandle regsvr32_handle;
- if (!base::LaunchProcess(command_line, options, regsvr32_handle.Receive())) {
+ if (!base::LaunchProcess(command_line.GetCommandLineString(), options,
+ &regsvr32_handle)) {
LOG(ERROR) << "Unable to launch regsvr32.exe.";
return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
}
@@ -540,8 +541,8 @@ int WINAPI WinMain(__in HINSTANCE hInstance,
CommandLine::Init(0, NULL);
HRESULT retval = cloud_print::ExecuteCommands();
- LOG(INFO) << _com_error(retval).ErrorMessage() << " HRESULT=0x" <<
- std::setbase(16) << retval;
+ VLOG(0) << _com_error(retval).ErrorMessage() << " HRESULT=0x" <<
+ std::setbase(16) << retval;
// Installer is silent by default as required by Google Update.
if (CommandLine::ForCurrentProcess()->HasSwitch("verbose")) {