ReactOS  0.4.14-dev-315-gbb6fece
printdrv.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS Kernel
4  * PURPOSE: GDI Printing Support
5  * FILE: dll/win32/gdi32/objects/printdrv.c
6  * PROGRAMER:
7  *
8  */
9 
10 // For the wine code:
11 /*
12  * Implementation of some printer driver bits
13  *
14  * Copyright 1996 John Harvey
15  * Copyright 1998 Huw Davies
16  * Copyright 1998 Andreas Mohr
17  * Copyright 1999 Klaas van Gend
18  *
19  * This library is free software; you can redistribute it and/or
20  * modify it under the terms of the GNU Lesser General Public
21  * License as published by the Free Software Foundation; either
22  * version 2.1 of the License, or (at your option) any later version.
23  *
24  * This library is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27  * Lesser General Public License for more details.
28  *
29  * You should have received a copy of the GNU Lesser General Public
30  * License along with this library; if not, write to the Free Software
31  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
32  */
33 
34 #include <precomp.h>
35 
36 #define NDEBUG
37 #include <debug.h>
38 
39 /* GLOBALS *******************************************************************/
41 
46 //static fpConnectToLd64In32Server;
67 
68 /* PRIVATE FUNCTIONS *********************************************************/
69 
70 static
71 int
74  HDC hdc,
75  BOOL Form
76 )
77 {
78  PLDC pldc;
79  int Ret = SP_ERROR;
80  ULONG hType = GDI_HANDLE_GET_TYPE(hdc);
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 }
137 
138 /* FUNCTIONS *****************************************************************/
139 
140 BOOL
141 FASTCALL
143  PVOID pvUMPDev,
144  HANDLE hPrinter
145 )
146 {
147  return fpAbortPrinter(hPrinter);
148 }
149 
150 int
151 FASTCALL
153  PVOID pvUMPDev,
154  HANDLE hPrinter,
155  HDC hdc,
156  int iEsc,
157  ULONG cbIn,
158  PVOID pvIn,
159  ULONG cbOut,
160  PVOID pvOut
161 )
162 {
163  return fpDocumentEvent(hPrinter,hdc,iEsc,cbIn,pvIn,cbOut,pvOut);
164 }
165 
166 BOOL
167 FASTCALL
169  PVOID pvUMPDev,
170  HANDLE hPrinter
171 )
172 {
173  return fpEndDocPrinter(hPrinter);
174 }
175 
176 BOOL
177 FASTCALL
179  PVOID pvUMPDev,
180  HANDLE hPrinter
181 )
182 {
183  return fpEndPagePrinter(hPrinter);
184 }
185 
186 BOOL
187 FASTCALL
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 ||
227  !fpClosePrinter ||
230  !fpDocumentEvent ||
232  !fpEndDocPrinter ||
233  !fpEndPagePrinter ||
234  !fpGetPrinterW ||
238  !fpOpenPrinterW ||
241  !fpQuerySpoolMode ||
242  !fpReadPrinter ||
243  !fpResetPrinterW ||
244  !fpSeekPrinter ||
246  !fpSplReadPrinter ||
247  !fpStartDocDlgW ||
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 }
265 
266 /*
267  Note from msdn:
268 
269  The sequence for a print job is as follows:
270 
271  1. To begin a print job, call StartDocPrinter.
272  2. To begin each page, call StartPagePrinter.
273  3. To write data to a page, call WritePrinter.
274  4. To end each page, call EndPagePrinter.
275  5. Repeat 2, 3, and 4 for as many pages as necessary.
276  6. To end the print job, call EndDocPrinter.
277 
278  */
279 DWORD
280 FASTCALL
282  PVOID pvUMPDev,
283  HANDLE hPrinter,
284  DWORD Level,
285  LPBYTE pDocInfo
286 )
287 {
288  return fpStartDocPrinterW(hPrinter,Level,pDocInfo);
289 }
290 
291 BOOL
292 FASTCALL
294  PVOID pvUMPDev,
295  HANDLE hPrinter
296 )
297 {
298  return fpStartPagePrinter(hPrinter);
299 }
300 
301 /* SYSCALLS ******************************************************************/
302 
303 /*
304  * @unimplemented
305  */
306 int
307 WINAPI
309  HDC hdc
310 )
311 {
312  PLDC pldc;
313  int Ret = SP_ERROR;
314  ULONG hType = GDI_HANDLE_GET_TYPE(hdc);
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 }
353 
354 /*
355  * @unimplemented
356  */
357 int
358 WINAPI
360  HDC hdc
361 )
362 {
363  PLDC pldc;
364  int Ret = SP_ERROR;
365  ULONG hType = GDI_HANDLE_GET_TYPE(hdc);
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 }
410 
411 /*
412  * @implemented
413  */
414 int
415 WINAPI
417 {
418  return IntEndPage(hdc,TRUE);
419 }
420 
421 /*
422  * @implemented
423  */
424 int
425 WINAPI
427 {
428  return IntEndPage(hdc,FALSE);
429 }
430 
431 /*
432  * @unimplemented
433  */
434 HANDLE
435 WINAPI
437  LPDEVMODEW pDevmode,
439 {
442  return 0;
443 }
444 
445 /*
446  * @unimplemented
447  */
448 BOOL
449 WINAPI
451 {
454  return 0;
455 }
456 
457 /*
458  * @unimplemented
459  */
460 DWORD
461 WINAPI
462 GdiGetPageCount(HANDLE SpoolFileHandle)
463 {
466  return 0;
467 }
468 
469 /*
470  * @unimplemented
471  */
472 int
473 WINAPI
475  HDC hdc,
476  CONST DOCINFOW *lpdi
477 )
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;
485  ULONG hType = GDI_HANDLE_GET_TYPE(hdc);
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 )
570  AbortPrinterEx(NULL, pldc->hPrinter);
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 }
591 
592 /*
593  * @implemented
594  */
595 int
596 WINAPI
598  HDC hdc,
599  CONST DOCINFOA *lpdi
600 )
601 {
602  LPWSTR szDocName = NULL, szOutput = NULL, szDatatype = NULL;
603  DOCINFOW docW;
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 }
639 
640 /*
641  * @unimplemented
642  */
643 int
644 WINAPI
646  HDC hdc
647 )
648 {
649  PLDC pldc;
650  ULONG hType = GDI_HANDLE_GET_TYPE(hdc);
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 
672  pldc->Flags &= ~(LDC_ATENDPAGE|LDC_STARTPAGE);
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 }
693 
694 /*
695  * @implemented
696  */
697 int
698 WINAPI
700 {
701  return StartPage(hdc);
702 }
703 
704 
705 /*
706  * @implemented
707  */
708 int
709 WINAPI
711  HDC hdc,
712  ABORTPROC lpAbortProc)
713 {
714  PLDC pldc;
715  ULONG hType = GDI_HANDLE_GET_TYPE(hdc);
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 }
744 
745 /*
746  * @unimplemented
747  */
748 DWORD
749 WINAPI
751  DWORD a0,
752  DWORD a1,
753  DWORD a2,
754  DWORD a3,
755  DWORD a4,
756  DWORD a5
757 )
758 {
761  return 0;
762 }
763 
764 /*
765  * @unimplemented
766  */
767 HDC
768 WINAPI
769 GdiGetDC(HANDLE SpoolFileHandle)
770 {
773  return 0;
774 }
775 
776 /*
777  * @unimplemented
778  */
779 HANDLE
780 WINAPI
781 GdiGetPageHandle(HANDLE SpoolFileHandle,
782  DWORD Page,
783  LPDWORD pdwPageType)
784 {
787  return 0;
788 }
789 
790 /*
791  * @unimplemented
792  */
793 BOOL
794 WINAPI
795 GdiStartDocEMF(HANDLE SpoolFileHandle,
796  DOCINFOW *pDocInfo)
797 {
800  return 0;
801 }
802 
803 /*
804  * @unimplemented
805  */
806 BOOL
807 WINAPI
808 GdiStartPageEMF(HANDLE SpoolFileHandle)
809 {
812  return 0;
813 }
814 
815 /*
816  * @unimplemented
817  */
818 BOOL
819 WINAPI
820 GdiPlayPageEMF(HANDLE SpoolFileHandle,
821  HANDLE hemf,
822  RECT *prectDocument,
823  RECT *prectBorder,
824  RECT *prectClip)
825 {
828  return 0;
829 }
830 
831 /*
832  * @unimplemented
833  */
834 BOOL
835 WINAPI
836 GdiEndPageEMF(HANDLE SpoolFileHandle,
837  DWORD dwOptimization)
838 {
841  return 0;
842 }
843 
844 /*
845  * @unimplemented
846  */
847 BOOL
848 WINAPI
849 GdiEndDocEMF(HANDLE SpoolFileHandle)
850 {
853  return 0;
854 }
855 
856 /*
857  * @unimplemented
858  */
859 BOOL
860 WINAPI
861 GdiGetDevmodeForPage(HANDLE SpoolFileHandle,
862  DWORD dwPageNumber,
863  PDEVMODEW *pCurrDM,
864  PDEVMODEW *pLastDM)
865 {
868  return 0;
869 }
870 
871 /*
872  * @unimplemented
873  */
874 BOOL
875 WINAPI
876 GdiResetDCEMF(HANDLE SpoolFileHandle,
877  PDEVMODEW pCurrDM)
878 {
881  return 0;
882 }
883 
884 
885 /*
886  * @unimplemented
887  */
888 BOOL
889 WINAPI
890 GdiPlayEMF(LPWSTR pwszPrinterName,
891  LPDEVMODEW pDevmode,
893  EMFPLAYPROC pfnEMFPlayFn,
894  HANDLE hPageQuery
895  )
896 {
899  return 0;
900 }
901 
902 /*
903  * @unimplemented
904  */
905 BOOL
906 WINAPI
908  DWORD unknown,
909  RECT *prectDocument)
910 {
913  return 0;
914 }
915 
916 /*
917  * @unimplemented
918  */
919 BOOL
920 WINAPI
922  IN HUMPD humpd,
923  DWORD *status,
924  DWORD unuse)
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 }
933 
934 /*
935  * @unimplemented
936  */
937 BOOL
938 WINAPI
940 {
943  return 0;
944 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define SP_ERROR
Definition: wingdi.h:317
static ABORTPRINTER fpAbortPrinter
Definition: printdrv.c:42
#define IN
Definition: typedefs.h:38
LPWSTR pDocName
Definition: winspool.h:556
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
static const struct update_accum a3
Definition: msg.c:600
HANDLE(WINAPI * COMMITSPOOLDATA)(HANDLE, HANDLE, DWORD)
Definition: gdi32p.h:181
BOOL WINAPI GdiStartPageEMF(HANDLE SpoolFileHandle)
Definition: printdrv.c:808
BOOL(WINAPI * READPRINTER)(HANDLE, PVOID, DWORD, PDWORD)
Definition: gdi32p.h:190
LONG(WINAPI * DOCUMENTPROPERTIESW)(HWND, HANDLE, LPWSTR, PDEVMODEW, PDEVMODEW, DWORD)
Definition: gdi32p.h:182
BOOL(WINAPI * ENDDOCPRINTER)(HANDLE)
Definition: gdi32p.h:183
INT(WINAPI * DOCUMENTEVENT)(HANDLE, HDC, INT, ULONG, PVOID, ULONG, PVOID)
Definition: gdi32p.h:202
struct _DOCINFOW DOCINFOW
DWORD WINAPI gdiPlaySpoolStream(DWORD a0, DWORD a1, DWORD a2, DWORD a3, DWORD a4, DWORD a5)
Definition: printdrv.c:750
HANDLE WINAPI GdiGetSpoolFileHandle(LPWSTR pwszPrinterName, LPDEVMODEW pDevmode, LPWSTR pwszDocName)
Definition: printdrv.c:436
static RESETPRINTERW fpResetPrinterW
Definition: printdrv.c:60
#define CP_ACP
Definition: compat.h:99
static DOCUMENTPROPERTIESW fpDocumentPropertiesW
Definition: printdrv.c:48
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LPWSTR pOutputFile
Definition: winspool.h:557
BOOL(WINAPI * CLOSESPOOLFILEHANDLE)(HANDLE, HANDLE)
Definition: gdi32p.h:180
static HDC
Definition: imagelist.c:92
DWORD CallBackTick
Definition: ntgdihdl.h:283
int WINAPI AbortDoc(HDC hdc)
Definition: printdrv.c:308
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
struct _W32CLIENTINFO * PW32CLIENTINFO
static const struct update_accum a4
Definition: msg.c:2285
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
BOOL(WINAPI * ENDPAGEPRINTER)(HANDLE)
Definition: gdi32p.h:184
#define DOCUMENTEVENT_STARTPAGE
Definition: winddiui.h:57
BOOL WINAPI GdiResetDCEMF(HANDLE SpoolFileHandle, PDEVMODEW pCurrDM)
Definition: printdrv.c:876
BOOL(WINAPI * CLOSEPRINTER)(HANDLE)
Definition: gdi32p.h:179
BOOL(WINAPI * SPLREADPRINTER)(HANDLE, LPBYTE *, DWORD)
Definition: gdi32p.h:197
BOOL(WINAPI * RESETPRINTERW)(HANDLE, LPPRINTER_DEFAULTSW)
Definition: gdi32p.h:191
static STARTDOCPRINTERW fpStartDocPrinterW
Definition: printdrv.c:65
#define FASTCALL
Definition: nt_native.h:50
int32_t INT
Definition: typedefs.h:56
BOOL(WINAPI * SPLDRIVERUNLOADCOMPLETE)(LPWSTR)
Definition: gdi32p.h:199
ULONG Flags
Definition: ntgdihdl.h:278
static STARTDOCDLGW fpStartDocDlgW
Definition: printdrv.c:64
int WINAPI EndPage(HDC hdc)
Definition: printdrv.c:426
LPCWSTR lpszOutput
Definition: wingdi.h:1680
#define LDC_ATENDPAGE
Definition: ntgdihdl.h:186
DWORD(WINAPI * QUERYSPOOLMODE)(HANDLE, DWORD, DWORD)
Definition: gdi32p.h:206
BOOL WINAPI GdiPlayEMF(LPWSTR pwszPrinterName, LPDEVMODEW pDevmode, LPWSTR pwszDocName, EMFPLAYPROC pfnEMFPlayFn, HANDLE hPageQuery)
Definition: printdrv.c:890
BOOL WINAPI GdiStartDocEMF(HANDLE SpoolFileHandle, DOCINFOW *pDocInfo)
Definition: printdrv.c:795
BOOL WINAPI GdiEndDocEMF(HANDLE SpoolFileHandle)
Definition: printdrv.c:849
#define LDC_KILL_DOCUMENT
Definition: ntgdihdl.h:178
__kernel_entry W32KAPI INT APIENTRY NtGdiStartDoc(_In_ HDC hdc, _In_ DOCINFOW *pdi, _Out_ BOOL *pbBanding, _In_ INT iJob)
unsigned char * LPBYTE
Definition: typedefs.h:52
static GETSPOOLFILEHANDLE fpGetSpoolFileHandle
Definition: printdrv.c:51
BOOL FASTCALL LoadTheSpoolerDrv(VOID)
Definition: printdrv.c:188
BOOL WINAPI GdiPlayPageEMF(HANDLE SpoolFileHandle, HANDLE hemf, RECT *prectDocument, RECT *prectBorder, RECT *prectClip)
Definition: printdrv.c:820
BOOL(WINAPI * GETPRINTERW)(HANDLE, DWORD, LPBYTE, DWORD, LPDWORD)
Definition: gdi32p.h:185
unsigned int BOOL
Definition: ntddk_ex.h:94
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
static SEEKPRINTER fpSeekPrinter
Definition: printdrv.c:61
#define DOCUMENTEVENT_ENDDOC
Definition: winddiui.h:59
HANDLE WINAPI GdiGetPageHandle(HANDLE SpoolFileHandle, DWORD Page, LPDWORD pdwPageType)
Definition: printdrv.c:781
static ISVALIDDEVMODEW fpIsValidDevmodeW
Definition: printdrv.c:54
#define DOCUMENTEVENT_STARTDOC
Definition: winddiui.h:55
DWORD WINAPI GdiGetPageCount(HANDLE SpoolFileHandle)
Definition: printdrv.c:462
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
_In_ LPWSTR pwszDocName
Definition: winddi.h:4071
BOOL WINAPI GdiEndPageEMF(HANDLE SpoolFileHandle, DWORD dwOptimization)
Definition: printdrv.c:836
BOOL FASTCALL EndDocPrinterEx(PVOID pvUMPDev, HANDLE hPrinter)
Definition: printdrv.c:168
#define LDC_INIT_DOCUMENT
Definition: ntgdihdl.h:173
int cbSize
Definition: wingdi.h:1678
int WINAPI StartDocA(HDC hdc, CONST DOCINFOA *lpdi)
Definition: printdrv.c:597
const char * LPCSTR
Definition: xmlstorage.h:183
void * PVOID
Definition: retypes.h:9
static GETPRINTERW fpGetPrinterW
Definition: printdrv.c:52
#define DOCUMENTEVENT_ENDDOCPOST
Definition: winddiui.h:64
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
BOOL WINAPI GdiPrinterThunk(IN HUMPD humpd, DWORD *status, DWORD unuse)
Definition: printdrv.c:921
CLOSEPRINTER fpClosePrinter
Definition: printdrv.c:43
#define LDC_STARTPAGE
Definition: ntgdihdl.h:175
#define LDC_INIT_PAGE
Definition: ntgdihdl.h:174
VOID GdiSAPCallback(PLDC pldc)
Definition: misc.c:819
LPCWSTR lpszDatatype
Definition: wingdi.h:1681
PLDC FASTCALL GdiGetLDC(HDC hDC)
Definition: misc.c:785
#define FreeLibrary(x)
Definition: compat.h:405
BOOL(WINAPI * STARTPAGEPRINTER)(HANDLE)
Definition: gdi32p.h:194
static SPLREADPRINTER fpSplReadPrinter
Definition: printdrv.c:63
BOOL FASTCALL StartPagePrinterEx(PVOID pvUMPDev, HANDLE hPrinter)
Definition: printdrv.c:293
DWORD(WINAPI * STARTDOCPRINTERW)(HANDLE, DWORD, PBYTE)
Definition: gdi32p.h:193
__kernel_entry W32KAPI BOOL APIENTRY NtGdiStartPage(_In_ HDC hdc)
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR pDatatype
Definition: winspool.h:558
BOOL(CALLBACK * ABORTPROC)(HDC, int)
Definition: wingdi.h:2906
static QUERYREMOTEFONTS fpQueryRemoteFonts
Definition: printdrv.c:57
static const struct update_accum a2
Definition: msg.c:586
static QUERYSPOOLMODE fpQuerySpoolMode
Definition: printdrv.c:56
BOOL WINAPI GdiGetDevmodeForPage(HANDLE SpoolFileHandle, DWORD dwPageNumber, PDEVMODEW *pCurrDM, PDEVMODEW *pLastDM)
Definition: printdrv.c:861
DWORD FASTCALL StartDocPrinterWEx(PVOID pvUMPDev, HANDLE hPrinter, DWORD Level, LPBYTE pDocInfo)
Definition: printdrv.c:281
#define WINAPI
Definition: msvc.h:8
#define LDC_META_PRINT
Definition: ntgdihdl.h:179
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
__kernel_entry W32KAPI BOOL APIENTRY NtGdiAbortDoc(_In_ HDC hdc)
HANDLE(WINAPI * GETSPOOLFILEHANDLE)(HANDLE)
Definition: gdi32p.h:187
static QUERYCOLORPROFILE fpQueryColorProfile
Definition: printdrv.c:58
Definition: id3.c:18
Definition: ntgdihdl.h:275
BOOL WINAPI GdiPlayPrivatePageEMF(HANDLE SpoolFileHandle, DWORD unknown, RECT *prectDocument)
Definition: printdrv.c:907
DWORD fwType
Definition: wingdi.h:1682
BOOL(WINAPI * QUERYCOLORPROFILE)(HANDLE, PDEVMODEW, ULONG, VOID *, ULONG, FLONG)
Definition: gdi32p.h:204
static ENDDOCPRINTER fpEndDocPrinter
Definition: printdrv.c:49
HANDLE ghSpooler
Definition: printdrv.c:40
int ret
int WINAPI StartPage(HDC hdc)
Definition: printdrv.c:645
static const WCHAR L[]
Definition: oid.c:1250
HDC hdc
Definition: main.c:9
LPCWSTR lpszDocName
Definition: wingdi.h:1679
static SPLDRIVERUNLOADCOMPLETE fpSplDriverUnloadComplete
Definition: printdrv.c:62
GLenum GLsizei len
Definition: glext.h:6722
#define SP_APPABORT
Definition: wingdi.h:321
BOOL(WINAPI * GETPRINTERDRIVERW)(HANDLE, LPWSTR, DWORD, LPBYTE, DWORD, LPDWORD)
Definition: gdi32p.h:186
_In_ ULONG iEsc
Definition: winddi.h:3529
static DOCUMENTEVENT fpDocumentEvent
Definition: printdrv.c:47
#define DOCUMENTEVENT_ENDPAGE
Definition: winddiui.h:58
int WINAPI EndFormPage(HDC hdc)
Definition: printdrv.c:416
#define LDC_SAPCALLBACK
Definition: ntgdihdl.h:172
OPENPRINTERW fpOpenPrinterW
Definition: printdrv.c:55
static GETPRINTERDRIVERW fpGetPrinterDriverW
Definition: printdrv.c:53
static COMMITSPOOLDATA fpCommitSpoolData
Definition: printdrv.c:45
HDC WINAPI GdiGetDC(HANDLE SpoolFileHandle)
Definition: printdrv.c:769
BOOL(WINAPI * ABORTPRINTER)(HANDLE)
Definition: gdi32p.h:178
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
int WINAPI StartDocW(HDC hdc, CONST DOCINFOW *lpdi)
Definition: printdrv.c:474
int WINAPI SetAbortProc(HDC hdc, ABORTPROC lpAbortProc)
Definition: printdrv.c:710
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
BOOL WINAPI GdiArtificialDecrementDriver(LPWSTR pDriverName, BOOL unknown)
Definition: printdrv.c:939
static int FASTCALL IntEndPage(HDC hdc, BOOL Form)
Definition: printdrv.c:73
__kernel_entry W32KAPI BOOL APIENTRY NtGdiEndPage(_In_ HDC hdc)
RTL_CRITICAL_SECTION semLocal
Definition: dllmain.c:12
#define MultiByteToWideChar
Definition: compat.h:100
BOOL FASTCALL EndPagePrinterEx(PVOID pvUMPDev, HANDLE hPrinter)
Definition: printdrv.c:178
int WINAPI EndDoc(HDC hdc)
Definition: printdrv.c:359
#define DPRINT1
Definition: precomp.h:8
int WINAPI StartFormPage(HDC hdc)
Definition: printdrv.c:699
BOOL(WINAPI * SEEKPRINTER)(HANDLE, LARGE_INTEGER, PLARGE_INTEGER, DWORD, BOOL)
Definition: gdi32p.h:196
static READPRINTER fpReadPrinter
Definition: printdrv.c:59
BOOL(WINAPI * ISVALIDDEVMODEW)(PDEVMODEW, size_t)
Definition: gdi32p.h:188
uint32_t * LPDWORD
Definition: typedefs.h:57
unsigned int ULONG
Definition: retypes.h:1
__kernel_entry W32KAPI BOOL APIENTRY NtGdiEndDoc(_In_ HDC hdc)
BOOL FASTCALL AbortPrinterEx(PVOID pvUMPDev, HANDLE hPrinter)
Definition: printdrv.c:142
INT(CALLBACK * EMFPLAYPROC)(HDC hdc, INT iFunction, HANDLE hPageQuery)
Definition: gdi32p.h:24
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define UNIMPLEMENTED
Definition: debug.h:114
#define GetProcAddress(x, y)
Definition: compat.h:410
BOOL WINAPI GdiDeleteSpoolFileHandle(HANDLE SpoolFileHandle)
Definition: printdrv.c:450
#define DOCUMENTEVENT_ABORTDOC
Definition: winddiui.h:61
static const struct update_accum a1
Definition: msg.c:578
static const WCHAR docW[]
Definition: setupcab.c:45
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPWSTR pwszPort
Definition: ntgdihdl.h:281
BOOL(WINAPI * OPENPRINTERW)(LPWSTR, PHANDLE, LPPRINTER_DEFAULTSW)
Definition: gdi32p.h:189
ABORTPROC pAbortProc
Definition: ntgdihdl.h:282
#define DOCUMENTEVENT_STARTDOCPOST
Definition: winddiui.h:65
int FASTCALL DocumentEventEx(PVOID pvUMPDev, HANDLE hPrinter, HDC hdc, int iEsc, ULONG cbIn, PVOID pvIn, ULONG cbOut, PVOID pvOut)
Definition: printdrv.c:152
#define HeapFree(x, y, z)
Definition: compat.h:394
#define CONST
Definition: pedump.c:81
HANDLE hPrinter
Definition: ntgdihdl.h:284
static ENDPAGEPRINTER fpEndPagePrinter
Definition: printdrv.c:50
LPWSTR(WINAPI * STARTDOCDLGW)(HANDLE, DOCINFOW *)
Definition: gdi32p.h:192
DWORD(WINAPI * QUERYREMOTEFONTS)(DWORD, DWORD, DWORD)
Definition: gdi32p.h:207
static STARTPAGEPRINTER fpStartPagePrinter
Definition: printdrv.c:66
static CLOSESPOOLFILEHANDLE fpCloseSpoolFileHandle
Definition: printdrv.c:44
Definition: ps.c:97