[BUGFIX] comdlg32->printdlg.c: Pages are printed incorrecly in duplex mode

Vitaly Perov vitperov at etersoft.ru
Sat May 24 09:09:18 CDT 2008


Pages are printed incorrecly in duplex mode if application is responsible for 
multiple copies. The bug appears only if we have an odd number of pages.
There is some applications that print correctly (by inserting empty page after 
each documet ends) like OpenOffice.
Currently in Wine: if printer support multiple copies, and application support 
it, then application prints multiple copies.
In this case Windows make printer to print multiple copies if it can. 

Changelog:
	-  If printer support multiple copies, then printer should print them (not 
application)

-- 
Best wishes,
Vitaly Perov
Russia, Saint-Petersburg. www.etersoft.ru
-------------- next part --------------
commit a4a8747c3bd774cdf349b979f16ff218f8cb7eae
Author: Vitaly Perov <vitperov at etersoft.ru>
Date:   Sat May 24 17:32:03 2008 +0400

       [BUGFIX] comdlg32->printdlg.c: Pages are printed incorrecly in duplex mode

diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c
index 2f07dfd..3aa9da7 100644
--- a/dlls/comdlg32/printdlg.c
+++ b/dlls/comdlg32/printdlg.c
@@ -286,6 +286,11 @@ static BOOL PRINTDLG_CreateDevNamesW(HGLOBAL *hmem, LPCWSTR DeviceDriverName,
 static BOOL PRINTDLG_UpdatePrintDlgA(HWND hDlg,
 				    PRINT_PTRA* PrintStructures)
 {
+    DEVNAMES	*dn;
+    DEVMODEA	*dm;
+    INT         copiesSupported;
+    LPSTR	devname, portname;
+
     LPPRINTDLGA       lppd = PrintStructures->lpPrintDlg;
     PDEVMODEA         lpdm = PrintStructures->lpDevMode;
     LPPRINTER_INFO_2A pi = PrintStructures->lpPrinterInfo;
@@ -340,6 +345,20 @@ static BOOL PRINTDLG_UpdatePrintDlgA(HWND hDlg,
 	    FIXME("Collate lppd not yet implemented as output\n");
 	}
 
+        /* If printer support multiple copies, then printer should do this (even if application support it too). It prevent some bugs with a duplex printing */
+        dn = GlobalLock(lppd->hDevNames);
+        dm = GlobalLock(lppd->hDevMode);
+        devname	= ((char*)dn)+dn->wDeviceOffset;
+        portname = ((char*)dn)+dn->wOutputOffset;
+
+        copiesSupported = DeviceCapabilitiesA(devname,portname,DC_COPIES,NULL,dm);
+
+        GlobalUnlock(lppd->hDevNames);
+        GlobalUnlock(lppd->hDevMode);
+
+        if (copiesSupported > 1)
+            lppd->Flags |= PD_USEDEVMODECOPIESANDCOLLATE; 
+
 	/* set PD_Collate and nCopies */
 	if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) {
 	  /*  The application doesn't support multiple copies or collate...


More information about the wine-patches mailing list