PATCH: wineps / devmode size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Word 2000 was calling GetPrinter(hprinter,2,...) twice, once with 0 
to get the number of bytes it wants to return and once with this
number of bytes.

However, both calls needed a different number of bytes, since in between
WINEPS got loaded and used a new, larger, DEVMODE structure.

Debugging the problem the real problem lies in the DefaultDevmode
structure of WINEPS, which does not specify the dmDriverExtra size, but
uses it in some cases, confusing WINE and the calling programs.

So I corrected the places where dmDriverExtra was not handled and
Word 2000 now prints to my CUPS printer.

Ciao, Marcus

Changelog:
	Specify existing extra size of WINEPS Devmode structure.
	Make ExtDeviceMode16 in WINEPS return the correct size.


Index: dlls/wineps/driver.c
===================================================================
RCS file: /home/wine/wine/dlls/wineps/driver.c,v
retrieving revision 1.16
diff -u -r1.16 driver.c
--- driver.c	31 Oct 2002 01:04:40 -0000	1.16
+++ driver.c	3 Nov 2002 21:18:01 -0000
@@ -285,7 +285,7 @@
 fwMode);
 
   if(!fwMode)
-    return sizeof(DEVMODEA); /* Just copy dmPublic bit of PSDRV_DEVMODE */
+    return pi->Devmode->dmPublic.dmSize + pi->Devmode->dmPublic.dmDriverExtra;
 
   if((fwMode & DM_MODIFY) && lpdmInput) {
     TRACE("DM_MODIFY set. devIn->dmFields = %08lx\n", lpdmInput->dmFields);
@@ -337,7 +337,7 @@
 
   if((fwMode & DM_COPY) || (fwMode & DM_UPDATE)) {
     if (lpdmOutput)
-        memcpy(lpdmOutput, pi->Devmode, sizeof(DEVMODEA));
+        memcpy(lpdmOutput, pi->Devmode, pi->Devmode->dmPublic.dmSize + pi->Devmode->dmPublic.dmDriverExtra );
     else
         FIXME("lpdmOutput is NULL what should we do??\n");
   }
Index: dlls/wineps/init.c
===================================================================
RCS file: /home/wine/wine/dlls/wineps/init.c,v
retrieving revision 1.39
diff -u -r1.39 init.c
--- init.c	18 Oct 2002 23:48:57 -0000	1.39
+++ init.c	3 Nov 2002 21:18:01 -0000
@@ -46,7 +46,7 @@
 /* dmSpecVersion */	0x30a,
 /* dmDriverVersion */	0x001,
 /* dmSize */		sizeof(DEVMODEA),
-/* dmDriverExtra */	0,
+/* dmDriverExtra */	sizeof(PSDRV_DEVMODEA)-sizeof(DEVMODEA),
 /* dmFields */		DM_ORIENTATION | DM_PAPERSIZE | DM_SCALE |
 			DM_COPIES | DM_DEFAULTSOURCE | DM_COLOR |
 			DM_DUPLEX | DM_YRESOLUTION | DM_TTOPTION,


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux