ReactOS 0.4.15-dev-7906-g1b85a5f
printdrv.c File Reference
#include <precomp.h>
#include <debug.h>
Include dependency graph for printdrv.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static int FASTCALL IntEndPage (HDC hdc, BOOL Form)
 
BOOL FASTCALL AbortPrinterEx (PVOID pvUMPDev, HANDLE hPrinter)
 
int FASTCALL DocumentEventEx (PVOID pvUMPDev, HANDLE hPrinter, HDC hdc, int iEsc, ULONG cbIn, PVOID pvIn, ULONG cbOut, PVOID pvOut)
 
BOOL FASTCALL EndDocPrinterEx (PVOID pvUMPDev, HANDLE hPrinter)
 
BOOL FASTCALL EndPagePrinterEx (PVOID pvUMPDev, HANDLE hPrinter)
 
BOOL FASTCALL LoadTheSpoolerDrv (VOID)
 
DWORD FASTCALL StartDocPrinterWEx (PVOID pvUMPDev, HANDLE hPrinter, DWORD Level, LPBYTE pDocInfo)
 
BOOL FASTCALL StartPagePrinterEx (PVOID pvUMPDev, HANDLE hPrinter)
 
int WINAPI AbortDoc (HDC hdc)
 
int WINAPI EndDoc (HDC hdc)
 
int WINAPI EndFormPage (HDC hdc)
 
int WINAPI EndPage (HDC hdc)
 
HANDLE WINAPI GdiGetSpoolFileHandle (LPWSTR pwszPrinterName, LPDEVMODEW pDevmode, LPWSTR pwszDocName)
 
BOOL WINAPI GdiDeleteSpoolFileHandle (HANDLE SpoolFileHandle)
 
DWORD WINAPI GdiGetPageCount (HANDLE SpoolFileHandle)
 
int WINAPI StartDocW (HDC hdc, CONST DOCINFOW *lpdi)
 
int WINAPI StartDocA (HDC hdc, CONST DOCINFOA *lpdi)
 
int WINAPI StartPage (HDC hdc)
 
int WINAPI StartFormPage (HDC hdc)
 
int WINAPI SetAbortProc (HDC hdc, ABORTPROC lpAbortProc)
 
DWORD WINAPI gdiPlaySpoolStream (DWORD a0, DWORD a1, DWORD a2, DWORD a3, DWORD a4, DWORD a5)
 
HDC WINAPI GdiGetDC (HANDLE SpoolFileHandle)
 
HANDLE WINAPI GdiGetPageHandle (HANDLE SpoolFileHandle, DWORD Page, LPDWORD pdwPageType)
 
BOOL WINAPI GdiStartDocEMF (HANDLE SpoolFileHandle, DOCINFOW *pDocInfo)
 
BOOL WINAPI GdiStartPageEMF (HANDLE SpoolFileHandle)
 
BOOL WINAPI GdiPlayPageEMF (HANDLE SpoolFileHandle, HANDLE hemf, RECT *prectDocument, RECT *prectBorder, RECT *prectClip)
 
BOOL WINAPI GdiEndPageEMF (HANDLE SpoolFileHandle, DWORD dwOptimization)
 
BOOL WINAPI GdiEndDocEMF (HANDLE SpoolFileHandle)
 
BOOL WINAPI GdiGetDevmodeForPage (HANDLE SpoolFileHandle, DWORD dwPageNumber, PDEVMODEW *pCurrDM, PDEVMODEW *pLastDM)
 
BOOL WINAPI GdiResetDCEMF (HANDLE SpoolFileHandle, PDEVMODEW pCurrDM)
 
BOOL WINAPI GdiPlayEMF (LPWSTR pwszPrinterName, LPDEVMODEW pDevmode, LPWSTR pwszDocName, EMFPLAYPROC pfnEMFPlayFn, HANDLE hPageQuery)
 
BOOL WINAPI GdiPlayPrivatePageEMF (HANDLE SpoolFileHandle, DWORD unknown, RECT *prectDocument)
 
BOOL WINAPI GdiPrinterThunk (IN HUMPD humpd, DWORD *status, DWORD unuse)
 
BOOL WINAPI GdiArtificialDecrementDriver (LPWSTR pDriverName, BOOL unknown)
 

Variables

HANDLE ghSpooler = NULL
 
static ABORTPRINTER fpAbortPrinter
 
CLOSEPRINTER fpClosePrinter
 
static CLOSESPOOLFILEHANDLE fpCloseSpoolFileHandle
 
static COMMITSPOOLDATA fpCommitSpoolData
 
static DOCUMENTEVENT fpDocumentEvent
 
static DOCUMENTPROPERTIESW fpDocumentPropertiesW
 
static ENDDOCPRINTER fpEndDocPrinter
 
static ENDPAGEPRINTER fpEndPagePrinter
 
static GETSPOOLFILEHANDLE fpGetSpoolFileHandle
 
static GETPRINTERW fpGetPrinterW
 
static GETPRINTERDRIVERW fpGetPrinterDriverW
 
static ISVALIDDEVMODEW fpIsValidDevmodeW
 
OPENPRINTERW fpOpenPrinterW
 
static QUERYSPOOLMODE fpQuerySpoolMode
 
static QUERYREMOTEFONTS fpQueryRemoteFonts
 
static QUERYCOLORPROFILE fpQueryColorProfile
 
