From: Dmitry Timoshkov dmitry@baikal.ru
Otherwise a being created file has wrong signature if an application directly injects PostScript code. This patch fixes printing from Adobe PageMaker.
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/gdi32/tests/dc.c | 1 - dlls/wineps.drv/escape.c | 18 ++++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c index 82cf200f4c..2d9ef1dd88 100644 --- a/dlls/gdi32/tests/dc.c +++ b/dlls/gdi32/tests/dc.c @@ -1433,7 +1433,6 @@ static void print_something(HDC hdc)
while (*p == '\r' || *p == '\n') p++; } -todo_wine ok(p && !memcmp(p, psadobe, sizeof(psadobe)), "wrong signature: %.14s\n", p ? p : buf);
DeleteFileA(file_name); diff --git a/dlls/wineps.drv/escape.c b/dlls/wineps.drv/escape.c index 44d790b298..b3eff6813c 100644 --- a/dlls/wineps.drv/escape.c +++ b/dlls/wineps.drv/escape.c @@ -397,15 +397,14 @@ INT PSDRV_StartPage( PHYSDEV dev ) { PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
+ TRACE("%p\n", dev->hdc); + if(!physDev->job.OutOfPage) { FIXME("Already started a page?\n"); return 1; }
- if(physDev->job.PageNo++ == 0) { - if(!PSDRV_WriteHeader( dev, physDev->job.doc_name )) - return 0; - } + physDev->job.PageNo++;
if(!PSDRV_WriteNewPage( dev )) return 0; @@ -421,6 +420,8 @@ INT PSDRV_EndPage( PHYSDEV dev ) { PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
+ TRACE("%p\n", dev->hdc); + if(physDev->job.OutOfPage) { FIXME("Already ended a page?\n"); return 1; @@ -483,6 +484,13 @@ INT PSDRV_StartDoc( PHYSDEV dev, const DOCINFOW *doc ) ClosePrinter(physDev->job.hprinter); return 0; } + + if (!PSDRV_WriteHeader( dev, doc->lpszDocName )) { + WARN("Failed to write header\n"); + ClosePrinter(physDev->job.hprinter); + return 0; + } + physDev->job.banding = FALSE; physDev->job.OutOfPage = TRUE; physDev->job.PageNo = 0; @@ -501,6 +509,8 @@ INT PSDRV_EndDoc( PHYSDEV dev ) PSDRV_PDEVICE *physDev = get_psdrv_dev( dev ); INT ret = 1;
+ TRACE("%p\n", dev->hdc); + if(!physDev->job.id) { FIXME("hJob == 0. Now what?\n"); return 0;