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.
5 #include "printing/backend/printing_info_win.h"
7 #include "base/logging.h"
13 uint8
* GetDriverInfo(HANDLE printer
, int level
) {
15 ::GetPrinterDriver(printer
, NULL
, level
, NULL
, 0, &size
);
19 scoped_ptr
<uint8
[]> buffer(new uint8
[size
]);
20 memset(buffer
.get(), 0, size
);
21 if (!::GetPrinterDriver(printer
, NULL
, level
, buffer
.get(), size
, &size
)) {
24 return buffer
.release();
27 uint8
* GetPrinterInfo(HANDLE printer
, int level
) {
29 ::GetPrinter(printer
, level
, NULL
, 0, &size
);
31 LOG(WARNING
) << "Failed to get size of PRINTER_INFO_" << level
<<
32 ", error = " << GetLastError();
35 scoped_ptr
<uint8
[]> buffer(new uint8
[size
]);
36 memset(buffer
.get(), 0, size
);
37 if (!::GetPrinter(printer
, level
, buffer
.get(), size
, &size
)) {
38 LOG(WARNING
) << "Failed to get PRINTER_INFO_" << level
<<
39 ", error = " << GetLastError();
42 return buffer
.release();
45 } // namespace internal
47 } // namespace printing