static READPRINTER fpReadPrinter
 
static RESETPRINTERW fpResetPrinterW
 
static SEEKPRINTER fpSeekPrinter
 
static SPLDRIVERUNLOADCOMPLETE fpSplDriverUnloadComplete
 
static SPLREADPRINTER fpSplReadPrinter
 
static STARTDOCDLGW fpStartDocDlgW
 
static STARTDOCPRINTERW fpStartDocPrinterW
 
static STARTPAGEPRINTER fpStartPagePrinter
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 36 of file printdrv.c.

Function Documentation

◆ AbortDoc()

int WINAPI AbortDoc ( HDC  hdc)

Definition at line 308 of file printdrv.c.

311{
312 PLDC pldc;
313 int Ret = SP_ERROR;
315
317 {
319 return SP_ERROR;
320 }
321
322 pldc = GdiGetLDC(hdc);
323 if ( !pldc )
324 {
326 return SP_ERROR;
327 }
328
329 if ( !(pldc->Flags & LDC_INIT_DOCUMENT) ) return 1;
330
332
333 ((PW32CLIENTINFO)NtCurrentTeb()->Win32ClientInfo)->cSpins = 0;
334
335 if ( pldc->Flags & LDC_META_PRINT)
336 {
339 return Ret;
340 }
341
342 if (NtGdiAbortDoc(hdc))
343 {
344 if (fpAbortPrinter(pldc->hPrinter)) Ret = 1;
345 }
346 else
347 Ret = SP_ERROR;
348
350
351 return Ret;
352}
#define UNIMPLEMENTED
Definition: debug.h:115
#define NULL
Definition: types.h:112
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define SetLastError(x)
Definition: compat.h:752
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
PLDC FASTCALL GdiGetLDC(HDC hDC)
Definition: misc.c:785
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
@ GDILoObjType_LO_METADC16_TYPE
Definition: gdi_private.h:49
@ GDILoObjType_LO_DC_TYPE
Definition: gdi_private.h:34
#define NtCurrentTeb
HDC hdc
Definition: main.c:9
__kernel_entry W32KAPI BOOL APIENTRY NtGdiAbortDoc(_In_ HDC hdc)
#define LDC_INIT_DOCUMENT
Definition: ntgdihdl.h:151
#define LDC_INIT_PAGE
Definition: ntgdihdl.h:152
#define LDC_SAPCALLBACK
Definition: ntgdihdl.h:150
#define LDC_STARTPAGE
Definition: ntgdihdl.h:153
#define LDC_ATENDPAGE
Definition: ntgdihdl.h:168
#define LDC_META_PRINT
Definition: ntgdihdl.h:159
struct _W32CLIENTINFO * PW32CLIENTINFO
static ABORTPRINTER fpAbortPrinter
Definition: printdrv.c:42
int FASTCALL DocumentEventEx(PVOID pvUMPDev, HANDLE hPrinter, HDC hdc, int iEsc, ULONG cbIn, PVOID pvIn, ULONG cbOut, PVOID pvOut)
Definition: printdrv.c:152
#define DOCUMENTEVENT_ABORTDOC
Definition: winddiui.h:61
Definition: ntgdihdl.h:263
HANDLE hPrinter
Definition: ntgdihdl.h:271
ULONG Flags
Definition: ntgdihdl.h:265
uint32_t ULONG
Definition: typedefs.h:59
#define SP_ERROR
Definition: wingdi.h:318

Referenced by StartDocW().

◆ AbortPrinterEx()

BOOL FASTCALL AbortPrinterEx ( PVOID  pvUMPDev,
HANDLE  hPrinter 
)

Definition at line 142 of file printdrv.c.

146{
147 return fpAbortPrinter(hPrinter);
148}

Referenced by StartDocW().

◆ DocumentEventEx()

int FASTCALL DocumentEventEx ( PVOID  pvUMPDev,
HANDLE  hPrinter,
HDC  hdc,
int  iEsc,
ULONG  cbIn,
PVOID  pvIn,
ULONG  cbOut,
PVOID  pvOut 
)

Definition at line 152 of file printdrv.c.

162{
163 return fpDocumentEvent(hPrinter,hdc,iEsc,cbIn,pvIn,cbOut,pvOut);
164}
static DOCUMENTEVENT fpDocumentEvent
Definition: printdrv.c:47
_In_ ULONG iEsc
Definition: winddi.h:3529

Referenced by AbortDoc(), EndDoc(), IntEndPage(), StartDocW(), and StartPage().

◆ EndDoc()

int WINAPI EndDoc ( HDC  hdc)

Definition at line 359 of file printdrv.c.

