Fix for SetAbortProc16, stub for SetAbortProc32 and tidy up some other
printing functions.

diff --git a/graphics/painting.c b/graphics/painting.c
index acac2f4..6992cf7 100644
--- a/graphics/painting.c
+++ b/graphics/painting.c
@@ -1144,30 +1144,3 @@
     return ret;
 }
 
-INT32 WINAPI EndDoc32(HDC32 a)
-{
-FIXME(gdi,"stub\n");
-SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 
-return 0; /* failure*/
-}
-
-INT32       WINAPI StartDoc32A(HDC32 hdc ,const DOCINFO32A* doc)
-{
-FIXME(gdi,"stub\n");
-SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 
-return 0; /* failure*/
-}
-
-INT32       WINAPI StartPage32(HDC32 hdc)
-{
-FIXME(gdi,"stub\n");
-SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 
-return 0; /* failure*/
-}
-
-INT32       WINAPI EndPage32(HDC32 hdc)
-{
-FIXME(gdi,"stub\n");
-SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 
-return 0; /* failure*/
-}
diff --git a/if1632/gdi.spec b/if1632/gdi.spec
index aab000b..bc0b52c 100644
--- a/if1632/gdi.spec
+++ b/if1632/gdi.spec
@@ -260,7 +260,7 @@
 378 pascal16 EndDoc(word) EndDoc16
 379 pascal16 StartPage() stub_GDI_379
 380 pascal16 EndPage() stub_GDI_380
-381 pascal16 SetAbortProc(word segptr) stub_GDI_381
+381 pascal16 SetAbortProc(word segptr) SetAbortProc16
 382 pascal16 AbortDoc() stub_GDI_382
 400 pascal16 FastWindowFrame(word ptr s_word s_word long) FastWindowFrame
 401 stub GDIMOVEBITMAP
diff --git a/include/windows.h b/include/windows.h
index b314b00..35c20a1 100644
--- a/include/windows.h
+++ b/include/windows.h
@@ -9092,6 +9092,9 @@
 LRESULT     WINAPI SendMessageTimeout32W(HWND32,UINT32,WPARAM32,LPARAM,UINT32,
 					 UINT32,LPDWORD);
 #define     SendMessageTimeout WINELIB_NAME_AW(SendMessageTimeout)
+INT16       WINAPI SetAbortProc16(HDC16,SEGPTR);
+INT32       WINAPI SetAbortProc32(HDC32,FARPROC32);
+#define     SetAbortProc WINELIB_NAME(SetAbortProc)
 HWND16      WINAPI SetActiveWindow16(HWND16);
 HWND32      WINAPI SetActiveWindow32(HWND32);
 #define     SetActiveWindow WINELIB_NAME(SetActiveWindow)
diff --git a/misc/printdrv.c b/misc/printdrv.c
index 9da69f1..1af6744 100644
--- a/misc/printdrv.c
+++ b/misc/printdrv.c
@@ -20,6 +20,10 @@
 static char PrinterDriverData[] = "PrinterDriverData";
 static char Printers[]		= "System\\CurrentControlSet\\Control\\Print\\Printers\\";
 
+/******************************************************************
+ *                  StartDoc16  [GDI.377]
+ *
+ */
 INT16 WINAPI StartDoc16( HDC16 hdc, const DOCINFO16 *lpdoc )
 {
   INT16 retVal;
@@ -36,12 +40,66 @@
   return retVal;
 }
 
+/******************************************************************
+ *                  StartDoc32A  [GDI32.347]
+ *
+ */
+INT32 WINAPI StartDoc32A(HDC32 hdc ,const DOCINFO32A* doc)
+{
+  FIXME(gdi,"stub\n");
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 
+  return 0; /* failure*/
+}
+
+/******************************************************************
+ *                  StartPage32  [GDI32.349]
+ *
+ */
+INT32 WINAPI StartPage32(HDC32 hdc)
+{
+  FIXME(gdi,"stub\n");
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 
+  return 0; /* failure*/
+}
+
+/******************************************************************
+ *                  EndPage32  [GDI32.77]
+ *
+ */
+INT32 WINAPI EndPage32(HDC32 hdc)
+{
+  FIXME(gdi,"stub\n");
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 
+  return 0; /* failure*/
+}
+
+/******************************************************************
+ *                  EndDoc16  [GDI.378]
+ *
+ */
 INT16 WINAPI EndDoc16(HDC16 hdc)
 {
   return  Escape16(hdc, ENDDOC, 0, 0, 0);
 }
 
