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

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

Issue 71013004: Base: Remove Receive() from ScopedHandle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix delegate_execute for google_chrome_build Created 7 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 | Annotate | Revision Log
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 <comdef.h> 5 #include <comdef.h>
6 #include <iomanip> 6 #include <iomanip>
7 #include <windows.h> 7 #include <windows.h>
8 #include <winspool.h> 8 #include <winspool.h>
9 #include <setupapi.h> // Must be included after windows.h 9 #include <setupapi.h> // Must be included after windows.h
10 10
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 if (net_path.empty()) 90 if (net_path.empty())
91 return; 91 return;
92 CommandLine command_line(net_path); 92 CommandLine command_line(net_path);
93 command_line.AppendArg(command); 93 command_line.AppendArg(command);
94 command_line.AppendArg("spooler"); 94 command_line.AppendArg("spooler");
95 command_line.AppendArg("/y"); 95 command_line.AppendArg("/y");
96 96
97 base::LaunchOptions options; 97 base::LaunchOptions options;
98 options.wait = true; 98 options.wait = true;
99 options.start_hidden = true; 99 options.start_hidden = true;
100 LOG(INFO) << command_line.GetCommandLineString(); 100 VLOG(0) << command_line.GetCommandLineString();
101 base::LaunchProcess(command_line, options, NULL); 101 base::LaunchProcess(command_line, options, NULL);
102 } 102 }
103 103
104 HRESULT RegisterPortMonitor(bool install, const base::FilePath& install_path) { 104 HRESULT RegisterPortMonitor(bool install, const base::FilePath& install_path) {
105 DCHECK(install || install_path.empty()); 105 DCHECK(install || install_path.empty());
106 base::FilePath target_path = GetNativeSystemPath(GetPortMonitorDllName()); 106 base::FilePath target_path = GetNativeSystemPath(GetPortMonitorDllName());
107 if (target_path.empty()) { 107 if (target_path.empty()) {
108 LOG(ERROR) << "Unable to get port monitor target path."; 108 LOG(ERROR) << "Unable to get port monitor target path.";
109 return HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND); 109 return HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND);
110 } 110 }
(...skipping 22 matching lines...) Expand all
133 command_line.AppendArg("/u"); 133 command_line.AppendArg("/u");
134 } 134 }
135 135
136 // Use system32 path here because otherwise ::AddMonitor would fail. 136 // Use system32 path here because otherwise ::AddMonitor would fail.
137 command_line.AppendArgPath(GetSystemPath(GetPortMonitorDllName())); 137 command_line.AppendArgPath(GetSystemPath(GetPortMonitorDllName()));
138 138
139 base::LaunchOptions options; 139 base::LaunchOptions options;
140 options.wait = true; 140 options.wait = true;
141 141
142 base::win::ScopedHandle regsvr32_handle; 142 base::win::ScopedHandle regsvr32_handle;
143 if (!base::LaunchProcess(command_line, options, regsvr32_handle.Receive())) { 143 if (!base::LaunchProcess(command_line.GetCommandLineString(), options,
144 &regsvr32_handle)) {
144 LOG(ERROR) << "Unable to launch regsvr32.exe."; 145 LOG(ERROR) << "Unable to launch regsvr32.exe.";
145 return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); 146 return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
146 } 147 }
147 148
148 DWORD exit_code = S_OK; 149 DWORD exit_code = S_OK;
149 if (install) { 150 if (install) {
150 if (!GetExitCodeProcess(regsvr32_handle, &exit_code)) { 151 if (!GetExitCodeProcess(regsvr32_handle, &exit_code)) {
151 LOG(ERROR) << "Unable to get regsvr32.exe exit code."; 152 LOG(ERROR) << "Unable to get regsvr32.exe exit code.";
152 return GetLastHResult(); 153 return GetLastHResult();
153 } 154 }
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 } // namespace cloud_print 534 } // namespace cloud_print
534 535
535 int WINAPI WinMain(__in HINSTANCE hInstance, 536 int WINAPI WinMain(__in HINSTANCE hInstance,
536 __in HINSTANCE hPrevInstance, 537 __in HINSTANCE hPrevInstance,
537 __in LPSTR lpCmdLine, 538 __in LPSTR lpCmdLine,
538 __in int nCmdShow) { 539 __in int nCmdShow) {
539 base::AtExitManager at_exit_manager; 540 base::AtExitManager at_exit_manager;
540 CommandLine::Init(0, NULL); 541 CommandLine::Init(0, NULL);
541 HRESULT retval = cloud_print::ExecuteCommands(); 542 HRESULT retval = cloud_print::ExecuteCommands();
542 543
543 LOG(INFO) << _com_error(retval).ErrorMessage() << " HRESULT=0x" << 544 VLOG(0) << _com_error(retval).ErrorMessage() << " HRESULT=0x" <<
544 std::setbase(16) << retval; 545 std::setbase(16) << retval;
545 546
546 // Installer is silent by default as required by Google Update. 547 // Installer is silent by default as required by Google Update.
547 if (CommandLine::ForCurrentProcess()->HasSwitch("verbose")) { 548 if (CommandLine::ForCurrentProcess()->HasSwitch("verbose")) {
548 cloud_print::DisplayWindowsMessage(NULL, retval, 549 cloud_print::DisplayWindowsMessage(NULL, retval,
549 cloud_print::LoadLocalString(IDS_DRIVER_NAME)); 550 cloud_print::LoadLocalString(IDS_DRIVER_NAME));
550 } 551 }
551 return retval; 552 return retval;
552 } 553 }
OLDNEW
« no previous file with comments | « cloud_print/service/win/chrome_launcher.cc ('k') | components/nacl/browser/nacl_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698