[Wine-patches] [eterhack] winspool.drv: If DEVMODE doesn't specify what we need - use sane defaults. (eterbug #8330)

Dmitry Timoshkov dtimoshkov на etersoft.ru
Ср Янв 23 10:39:39 MSK 2013


---
 dlls/winspool.drv/info.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index 2ca4d9a..7746805 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -8458,8 +8458,13 @@ static void prepare_destination_string(HANDLE hPrinter, DWORD JobId, LPWSTR outp
 
     GetJobW(hPrinter, JobId, 2, NULL, 0, &needed);
     ji2 = HeapAlloc(GetProcessHeap(), 0, needed);
-    GetJobW(hPrinter, JobId, 2, (LPBYTE)ji2, needed, &needed);
+    if (!GetJobW(hPrinter, JobId, 2, (LPBYTE)ji2, needed, &needed))
+        ERR("GetJobW failed\n");
     dm = ji2->pDevMode;
+    /* if DEVMODE doesn't specify what we need - set sane defaults */
+    if (!(dm->dmFields & DM_COPIES)) dm->u1.s1.dmCopies = 1;
+    if (!(dm->dmFields & DM_DUPLEX)) dm->dmDuplex = DMDUP_SIMPLEX;
+    if (!(dm->dmFields & DM_COLLATE)) dm->dmCollate = DMCOLLATE_FALSE;
     docname = ji2->pDocument;
 
     switch (dm->dmDuplex)
@@ -8480,8 +8485,9 @@ static void prepare_destination_string(HANDLE hPrinter, DWORD JobId, LPWSTR outp
         option_sides = sidesnoDuplex;
         option_duplex = noDuplex;
         ERR("Unexpected value of dmDuplex field\n");
+        break;
     }
-    
+
     if (eterprinting_method() == PM_SIDES)
         option_duplex = option_sides;
     sprintfW(output, comstr, ji2->pPrinterName,lstrlenW(docname)?docname:defaultname,
-- 
1.8.0.2



Подробная информация о списке рассылки Wine-patches