362{
363 PLDC pldc;
364 int Ret = SP_ERROR;
366
368 {
370 return SP_ERROR;
371 }
372
373 pldc = GdiGetLDC(hdc);
374 if ( !pldc )
375 {
377 return SP_ERROR;
378 }
379
380 if (pldc->Flags & LDC_META_PRINT)
381 {
384 return Ret;
385 }
386
387 if (pldc->Flags & LDC_INIT_DOCUMENT)
388 {
389 BOOL Good;
390 if (pldc->Flags & LDC_INIT_PAGE) EndPage(hdc);
391
393
394 ((PW32CLIENTINFO)NtCurrentTeb()->Win32ClientInfo)->cSpins = 0;
395
396 Good = NtGdiEndDoc(hdc);
397
398// if (pldc->pUMPDev)
399 Good = EndDocPrinterEx(NULL,pldc->hPrinter);
400
401 if (Good)
402 {
404 Ret = 1;
405 }
407 }
408 return Ret;
409}
unsigned int BOOL
Definition: ntddk_ex.h:94
__kernel_entry W32KAPI BOOL APIENTRY NtGdiEndDoc(_In_ HDC hdc)
int WINAPI EndPage(HDC hdc)
Definition: printdrv.c:426
BOOL FASTCALL EndDocPrinterEx(PVOID pvUMPDev, HANDLE hPrinter)
Definition: printdrv.c:168
#define DOCUMENTEVENT_ENDDOC
Definition: winddiui.h:59
#define DOCUMENTEVENT_ENDDOCPOST
Definition: winddiui.h:64

Referenced by StartPage().

◆ EndDocPrinterEx()

BOOL FASTCALL EndDocPrinterEx ( PVOID  pvUMPDev,
HANDLE  hPrinter 
)

Definition at line 168 of file printdrv.c.

172{
173 return fpEndDocPrinter(hPrinter);
174}
static ENDDOCPRINTER fpEndDocPrinter
Definition: printdrv.c:49

Referenced by EndDoc().

◆ EndFormPage()

int WINAPI EndFormPage ( HDC  hdc)

Definition at line 416 of file printdrv.c.

417{
418 return IntEndPage(hdc,TRUE);
419}
#define TRUE
Definition: types.h:120
static int FASTCALL IntEndPage(HDC hdc, BOOL Form)
Definition: printdrv.c:73

◆ EndPage()

int WINAPI EndPage ( HDC  hdc)

Definition at line 426 of file printdrv.c.

427{
428 return IntEndPage(hdc,FALSE);
429}
#define FALSE
Definition: types.h:117

Referenced by EndDoc().

◆ EndPagePrinterEx()

BOOL FASTCALL EndPagePrinterEx ( PVOID  pvUMPDev,
HANDLE  hPrinter 
)

Definition at line 178 of file printdrv.c.

182{
183 return fpEndPagePrinter(hPrinter);
184}
static ENDPAGEPRINTER fpEndPagePrinter
Definition: printdrv.c:50

Referenced by IntEndPage().

◆ GdiArtificialDecrementDriver()

BOOL WINAPI GdiArtificialDecrementDriver ( LPWSTR  pDriverName,
BOOL  unknown 
)

Definition at line 939 of file printdrv.c.

940{
943 return 0;
944}

◆ GdiDeleteSpoolFileHandle()

BOOL WINAPI GdiDeleteSpoolFileHandle ( HANDLE  SpoolFileHandle)

Definition at line 450 of file printdrv.c.

451{
454 return 0;
455}

◆ GdiEndDocEMF()

BOOL WINAPI GdiEndDocEMF ( HANDLE  SpoolFileHandle)

Definition at line 849 of file printdrv.c.

850{
853 return 0;
854}

◆ GdiEndPageEMF()

BOOL WINAPI GdiEndPageEMF ( HANDLE  SpoolFileHandle,
DWORD  dwOptimization 
)

Definition at line 836 of file printdrv.c.

838{
841 return 0;
842}

◆ GdiGetDC()

HDC WINAPI GdiGetDC ( HANDLE  SpoolFileHandle)

Definition at line 769 of file printdrv.c.

770{
773 return 0;
774}

◆ GdiGetDevmodeForPage()

BOOL WINAPI GdiGetDevmodeForPage ( HANDLE  SpoolFileHandle,
DWORD  dwPageNumber,
PDEVMODEW pCurrDM,
PDEVMODEW pLastDM 
)

Definition at line 861 of file printdrv.c.

865{
868 return 0;
869}

◆ GdiGetPageCount()

DWORD WINAPI GdiGetPageCount ( HANDLE  SpoolFileHandle)

Definition at line 462 of file printdrv.c.

463{
466 return 0;
467}

◆ GdiGetPageHandle()

HANDLE WINAPI GdiGetPageHandle ( HANDLE  SpoolFileHandle,
DWORD  Page,
LPDWORD  pdwPageType 
)

Definition at line 781 of file printdrv.c.

784{
787 return 0;
788}

◆ GdiGetSpoolFileHandle()

HANDLE WINAPI GdiGetSpoolFileHandle ( LPWSTR  pwszPrinterName,
LPDEVMODEW  pDevmode,
LPWSTR  pwszDocName 
)

Definition at line 436 of file printdrv.c.

439{
442 return 0;
443}

◆ GdiPlayEMF()

BOOL WINAPI GdiPlayEMF ( LPWSTR  pwszPrinterName,
LPDEVMODEW  pDevmode,
LPWSTR  pwszDocName,
EMFPLAYPROC  pfnEMFPlayFn,
HANDLE  hPageQuery 
)

Definition at line 890 of file printdrv.c.

896{
899 return 0;
900}

◆ GdiPlayPageEMF()

BOOL WINAPI GdiPlayPageEMF ( HANDLE  SpoolFileHandle,
HANDLE  hemf,
RECT prectDocument,
RECT prectBorder,
RECT prectClip 
)

Definition at line 820 of file printdrv.c.

825{
828 return 0;
829}

◆ GdiPlayPrivatePageEMF()

