Change interfaces to THUNK_Alloc/Free slightly and make them non-static.
Remove relays for win16drv from CallBack table, instead use build to
generate them directly in graphics/win16drv/prtdrv.c.
If Printer AbortProc is 16bit then allocate thunk and store that as a
32bit proc in DC. Setting of abortprocs now done in the correct place
(i.e. not in the driver).
diff --git a/misc/printdrv.c b/misc/printdrv.c
index 2c8553e..006555e 100644
--- a/misc/printdrv.c
+++ b/misc/printdrv.c
@@ -208,36 +208,30 @@
BOOL16 WINAPI QueryAbort16(HDC16 hdc, INT16 reserved)
{
DC *dc = DC_GetDCPtr( hdc );
- BOOL16 ret;
if(!dc) {
ERR("Invalid hdc %04x\n", hdc);
return FALSE;
}
- if(!dc->w.lpfnPrint && !dc->w.spfnPrint)
+ if(!dc->w.pAbortProc)
return TRUE;
-
- if(dc->w.lpfnPrint && dc->w.spfnPrint)
- FIXME("16 and 32 bit AbortProcs set?\n");
-
- if(dc->w.spfnPrint) {
- TRACE("Calling 16bit AbortProc\n");
- ret = Callbacks->CallDrvAbortProc(dc->w.spfnPrint, hdc, 0);
- } else {
- TRACE("Calling 32bit AbortProc\n");
- ret = dc->w.lpfnPrint(hdc,0);
- }
- return ret;
+ return dc->w.pAbortProc(hdc, 0);
}
+/* ### start build ### */
+extern WORD CALLBACK PRTDRV_CallTo16_word_ww(FARPROC16,WORD,WORD);
+/* ### stop build ### */
+
/**********************************************************************
* SetAbortProc16 (GDI.381)
*
*/
INT16 WINAPI SetAbortProc16(HDC16 hdc, SEGPTR abrtprc)
{
- return Escape16(hdc, SETABORTPROC, 0, abrtprc, (SEGPTR)0);
+ ABORTPROC proc32 = (ABORTPROC)THUNK_Alloc((FARPROC16)abrtprc,
+ (RELAY)PRTDRV_CallTo16_word_ww);
+ return SetAbortProc(hdc, proc32);
}
/**********************************************************************
@@ -248,7 +242,8 @@
{
DC *dc = DC_GetDCPtr( hdc );
- dc->w.lpfnPrint = abrtprc;
+ if(dc->w.pAbortProc) THUNK_Free((FARPROC)dc->w.pAbortProc);
+ dc->w.pAbortProc = abrtprc;
return TRUE;
}