Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: cloud_print/virtual_driver/win/install/setup.cc

Issue 759903002: Upgrade the windows specific version of LaunchProcess to avoid raw handles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix chrome build Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <setupapi.h> // Must be included after windows.h 6 #include <setupapi.h> // Must be included after windows.h
7 #include <winspool.h> 7 #include <winspool.h>
8 #include <iomanip> 8 #include <iomanip>
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (!install) { 131 if (!install) {
132 command_line.AppendArg("/u"); 132 command_line.AppendArg("/u");
133 } 133 }
134 134
135 // Use system32 path here because otherwise ::AddMonitor would fail. 135 // Use system32 path here because otherwise ::AddMonitor would fail.
136 command_line.AppendArgPath(GetSystemPath(GetPortMonitorDllName())); 136 command_line.AppendArgPath(GetSystemPath(GetPortMonitorDllName()));
137 137
138 base::LaunchOptions options; 138 base::LaunchOptions options;
139 options.wait = true; 139 options.wait = true;
140 140
141 base::win::ScopedHandle regsvr32_handle; 141 base::Process regsvr32_process =
142 if (!base::LaunchProcess(command_line.GetCommandLineString(), options, 142 base::LaunchProcess(command_line.GetCommandLineString(), options);
143 &regsvr32_handle)) { 143 if (!regsvr32_process.IsValid()) {
144 LOG(ERROR) << "Unable to launch regsvr32.exe."; 144 LOG(ERROR) << "Unable to launch regsvr32.exe.";
145 return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); 145 return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
146 } 146 }
147 147
148 DWORD exit_code = S_OK; 148 DWORD exit_code = S_OK;
149 if (install) { 149 if (install) {
150 if (!GetExitCodeProcess(regsvr32_handle.Get(), &exit_code)) { 150 if (!GetExitCodeProcess(regsvr32_process.Handle(), &exit_code)) {
151 LOG(ERROR) << "Unable to get regsvr32.exe exit code."; 151 LOG(ERROR) << "Unable to get regsvr32.exe exit code.";
152 return GetLastHResult(); 152 return GetLastHResult();
153 } 153 }
154 if (exit_code != 0) { 154 if (exit_code != 0) {
155 LOG(ERROR) << "Regsvr32.exe failed with " << exit_code; 155 LOG(ERROR) << "Regsvr32.exe failed with " << exit_code;
156 return HRESULT_FROM_WIN32(exit_code); 156 return HRESULT_FROM_WIN32(exit_code);
157 } 157 }
158 } else { 158 } else {
159 if (!base::DeleteFile(target_path, false)) { 159 if (!base::DeleteFile(target_path, false)) {
160 SpoolerServiceCommand("stop"); 160 SpoolerServiceCommand("stop");
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 551
552 VLOG(0) << GetErrorMessage(retval) 552 VLOG(0) << GetErrorMessage(retval)
553 << " HRESULT=0x" << std::setbase(16) << retval; 553 << " HRESULT=0x" << std::setbase(16) << retval;
554 554
555 // Installer is silent by default as required by Google Update. 555 // Installer is silent by default as required by Google Update.
556 if (base::CommandLine::ForCurrentProcess()->HasSwitch("verbose")) { 556 if (base::CommandLine::ForCurrentProcess()->HasSwitch("verbose")) {
557 DisplayWindowsMessage(NULL, retval, LoadLocalString(IDS_DRIVER_NAME)); 557 DisplayWindowsMessage(NULL, retval, LoadLocalString(IDS_DRIVER_NAME));
558 } 558 }
559 return retval; 559 return retval;
560 } 560 }
OLDNEW
« no previous file with comments | « chrome/installer/util/install_util.cc ('k') | components/storage_monitor/storage_monitor_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698