From 93543752960447decfc8f0ca38ef9f44f7209cfd Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Thu, 25 Aug 2011 22:26:26 +0000 Subject: Printing Backend: Check the results from a DocumentProperties() call. BUG=94138 TEST=Print preview works again on vandebo's machine. Review URL: http://codereview.chromium.org/7741003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98330 0039d316-1c4b-4281-b951-d872f2087c98 --- printing/backend/print_backend_win.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'printing') diff --git a/printing/backend/print_backend_win.cc b/printing/backend/print_backend_win.cc index dbbb270..39f085e 100644 --- a/printing/backend/print_backend_win.cc +++ b/printing/backend/print_backend_win.cc @@ -137,10 +137,11 @@ bool PrintBackendWin::GetPrinterCapsAndDefaults( NULL); DCHECK(printer_handle); if (printer_handle) { - DWORD devmode_size = DocumentProperties( + LONG devmode_size = DocumentProperties( NULL, printer_handle, const_cast(printer_name_wide.c_str()), NULL, NULL, 0); - DCHECK_NE(0U, devmode_size); + if (devmode_size <= 0) + return false; scoped_ptr devmode_out_buffer(new BYTE[devmode_size]); DEVMODE* devmode_out = reinterpret_cast(devmode_out_buffer.get()); -- cgit v1.1