-DWORD DrvGetPrinterDataInternal(LPSTR RegStr_Printer, LPBYTE lpPrinterData, int cbData)
+/******************************************************************
+ *                  EndDoc32  [GDI32.76]
+ *
+ */
+INT32 WINAPI EndDoc32(HDC32 hdc)
+{
+  FIXME(gdi,"stub\n");
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 
+  return 0; /* failure*/
+}
+
+/******************************************************************
+ *                  DrvGetPrinterDataInternal
+ *
+ * Helper for DrvGetPrinterData
+ */
+static DWORD DrvGetPrinterDataInternal(LPSTR RegStr_Printer,
+LPBYTE lpPrinterData, int cbData)
 {
     DWORD res = -1;
     HKEY hkey;
@@ -70,7 +128,10 @@
     return res;
 }
 
-
+/******************************************************************
+ *                DrvGetPrinterData     [GDI.282]
+ *
+ */
 DWORD WINAPI DrvGetPrinterData(LPSTR lpPrinter, LPSTR lpProfile,
                                LPDWORD lpType, LPBYTE lpPrinterData,
                                int cbData, LPDWORD lpNeeded)
@@ -159,7 +220,10 @@
 }
 
 
-
+/******************************************************************
+ *                 DrvSetPrinterData     [GDI.281]
+ *
+ */
 DWORD WINAPI DrvSetPrinterData(LPSTR lpPrinter, LPSTR lpProfile,
                                DWORD lpType, LPBYTE lpPrinterData,
                                DWORD dwSize)
@@ -217,6 +281,10 @@
 }
 
 
+/******************************************************************
+ *              DeviceCapabilities32A    [WINSPOOL.151]
+ *
+ */
 INT32 WINAPI DeviceCapabilities32A(LPCSTR printer,LPCSTR target,WORD z,
                                    LPSTR a,LPDEVMODE32A b)
 {
@@ -224,6 +292,11 @@
     return 1;   	
 }
 
+
+/******************************************************************
+ *              DocumentProperties32A   [WINSPOOL.155]
+ *
+ */
 LONG WINAPI DocumentProperties32A(HWND32 hWnd,HANDLE32 hPrinter,
                                 LPSTR pDeviceName, LPDEVMODE32A pDevModeOutput,
                                   LPDEVMODE32A pDevModeInput,DWORD fMode )
@@ -234,6 +307,11 @@
     return 1;
 }
 
+
+/******************************************************************
+ *              OpenPrinter32A        [WINSPOOL.196]
+ *
+ */
 BOOL32 WINAPI OpenPrinter32A(LPSTR lpPrinterName,HANDLE32 *phPrinter,
 			     LPPRINTER_DEFAULTS32A pDefault)
 {
@@ -243,6 +321,10 @@
     return FALSE;
 }
 
+/******************************************************************
+ *              OpenPrinter32W        [WINSPOOL.197]
+ *
+ */
 BOOL32 WINAPI OpenPrinter32W(LPWSTR lpPrinterName,HANDLE32 *phPrinter,
 			     LPPRINTER_DEFAULTS32W pDefault)
 {
@@ -252,6 +334,10 @@
     return FALSE;
 }
 
+/******************************************************************
+ *              EnumPrinters32A        [WINSPOOL.174]
+ *
+ */
 BOOL32  WINAPI EnumPrinters32A(DWORD dwType, LPSTR lpszName,
 			       DWORD dwLevel, LPBYTE lpbPrinters,
 			       DWORD cbBuf, LPDWORD lpdwNeeded,
@@ -262,6 +348,10 @@
     return TRUE;
 }
 
