| OLD | NEW | 
|---|
| 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 "cloud_print/virtual_driver/win/virtual_driver_helpers.h" | 5 #include "cloud_print/virtual_driver/win/virtual_driver_helpers.h" | 
| 6 #include <windows.h> | 6 #include <windows.h> | 
| 7 #include <winspool.h> | 7 #include <winspool.h> | 
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" | 
| 9 #include "base/logging.h" | 9 #include "base/logging.h" | 
| 10 #include "base/string16.h" | 10 #include "base/string16.h" | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
| 35 } | 35 } | 
| 36 | 36 | 
| 37 string16 GetPortMonitorDllName() { | 37 string16 GetPortMonitorDllName() { | 
| 38   if (IsSystem64Bit()) { | 38   if (IsSystem64Bit()) { | 
| 39     return string16(L"gcp_portmon64.dll"); | 39     return string16(L"gcp_portmon64.dll"); | 
| 40   } else { | 40   } else { | 
| 41     return string16(L"gcp_portmon.dll"); | 41     return string16(L"gcp_portmon.dll"); | 
| 42   } | 42   } | 
| 43 } | 43 } | 
| 44 | 44 | 
| 45 HRESULT GetPrinterDriverDir(FilePath* path) { | 45 HRESULT GetPrinterDriverDir(base::FilePath* path) { | 
| 46   BYTE driver_dir_buffer[MAX_PATH * sizeof(wchar_t)]; | 46   BYTE driver_dir_buffer[MAX_PATH * sizeof(wchar_t)]; | 
| 47   DWORD needed = 0; | 47   DWORD needed = 0; | 
| 48   if (!GetPrinterDriverDirectory(NULL, | 48   if (!GetPrinterDriverDirectory(NULL, | 
| 49                                  NULL, | 49                                  NULL, | 
| 50                                  1, | 50                                  1, | 
| 51                                  driver_dir_buffer, | 51                                  driver_dir_buffer, | 
| 52                                  MAX_PATH * sizeof(wchar_t), | 52                                  MAX_PATH * sizeof(wchar_t), | 
| 53                                  &needed)) { | 53                                  &needed)) { | 
| 54     // We could try to allocate a larger buffer if needed > MAX_PATH | 54     // We could try to allocate a larger buffer if needed > MAX_PATH | 
| 55     // but that really shouldn't happen. | 55     // but that really shouldn't happen. | 
| 56     return cloud_print::GetLastHResult(); | 56     return cloud_print::GetLastHResult(); | 
| 57   } | 57   } | 
| 58   *path = FilePath(reinterpret_cast<wchar_t*>(driver_dir_buffer)); | 58   *path = base::FilePath(reinterpret_cast<wchar_t*>(driver_dir_buffer)); | 
| 59 | 59 | 
| 60   // The XPS driver is a "Level 3" driver | 60   // The XPS driver is a "Level 3" driver | 
| 61   *path = path->Append(L"3"); | 61   *path = path->Append(L"3"); | 
| 62   return S_OK; | 62   return S_OK; | 
| 63 } | 63 } | 
| 64 | 64 | 
| 65 bool IsSystem64Bit() { | 65 bool IsSystem64Bit() { | 
| 66   base::win::OSInfo::WindowsArchitecture arch = | 66   base::win::OSInfo::WindowsArchitecture arch = | 
| 67       base::win::OSInfo::GetInstance()->architecture(); | 67       base::win::OSInfo::GetInstance()->architecture(); | 
| 68   return (arch == base::win::OSInfo::X64_ARCHITECTURE) || | 68   return (arch == base::win::OSInfo::X64_ARCHITECTURE) || | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 80                     &module); | 80                     &module); | 
| 81   int count = LoadString(module, | 81   int count = LoadString(module, | 
| 82                          string_id, | 82                          string_id, | 
| 83                          buffer, | 83                          buffer, | 
| 84                          MAX_PATH); | 84                          MAX_PATH); | 
| 85   CHECK_NE(0, count); | 85   CHECK_NE(0, count); | 
| 86   return string16(buffer); | 86   return string16(buffer); | 
| 87 } | 87 } | 
| 88 } | 88 } | 
| 89 | 89 | 
| OLD | NEW | 
|---|