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

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

Issue 382673002: Fixes for re-enabling more MSVC level 4 warnings: misc edition #2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 months 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
« no previous file with comments | « ash/drag_drop/drag_drop_controller.cc ('k') | crypto/symmetric_key_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <iomanip> 5 #include <iomanip>
6 #include <windows.h> 6 #include <windows.h>
7 #include <winspool.h> 7 #include <winspool.h>
8 #include <setupapi.h> // Must be included after windows.h 8 #include <setupapi.h> // Must be included after windows.h
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 temp_path->Append(kDependencyList[i]).value().c_str()); 203 temp_path->Append(kDependencyList[i]).value().c_str());
204 return FILEOP_DOIT; 204 return FILEOP_DOIT;
205 } 205 }
206 } 206 }
207 return FILEOP_SKIP; 207 return FILEOP_SKIP;
208 } 208 }
209 return NO_ERROR; 209 return NO_ERROR;
210 } 210 }
211 211
212 void ReadyDriverDependencies(const base::FilePath& destination) { 212 void ReadyDriverDependencies(const base::FilePath& destination) {
213 base::FilePath destination_copy(destination);
213 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { 214 if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
214 // GetCorePrinterDrivers and GetPrinterDriverPackagePath only exist on 215 // GetCorePrinterDrivers and GetPrinterDriverPackagePath only exist on
215 // Vista and later. Winspool.drv must be delayloaded so these calls don't 216 // Vista and later. Winspool.drv must be delayloaded so these calls don't
216 // create problems on XP. 217 // create problems on XP.
217 DWORD size = MAX_PATH; 218 DWORD size = MAX_PATH;
218 wchar_t package_path[MAX_PATH] = {0}; 219 wchar_t package_path[MAX_PATH] = {0};
219 CORE_PRINTER_DRIVER driver; 220 CORE_PRINTER_DRIVER driver;
220 GetCorePrinterDrivers(NULL, NULL, L"{D20EA372-DD35-4950-9ED8-A6335AFE79F5}", 221 GetCorePrinterDrivers(NULL, NULL, L"{D20EA372-DD35-4950-9ED8-A6335AFE79F5}",
221 1, &driver); 222 1, &driver);
222 GetPrinterDriverPackagePath(NULL, NULL, NULL, driver.szPackageID, 223 GetPrinterDriverPackagePath(NULL, NULL, NULL, driver.szPackageID,
223 package_path, MAX_PATH, &size); 224 package_path, MAX_PATH, &size);
224 SetupIterateCabinet(package_path, 0, &CabinetCallback, 225 SetupIterateCabinet(package_path, 0, &CabinetCallback, &destination_copy);
225 &base::FilePath(destination));
226 } else { 226 } else {
227 // Driver files are in the sp3 cab. 227 // Driver files are in the sp3 cab.
228 base::FilePath package_path; 228 base::FilePath package_path;
229 PathService::Get(base::DIR_WINDOWS, &package_path); 229 PathService::Get(base::DIR_WINDOWS, &package_path);
230 package_path = package_path.Append(L"Driver Cache\\i386\\sp3.cab"); 230 package_path = package_path.Append(L"Driver Cache\\i386\\sp3.cab");
231 SetupIterateCabinet(package_path.value().c_str(), 0, &CabinetCallback, 231 SetupIterateCabinet(package_path.value().c_str(), 0, &CabinetCallback,
232 &base::FilePath(destination)); 232 &destination_copy);
233 233
234 // Copy the rest from the driver cache or system dir. 234 // Copy the rest from the driver cache or system dir.
235 base::FilePath driver_cache_path; 235 base::FilePath driver_cache_path;
236 PathService::Get(base::DIR_WINDOWS, &driver_cache_path); 236 PathService::Get(base::DIR_WINDOWS, &driver_cache_path);
237 driver_cache_path = driver_cache_path.Append(L"Driver Cache\\i386"); 237 driver_cache_path = driver_cache_path.Append(L"Driver Cache\\i386");
238 for (size_t i = 0; i < arraysize(kDependencyList); ++i) { 238 for (size_t i = 0; i < arraysize(kDependencyList); ++i) {
239 base::FilePath dst_path = destination.Append(kDependencyList[i]); 239 base::FilePath dst_path = destination.Append(kDependencyList[i]);
240 if (!base::PathExists(dst_path)) { 240 if (!base::PathExists(dst_path)) {
241 base::FilePath src_path = driver_cache_path.Append(kDependencyList[i]); 241 base::FilePath src_path = driver_cache_path.Append(kDependencyList[i]);
242 if (!base::PathExists(src_path)) 242 if (!base::PathExists(src_path))
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 550
551 VLOG(0) << GetErrorMessage(retval) 551 VLOG(0) << GetErrorMessage(retval)
552 << " HRESULT=0x" << std::setbase(16) << retval; 552 << " HRESULT=0x" << std::setbase(16) << retval;
553 553
554 // Installer is silent by default as required by Google Update. 554 // Installer is silent by default as required by Google Update.
555 if (CommandLine::ForCurrentProcess()->HasSwitch("verbose")) { 555 if (CommandLine::ForCurrentProcess()->HasSwitch("verbose")) {
556 DisplayWindowsMessage(NULL, retval, LoadLocalString(IDS_DRIVER_NAME)); 556 DisplayWindowsMessage(NULL, retval, LoadLocalString(IDS_DRIVER_NAME));
557 } 557 }
558 return retval; 558 return retval;
559 } 559 }
OLDNEW
« no previous file with comments | « ash/drag_drop/drag_drop_controller.cc ('k') | crypto/symmetric_key_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698