+/******************************************************************
+ *              EnumPrinters32W        [WINSPOOL.175]
+ *
+ */
 BOOL32  WINAPI EnumPrinters32W(DWORD dwType, LPWSTR lpszName,
 			       DWORD dwLevel, LPBYTE lpbPrinters,
 			       DWORD cbBuf, LPDWORD lpdwNeeded,
@@ -272,7 +362,10 @@
     return TRUE;
 }
 
-
+/******************************************************************
+ *              AddMonitor32A        [WINSPOOL.107]
+ *
+ */
 BOOL32 WINAPI AddMonitor32A(LPCSTR pName, DWORD Level, LPBYTE pMonitors)
 {
     FIXME(print, "(%s,%lx,%p):stub!\n", pName, Level, pMonitors);
@@ -280,7 +373,10 @@
     return FALSE;
 }
 
-
+/******************************************************************
+ *              DeletePrinterDriver32A        [WINSPOOL.146]
+ *
+ */
 BOOL32 WINAPI
 DeletePrinterDriver32A (LPSTR pName, LPSTR pEnvironment, LPSTR pDriverName)
 {
@@ -291,6 +387,10 @@
 }
 
 
+/******************************************************************
+ *              DeleteMonitor32A        [WINSPOOL.135]
+ *
+ */
 BOOL32 WINAPI
 DeleteMonitor32A (LPSTR pName, LPSTR pEnvironment, LPSTR pMonitorName)
 {
@@ -301,6 +401,10 @@
 }
 
 
+/******************************************************************
+ *              DeletePort32A        [WINSPOOL.137]
+ *
+ */
 BOOL32 WINAPI
 DeletePort32A (LPSTR pName, HWND32 hWnd, LPSTR pPortName)
 {
diff --git a/misc/spooler.c b/misc/spooler.c
index 0823eb5..c17671b 100644
--- a/misc/spooler.c
+++ b/misc/spooler.c
@@ -18,6 +18,7 @@
 #include "gdi.h"
 #include "options.h"
 #include "windows.h"
+#include "winerror.h"
 #include "xmalloc.h"
 
 /**********************************************************************
@@ -39,20 +40,26 @@
 }
 
 /**********************************************************************
- *           SetAbortProc   (GDI.381)
+ *           SetAbortProc16   (GDI.381)
  *
  */
-INT16 WINAPI SetAbortProc(HDC16 hdc, FARPROC16 abrtprc)
+INT16 WINAPI SetAbortProc16(HDC16 hdc, SEGPTR abrtprc)
 {
-    DC *dc = DC_GetDCPtr( hdc );
-
-    if (dc) {
-	dc->w.lpfnPrint = abrtprc;
-	return 1;
-    }
-    return -1;
+    return Escape16(hdc, SETABORTPROC, 0, abrtprc, (SEGPTR)0);
 } 
 
+/**********************************************************************
+ *           SetAbortProc32   (GDI32.301)
+ *
+ */
+INT32 WINAPI SetAbortProc32(HDC32 hdc, FARPROC32 abrtprc)
+{
+    FIXME(print, "stub\n");
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return SP_ERROR;
+}
+
+
 /****************** misc. printer related functions */
 
 /*
diff --git a/relay32/gdi32.spec b/relay32/gdi32.spec
index 0601335..6a9dc1e 100644
--- a/relay32/gdi32.spec
+++ b/relay32/gdi32.spec
@@ -303,7 +303,7 @@
 298 stub SelectFontLocal
 299 stdcall SelectObject(long long) SelectObject32
 300 stdcall SelectPalette(long long long) SelectPalette32
-301 stub SetAbortProc
+301 stdcall SetAbortProc(long ptr) SetAbortProc32
 302 stdcall SetArcDirection(long long) SetArcDirection32
 303 stdcall SetBitmapBits(long long ptr) SetBitmapBits32
 304 stdcall SetBitmapDimensionEx(long long long ptr) SetBitmapDimensionEx32