[PATCH v9 0/1] MR3160: wineps.drv: Not set dc_top should not affect printing failed
Not set dc_top should not affect printing failed -- v9: wineps.drv: Not set dc_top should not affect printing failed https://gitlab.winehq.org/wine/wine/-/merge_requests/3160
From: liuchenghao <linkmecry@gmail.com> --- dlls/wineps.drv/printproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/wineps.drv/printproc.c b/dlls/wineps.drv/printproc.c index 91e4f651d4b..875481900ff 100644 --- a/dlls/wineps.drv/printproc.c +++ b/dlls/wineps.drv/printproc.c @@ -2292,7 +2292,7 @@ static int WINAPI hmf_proc(HDC hdc, HANDLETABLE *htable, PSDRV_SetTextColor(data->ctx, GetTextColor(hdc)); if (p->iRelative >= 0 || data->saved_dc_top + p->iRelative < 0) - return 0; + return ret; data->saved_dc_top += p->iRelative; data->break_extra = data->saved_dc[data->saved_dc_top].break_extra; data->break_rem = data->saved_dc[data->saved_dc_top].break_rem; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3160
On Wed Jul 5 06:10:01 2023 +0000, Huw Davies wrote:
Some of these look more like the calls that Wine is making internally (e.g. `StartDocPrinterW()` doesn't tend to get called by applications directly). Is this really the case here? Perhaps an easier question to ask is could you write a simple test that demontrates the issue (ideally as part of Wine's test suite, but a stand-alone program would also be ok)? I must apologise for the delay in responding to you.This issue arises when attempting to print a multi-page PDF file, as only a single page is printed. Below is my analysis process.
1. Added +psdrv, +spool, +localspl, +enhmetafile logging 2. Confirmed error log `07d8:warn:localspl:fpScheduleJob PrintDocumentOnPrintProcessor failed 0` 3. The core printing process resides within the `hmf_proc` function 4. Both `PSDRV_StartPage` and `PSDRV_EndPage` are invoked when printing two pages 5. During the first print operation, `EMF_SaveDC` and `EMF_RestoreDC` are called; both occur within the `hmf_proc` function 6. The `hmf_proc` function serves as a callback handler for Enhanced Metafile (EMF) records. EMF files (.emf) contain a sequence of Graphics Device Interface (GDI) commands describing image rendering. This function handles different types of EMF records (such as line drawing, filling, text output, bitmap operations, etc.) via an extensive switch statement, converting them into corresponding PostScript driver (PSDRV) calls for output on a PostScript printer. 7. During the second print attempt, `EMF_RestoreDC` was called directly without first invoking `EMF_SaveDC`, causing the second print to fail. 8. The primary error occurred within the function line `if (p->iRelative >= 0 || data->saved_dc_top + p->iRelative < 0){`. Here, `data->saved_dc_top` was `0` and `p->iRelative` was `-1`, both representing valid data. 9. The error stems from the second print attempt improperly utilising `restoredc` without first employing `savedc`, resulting in the second page failing to print correctly.
I am most sorry that I cannot provide the entire application experiencing issues (as this is internal software). Should you wish, I shall endeavour to create a problem-demonstrating example. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3160#note_125269
On Tue Dec 9 08:55:30 2025 +0000, 张顾在 wrote:
I must apologise for the delay in responding to you.This issue arises when attempting to print a multi-page PDF file, as only a single page is printed. Below is my analysis process.
1. Added +psdrv, +spool, +localspl, +enhmetafile logging 2. Confirmed error log `07d8:warn:localspl:fpScheduleJob PrintDocumentOnPrintProcessor failed 0` 3. The core printing process resides within the `hmf_proc` function 4. Both `PSDRV_StartPage` and `PSDRV_EndPage` are invoked when printing two pages 5. During the first print operation, `EMF_SaveDC` and `EMF_RestoreDC` are called; both occur within the `hmf_proc` function 6. The `hmf_proc` function serves as a callback handler for Enhanced Metafile (EMF) records. EMF files (.emf) contain a sequence of Graphics Device Interface (GDI) commands describing image rendering. This function handles different types of EMF records (such as line drawing, filling, text output, bitmap operations, etc.) via an extensive switch statement, converting them into corresponding PostScript driver (PSDRV) calls for output on a PostScript printer. 7. During the second print attempt, `EMF_RestoreDC` was called directly without first invoking `EMF_SaveDC`, causing the second print to fail. 8. The primary error occurred within the function line `if (p->iRelative >= 0 || data->saved_dc_top + p->iRelative < 0){`. Here, `data->saved_dc_top` was `0` and `p->iRelative` was `-1`, both representing valid data. 9. The error stems from the second print attempt improperly utilising `restoredc` without first employing `savedc`, resulting in the second page failing to print correctly. I am most sorry that I cannot provide the entire application experiencing issues (as this is internal software). Should you wish, I shall endeavour to create a problem-demonstrating example. @huw
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3160#note_125270
participants (2)
-
liuchenghao -
张顾在 (@linkmecry)