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/printing_context_win.h"
11 #include "base/i18n/file_util_icu.h"
12 #include "base/i18n/time_formatting.h"
13 #include "base/message_loop.h"
14 #include "base/metrics/histogram.h"
15 #include "base/time.h"
16 #include "base/utf_string_conversions.h"
17 #include "base/values.h"
18 #include "base/win/metro.h"
19 #include "printing/backend/print_backend.h"
20 #include "printing/backend/printing_info_win.h"
21 #include "printing/backend/win_helper.h"
22 #include "printing/print_job_constants.h"
23 #include "printing/print_settings_initializer_win.h"
24 #include "printing/printed_document.h"
25 #include "printing/units.h"
26 #include "skia/ext/platform_device.h"
27 #include "win8/util/win8_util.h"
33 // Constants for setting default PDF settings.
34 const int kPDFDpi
= 300; // 300 dpi
35 // LETTER: 8.5 x 11 inches
36 const int kPDFLetterWidth
= 8.5 * kPDFDpi
;
37 const int kPDFLetterHeight
= 11 * kPDFDpi
;
38 // LEGAL: 8.5 x 14 inches
39 const int kPDFLegalWidth
= 8.5 * kPDFDpi
;
40 const int kPDFLegalHeight
= 14 * kPDFDpi
;
41 // A4: 8.27 x 11.69 inches
42 const int kPDFA4Width
= 8.27 * kPDFDpi
;
43 const int kPDFA4Height
= 11.69 * kPDFDpi
;
44 // A3: 11.69 x 16.54 inches
45 const int kPDFA3Width
= 11.69 * kPDFDpi
;
46 const int kPDFA3Height
= 16.54 * kPDFDpi
;
48 } // anonymous namespace
52 class PrintingContextWin::CallbackHandler
: public IPrintDialogCallback
,
53 public IObjectWithSite
{
55 CallbackHandler(PrintingContextWin
& owner
, HWND owner_hwnd
)
57 owner_hwnd_(owner_hwnd
),
66 IUnknown
* ToIUnknown() {
67 return static_cast<IUnknown
*>(static_cast<IPrintDialogCallback
*>(this));
71 virtual HRESULT WINAPI
QueryInterface(REFIID riid
, void**object
) {
72 if (riid
== IID_IUnknown
) {
73 *object
= ToIUnknown();
74 } else if (riid
== IID_IPrintDialogCallback
) {
75 *object
= static_cast<IPrintDialogCallback
*>(this);
76 } else if (riid
== IID_IObjectWithSite
) {
77 *object
= static_cast<IObjectWithSite
*>(this);
84 // No real ref counting.
85 virtual ULONG WINAPI
AddRef() {
88 virtual ULONG WINAPI
Release() {
92 // IPrintDialogCallback methods
93 virtual HRESULT WINAPI
InitDone() {
97 virtual HRESULT WINAPI
SelectionChange() {
99 // TODO(maruel): Get the devmode for the new printer with
100 // services_->GetCurrentDevMode(&devmode, &size), send that information
101 // back to our client and continue. The client needs to recalculate the
102 // number of rendered pages and send back this information here.
107 virtual HRESULT WINAPI
HandleMessage(HWND dialog
,
112 // Cheap way to retrieve the window handle.
113 if (!owner_
.dialog_box_
) {
114 // The handle we receive is the one of the groupbox in the General tab. We
115 // need to get the grand-father to get the dialog box handle.
116 owner_
.dialog_box_
= GetAncestor(dialog
, GA_ROOT
);
117 // Trick to enable the owner window. This can cause issues with navigation
118 // events so it may have to be disabled if we don't fix the side-effects.
119 EnableWindow(owner_hwnd_
, TRUE
);
124 virtual HRESULT WINAPI
SetSite(IUnknown
* site
) {
127 services_
->Release();
129 // The dialog box is destroying, PrintJob::Worker don't need the handle
131 owner_
.dialog_box_
= NULL
;
133 DCHECK(services_
== NULL
);
134 HRESULT hr
= site
->QueryInterface(IID_IPrintDialogServices
,
135 reinterpret_cast<void**>(&services_
));
136 DCHECK(SUCCEEDED(hr
));
141 virtual HRESULT WINAPI
GetSite(REFIID riid
, void** site
) {
146 PrintingContextWin
& owner_
;
148 IPrintDialogServices
* services_
;
150 DISALLOW_COPY_AND_ASSIGN(CallbackHandler
);
154 PrintingContext
* PrintingContext::Create(const std::string
& app_locale
) {
155 return static_cast<PrintingContext
*>(new PrintingContextWin(app_locale
));
158 PrintingContextWin::PrintingContextWin(const std::string
& app_locale
)
159 : PrintingContext(app_locale
),
162 print_dialog_func_(&PrintDlgEx
) {
165 PrintingContextWin::~PrintingContextWin() {
169 void PrintingContextWin::AskUserForSettings(
170 gfx::NativeView view
, int max_pages
, bool has_selection
,
171 const PrintSettingsCallback
& callback
) {
172 #if !defined(USE_AURA)
173 DCHECK(!in_print_job_
);
175 if (win8::IsSingleWindowMetroMode()) {
176 // The system dialog can not be opened while running in Metro.
177 // But we can programatically launch the Metro print device charm though.
178 HMODULE metro_module
= base::win::GetMetroModule();
179 if (metro_module
!= NULL
) {
180 typedef void (*MetroShowPrintUI
)();
181 MetroShowPrintUI metro_show_print_ui
=
182 reinterpret_cast<MetroShowPrintUI
>(
183 ::GetProcAddress(metro_module
, "MetroShowPrintUI"));
184 if (metro_show_print_ui
) {
185 // TODO(mad): Remove this once we can send user metrics from the metro
186 // driver. crbug.com/142330
187 UMA_HISTOGRAM_ENUMERATION("Metro.Print", 1, 2);
188 metro_show_print_ui();
191 return callback
.Run(CANCEL
);
193 dialog_box_dismissed_
= false;
196 if (!view
|| !IsWindow(view
)) {
197 // TODO(maruel): bug 1214347 Get the right browser window instead.
198 window
= GetDesktopWindow();
200 window
= GetAncestor(view
, GA_ROOTOWNER
);
204 // Show the OS-dependent dialog box.
206 // - OK, the settings are reset and reinitialized with the new settings. OK is
208 // - Apply then Cancel, the settings are reset and reinitialized with the new
209 // settings. CANCEL is returned.
210 // - Cancel, the settings are not changed, the previous setting, if it was
211 // initialized before, are kept. CANCEL is returned.
212 // On failure, the settings are reset and FAILED is returned.
213 PRINTDLGEX dialog_options
= { sizeof(PRINTDLGEX
) };
214 dialog_options
.hwndOwner
= window
;
215 // Disable options we don't support currently.
216 // TODO(maruel): Reuse the previously loaded settings!
217 dialog_options
.Flags
= PD_RETURNDC
| PD_USEDEVMODECOPIESANDCOLLATE
|
218 PD_NOCURRENTPAGE
| PD_HIDEPRINTTOFILE
;
220 dialog_options
.Flags
|= PD_NOSELECTION
;
222 PRINTPAGERANGE ranges
[32];
223 dialog_options
.nStartPage
= START_PAGE_GENERAL
;
225 // Default initialize to print all the pages.
226 memset(ranges
, 0, sizeof(ranges
));
227 ranges
[0].nFromPage
= 1;
228 ranges
[0].nToPage
= max_pages
;
229 dialog_options
.nPageRanges
= 1;
230 dialog_options
.nMaxPageRanges
= arraysize(ranges
);
231 dialog_options
.nMinPage
= 1;
232 dialog_options
.nMaxPage
= max_pages
;
233 dialog_options
.lpPageRanges
= ranges
;
235 // No need to bother, we don't know how many pages are available.
236 dialog_options
.Flags
|= PD_NOPAGENUMS
;
239 if ((*print_dialog_func_
)(&dialog_options
) != S_OK
) {
241 callback
.Run(FAILED
);
244 // TODO(maruel): Support PD_PRINTTOFILE.
245 callback
.Run(ParseDialogResultEx(dialog_options
));
249 PrintingContext::Result
PrintingContextWin::UseDefaultSettings() {
250 DCHECK(!in_print_job_
);
252 PRINTDLG dialog_options
= { sizeof(PRINTDLG
) };
253 dialog_options
.Flags
= PD_RETURNDC
| PD_RETURNDEFAULT
;
254 if (PrintDlg(&dialog_options
))
255 return ParseDialogResult(dialog_options
);
257 // No default printer configured, do we have any printers at all?
258 DWORD bytes_needed
= 0;
259 DWORD count_returned
= 0;
260 (void)::EnumPrinters(PRINTER_ENUM_LOCAL
|PRINTER_ENUM_CONNECTIONS
,
261 NULL
, 2, NULL
, 0, &bytes_needed
, &count_returned
);
263 DCHECK(bytes_needed
>= count_returned
* sizeof(PRINTER_INFO_2
));
264 scoped_array
<BYTE
> printer_info_buffer(new BYTE
[bytes_needed
]);
265 BOOL ret
= ::EnumPrinters(PRINTER_ENUM_LOCAL
|PRINTER_ENUM_CONNECTIONS
,
266 NULL
, 2, printer_info_buffer
.get(),
267 bytes_needed
, &bytes_needed
,
269 if (ret
&& count_returned
) { // have printers
270 // Open the first successfully found printer.
271 for (DWORD count
= 0; count
< count_returned
; ++count
) {
272 PRINTER_INFO_2
* info_2
= reinterpret_cast<PRINTER_INFO_2
*>(
273 printer_info_buffer
.get() + count
* sizeof(PRINTER_INFO_2
));
274 std::wstring printer_name
= info_2
->pPrinterName
;
275 if (info_2
->pDevMode
== NULL
|| printer_name
.length() == 0)
277 if (!AllocateContext(printer_name
, info_2
->pDevMode
, &context_
))
279 if (InitializeSettings(*info_2
->pDevMode
, printer_name
,
294 PrintingContext::Result
PrintingContextWin::UpdatePrinterSettings(
295 const DictionaryValue
& job_settings
,
296 const PageRanges
& ranges
) {
297 DCHECK(!in_print_job_
);
303 bool is_cloud_dialog
;
306 string16 device_name
;
308 if (!job_settings
.GetBoolean(kSettingLandscape
, &landscape
) ||
309 !job_settings
.GetBoolean(kSettingCollate
, &collate
) ||
310 !job_settings
.GetInteger(kSettingColor
, &color
) ||
311 !job_settings
.GetBoolean(kSettingPrintToPDF
, &print_to_pdf
) ||
312 !job_settings
.GetInteger(kSettingDuplexMode
, &duplex_mode
) ||
313 !job_settings
.GetInteger(kSettingCopies
, &copies
) ||
314 !job_settings
.GetString(kSettingDeviceName
, &device_name
) ||
315 !job_settings
.GetBoolean(kSettingCloudPrintDialog
, &is_cloud_dialog
)) {
319 bool print_to_cloud
= job_settings
.HasKey(kSettingCloudPrintId
);
321 if (print_to_pdf
|| print_to_cloud
|| is_cloud_dialog
) {
322 // Default fallback to Letter size.
323 gfx::Size paper_size
;
324 gfx::Rect paper_rect
;
325 paper_size
.SetSize(kPDFLetterWidth
, kPDFLetterHeight
);
327 // Get settings from locale. Paper type buffer length is at most 4.
328 const int paper_type_buffer_len
= 4;
329 wchar_t paper_type_buffer
[paper_type_buffer_len
] = {0};
330 GetLocaleInfo(LOCALE_USER_DEFAULT
, LOCALE_IPAPERSIZE
, paper_type_buffer
,
331 paper_type_buffer_len
);
332 if (wcslen(paper_type_buffer
)) { // The call succeeded.
333 int paper_code
= _wtoi(paper_type_buffer
);
334 switch (paper_code
) {
336 paper_size
.SetSize(kPDFLegalWidth
, kPDFLegalHeight
);
339 paper_size
.SetSize(kPDFA4Width
, kPDFA4Height
);
342 paper_size
.SetSize(kPDFA3Width
, kPDFA3Height
);
344 default: // DMPAPER_LETTER is used for default fallback.
348 paper_rect
.SetRect(0, 0, paper_size
.width(), paper_size
.height());
349 settings_
.SetPrinterPrintableArea(paper_size
, paper_rect
, kPDFDpi
);
350 settings_
.set_dpi(kPDFDpi
);
351 settings_
.SetOrientation(landscape
);
352 settings_
.ranges
= ranges
;
356 ScopedPrinterHandle printer
;
357 LPWSTR device_name_wide
= const_cast<wchar_t*>(device_name
.c_str());
358 if (!OpenPrinter(device_name_wide
, printer
.Receive(), NULL
))
361 // Make printer changes local to Chrome.
362 // See MSDN documentation regarding DocumentProperties.
363 scoped_array
<uint8
> buffer
;
364 DEVMODE
* dev_mode
= NULL
;
365 LONG buffer_size
= DocumentProperties(NULL
, printer
, device_name_wide
,
367 if (buffer_size
> 0) {
368 buffer
.reset(new uint8
[buffer_size
]);
369 memset(buffer
.get(), 0, buffer_size
);
370 if (DocumentProperties(NULL
, printer
, device_name_wide
,
371 reinterpret_cast<PDEVMODE
>(buffer
.get()), NULL
,
372 DM_OUT_BUFFER
) == IDOK
) {
373 dev_mode
= reinterpret_cast<PDEVMODE
>(buffer
.get());
376 if (dev_mode
== NULL
) {
382 dev_mode
->dmColor
= DMCOLOR_MONOCHROME
;
384 dev_mode
->dmColor
= DMCOLOR_COLOR
;
386 dev_mode
->dmCopies
= std::max(copies
, 1);
387 if (dev_mode
->dmCopies
> 1) // do not change collate unless multiple copies
388 dev_mode
->dmCollate
= collate
? DMCOLLATE_TRUE
: DMCOLLATE_FALSE
;
389 switch (duplex_mode
) {
391 dev_mode
->dmDuplex
= DMDUP_VERTICAL
;
394 dev_mode
->dmDuplex
= DMDUP_HORIZONTAL
;
397 dev_mode
->dmDuplex
= DMDUP_SIMPLEX
;
399 default: // UNKNOWN_DUPLEX_MODE
402 dev_mode
->dmOrientation
= landscape
? DMORIENT_LANDSCAPE
: DMORIENT_PORTRAIT
;
404 // Update data using DocumentProperties.
405 if (DocumentProperties(NULL
, printer
, device_name_wide
, dev_mode
, dev_mode
,
406 DM_IN_BUFFER
| DM_OUT_BUFFER
) != IDOK
) {
410 // Set printer then refresh printer settings.
411 if (!AllocateContext(device_name
, dev_mode
, &context_
)) {
414 PrintSettingsInitializerWin::InitPrintSettings(context_
, *dev_mode
,
420 PrintingContext::Result
PrintingContextWin::InitWithSettings(
421 const PrintSettings
& settings
) {
422 DCHECK(!in_print_job_
);
424 settings_
= settings
;
426 // TODO(maruel): settings_.ToDEVMODE()
427 ScopedPrinterHandle printer
;
428 if (!OpenPrinter(const_cast<wchar_t*>(settings_
.device_name().c_str()),
429 printer
.Receive(), NULL
))
434 if (!GetPrinterSettings(printer
, settings_
.device_name()))
442 PrintingContext::Result
PrintingContextWin::NewDocument(
443 const string16
& document_name
) {
444 DCHECK(!in_print_job_
);
448 // Set the flag used by the AbortPrintJob dialog procedure.
449 abort_printing_
= false;
451 in_print_job_
= true;
453 // Register the application's AbortProc function with GDI.
454 if (SP_ERROR
== SetAbortProc(context_
, &AbortProc
))
457 DCHECK(PrintBackend::SimplifyDocumentTitle(document_name
) == document_name
);
458 DOCINFO di
= { sizeof(DOCINFO
) };
459 const std::wstring
& document_name_wide
= UTF16ToWide(document_name
);
460 di
.lpszDocName
= document_name_wide
.c_str();
462 // Is there a debug dump directory specified? If so, force to print to a file.
463 base::FilePath debug_dump_path
= PrintedDocument::debug_dump_path();
464 if (!debug_dump_path
.empty()) {
465 // Create a filename.
466 std::wstring filename
;
467 Time
now(Time::Now());
468 filename
= base::TimeFormatShortDateNumeric(now
);
470 filename
+= base::TimeFormatTimeOfDay(now
);
472 filename
+= UTF16ToWide(document_name
);
474 filename
+= L
"buffer.prn";
475 file_util::ReplaceIllegalCharactersInPath(&filename
, '_');
476 debug_dump_path
.Append(filename
);
477 di
.lpszOutput
= debug_dump_path
.value().c_str();
480 // No message loop running in unit tests.
481 DCHECK(!MessageLoop::current() ? true :
482 !MessageLoop::current()->NestableTasksAllowed());
484 // Begin a print job by calling the StartDoc function.
485 // NOTE: StartDoc() starts a message loop. That causes a lot of problems with
486 // IPC. Make sure recursive task processing is disabled.
487 if (StartDoc(context_
, &di
) <= 0)
493 PrintingContext::Result
PrintingContextWin::NewPage() {
497 DCHECK(in_print_job_
);
499 // Intentional No-op. NativeMetafile::SafePlayback takes care of calling
505 PrintingContext::Result
PrintingContextWin::PageDone() {
508 DCHECK(in_print_job_
);
510 // Intentional No-op. NativeMetafile::SafePlayback takes care of calling
516 PrintingContext::Result
PrintingContextWin::DocumentDone() {
519 DCHECK(in_print_job_
);
522 // Inform the driver that document has ended.
523 if (EndDoc(context_
) <= 0)
530 void PrintingContextWin::Cancel() {
531 abort_printing_
= true;
532 in_print_job_
= false;
536 DestroyWindow(dialog_box_
);
537 dialog_box_dismissed_
= true;
541 void PrintingContextWin::ReleaseContext() {
548 gfx::NativeDrawingContext
PrintingContextWin::context() const {
553 BOOL
PrintingContextWin::AbortProc(HDC hdc
, int nCode
) {
555 // TODO(maruel): Need a way to find the right instance to set. Should
556 // leverage PrintJobManager here?
557 // abort_printing_ = true;
562 bool PrintingContextWin::InitializeSettings(const DEVMODE
& dev_mode
,
563 const std::wstring
& new_device_name
,
564 const PRINTPAGERANGE
* ranges
,
566 bool selection_only
) {
567 skia::InitializeDC(context_
);
568 DCHECK(GetDeviceCaps(context_
, CLIPCAPS
));
569 DCHECK(GetDeviceCaps(context_
, RASTERCAPS
) & RC_STRETCHDIB
);
570 DCHECK(GetDeviceCaps(context_
, RASTERCAPS
) & RC_BITMAP64
);
571 // Some printers don't advertise these.
572 // DCHECK(GetDeviceCaps(context_, RASTERCAPS) & RC_SCALING);
573 // DCHECK(GetDeviceCaps(context_, SHADEBLENDCAPS) & SB_CONST_ALPHA);
574 // DCHECK(GetDeviceCaps(context_, SHADEBLENDCAPS) & SB_PIXEL_ALPHA);
576 // StretchDIBits() support is needed for printing.
577 if (!(GetDeviceCaps(context_
, RASTERCAPS
) & RC_STRETCHDIB
) ||
578 !(GetDeviceCaps(context_
, RASTERCAPS
) & RC_BITMAP64
)) {
584 DCHECK(!in_print_job_
);
586 PageRanges ranges_vector
;
587 if (!selection_only
) {
588 // Convert the PRINTPAGERANGE array to a PrintSettings::PageRanges vector.
589 ranges_vector
.reserve(number_ranges
);
590 for (int i
= 0; i
< number_ranges
; ++i
) {
592 // Transfer from 1-based to 0-based.
593 range
.from
= ranges
[i
].nFromPage
- 1;
594 range
.to
= ranges
[i
].nToPage
- 1;
595 ranges_vector
.push_back(range
);
599 PrintSettingsInitializerWin::InitPrintSettings(context_
,
609 bool PrintingContextWin::GetPrinterSettings(HANDLE printer
,
610 const std::wstring
& device_name
) {
611 DCHECK(!in_print_job_
);
613 UserDefaultDevMode user_settings
;
615 if (!user_settings
.Init(printer
) ||
616 !AllocateContext(device_name
, user_settings
.get(), &context_
)) {
621 return InitializeSettings(*user_settings
.get(), device_name
, NULL
, 0, false);
625 bool PrintingContextWin::AllocateContext(const std::wstring
& device_name
,
626 const DEVMODE
* dev_mode
,
627 gfx::NativeDrawingContext
* context
) {
628 *context
= CreateDC(L
"WINSPOOL", device_name
.c_str(), NULL
, dev_mode
);
630 return *context
!= NULL
;
633 PrintingContext::Result
PrintingContextWin::ParseDialogResultEx(
634 const PRINTDLGEX
& dialog_options
) {
635 // If the user clicked OK or Apply then Cancel, but not only Cancel.
636 if (dialog_options
.dwResultAction
!= PD_RESULT_CANCEL
) {
640 DEVMODE
* dev_mode
= NULL
;
641 if (dialog_options
.hDevMode
) {
643 reinterpret_cast<DEVMODE
*>(GlobalLock(dialog_options
.hDevMode
));
647 std::wstring device_name
;
648 if (dialog_options
.hDevNames
) {
649 DEVNAMES
* dev_names
=
650 reinterpret_cast<DEVNAMES
*>(GlobalLock(dialog_options
.hDevNames
));
654 reinterpret_cast<const wchar_t*>(
655 reinterpret_cast<const wchar_t*>(dev_names
) +
656 dev_names
->wDeviceOffset
);
657 GlobalUnlock(dialog_options
.hDevNames
);
661 bool success
= false;
662 if (dev_mode
&& !device_name
.empty()) {
663 context_
= dialog_options
.hDC
;
664 PRINTPAGERANGE
* page_ranges
= NULL
;
665 DWORD num_page_ranges
= 0;
666 bool print_selection_only
= false;
667 if (dialog_options
.Flags
& PD_PAGENUMS
) {
668 page_ranges
= dialog_options
.lpPageRanges
;
669 num_page_ranges
= dialog_options
.nPageRanges
;
671 if (dialog_options
.Flags
& PD_SELECTION
) {
672 print_selection_only
= true;
674 success
= InitializeSettings(*dev_mode
,
678 print_selection_only
);
681 if (!success
&& dialog_options
.hDC
) {
682 DeleteDC(dialog_options
.hDC
);
687 GlobalUnlock(dialog_options
.hDevMode
);
690 if (dialog_options
.hDC
) {
691 DeleteDC(dialog_options
.hDC
);
695 if (dialog_options
.hDevMode
!= NULL
)
696 GlobalFree(dialog_options
.hDevMode
);
697 if (dialog_options
.hDevNames
!= NULL
)
698 GlobalFree(dialog_options
.hDevNames
);
700 switch (dialog_options
.dwResultAction
) {
701 case PD_RESULT_PRINT
:
702 return context_
? OK
: FAILED
;
703 case PD_RESULT_APPLY
:
704 return context_
? CANCEL
: FAILED
;
705 case PD_RESULT_CANCEL
:
712 PrintingContext::Result
PrintingContextWin::ParseDialogResult(
713 const PRINTDLG
& dialog_options
) {
714 // If the user clicked OK or Apply then Cancel, but not only Cancel.
718 DEVMODE
* dev_mode
= NULL
;
719 if (dialog_options
.hDevMode
) {
721 reinterpret_cast<DEVMODE
*>(GlobalLock(dialog_options
.hDevMode
));
725 std::wstring device_name
;
726 if (dialog_options
.hDevNames
) {
727 DEVNAMES
* dev_names
=
728 reinterpret_cast<DEVNAMES
*>(GlobalLock(dialog_options
.hDevNames
));
732 reinterpret_cast<const wchar_t*>(
733 reinterpret_cast<const wchar_t*>(dev_names
) +
734 dev_names
->wDeviceOffset
);
735 GlobalUnlock(dialog_options
.hDevNames
);
739 bool success
= false;
740 if (dev_mode
&& !device_name
.empty()) {
741 context_
= dialog_options
.hDC
;
742 success
= InitializeSettings(*dev_mode
, device_name
, NULL
, 0, false);
745 if (!success
&& dialog_options
.hDC
) {
746 DeleteDC(dialog_options
.hDC
);
751 GlobalUnlock(dialog_options
.hDevMode
);
754 if (dialog_options
.hDevMode
!= NULL
)
755 GlobalFree(dialog_options
.hDevMode
);
756 if (dialog_options
.hDevNames
!= NULL
)
757 GlobalFree(dialog_options
.hDevNames
);
759 return context_
? OK
: FAILED
;
762 } // namespace printing