BOOL WINAPI GdiPlayPrivatePageEMF ( HANDLE  SpoolFileHandle,
DWORD  unknown,
RECT prectDocument 
)

Definition at line 907 of file printdrv.c.

910{
913 return 0;
914}

◆ gdiPlaySpoolStream()

DWORD WINAPI gdiPlaySpoolStream ( DWORD  a0,
DWORD  a1,
DWORD  a2,
DWORD  a3,
DWORD  a4,
DWORD  a5 
)

Definition at line 750 of file printdrv.c.

758{
761 return 0;
762}

◆ GdiPrinterThunk()

BOOL WINAPI GdiPrinterThunk ( IN HUMPD  humpd,
DWORD status,
DWORD  unuse 
)

Definition at line 921 of file printdrv.c.

925{
926 /* FIXME figout the protypes, the HUMPD are a STRUCT or COM object */
927 /* status contain some form of return value that being save, what it is I do not known */
928 /* unsue seam have zero effect, what it is for I do not known */
929
930 // ? return NtGdiSetPUMPDOBJ(humpd->0x10,TRUE, humpd, ?) <- blackbox, OpenRCE info, and api hooks for anylaysing;
931 return FALSE;
932}

◆ GdiResetDCEMF()

BOOL WINAPI GdiResetDCEMF ( HANDLE  SpoolFileHandle,
PDEVMODEW  pCurrDM 
)

Definition at line 876 of file printdrv.c.

878{
881 return 0;
882}

◆ GdiStartDocEMF()

BOOL WINAPI GdiStartDocEMF ( HANDLE  SpoolFileHandle,
DOCINFOW pDocInfo 
)

Definition at line 795 of file printdrv.c.

797{
800 return 0;
801}

◆ GdiStartPageEMF()

BOOL WINAPI GdiStartPageEMF ( HANDLE  SpoolFileHandle)

Definition at line 808 of file printdrv.c.

809{
812 return 0;
813}

◆ IntEndPage()

static int FASTCALL IntEndPage ( HDC  hdc,
BOOL  Form 
)
static

Definition at line 73 of file printdrv.c.

77{
78 PLDC pldc;
79 int Ret = SP_ERROR;
81
83 {
85 return SP_ERROR;
86 }
87
88 pldc = GdiGetLDC(hdc);
89 if ( !pldc )
90 {
92 return SP_ERROR;
93 }
94
95 if (pldc->Flags & LDC_ATENDPAGE) return 1;
96
97 if (pldc->Flags & LDC_META_PRINT)
98 {
99 if ( Form )
100 {
101 // Do MF EndPageForm
102 }
103 else
104 {
105 // Do MF EndPage
106 }
107 return Ret;
108 }
109
110 if (pldc->Flags & LDC_KILL_DOCUMENT || pldc->Flags & LDC_INIT_PAGE)
111 {
113 return SP_ERROR;
114 }
115
116 if (pldc->Flags & LDC_SAPCALLBACK) GdiSAPCallback(pldc);
117
118 pldc->Flags &= ~LDC_INIT_PAGE;
119
121
122 ((PW32CLIENTINFO)NtCurrentTeb()->Win32ClientInfo)->cSpins = 0;
123
124 if ( NtGdiEndPage(hdc) )
125 {
126 BOOL Good;
127// if (pldc->pUMPDev)
128 Good = EndPagePrinterEx(NULL,pldc->hPrinter);
129
130 if (Good) pldc->Flags |= LDC_STARTPAGE;
131 Ret = 1;
132 }
133 else
135 return Ret;
136}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
VOID GdiSAPCallback(PLDC pldc)
Definition: misc.c:819
__kernel_entry W32KAPI BOOL APIENTRY NtGdiEndPage(_In_ HDC hdc)
#define LDC_KILL_DOCUMENT
Definition: ntgdihdl.h:158
BOOL FASTCALL EndPagePrinterEx(PVOID pvUMPDev, HANDLE hPrinter)
Definition: printdrv.c:178
#define DOCUMENTEVENT_ENDPAGE
Definition: winddiui.h:58

Referenced by EndFormPage(), and EndPage().

◆ LoadTheSpoolerDrv()

BOOL FASTCALL LoadTheSpoolerDrv ( VOID  )

Definition at line 188 of file printdrv.c.

