| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cloud_print/virtual_driver/win/virtual_driver_helpers.h" |
| 6 |
| 7 #include <windows.h> |
| 8 #include <winspool.h> |
| 9 |
| 10 #include "base/files/file_util.h" |
| 11 #include "base/logging.h" |
| 12 #include "base/strings/string16.h" |
| 13 #include "base/win/windows_version.h" |
| 14 #include "cloud_print/common/win/cloud_print_utils.h" |
| 15 |
| 16 namespace cloud_print { |
| 17 |
| 18 void DisplayWindowsMessage(HWND hwnd, |
| 19 HRESULT hr, |
| 20 const base::string16& caption) { |
| 21 ::MessageBox(hwnd, GetErrorMessage(hr).c_str(), caption.c_str(), MB_OK); |
| 22 } |
| 23 |
| 24 HRESULT GetPrinterDriverDir(base::FilePath* path) { |
| 25 BYTE driver_dir_buffer[MAX_PATH * sizeof(wchar_t)]; |
| 26 DWORD needed = 0; |
| 27 if (!GetPrinterDriverDirectory(NULL, NULL, 1, driver_dir_buffer, |
| 28 MAX_PATH * sizeof(wchar_t), &needed)) { |
| 29 // We could try to allocate a larger buffer if needed > MAX_PATH |
| 30 // but that really shouldn't happen. |
| 31 return cloud_print::GetLastHResult(); |
| 32 } |
| 33 *path = base::FilePath(reinterpret_cast<wchar_t*>(driver_dir_buffer)); |
| 34 |
| 35 // The XPS driver is a "Level 3" driver |
| 36 *path = path->Append(L"3"); |
| 37 return S_OK; |
| 38 } |
| 39 } |
| OLD | NEW |