189{
190 HMODULE hModWinSpoolDrv;
191
192 if ( !ghSpooler )
193 {
195
196 hModWinSpoolDrv = LoadLibraryW(L"WINSPOOL.DRV");
197
198 if (hModWinSpoolDrv)
199 {
200 fpAbortPrinter = (PVOID)GetProcAddress(hModWinSpoolDrv, "AbortPrinter");
201 fpClosePrinter = (PVOID)GetProcAddress(hModWinSpoolDrv, "ClosePrinter");
202 fpCloseSpoolFileHandle = (PVOID)GetProcAddress(hModWinSpoolDrv, "CloseSpoolFileHandle");
203 fpCommitSpoolData = (PVOID)GetProcAddress(hModWinSpoolDrv, "CommitSpoolData");
204 // fpConnectToLd64In32Server = (PVOID)GetProcAddress(hModWinSpoolDrv, (LPCSTR)224);
205 fpDocumentEvent = (PVOID)GetProcAddress(hModWinSpoolDrv,"DocumentEvent");
206 fpDocumentPropertiesW = (PVOID)GetProcAddress(hModWinSpoolDrv, "DocumentPropertiesW");
207 fpEndDocPrinter = (PVOID)GetProcAddress(hModWinSpoolDrv, "EndDocPrinter");
208 fpEndPagePrinter = (PVOID)GetProcAddress(hModWinSpoolDrv, "EndPagePrinter");
209 fpGetPrinterW = (PVOID)GetProcAddress( hModWinSpoolDrv,"GetPrinterW");
210 fpGetPrinterDriverW = (PVOID)GetProcAddress(hModWinSpoolDrv,"GetPrinterDriverW");
211 fpGetSpoolFileHandle = (PVOID)GetProcAddress(hModWinSpoolDrv, "GetSpoolFileHandle");
212 fpIsValidDevmodeW = (PVOID)GetProcAddress(hModWinSpoolDrv, "IsValidDevmodeW");
213 fpOpenPrinterW = (PVOID)GetProcAddress(hModWinSpoolDrv, "OpenPrinterW");
214 fpQueryColorProfile = (PVOID)GetProcAddress(hModWinSpoolDrv,"QueryColorProfile");
215 fpQueryRemoteFonts = (PVOID)GetProcAddress(hModWinSpoolDrv, "QueryRemoteFonts");
216 fpQuerySpoolMode = (PVOID)GetProcAddress(hModWinSpoolDrv, "QuerySpoolMode");
217 fpReadPrinter = (PVOID)GetProcAddress(hModWinSpoolDrv, "ReadPrinter");
218 fpResetPrinterW = (PVOID)GetProcAddress(hModWinSpoolDrv, "ResetPrinterW");
219 fpSeekPrinter = (PVOID)GetProcAddress(hModWinSpoolDrv, "SeekPrinter");
220 fpSplDriverUnloadComplete = (PVOID)GetProcAddress(hModWinSpoolDrv, "SplDriverUnloadComplete");
221 fpSplReadPrinter = (PVOID)GetProcAddress(hModWinSpoolDrv, (LPCSTR)205);
222 fpStartDocDlgW = (PVOID)GetProcAddress(hModWinSpoolDrv, "StartDocDlgW");
223 fpStartDocPrinterW = (PVOID)GetProcAddress(hModWinSpoolDrv, "StartDocPrinterW");
224 fpStartPagePrinter = (PVOID)GetProcAddress(hModWinSpoolDrv, "StartPagePrinter");
225
226 if ( !fpAbortPrinter ||
234 !fpGetPrinterW ||
242 !fpReadPrinter ||
244 !fpSeekPrinter ||
250 {
251 FreeLibrary(hModWinSpoolDrv);
252 hModWinSpoolDrv = NULL;
253 }
254 ghSpooler = hModWinSpoolDrv;
255 }
257 }
258 else
259 return TRUE;
260
262
263 return (ghSpooler != NULL);
264}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
#define LoadLibraryW(x)
Definition: compat.h:747
RTL_CRITICAL_SECTION semLocal
Definition: dllmain.c:13
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define L(x)
Definition: ntvdm.h:50
OPENPRINTERW fpOpenPrinterW
Definition: printdrv.c:55
static CLOSESPOOLFILEHANDLE fpCloseSpoolFileHandle
Definition: printdrv.c:44
static QUERYSPOOLMODE fpQuerySpoolMode
Definition: printdrv.c:56
static RESETPRINTERW fpResetPrinterW
Definition: printdrv.c:60
static COMMITSPOOLDATA fpCommitSpoolData
Definition: printdrv.c:45
static SPLREADPRINTER fpSplReadPrinter
Definition: printdrv.c:63
CLOSEPRINTER fpClosePrinter
Definition: printdrv.c:43
static QUERYCOLORPROFILE fpQueryColorProfile
Definition: printdrv.c:58
static ISVALIDDEVMODEW fpIsValidDevmodeW
Definition: printdrv.c:54
static GETSPOOLFILEHANDLE fpGetSpoolFileHandle
Definition: printdrv.c:51
static DOCUMENTPROPERTIESW fpDocumentPropertiesW
Definition: printdrv.c:48
static SEEKPRINTER fpSeekPrinter
Definition: printdrv.c:61
static SPLDRIVERUNLOADCOMPLETE fpSplDriverUnloadComplete
Definition: printdrv.c:62
static QUERYREMOTEFONTS fpQueryRemoteFonts
Definition: printdrv.c:57
static STARTPAGEPRINTER fpStartPagePrinter
Definition: printdrv.c:66
static GETPRINTERDRIVERW fpGetPrinterDriverW
Definition: printdrv.c:53
HANDLE ghSpooler
Definition: printdrv.c:40
static STARTDOCDLGW fpStartDocDlgW
Definition: printdrv.c:64
static READPRINTER fpReadPrinter
Definition: printdrv.c:59
static STARTDOCPRINTERW fpStartDocPrinterW
Definition: printdrv.c:65
static GETPRINTERW fpGetPrinterW
Definition: printdrv.c:52
void * PVOID
Definition: typedefs.h:50
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by IntCreateDICW().

◆ SetAbortProc()

int WINAPI SetAbortProc ( HDC  hdc,
ABORTPROC  lpAbortProc 
)

Definition at line 710 of file printdrv.c.

713{
714 PLDC pldc;
716
718 return SP_ERROR;
719
720 pldc = GdiGetLDC(hdc);
721 if ( pldc )
722 {
723 if ( lpAbortProc )
724 {
725 if ( pldc->Flags & LDC_INIT_DOCUMENT )
726 {
727 pldc->Flags |= LDC_SAPCALLBACK;
728 pldc->CallBackTick = GetTickCount();
729 }
730 }
731 else
732 {
733 pldc->Flags &= ~LDC_SAPCALLBACK;
734 }
735 pldc->pAbortProc = lpAbortProc;
736 return 1;
737 }
738 else
739 {
741 }
742 return SP_ERROR;
743}
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
DWORD CallBackTick
Definition: ntgdihdl.h:270
ABORTPROC pAbortProc
Definition: ntgdihdl.h:269

◆ StartDocA()

int WINAPI StartDocA ( HDC  hdc,
CONST DOCINFOA lpdi 
)

Definition at line 597 of file printdrv.c.

601{
602 LPWSTR szDocName = NULL, szOutput = NULL, szDatatype = NULL;
604 INT ret, len;
605
606 docW.cbSize = lpdi->cbSize;
607 if (lpdi->lpszDocName)
608 {
609 len = MultiByteToWideChar(CP_ACP,0,lpdi->lpszDocName,-1,NULL,0);
610 szDocName = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
611 MultiByteToWideChar(CP_ACP,0,lpdi->lpszDocName,-1,szDocName,len);
612 }
613 if (lpdi->lpszOutput)
614 {
615 len = MultiByteToWideChar(CP_ACP,0,lpdi->lpszOutput,-1,NULL,0);
616 szOutput = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
617 MultiByteToWideChar(CP_ACP,0,lpdi->lpszOutput,-1,szOutput,len);
618 }
619 if (lpdi->lpszDatatype)
620 {
621 len = MultiByteToWideChar(CP_ACP,0,lpdi->lpszDatatype,-1,NULL,0);
622 szDatatype = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
623 MultiByteToWideChar(CP_ACP,0,lpdi->lpszDatatype,-1,szDatatype,len);
624 }
625
626 docW.lpszDocName = szDocName;
627 docW.lpszOutput = szOutput;
628 docW.lpszDatatype = szDatatype;
629 docW.fwType = lpdi->fwType;
630
631 ret = StartDocW(hdc, &docW);
632
633 HeapFree( GetProcessHeap(), 0, szDocName );
634 HeapFree( GetProcessHeap(), 0, szOutput );
635 HeapFree( GetProcessHeap(), 0, szDatatype );
636
637 return ret;
638}
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define MultiByteToWideChar
Definition: compat.h:110
GLenum GLsizei len
Definition: glext.h:6722
static const WCHAR docW[]
Definition: setupcab.c:45
int WINAPI StartDocW(HDC hdc, CONST DOCINFOW *lpdi)
Definition: printdrv.c:474
int32_t INT
Definition: typedefs.h:58
int ret
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ StartDocPrinterWEx()

DWORD FASTCALL StartDocPrinterWEx ( PVOID  pvUMPDev,
HANDLE  hPrinter,
DWORD  Level,
LPBYTE  pDocInfo 
)

Definition at line 281 of file printdrv.c.

287{
288 return fpStartDocPrinterW(hPrinter,Level,pDocInfo);
289}
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:56

Referenced by StartDocW().

◆ StartDocW()

int WINAPI StartDocW ( HDC  hdc,
CONST DOCINFOW lpdi 
)

Definition at line 474 of file printdrv.c.

478{
479 PLDC pldc;
480 DOCINFOW diW;
481 DOC_INFO_1W di1W;
482 LPWSTR lpwstrRet = NULL;
483 BOOL Banding;
484 int PrnJobNo, Ret = SP_ERROR;
486
488 return SP_ERROR;
489
490 pldc = GdiGetLDC(hdc);
491 if ( !pldc || pldc->Flags & LDC_ATENDPAGE)
492 {
494 return SP_ERROR;
495 }
496
497 if (!pldc->hPrinter) return SP_ERROR;
498
499 pldc->Flags &= ~LDC_KILL_DOCUMENT;
500
501 if (lpdi)
502 RtlCopyMemory(&diW, lpdi, sizeof(DOCINFOW));
503 else
504 {
505 diW.cbSize = sizeof(DOCINFOW);
506 diW.lpszDocName = NULL;
507 diW.lpszOutput = NULL;
508 diW.lpszDatatype = NULL;
509 diW.fwType = 0;
510 }
511
512 if (!diW.lpszOutput)
513 if (pldc->pwszPort) diW.lpszOutput = pldc->pwszPort;
514
515 lpwstrRet = fpStartDocDlgW(pldc->hPrinter, &diW);
516 if (lpwstrRet == (LPWSTR)SP_APPABORT)
517 {
518 pldc->Flags |= LDC_KILL_DOCUMENT;
519 return SP_ERROR;
520 }
521 if (lpwstrRet == (LPWSTR)SP_ERROR) return SP_ERROR;
522
523 if (lpwstrRet != 0) diW.lpszOutput = lpwstrRet;
524
525 Ret = DocumentEventEx( NULL,
526 pldc->hPrinter,
527 hdc,
529 sizeof(ULONG),
530 &diW,
531 0,
532 NULL);
533
534 if (Ret == SP_APPABORT)
535 {
536 pldc->Flags |= LDC_KILL_DOCUMENT;
537 Ret = SP_ERROR;
538 }
539 if (Ret == SP_ERROR)
540 {
541 if (lpwstrRet) LocalFree(lpwstrRet);
542 return Ret;
543 }
544
545 di1W.pDocName = (LPWSTR)diW.lpszDocName;
546 di1W.pOutputFile = (LPWSTR)diW.lpszOutput;
547 di1W.pDatatype = (LPWSTR)diW.lpszDatatype;
548
549 Ret = SP_ERROR;
550
551 PrnJobNo = StartDocPrinterWEx(NULL, pldc->hPrinter, 1, (LPBYTE)&di1W);
552 if (PrnJobNo <= 0)
553 {
554 Ret = NtGdiStartDoc( hdc, &diW, &Banding, PrnJobNo);
555 if (Ret)
556 {
557 if (pldc->pAbortProc)
558 {
559 GdiSAPCallback(pldc);
560 pldc->Flags |= LDC_SAPCALLBACK;
561 pldc->CallBackTick = GetTickCount();
562 }
563 pldc->Flags |= LDC_INIT_DOCUMENT;
564 if (!Banding) pldc->Flags |= LDC_STARTPAGE;
565 }
566 }
567 if (Ret == SP_ERROR)
568 {
569 //if ( pldc->pUMPDev )
571 DPRINT1("StartDoc Died!!!\n");
572 }
573 else
574 {
575 if ( DocumentEventEx( NULL,
576 pldc->hPrinter,
577 hdc,
579 sizeof(ULONG),
580 &Ret,
581 0,
582 NULL) == SP_ERROR)
583 {
584 AbortDoc(hdc);
585 Ret = SP_ERROR;
586 }
587 }
588 if (lpwstrRet) LocalFree(lpwstrRet);
589 return Ret;
590}
#define DPRINT1
Definition: precomp.h:8
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
__kernel_entry W32KAPI INT APIENTRY NtGdiStartDoc(_In_ HDC hdc, _In_ DOCINFOW *pdi, _Out_ BOOL *pbBanding, _In_ INT iJob)
int WINAPI AbortDoc(HDC hdc)
Definition: printdrv.c:308
DWORD FASTCALL StartDocPrinterWEx(PVOID pvUMPDev, HANDLE hPrinter, DWORD Level, LPBYTE pDocInfo)
Definition: printdrv.c:281
BOOL FASTCALL AbortPrinterEx(PVOID pvUMPDev, HANDLE hPrinter)
Definition: printdrv.c:142
#define DOCUMENTEVENT_STARTDOCPOST
Definition: winddiui.h:65
#define DOCUMENTEVENT_STARTDOC
Definition: winddiui.h:55
LPCWSTR lpszDocName
Definition: wingdi.h:1684
int cbSize
Definition: wingdi.h:1683
DWORD fwType
Definition: wingdi.h:1687
LPCWSTR lpszOutput
Definition: wingdi.h:1685
LPCWSTR lpszDatatype
Definition: wingdi.h:1686
LPWSTR pOutputFile
Definition: winspool.h:617
LPWSTR pDatatype
Definition: winspool.h:618
LPWSTR pDocName
Definition: winspool.h:616
LPWSTR pwszPort
Definition: ntgdihdl.h:268
unsigned char * LPBYTE
Definition: typedefs.h:53
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
struct _DOCINFOW DOCINFOW
#define SP_APPABORT
Definition: wingdi.h:322

Referenced by StartDocA().

◆ StartFormPage()

int WINAPI StartFormPage ( HDC  hdc)

Definition at line 699 of file printdrv.c.

700{
701 return StartPage(hdc);
702}
int WINAPI StartPage(HDC hdc)
Definition: printdrv.c:645

◆ StartPage()

int WINAPI StartPage ( HDC  hdc)

Definition at line 645 of file printdrv.c.

648{
649 PLDC pldc;
651
653 {
655 return SP_ERROR;
656 }
657
658 pldc = GdiGetLDC(hdc);
659 if ( !pldc )
660 {
662 return SP_ERROR;
663 }
664
665 if (pldc->Flags & LDC_META_PRINT)
666 {
669 return SP_ERROR;
670 }
671
673
674 if (pldc->Flags & LDC_INIT_PAGE) return 1;
675
677 {
678 pldc->Flags |= LDC_INIT_PAGE;
679
680 ((PW32CLIENTINFO)NtCurrentTeb()->Win32ClientInfo)->cSpins = 0;
681
682 if (StartPagePrinterEx(NULL, pldc->hPrinter))
683 {
684 if (NtGdiStartPage(hdc)) return 1;
685 }
686
687 pldc->Flags &= ~(LDC_INIT_PAGE);
688 EndDoc(hdc);
690 }
691 return SP_ERROR;
692}
__kernel_entry W32KAPI BOOL APIENTRY NtGdiStartPage(_In_ HDC hdc)
BOOL FASTCALL StartPagePrinterEx(PVOID pvUMPDev, HANDLE hPrinter)
Definition: printdrv.c:293
int WINAPI EndDoc(HDC hdc)
Definition: printdrv.c:359
#define DOCUMENTEVENT_STARTPAGE
Definition: winddiui.h:57

Referenced by StartFormPage().

◆ StartPagePrinterEx()

BOOL FASTCALL StartPagePrinterEx ( PVOID  pvUMPDev,
HANDLE  hPrinter 
)

Definition at line 293 of file printdrv.c.

297{
298 return fpStartPagePrinter(hPrinter);
299}

Referenced by StartPage().

Variable Documentation

◆ fpAbortPrinter

ABORTPRINTER fpAbortPrinter
static

Definition at line 42 of file printdrv.c.

Referenced by AbortDoc(), AbortPrinterEx(), and LoadTheSpoolerDrv().

◆ fpClosePrinter

CLOSEPRINTER fpClosePrinter

Definition at line 43 of file printdrv.c.

Referenced by LoadTheSpoolerDrv().

◆ fpCloseSpoolFileHandle

CLOSESPOOLFILEHANDLE fpCloseSpoolFileHandle
static

Definition at line 44 of file printdrv.c.

Referenced by LoadTheSpoolerDrv().

◆ fpCommitSpoolData

COMMITSPOOLDATA fpCommitSpoolData
static

Definition at line 45 of file printdrv.c.

Referenced by LoadTheSpoolerDrv().

◆ fpDocumentEvent

DOCUMENTEVENT fpDocumentEvent
static

Definition at line 47 of file printdrv.c.

Referenced by DocumentEventEx(), and LoadTheSpoolerDrv().

◆ fpDocumentPropertiesW

DOCUMENTPROPERTIESW fpDocumentPropertiesW
static

Definition at line 48 of file printdrv.c.

Referenced by LoadTheSpoolerDrv().

◆ fpEndDocPrinter

ENDDOCPRINTER fpEndDocPrinter
static

Definition at line 49 of file printdrv.c.

Referenced by EndDocPrinterEx(), and LoadTheSpoolerDrv().

◆ fpEndPagePrinter

ENDPAGEPRINTER fpEndPagePrinter
static

Definition at line 50 of file printdrv.c.

Referenced by EndPagePrinterEx(), and LoadTheSpoolerDrv().

◆ fpGetPrinterDriverW

GETPRINTERDRIVERW fpGetPrinterDriverW
static

Definition at line 53 of file printdrv.c.

Referenced by LoadTheSpoolerDrv().

◆ fpGetPrinterW

GETPRINTERW fpGetPrinterW
static

Definition at line 52 of file printdrv.c.

Referenced by LoadTheSpoolerDrv().

◆ fpGetSpoolFileHandle

GETSPOOLFILEHANDLE fpGetSpoolFileHandle
static

Definition at line 51 of file printdrv.c.

Referenced by LoadTheSpoolerDrv().

◆ fpIsValidDevmodeW

ISVALIDDEVMODEW fpIsValidDevmodeW
static

Definition at line 54 of file printdrv.c.

Referenced by LoadTheSpoolerDrv().

◆ fpOpenPrinterW

OPENPRINTERW fpOpenPrinterW

Definition at line 55 of file printdrv.c.

Referenced by LoadTheSpoolerDrv().

◆ fpQueryColorProfile

QUERYCOLORPROFILE fpQueryColorProfile
static

Definition at line 58 of file printdrv.c.

Referenced by LoadTheSpoolerDrv().

◆ fpQueryRemoteFonts

QUERYREMOTEFONTS fpQueryRemoteFonts
static

Definition at line 57 of file printdrv.c.

Referenced by LoadTheSpoolerDrv().

◆ fpQuerySpoolMode

QUERYSPOOLMODE fpQuerySpoolMode
static

Definition at line 56 of file printdrv.c.

Referenced by LoadTheSpoolerDrv().

◆ fpReadPrinter

READPRINTER fpReadPrinter
static

Definition at line 59 of file printdrv.c.

Referenced by LoadTheSpoolerDrv().

◆ fpResetPrinterW

RESETPRINTERW fpResetPrinterW
static

Definition at line 60 of file printdrv.c.

Referenced by LoadTheSpoolerDrv().

◆ fpSeekPrinter

SEEKPRINTER fpSeekPrinter
static

Definition at line 61 of file printdrv.c.

Referenced by LoadTheSpoolerDrv().

◆ fpSplDriverUnloadComplete

SPLDRIVERUNLOADCOMPLETE fpSplDriverUnloadComplete
static

Definition at line 62 of file printdrv.c.

Referenced by LoadTheSpoolerDrv().

◆ fpSplReadPrinter

SPLREADPRINTER fpSplReadPrinter
static

Definition at line 63 of file printdrv.c.

Referenced by LoadTheSpoolerDrv().

◆ fpStartDocDlgW

STARTDOCDLGW fpStartDocDlgW
static

Definition at line 64 of file printdrv.c.

Referenced by LoadTheSpoolerDrv(), and StartDocW().

◆ fpStartDocPrinterW

STARTDOCPRINTERW fpStartDocPrinterW
static

Definition at line 65 of file printdrv.c.

Referenced by LoadTheSpoolerDrv(), and StartDocPrinterWEx().

◆ fpStartPagePrinter

STARTPAGEPRINTER fpStartPagePrinter
static

Definition at line 66 of file printdrv.c.

Referenced by LoadTheSpoolerDrv(), and StartPagePrinterEx().

◆ ghSpooler

HANDLE ghSpooler = NULL

Definition at line 40 of file printdrv.c.

Referenced by IntCreateDICW(), and LoadTheSpoolerDrv().