xref: /reactos/sdk/include/psdk/winsplp.h (revision 40462c92)
1 /*
2  * winsplp.h
3  *
4  * This file is part of the ReactOS PSDK package.
5  *
6  * Contributors:
7  *   Created by Amine Khaldi.
8  *
9  * THIS SOFTWARE IS NOT COPYRIGHTED
10  *
11  * This source code is offered for use in the public domain. You may
12  * use, modify or distribute it freely.
13  *
14  * This code is distributed in the hope that it will be useful but
15  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
16  * DISCLAIMED. This includes but is not limited to warranties of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18  *
19  */
20 
21 #pragma once
22 
23 #ifndef _WINSPLP_
24 #define _WINSPLP_
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #if (STRICT && (NTDDI_VERSION >= NTDDI_VISTA))
31 #define HKEYMONITOR HKEY
32 #else
33 #define HKEYMONITOR HANDLE
34 #endif
35 
36 #define PRINTER_NOTIFY_STATUS_ENDPOINT  1
37 #define PRINTER_NOTIFY_STATUS_POLL      2
38 #define PRINTER_NOTIFY_STATUS_INFO      4
39 
40 #define ROUTER_UNKNOWN      0
41 #define ROUTER_SUCCESS      1
42 #define ROUTER_STOP_ROUTING 2
43 
44 #if (NTDDI_VERSION >= NTDDI_WINXP)
45 #define MONITOR2_SIZE_WIN2K (sizeof(DWORD) + (sizeof(PVOID)*18))
46 #endif
47 
48 #define COPYFILE_EVENT_SET_PRINTER_DATAEX           1
49 #define COPYFILE_EVENT_DELETE_PRINTER               2
50 #define COPYFILE_EVENT_ADD_PRINTER_CONNECTION       3
51 #define COPYFILE_EVENT_DELETE_PRINTER_CONNECTION    4
52 #define COPYFILE_EVENT_FILES_CHANGED                5
53 
54 #define COPYFILE_FLAG_CLIENT_SPOOLER             0x00000001
55 #define COPYFILE_FLAG_SERVER_SPOOLER             0x00000002
56 
57 #define PRINTER_NOTIFY_INFO_DATA_COMPACT         1
58 
59 typedef struct _PRINTER_NOTIFY_INIT {
60   DWORD Size;
61   DWORD Reserved;
62   DWORD PollTime;
63 } PRINTER_NOTIFY_INIT, *LPPRINTER_NOTIFY_INIT, *PPRINTER_NOTIFY_INIT;
64 
65 typedef struct _SPLCLIENT_INFO_1 {
66   DWORD dwSize;
67   LPWSTR pMachineName;
68   LPWSTR pUserName;
69   DWORD dwBuildNum;
70   DWORD dwMajorVersion;
71   DWORD dwMinorVersion;
72   WORD wProcessorArchitecture;
73 } SPLCLIENT_INFO_1, *LPSPLCLIENT_INFO_1, *PSPLCLIENT_INFO_1;
74 
75 typedef struct _SPLCLIENT_INFO_2_V1{
76   ULONG_PTR hSplPrinter;
77 } SPLCLIENT_INFO_2_W2K;
78 
79 typedef struct _SPLCLIENT_INFO_2_V2{
80 #ifdef _WIN64
81   DWORD64 hSplPrinter;
82 #else
83   DWORD32 hSplPrinter;
84 #endif
85 } SPLCLIENT_INFO_2_WINXP;
86 
87 typedef struct _SPLCLIENT_INFO_2_V3{
88   UINT64 hSplPrinter;
89 } SPLCLIENT_INFO_2_LONGHORN;
90 
91 typedef struct _PRINTPROVIDOR {
92 
93   BOOL
94   (WINAPI *fpOpenPrinter)(
95     _In_opt_ PWSTR lpPrinterName,
96     _Out_ HANDLE *phPrinter,
97     _In_opt_ PPRINTER_DEFAULTSW pDefault);
98 
99   BOOL
100   (WINAPI *fpSetJob)(
101     _In_ HANDLE hPrinter,
102     _In_ DWORD JobID,
103     _In_ DWORD Level,
104     _In_reads_opt_(_Inexpressible_(0)) LPBYTE pJob,
105     _In_ DWORD Command);
106 
107   BOOL
108   (WINAPI *fpGetJob)(
109     _In_ HANDLE hPrinter,
110     _In_ DWORD JobID,
111     _In_ DWORD Level,
112     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE pJob,
113     _In_ DWORD cbBuf,
114     _Out_ LPDWORD pcbNeeded);
115 
116   BOOL
117   (WINAPI *fpEnumJobs)(
118     _In_ HANDLE hPrinter,
119     _In_ DWORD FirstJob,
120     _In_ DWORD NoJobs,
121     _In_ DWORD Level,
122     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE pJob,
123     _In_ DWORD cbBuf,
124     _Out_ LPDWORD pcbNeeded,
125     _Out_ LPDWORD pcReturned);
126 
127   HANDLE
128   (WINAPI *fpAddPrinter)(
129     _In_opt_ LPWSTR pName,
130     _In_ DWORD Level,
131     _In_reads_(_Inexpressible_(0)) LPBYTE pPrinter);
132 
133   BOOL (WINAPI *fpDeletePrinter)(_In_ HANDLE hPrinter);
134 
135   BOOL
136   (WINAPI *fpSetPrinter)(
137     _In_ HANDLE hPrinter,
138     _In_ DWORD Level,
139     _In_reads_(_Inexpressible_(0)) LPBYTE pPrinter,
140     _In_ DWORD Command);
141 
142   BOOL
143   (WINAPI *fpGetPrinter)(
144     _In_ HANDLE hPrinter,
145     _In_ DWORD Level,
146     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE pPrinter,
147     _In_ DWORD cbBuf,
148     _Out_ LPDWORD pcbNeeded);
149 
150   BOOL
151   (WINAPI *fpEnumPrinters)(
152     _In_ DWORD dwType,
153     _In_opt_ LPWSTR lpszName,
154     _In_ DWORD dwLevel,
155     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE lpbPrinters,
156     _In_ DWORD cbBuf,
157     _Out_ LPDWORD lpdwNeeded,
158     _Out_ LPDWORD lpdwReturned);
159 
160   BOOL
161   (WINAPI *fpAddPrinterDriver)(
162     _In_opt_ LPWSTR pName,
163     _In_ DWORD Level,
164     _In_reads_(_Inexpressible_(0)) LPBYTE pDriverInfo);
165 
166   BOOL
167   (WINAPI *fpEnumPrinterDrivers)(
168     _In_opt_ LPWSTR pName,
169     _In_opt_ LPWSTR pEnvironment,
170     _In_ DWORD Level,
171     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE pDriverInfo,
172     _In_ DWORD cbBuf,
173     _Out_ LPDWORD pcbNeeded,
174     _Out_ LPDWORD pcbReturned);
175 
176   BOOL
177   (WINAPI *fpGetPrinterDriver)(
178     _In_ HANDLE hPrinter,
179     _In_opt_ LPWSTR pEnvironment,
180     _In_ DWORD Level,
181     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE pDriverInfo,
182     _In_ DWORD cbBuf,
183     _Out_ LPDWORD pcbNeeded);
184 
185   BOOL
186   (WINAPI *fpGetPrinterDriverDirectory)(
187     _In_opt_ LPWSTR pName,
188     _In_opt_ LPWSTR pEnvironment,
189     _In_ DWORD Level,
190     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE pDriverDirectory,
191     _In_ DWORD cbBuf,
192     _Out_ LPDWORD pcbNeeded);
193 
194   BOOL
195   (WINAPI *fpDeletePrinterDriver)(
196     _In_opt_ LPWSTR pName,
197     _In_opt_ LPWSTR pEnvironment,
198     _In_ LPWSTR pDriverName);
199 
200   BOOL
201   (WINAPI *fpAddPrintProcessor)(
202     _In_opt_ LPWSTR pName,
203     _In_opt_ LPWSTR pEnvironment,
204     _In_ LPWSTR pPathName,
205     _In_ LPWSTR pPrintProcessorName);
206 
207   BOOL
208   (WINAPI *fpEnumPrintProcessors)(
209     _In_opt_ LPWSTR pName,
210     _In_opt_ LPWSTR pEnvironment,
211     _In_ DWORD Level,
212     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE pPrintProcessorInfo,
213     _In_ DWORD cbBuf,
214     _Out_ LPDWORD pcbNeeded,
215     _Out_ LPDWORD pcbReturned);
216 
217   BOOL
218   (WINAPI *fpGetPrintProcessorDirectory)(
219     _In_opt_ LPWSTR pName,
220     _In_opt_ LPWSTR pEnvironment,
221     _In_ DWORD Level,
222     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE pPrintProcessorInfo,
223     _In_ DWORD cbBuf,
224     _In_ LPDWORD pcbNeeded);
225 
226   BOOL
227   (WINAPI *fpDeletePrintProcessor)(
228     _In_opt_ LPWSTR pName,
229     _In_opt_ LPWSTR pEnvironment,
230     _In_ LPWSTR pPrintProcessorName);
231 
232   BOOL
233   (WINAPI *fpEnumPrintProcessorDatatypes)(
234     _In_opt_ LPWSTR pName,
235     _In_ LPWSTR pPrintProcessorName,
236     _In_ DWORD Level,
237     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE pDatatypes,
238     _In_ DWORD cbBuf,
239     _Out_ LPDWORD pcbNeeded,
240     _Out_ LPDWORD pcbReturned);
241 
242   DWORD
243   (WINAPI *fpStartDocPrinter)(
244     _In_ HANDLE hPrinter,
245     _In_ DWORD Level,
246     _In_reads_(_Inexpressible_(0)) LPBYTE pDocInfo);
247 
248   BOOL (WINAPI *fpStartPagePrinter)(_In_ HANDLE hPrinter);
249 
250   BOOL
251   (WINAPI *fpWritePrinter)(
252     _In_ HANDLE hPrinter,
253     _In_reads_bytes_(cbBuf) LPVOID pBuf,
254     _In_ DWORD cbBuf,
255     _Out_ LPDWORD pcWritten);
256 
257   BOOL (WINAPI *fpEndPagePrinter)(_In_ HANDLE hPrinter);
258 
259   BOOL (WINAPI *fpAbortPrinter)(_In_ HANDLE hPrinter);
260 
261   BOOL
262   (WINAPI *fpReadPrinter)(
263     _In_ HANDLE hPrinter,
264     _Out_writes_bytes_to_opt_(cbBuf, *pNoBytesRead) LPVOID pBuf,
265     _In_ DWORD cbBuf,
266     _Out_ LPDWORD pNoBytesRead);
267 
268   BOOL (WINAPI *fpEndDocPrinter)(_In_ HANDLE hPrinter);
269 
270   BOOL
271   (WINAPI *fpAddJob)(
272     _In_ HANDLE hPrinter,
273     _In_ DWORD Level,
274     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE pData,
275     _In_ DWORD cbBuf,
276     _Out_ LPDWORD pcbNeeded);
277 
278   BOOL (WINAPI *fpScheduleJob)(_In_ HANDLE hPrinter, _In_ DWORD JobID);
279 
280   DWORD
281   (WINAPI *fpGetPrinterData)(
282     _In_ HANDLE hPrinter,
283     _In_ LPWSTR pValueName,
284     _Out_opt_ LPDWORD pType,
285     _Out_writes_bytes_to_opt_(nSize, *pcbNeeded) LPBYTE pData,
286     _In_ DWORD nSize,
287     _Out_ LPDWORD pcbNeeded);
288 
289   DWORD
290   (WINAPI *fpSetPrinterData)(
291     _In_ HANDLE hPrinter,
292     _In_ LPWSTR pValueName,
293     _In_ DWORD Type,
294     _In_reads_bytes_(cbData) LPBYTE pData,
295     _In_ DWORD cbData);
296 
297   DWORD
298   (WINAPI *fpWaitForPrinterChange)(
299     _In_ HANDLE hPrinter,
300     _In_ DWORD Flags);
301 
302   BOOL (WINAPI *fpClosePrinter)(_In_ HANDLE phPrinter);
303 
304   BOOL
305   (WINAPI *fpAddForm)(
306     _In_ HANDLE hPrinter,
307     _In_ DWORD Level,
308     _In_reads_(_Inexpressible_(0)) LPBYTE pForm);
309 
310   BOOL (WINAPI *fpDeleteForm)(_In_ HANDLE hPrinter, _In_ LPWSTR pFormName);
311 
312   BOOL
313   (WINAPI *fpGetForm)(
314     _In_ HANDLE hPrinter,
315     _In_ LPWSTR pFormName,
316     _In_ DWORD Level,
317     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE pForm,
318     _In_ DWORD cbBuf,
319     _Out_ LPDWORD pcbNeeded);
320 
321   BOOL
322   (WINAPI *fpSetForm)(
323     _In_ HANDLE hPrinter,
324     _In_ LPWSTR pFormName,
325     _In_ DWORD Level,
326     _In_reads_(_Inexpressible_(0)) LPBYTE pForm);
327 
328   BOOL
329   (WINAPI *fpEnumForms)(
330     _In_ HANDLE hPrinter,
331     _In_ DWORD Level,
332     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE pForm,
333     _In_ DWORD cbBuf,
334     _Out_ LPDWORD pcbNeeded,
335     _Out_ LPDWORD pcReturned);
336 
337   BOOL
338   (WINAPI *fpEnumMonitors)(
339     _In_opt_ LPWSTR pName,
340     _In_ DWORD Level,
341     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE pMonitors,
342     _In_ DWORD cbBuf,
343     _Out_ LPDWORD pcbNeeded,
344     _Out_ LPDWORD pcReturned);
345 
346   BOOL
347   (WINAPI *fpEnumPorts)(
348     _In_opt_ LPWSTR pName,
349     _In_ DWORD Level,
350     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE pPorts,
351     _In_ DWORD cbBuf,
352     _Out_ LPDWORD pcbNeeded,
353     _Out_ LPDWORD pcReturned);
354 
355   BOOL
356   (WINAPI *fpAddPort)(
357     _In_opt_ LPWSTR pName,
358     _In_ HWND hWnd,
359     _In_ LPWSTR pMonitorName);
360 
361   BOOL
362   (WINAPI *fpConfigurePort)(
363     _In_opt_ LPWSTR pName,
364     _In_ HWND hWnd,
365     _In_ LPWSTR pPortName);
366 
367   BOOL
368   (WINAPI *fpDeletePort)(
369     _In_opt_ LPWSTR pName,
370     _In_ HWND hWnd,
371     _In_ LPWSTR pPortName);
372 
373   HANDLE
374   (WINAPI *fpCreatePrinterIC)(
375     _In_ HANDLE hPrinter,
376     _In_opt_ LPDEVMODEW pDevMode);
377 
378   BOOL
379   (WINAPI *fpPlayGdiScriptOnPrinterIC)(
380     _In_ HANDLE hPrinterIC,
381     _In_reads_bytes_(cIn) LPBYTE pIn,
382     _In_ DWORD cIn,
383     _Out_writes_bytes_(cOut) LPBYTE pOut,
384     _In_ DWORD cOut,
385     _In_ DWORD ul);
386 
387   BOOL (WINAPI *fpDeletePrinterIC)(_In_ HANDLE hPrinterIC);
388 
389   BOOL (WINAPI *fpAddPrinterConnection)(_In_ LPWSTR pName);
390 
391   BOOL (WINAPI *fpDeletePrinterConnection)(_In_ LPWSTR pName);
392 
393   DWORD
394   (WINAPI *fpPrinterMessageBox)(
395     _In_ HANDLE hPrinter,
396     _In_ DWORD Error,
397     _In_ HWND hWnd,
398     _In_ LPWSTR pText,
399     _In_ LPWSTR pCaption,
400     _In_ DWORD dwType);
401 
402   BOOL
403   (WINAPI *fpAddMonitor)(
404     _In_opt_ LPWSTR pName,
405     _In_ DWORD Level,
406     _In_reads_(_Inexpressible_(0)) LPBYTE pMonitors);
407 
408   BOOL
409   (WINAPI *fpDeleteMonitor)(
410     _In_ LPWSTR pName,
411     _In_opt_ LPWSTR pEnvironment,
412     _In_ LPWSTR pMonitorName);
413 
414   BOOL
415   (WINAPI *fpResetPrinter)(
416     _In_ HANDLE hPrinter,
417     _In_ LPPRINTER_DEFAULTSW pDefault);
418 
419   BOOL
420   (WINAPI *fpGetPrinterDriverEx)(
421     _In_ HANDLE hPrinter,
422     _In_opt_ LPWSTR pEnvironment,
423     _In_ DWORD Level,
424     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE pDriverInfo,
425     _In_ DWORD cbBuf,
426     _Out_ LPDWORD pcbNeeded,
427     _In_ DWORD dwClientMajorVersion,
428     _In_ DWORD dwClientMinorVersion,
429     _Out_ PDWORD pdwServerMajorVersion,
430     _Out_ PDWORD pdwServerMinorVersion);
431 
432   HANDLE (WINAPI *fpFindFirstPrinterChangeNotification)(HANDLE hPrinter,
433                                                         DWORD fdwFlags,
434                                                         DWORD fdwOptions,
435                                                         LPVOID pPrinterNotifyOptions);
436 
437   BOOL (WINAPI *fpFindClosePrinterChangeNotification)(_In_ HANDLE hChange);
438 
439   BOOL
440   (WINAPI *fpAddPortEx)(
441     _In_opt_ LPWSTR pName,
442     _In_ DWORD Level,
443     _In_reads_(_Inexpressible_(0)) LPBYTE lpBuffer,
444     _In_ LPWSTR lpMonitorName);
445 
446   BOOL (WINAPI *fpShutDown)(_In_opt_ LPVOID pvReserved);
447 
448   BOOL
449   (WINAPI *fpRefreshPrinterChangeNotification)(
450     _In_ HANDLE hPrinter,
451     _In_ DWORD Reserved,
452     _In_opt_ PVOID pvReserved,
453     _In_ PVOID pPrinterNotifyInfo);
454 
455   BOOL
456   (WINAPI *fpOpenPrinterEx)(
457     _In_opt_ LPWSTR pPrinterName,
458     _Out_ LPHANDLE phPrinter,
459     _In_opt_ LPPRINTER_DEFAULTSW pDefault,
460     _In_reads_opt_(_Inexpressible_(0)) LPBYTE pClientInfo,
461     _In_ DWORD Level);
462 
463   HANDLE
464   (WINAPI *fpAddPrinterEx)(
465     _In_opt_ LPWSTR pName,
466     _In_ DWORD Level,
467     _In_reads_(_Inexpressible_(0)) LPBYTE pPrinter,
468     _In_reads_opt_(_Inexpressible_(0)) LPBYTE pClientInfo,
469     _In_ DWORD ClientInfoLevel);
470 
471   BOOL
472   (WINAPI *fpSetPort)(
473     _In_opt_ LPWSTR pName,
474     _In_ LPWSTR pPortName,
475     _In_ DWORD dwLevel,
476     _In_reads_(_Inexpressible_(0)) LPBYTE pPortInfo);
477 
478   DWORD
479   (WINAPI *fpEnumPrinterData)(
480     _In_ HANDLE hPrinter,
481     _In_ DWORD dwIndex,
482     _Out_writes_bytes_to_opt_(cbValueName, *pcbValueName) LPWSTR pValueName,
483     _In_ DWORD cbValueName,
484     _Out_ LPDWORD pcbValueName,
485     _Out_opt_ LPDWORD pType,
486     _Out_writes_bytes_to_opt_(cbData, *pcbData) LPBYTE pData,
487     _In_ DWORD cbData,
488     _Out_ LPDWORD pcbData);
489 
490   DWORD
491   (WINAPI *fpDeletePrinterData)(
492     _In_ HANDLE hPrinter,
493     _In_ LPWSTR pValueName);
494 
495   DWORD
496   (WINAPI *fpClusterSplOpen)(
497     _In_ LPCWSTR pszServer,
498     _In_ LPCWSTR pszResource,
499     _Out_ PHANDLE phSpooler,
500     _In_ LPCWSTR pszName,
501     _In_ LPCWSTR pszAddress);
502 
503   DWORD (WINAPI *fpClusterSplClose)(_In_ HANDLE hSpooler);
504 
505   DWORD (WINAPI *fpClusterSplIsAlive)(_In_ HANDLE hSpooler);
506 
507   DWORD
508   (WINAPI *fpSetPrinterDataEx)(
509     _In_ HANDLE hPrinter,
510     _In_ LPCWSTR pKeyName,
511     _In_ LPCWSTR pValueName,
512     _In_ DWORD Type,
513     _In_reads_bytes_(cbData) LPBYTE pData,
514     _In_ DWORD cbData);
515 
516   DWORD
517   (WINAPI *fpGetPrinterDataEx)(
518     _In_ HANDLE hPrinter,
519     _In_ LPCWSTR pKeyName,
520     _In_ LPCWSTR pValueName,
521     _Out_opt_ LPDWORD pType,
522     _Out_writes_bytes_to_opt_(nSize, *pcbNeeded) LPBYTE pData,
523     _In_ DWORD nSize,
524     _Out_ LPDWORD pcbNeeded);
525 
526   DWORD
527   (WINAPI *fpEnumPrinterDataEx)(
528     _In_ HANDLE hPrinter,
529     _In_ LPCWSTR pKeyName,
530     _Out_writes_bytes_to_opt_(cbEnumValues, *pcbEnumValues) LPBYTE pEnumValues,
531     _In_ DWORD cbEnumValues,
532     _Out_ LPDWORD pcbEnumValues,
533     _Out_ LPDWORD pnEnumValues);
534 
535   DWORD
536   (WINAPI *fpEnumPrinterKey)(
537     _In_ HANDLE hPrinter,
538     _In_ LPCWSTR pKeyName,
539     _Out_writes_bytes_to_opt_(cbSubkey, *pcbSubkey) LPWSTR pSubkey,
540     _In_ DWORD cbSubkey,
541     _Out_ LPDWORD pcbSubkey);
542 
543   DWORD
544   (WINAPI *fpDeletePrinterDataEx)(
545     _In_ HANDLE hPrinter,
546     _In_ LPCWSTR pKeyName,
547     _In_ LPCWSTR pValueName);
548 
549   DWORD
550   (WINAPI *fpDeletePrinterKey)(
551     _In_ HANDLE hPrinter,
552     _In_ LPCWSTR pKeyName);
553 
554   BOOL
555   (WINAPI *fpSeekPrinter)(
556     _In_ HANDLE hPrinter,
557     _In_ LARGE_INTEGER liDistanceToMove,
558     _Out_ PLARGE_INTEGER pliNewPointer,
559     _In_ DWORD dwMoveMethod,
560     _In_ BOOL bWrite);
561 
562   BOOL
563   (WINAPI *fpDeletePrinterDriverEx)(
564     _In_opt_ LPWSTR pName,
565     _In_opt_ LPWSTR pEnvironment,
566     _In_ LPWSTR pDriverName,
567     _In_ DWORD dwDeleteFlag,
568     _In_ DWORD dwVersionNum);
569 
570   BOOL
571   (WINAPI *fpAddPerMachineConnection)(
572     _In_opt_ LPCWSTR pServer,
573     _In_ LPCWSTR pPrinterName,
574     _In_ LPCWSTR pPrintServer,
575     _In_ LPCWSTR pProvider);
576 
577   BOOL
578   (WINAPI *fpDeletePerMachineConnection)(
579     _In_opt_ LPCWSTR pServer,
580     _In_ LPCWSTR pPrinterName);
581 
582   BOOL
583   (WINAPI *fpEnumPerMachineConnections)(
584     _In_opt_ LPCWSTR pServer,
585     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE pPrinterEnum,
586     _In_ DWORD cbBuf,
587     _Out_ LPDWORD pcbNeeded,
588     _Out_ LPDWORD pcReturned);
589 
590   BOOL
591   (WINAPI *fpXcvData)(
592     _In_ HANDLE hXcv,
593     _In_ LPCWSTR pszDataName,
594     _In_reads_bytes_(cbInputData) PBYTE pInputData,
595     _In_ DWORD cbInputData,
596     _Out_writes_bytes_to_opt_(cbOutputData, *pcbOutputNeeded) PBYTE pOutputData,
597     _In_ DWORD cbOutputData,
598     _Out_ PDWORD pcbOutputNeeded,
599     _Out_ PDWORD pdwStatus);
600 
601   BOOL
602   (WINAPI *fpAddPrinterDriverEx)(
603     _In_opt_ LPWSTR pName,
604     _In_ DWORD Level,
605     _In_reads_(_Inexpressible_(0)) LPBYTE pDriverInfo,
606     _In_ DWORD dwFileCopyFlags);
607 
608   BOOL
609   (WINAPI *fpSplReadPrinter)(
610     _In_ HANDLE hPrinter,
611     _Out_writes_bytes_(cbBuf) LPBYTE *pBuf,
612     _In_ DWORD cbBuf);
613 
614   BOOL (WINAPI *fpDriverUnloadComplete)(_In_ LPWSTR pDriverFile);
615 
616   BOOL
617   (WINAPI *fpGetSpoolFileInfo)(
618     _In_ HANDLE hPrinter,
619     _Outptr_result_maybenull_ LPWSTR *pSpoolDir,
620     _Out_ LPHANDLE phFile,
621     _In_ HANDLE hSpoolerProcess,
622     _In_ HANDLE hAppProcess);
623 
624   BOOL (WINAPI *fpCommitSpoolData)(_In_ HANDLE hPrinter, _In_ DWORD cbCommit);
625 
626   BOOL (WINAPI *fpCloseSpoolFileHandle)(_In_ HANDLE hPrinter);
627 
628   BOOL
629   (WINAPI *fpFlushPrinter)(
630     _In_ HANDLE hPrinter,
631     _In_reads_bytes_(cbBuf) LPBYTE pBuf,
632     _In_ DWORD cbBuf,
633     _Out_ LPDWORD pcWritten,
634     _In_ DWORD cSleep);
635 
636   DWORD
637   (WINAPI *fpSendRecvBidiData)(
638     _In_ HANDLE hPort,
639     _In_ LPCWSTR pAction,
640     _In_ LPBIDI_REQUEST_CONTAINER pReqData,
641     _Outptr_ LPBIDI_RESPONSE_CONTAINER *ppResData);
642 
643   BOOL (WINAPI *fpAddDriverCatalog)(HANDLE hPrinter, DWORD dwLevel,
644                                     VOID *pvDriverInfCatInfo, DWORD dwCatalogCopyFlags);
645 } PRINTPROVIDOR, *LPPRINTPROVIDOR;
646 
647 typedef struct _PRINTPROCESSOROPENDATA {
648   PDEVMODEW pDevMode;
649   LPWSTR pDatatype;
650   LPWSTR pParameters;
651   LPWSTR pDocumentName;
652   DWORD JobId;
653   LPWSTR pOutputFile;
654   LPWSTR pPrinterName;
655 } PRINTPROCESSOROPENDATA, *LPPRINTPROCESSOROPENDATA, *PPRINTPROCESSOROPENDATA;
656 
657 typedef struct _MONITORREG {
658   DWORD cbSize;
659 
660   LONG
661   (WINAPI *fpCreateKey)(
662     _In_ HANDLE hcKey,
663     _In_ LPCWSTR pszSubKey,
664     _In_ DWORD dwOptions,
665     _In_ REGSAM samDesired,
666     _In_opt_ PSECURITY_ATTRIBUTES pSecurityAttributes,
667     _Out_ PHANDLE phckResult,
668     _Out_opt_ PDWORD pdwDisposition,
669     _In_ HANDLE hSpooler);
670 
671   LONG
672   (WINAPI *fpOpenKey)(
673     _In_ HANDLE hcKey,
674     _In_ LPCWSTR pszSubKey,
675     _In_ REGSAM samDesired,
676     _Out_ PHANDLE phkResult,
677     _In_ HANDLE hSpooler);
678 
679   LONG (WINAPI *fpCloseKey)(_In_ HANDLE hcKey, _In_ HANDLE hSpooler);
680 
681   LONG
682   (WINAPI *fpDeleteKey)(
683     _In_ HANDLE hcKey,
684     _In_ LPCWSTR pszSubKey,
685     _In_ HANDLE hSpooler);
686 
687   LONG
688   (WINAPI *fpEnumKey)(
689     _In_ HANDLE hcKey,
690     _In_ DWORD dwIndex,
691     _Inout_updates_to_(*pcchName, *pcchName) LPWSTR pszName,
692     _Inout_ PDWORD pcchName,
693     _Out_opt_ PFILETIME pftLastWriteTime,
694     _In_ HANDLE hSpooler);
695 
696   LONG
697   (WINAPI *fpQueryInfoKey)(
698     _In_ HANDLE hcKey,
699     _Out_opt_ PDWORD pcSubKeys,
700     _Out_opt_ PDWORD pcbKey,
701     _Out_opt_ PDWORD pcValues,
702     _Out_opt_ PDWORD pcbValue,
703     _Out_opt_ PDWORD pcbData,
704     _Out_opt_ PDWORD pcbSecurityDescriptor,
705     _Out_opt_ PFILETIME pftLastWriteTime,
706     _In_ HANDLE hSpooler);
707 
708   LONG
709   (WINAPI *fpSetValue)(
710     _In_ HANDLE hcKey,
711     _In_ LPCWSTR pszValue,
712     _In_ DWORD dwType,
713     _In_reads_bytes_(cbData) const BYTE *pData,
714     _In_ DWORD cbData,
715     _In_ HANDLE hSpooler);
716 
717   LONG
718   (WINAPI *fpDeleteValue)(
719     _In_ HANDLE hcKey,
720     _In_ LPCWSTR pszValue,
721     _In_ HANDLE hSpooler);
722 
723   LONG
724   (WINAPI *fpEnumValue)(
725     _In_ HANDLE hcKey,
726     _In_ DWORD dwIndex,
727     _Inout_updates_to_(*pcbValue, *pcbValue) LPWSTR pszValue,
728     _Inout_ PDWORD pcbValue,
729     _Out_opt_ PDWORD pType,
730     _Out_writes_bytes_to_opt_(*pcbData, *pcbData) PBYTE pData,
731     _Inout_ PDWORD pcbData,
732     _In_ HANDLE hSpooler);
733 
734   LONG
735   (WINAPI *fpQueryValue)(
736     _In_ HANDLE hcKey,
737     _In_ LPCWSTR pszValue,
738     _Out_opt_ PDWORD pType,
739     _Out_writes_bytes_to_opt_(*pcbData, *pcbData) PBYTE pData,
740     _Inout_ PDWORD pcbData,
741     _In_ HANDLE hSpooler);
742 
743 } MONITORREG, *PMONITORREG;
744 
745 typedef struct _MONITORINIT {
746   DWORD cbSize;
747   HANDLE hSpooler;
748   HKEYMONITOR hckRegistryRoot;
749   PMONITORREG pMonitorReg;
750   BOOL bLocal;
751   LPCWSTR pszServerName;
752 } MONITORINIT, *PMONITORINIT;
753 
754 typedef struct _MONITOR {
755 
756   BOOL
757   (WINAPI *pfnEnumPorts)(
758     _In_opt_ LPWSTR pName,
759     _In_ DWORD Level,
760     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE pPorts,
761     _In_ DWORD cbBuf,
762     _Out_ LPDWORD pcbNeeded,
763     _Out_ LPDWORD pcReturned);
764 
765   BOOL (WINAPI *pfnOpenPort)(_In_ LPWSTR pName, _Out_ PHANDLE pHandle);
766 
767   BOOL
768   (WINAPI *pfnOpenPortEx)(
769     _In_ LPWSTR pPortName,
770     _In_ LPWSTR pPrinterName,
771     _Out_ PHANDLE pHandle,
772     _In_ struct _MONITOR *pMonitor);
773 
774   BOOL
775   (WINAPI *pfnStartDocPort)(
776     _In_ HANDLE hPort,
777     _In_ LPWSTR pPrinterName,
778     _In_ DWORD JobId,
779     _In_ DWORD Level,
780     _In_reads_(_Inexpressible_(0)) LPBYTE pDocInfo);
781 
782   BOOL
783   (WINAPI *pfnWritePort)(
784     _In_ HANDLE hPort,
785     _In_reads_bytes_(cbBuf) LPBYTE pBuffer,
786     _In_ DWORD cbBuf,
787     _Out_ LPDWORD pcbWritten);
788 
789   BOOL
790   (WINAPI *pfnReadPort)(
791     _In_ HANDLE hPort,
792     _Out_writes_bytes_to_(cbBuffer, *pcbRead) LPBYTE pBuffer,
793     _In_ DWORD cbBuffer,
794     _Out_ LPDWORD pcbRead);
795 
796   BOOL (WINAPI *pfnEndDocPort)(_In_ HANDLE hPort);
797 
798   BOOL (WINAPI *pfnClosePort)(_In_ HANDLE hPort);
799 
800   BOOL
801   (WINAPI *pfnAddPort)(
802     _In_ LPWSTR pName,
803     _In_ HWND hWnd,
804     _In_ LPWSTR pMonitorName);
805 
806   BOOL
807   (WINAPI *pfnAddPortEx)(
808     _In_ LPWSTR pName,
809     _In_ DWORD Level,
810     _In_reads_(_Inexpressible_(0)) LPBYTE lpBuffer,
811     _In_ LPWSTR lpMonitorName);
812 
813   BOOL
814   (WINAPI *pfnConfigurePort)(
815     _In_ LPWSTR pName,
816     _In_ HWND hWnd,
817     _In_ LPWSTR pPortName);
818 
819   BOOL
820   (WINAPI *pfnDeletePort)(
821     _In_ LPWSTR pName,
822     _In_ HWND hWnd,
823     _In_ LPWSTR pPortName);
824 
825   BOOL
826   (WINAPI *pfnGetPrinterDataFromPort)(
827     _In_ HANDLE hPort,
828     _In_ DWORD ControlID,
829     _In_ LPWSTR pValueName,
830     _In_reads_bytes_(cbInBuffer) LPWSTR lpInBuffer,
831     _In_ DWORD cbInBuffer,
832     _Out_writes_bytes_to_opt_(cbOutBuffer, *lpcbReturned) LPWSTR lpOutBuffer,
833     _In_ DWORD cbOutBuffer,
834     _Out_ LPDWORD lpcbReturned);
835 
836   BOOL
837   (WINAPI *pfnSetPortTimeOuts)(
838     _In_ HANDLE hPort,
839     _In_ LPCOMMTIMEOUTS lpCTO,
840     _In_ DWORD reserved);
841 
842   BOOL
843   (WINAPI *pfnXcvOpenPort)(
844     _In_ LPCWSTR pszObject,
845     _In_ ACCESS_MASK GrantedAccess,
846     _Out_ PHANDLE phXcv);
847 
848   DWORD
849   (WINAPI *pfnXcvDataPort)(
850     _In_ HANDLE hXcv,
851     _In_ LPCWSTR pszDataName,
852     _In_reads_bytes_(cbInputData) PBYTE pInputData,
853     _In_ DWORD cbInputData,
854     _Out_writes_bytes_to_opt_(cbOutputData, *pcbOutputNeeded) PBYTE pOutputData,
855     _In_ DWORD cbOutputData,
856     _Out_ PDWORD pcbOutputNeeded);
857 
858   BOOL (WINAPI *pfnXcvClosePort)(_In_ HANDLE hXcv);
859 
860 } MONITOR, *LPMONITOR;
861 
862 typedef struct _MONITOREX {
863   DWORD dwMonitorSize;
864   MONITOR Monitor;
865 } MONITOREX, *LPMONITOREX;
866 
867 typedef struct _MONITOR2 {
868   DWORD cbSize;
869 
870   BOOL
871   (WINAPI *pfnEnumPorts)(
872     _In_ HANDLE hMonitor,
873     _In_opt_ LPWSTR pName,
874     _In_ DWORD Level,
875     _Out_writes_bytes_to_opt_(cbBuf, *pcbNeeded) LPBYTE pPorts,
876     _In_ DWORD cbBuf,
877     _Out_ LPDWORD pcbNeeded,
878     _Out_ LPDWORD pcReturned);
879 
880   BOOL
881   (WINAPI *pfnOpenPort)(
882     _In_ HANDLE hMonitor,
883     _In_ LPWSTR pName,
884     _Out_ PHANDLE pHandle);
885 
886   BOOL
887   (WINAPI *pfnOpenPortEx)(
888     _In_ HANDLE hMonitor,
889     _In_ HANDLE hMonitorPort,
890     _In_ LPWSTR pPortName,
891     _In_ LPWSTR pPrinterName,
892     _Out_ PHANDLE pHandle,
893     _In_ struct _MONITOR2 *pMonitor2);
894 
895   BOOL
896   (WINAPI *pfnStartDocPort)(
897     _In_ HANDLE hPort,
898     _In_ LPWSTR pPrinterName,
899     _In_ DWORD JobId,
900     _In_ DWORD Level,
901     _In_reads_(_Inexpressible_(0)) LPBYTE pDocInfo);
902 
903   BOOL
904   (WINAPI *pfnWritePort)(
905     _In_ HANDLE hPort,
906     _In_reads_bytes_(cbBuf) LPBYTE pBuffer,
907     _In_ DWORD cbBuf,
908     _Out_ LPDWORD pcbWritten);
909 
910   BOOL
911   (WINAPI *pfnReadPort)(
912     _In_ HANDLE hPort,
913     _Out_writes_bytes_to_opt_(cbBuffer, *pcbRead) LPBYTE pBuffer,
914     _In_ DWORD cbBuffer,
915     _Out_ LPDWORD pcbRead);
916 
917   BOOL (WINAPI *pfnEndDocPort)(_In_ HANDLE hPort);
918 
919   BOOL (WINAPI *pfnClosePort)(_In_ HANDLE hPort);
920 
921   BOOL
922   (WINAPI *pfnAddPort)(
923     _In_ HANDLE hMonitor,
924     _In_ LPWSTR pName,
925     _In_ HWND hWnd,
926     _In_ LPWSTR pMonitorName);
927 
928   BOOL
929   (WINAPI *pfnAddPortEx)(
930     _In_ HANDLE hMonitor,
931     _In_ LPWSTR pName,
932     _In_ DWORD Level,
933     _In_reads_(_Inexpressible_(0)) LPBYTE lpBuffer,
934     _In_ LPWSTR lpMonitorName);
935 
936   BOOL
937   (WINAPI *pfnConfigurePort)(
938     _In_ HANDLE hMonitor,
939     _In_ LPWSTR pName,
940     _In_ HWND hWnd,
941     _In_ LPWSTR pPortName);
942 
943   BOOL
944   (WINAPI *pfnDeletePort)(
945     _In_ HANDLE hMonitor,
946     _In_ LPWSTR pName,
947     _In_ HWND hWnd,
948     _In_ LPWSTR pPortName);
949 
950   BOOL
951   (WINAPI *pfnGetPrinterDataFromPort)(
952     _In_ HANDLE hPort,
953     _In_ DWORD ControlID,
954     _In_ LPWSTR pValueName,
955     _In_reads_bytes_(cbInBuffer) LPWSTR lpInBuffer,
956     _In_ DWORD cbInBuffer,
957     _Out_writes_bytes_to_opt_(cbOutBuffer, *lpcbReturned) LPWSTR lpOutBuffer,
958     _In_ DWORD cbOutBuffer,
959     _Out_ LPDWORD lpcbReturned);
960 
961   BOOL
962   (WINAPI *pfnSetPortTimeOuts)(
963     _In_ HANDLE hPort,
964     _In_ LPCOMMTIMEOUTS lpCTO,
965     _In_ DWORD reserved);
966 
967   BOOL
968   (WINAPI *pfnXcvOpenPort)(
969     _In_ HANDLE hMonitor,
970     _In_ LPCWSTR pszObject,
971     _In_ ACCESS_MASK GrantedAccess,
972     _Out_ PHANDLE phXcv);
973 
974   DWORD
975   (WINAPI *pfnXcvDataPort)(
976     _In_ HANDLE hXcv,
977     _In_ LPCWSTR pszDataName,
978     _In_reads_bytes_(cbInputData) PBYTE pInputData,
979     _In_ DWORD cbInputData,
980     _Out_writes_bytes_to_opt_(cbOutputData, *pcbOutputNeeded) PBYTE pOutputData,
981     _In_ DWORD cbOutputData,
982     _Out_ PDWORD pcbOutputNeeded);
983 
984   BOOL (WINAPI *pfnXcvClosePort)(_In_ HANDLE hXcv);
985 
986   VOID (WINAPI *pfnShutdown)(_In_ HANDLE hMonitor);
987 
988 #if (NTDDI_VERSION >= NTDDI_WINXP)
989   DWORD
990   (WINAPI *pfnSendRecvBidiDataFromPort)(
991     _In_ HANDLE hPort,
992     _In_ DWORD dwAccessBit,
993     _In_ LPCWSTR pAction,
994     _In_ PBIDI_REQUEST_CONTAINER pReqData,
995     _Outptr_ PBIDI_RESPONSE_CONTAINER *ppResData);
996 #endif
997 
998 #if (NTDDI_VERSION >= NTDDI_WIN7)
999 
1000   DWORD
1001   (WINAPI *pfnNotifyUsedPorts)(
1002     _In_ HANDLE hMonitor,
1003     _In_ DWORD cPorts,
1004     _In_reads_(cPorts) PCWSTR *ppszPorts);
1005 
1006   DWORD
1007   (WINAPI *pfnNotifyUnusedPorts)(
1008     _In_ HANDLE hMonitor,
1009     _In_ DWORD cPorts,
1010     _In_reads_(cPorts) PCWSTR *ppszPorts);
1011 
1012 #endif
1013 
1014 } MONITOR2, *LPMONITOR2, *PMONITOR2;
1015 
1016 typedef struct _MONITORUI {
1017   DWORD dwMonitorUISize;
1018 
1019   BOOL
1020   (WINAPI *pfnAddPortUI)(
1021     _At_(return, _Success_(return != 0)) _In_opt_ PCWSTR pszServer,
1022     _In_ HWND hWnd,
1023     _In_ PCWSTR pszPortNameIn,
1024     _Out_opt_ PWSTR *ppszPortNameOut);
1025 
1026   BOOL
1027   (WINAPI *pfnConfigurePortUI)(
1028     _In_opt_ PCWSTR pName,
1029     _In_ HWND hWnd,
1030     _In_ PCWSTR pPortName);
1031 
1032   BOOL
1033   (WINAPI *pfnDeletePortUI)(
1034     _In_opt_ PCWSTR pszServer,
1035     _In_ HWND hWnd,
1036     _In_ PCWSTR pszPortName);
1037 
1038 } MONITORUI, *PMONITORUI;
1039 
1040 #if (NTDDI_VERSION >= NTDDI_WINXP)
1041 
1042 typedef enum {
1043   kMessageBox = 0
1044 } UI_TYPE;
1045 
1046 typedef struct {
1047   DWORD cbSize;
1048   LPWSTR pTitle;
1049   LPWSTR pMessage;
1050   DWORD Style;
1051   DWORD dwTimeout;
1052   BOOL bWait;
1053 } MESSAGEBOX_PARAMS, *PMESSAGEBOX_PARAMS;
1054 
1055 typedef struct {
1056   UI_TYPE UIType;
1057   MESSAGEBOX_PARAMS MessageBoxParams;
1058 } SHOWUIPARAMS, *PSHOWUIPARAMS;
1059 
1060 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
1061 
1062 #if (NTDDI_VERSION >= NTDDI_WS03)
1063 #ifndef __ATTRIBUTE_INFO_3__
1064 #define __ATTRIBUTE_INFO_3__
1065 typedef struct _ATTRIBUTE_INFO_3 {
1066   DWORD dwJobNumberOfPagesPerSide;
1067   DWORD dwDrvNumberOfPagesPerSide;
1068   DWORD dwNupBorderFlags;
1069   DWORD dwJobPageOrderFlags;
1070   DWORD dwDrvPageOrderFlags;
1071   DWORD dwJobNumberOfCopies;
1072   DWORD dwDrvNumberOfCopies;
1073   DWORD dwColorOptimization;
1074   short dmPrintQuality;
1075   short dmYResolution;
1076 } ATTRIBUTE_INFO_3, *PATTRIBUTE_INFO_3;
1077 #endif /* __ATTRIBUTE_INFO_3__ */
1078 #endif /* (NTDDI_VERSION >= NTDDI_WS03) */
1079 
1080 #if (NTDDI_VERSION >= NTDDI_VISTA)
1081 
1082 typedef BOOL
1083 (CALLBACK *ROUTER_NOTIFY_CALLBACK)(
1084   _In_ DWORD dwCommand,
1085   _In_ PVOID pContext,
1086   _In_ DWORD dwColor,
1087   _In_ PPRINTER_NOTIFY_INFO pNofityInfo,
1088   _In_ DWORD fdwFlags,
1089   _Out_ PDWORD pdwResult);
1090 
1091 typedef enum _NOTIFICATION_CALLBACK_COMMANDS {
1092   NOTIFICATION_COMMAND_NOTIFY,
1093   NOTIFICATION_COMMAND_CONTEXT_ACQUIRE,
1094   NOTIFICATION_COMMAND_CONTEXT_RELEASE
1095 } NOTIFICATION_CALLBACK_COMMANDS;
1096 
1097 typedef struct _NOTIFICATION_CONFIG_1 {
1098   UINT cbSize;
1099   DWORD fdwFlags;
1100   ROUTER_NOTIFY_CALLBACK pfnNotifyCallback;
1101   PVOID pContext;
1102 } NOTIFICATION_CONFIG_1, *PNOTIFICATION_CONFIG_1;
1103 
1104 typedef enum _NOTIFICATION_CONFIG_FLAGS {
1105   NOTIFICATION_CONFIG_CREATE_EVENT = 1 << 0,
1106   NOTIFICATION_CONFIG_REGISTER_CALLBACK = 1 << 1,
1107   NOTIFICATION_CONFIG_EVENT_TRIGGER = 1 << 2,
1108   NOTIFICATION_CONFIG_ASYNC_CHANNEL = 1 << 3
1109 } NOTIFICATION_CONFIG_FLAGS;
1110 
1111 typedef struct _SPLCLIENT_INFO_3 {
1112   UINT cbSize;
1113   DWORD dwFlags;
1114   DWORD dwSize;
1115   PWSTR pMachineName;
1116   PWSTR pUserName;
1117   DWORD dwBuildNum;
1118   DWORD dwMajorVersion;
1119   DWORD dwMinorVersion;
1120   WORD wProcessorArchitecture;
1121   UINT64 hSplPrinter;
1122 } SPLCLIENT_INFO_3, *PSPLCLIENT_INFO_3, *LPSPLCLIENT_INFO_3;
1123 
1124 #ifndef __ATTRIBUTE_INFO_4__
1125 #define __ATTRIBUTE_INFO_4__
1126 
1127 typedef struct _ATTRIBUTE_INFO_4 {
1128   DWORD dwJobNumberOfPagesPerSide;
1129   DWORD dwDrvNumberOfPagesPerSide;
1130   DWORD dwNupBorderFlags;
1131   DWORD dwJobPageOrderFlags;
1132   DWORD dwDrvPageOrderFlags;
1133   DWORD dwJobNumberOfCopies;
1134   DWORD dwDrvNumberOfCopies;
1135   DWORD dwColorOptimization;
1136   short dmPrintQuality;
1137   short dmYResolution;
1138   DWORD dwDuplexFlags;
1139   DWORD dwNupDirection;
1140   DWORD dwBookletFlags;
1141   DWORD dwScalingPercentX;
1142   DWORD dwScalingPercentY;
1143 } ATTRIBUTE_INFO_4, *PATTRIBUTE_INFO_4;
1144 
1145 #define REVERSE_PAGES_FOR_REVERSE_DUPLEX (0x00000001)
1146 #define DONT_SEND_EXTRA_PAGES_FOR_DUPLEX (0x00000001 << 1)
1147 
1148 #define RIGHT_THEN_DOWN                  (0x00000001)
1149 #define DOWN_THEN_RIGHT                  (0x00000001 << 1)
1150 #define LEFT_THEN_DOWN                   (0x00000001 << 2)
1151 #define DOWN_THEN_LEFT                   (0x00000001 << 3)
1152 
1153 #define BOOKLET_EDGE_LEFT                0x00000000
1154 #define BOOKLET_EDGE_RIGHT               0x00000001
1155 
1156 #endif /* __ATTRIBUTE_INFO_4__ */
1157 
1158 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
1159 
1160 #if (OSVER(NTDDI_VERSION) == NTDDI_W2K)
1161 typedef SPLCLIENT_INFO_2_W2K SPLCLIENT_INFO_2, *PSPLCLIENT_INFO_2, *LPSPLCLIENT_INFO_2;
1162 #elif ((OSVER(NTDDI_VERSION) == NTDDI_WINXP) || (OSVER(NTDDI_VERSION) == NTDDI_WS03))
1163 typedef SPLCLIENT_INFO_2_WINXP SPLCLIENT_INFO_2, *PSPLCLIENT_INFO_2, *LPSPLCLIENT_INFO_2;
1164 #else
1165 typedef SPLCLIENT_INFO_2_LONGHORN SPLCLIENT_INFO_2, *PSPLCLIENT_INFO_2, *LPSPLCLIENT_INFO_2;
1166 #endif /* (OSVER(NTDDI_VERSION) == NTDDI_W2K) */
1167 
1168 BOOL
1169 WINAPI
1170 InitializePrintProvidor(
1171   _Out_writes_bytes_(cbPrintProvidor) LPPRINTPROVIDOR pPrintProvidor,
1172   _In_ DWORD cbPrintProvidor,
1173   _In_opt_ LPWSTR pFullRegistryPath);
1174 
1175 HANDLE
1176 WINAPI
1177 OpenPrintProcessor(
1178   _In_ LPWSTR pPrinterName,
1179   _In_ PPRINTPROCESSOROPENDATA pPrintProcessorOpenData);
1180 
1181 BOOL
1182 WINAPI
1183 PrintDocumentOnPrintProcessor(
1184   _In_ HANDLE hPrintProcessor,
1185   _In_ LPWSTR pDocumentName);
1186 
1187 BOOL
1188 WINAPI
1189 ClosePrintProcessor(
1190   _Inout_ HANDLE hPrintProcessor);
1191 
1192 BOOL
1193 WINAPI
1194 ControlPrintProcessor(
1195   _In_ HANDLE hPrintProcessor,
1196   _In_ DWORD Command);
1197 
1198 DWORD
1199 WINAPI
1200 GetPrintProcessorCapabilities(
1201   _In_ LPTSTR pValueName,
1202   _In_ DWORD dwAttributes,
1203   _Out_writes_bytes_(nSize) LPBYTE pData,
1204   _In_ DWORD nSize,
1205   _Out_ LPDWORD pcbNeeded);
1206 
1207 BOOL
1208 WINAPI
1209 InitializeMonitor(
1210   _In_ LPWSTR pRegistryRoot);
1211 
1212 BOOL
1213 WINAPI
1214 OpenPort(
1215   _In_ LPWSTR pName,
1216   _Out_ PHANDLE pHandle);
1217 
1218 BOOL
1219 WINAPI
1220 WritePort(
1221   _In_ HANDLE hPort,
1222   _In_reads_bytes_(cbBuf) LPBYTE pBuffer,
1223   _In_ DWORD cbBuf,
1224   _Out_ LPDWORD pcbWritten);
1225 
1226 BOOL
1227 WINAPI
1228 ReadPort(
1229   _In_ HANDLE hPort,
1230   _Out_writes_bytes_(cbBuffer) LPBYTE pBuffer,
1231   _In_ DWORD cbBuffer,
1232   _Out_ LPDWORD pcbRead);
1233 
1234 BOOL
1235 WINAPI
1236 ClosePort(
1237   _In_ HANDLE hPort);
1238 
1239 BOOL
1240 WINAPI
1241 XcvOpenPort(
1242   _In_ LPCWSTR pszObject,
1243   _In_ ACCESS_MASK GrantedAccess,
1244   _Out_ PHANDLE phXcv);
1245 
1246 DWORD
1247 WINAPI
1248 XcvDataPort(
1249   _In_ HANDLE hXcv,
1250   _In_ LPCWSTR pszDataName,
1251   _In_reads_bytes_(cbInputData) PBYTE pInputData,
1252   _In_ DWORD cbInputData,
1253   _Out_writes_bytes_(cbOutputData) PBYTE pOutputData,
1254   _In_ DWORD cbOutputData,
1255   _Out_ PDWORD pcbOutputNeeded);
1256 
1257 BOOL
1258 WINAPI
1259 XcvClosePort(
1260   _In_ HANDLE hXcv);
1261 
1262 _Success_(return != 0)
1263 BOOL
1264 WINAPI
1265 AddPortUI(
1266   _In_opt_ PCWSTR pszServer,
1267   _In_ HWND hWnd,
1268   _In_ PCWSTR pszMonitorNameIn,
1269   _Out_opt_ PWSTR *ppszPortNameOut);
1270 
1271 BOOL
1272 WINAPI
1273 ConfigurePortUI(
1274   _In_ PCWSTR pszServer,
1275   _In_ HWND hWnd,
1276   _In_ PCWSTR pszPortName);
1277 
1278 BOOL
1279 WINAPI
1280 DeletePortUI(
1281   _In_ PCWSTR pszServer,
1282   _In_ HWND hWnd,
1283   _In_ PCWSTR pszPortName);
1284 
1285 BOOL
1286 WINAPI
1287 SplDeleteSpoolerPortStart(
1288   _In_ PCWSTR pPortName);
1289 
1290 BOOL
1291 WINAPI
1292 SplDeleteSpoolerPortEnd(
1293   _In_ PCWSTR pName,
1294   _In_ BOOL bDeletePort);
1295 
1296 BOOL
1297 WINAPI
1298 SpoolerCopyFileEvent(
1299   _In_ LPWSTR pszPrinterName,
1300   _In_ LPWSTR pszKey,
1301   _In_ DWORD dwCopyFileEvent);
1302 
1303 DWORD
1304 WINAPI
1305 GenerateCopyFilePaths(
1306   _In_ LPCWSTR pszPrinterName,
1307   _In_ LPCWSTR pszDirectory,
1308   _In_ LPBYTE pSplClientInfo,
1309   _In_ DWORD dwLevel,
1310   _Inout_updates_(*pcchSourceDirSize) LPWSTR pszSourceDir,
1311   _Inout_ LPDWORD pcchSourceDirSize,
1312   _Inout_updates_(*pcchTargetDirSize) LPWSTR pszTargetDir,
1313   _Inout_ LPDWORD pcchTargetDirSize,
1314   _In_ DWORD dwFlags);
1315 
1316 HANDLE
1317 WINAPI
1318 CreatePrinterIC(
1319   _In_ HANDLE hPrinter,
1320   _In_opt_ LPDEVMODEW pDevMode);
1321 
1322 BOOL
1323 WINAPI
1324 PlayGdiScriptOnPrinterIC(
1325   _In_ HANDLE hPrinterIC,
1326   _In_reads_bytes_(cIn) LPBYTE pIn,
1327   _In_ DWORD cIn,
1328   _Out_writes_bytes_(cOut) LPBYTE pOut,
1329   _In_ DWORD cOut,
1330   _In_ DWORD ul);
1331 
1332 BOOL WINAPI DeletePrinterIC(_In_ HANDLE hPrinterIC);
1333 
1334 BOOL
1335 WINAPI
1336 DevQueryPrint(
1337   _In_ HANDLE hPrinter,
1338   _In_ LPDEVMODEW pDevMode,
1339   _Out_ DWORD *pResID);
1340 
1341 HANDLE WINAPI RevertToPrinterSelf(VOID);
1342 BOOL WINAPI ImpersonatePrinterClient(_In_ HANDLE hToken);
1343 
1344 BOOL
1345 WINAPI
1346 ReplyPrinterChangeNotification(
1347   _In_ HANDLE hNotify,
1348   _In_ DWORD fdwFlags,
1349   _Out_opt_ PDWORD pdwResult,
1350   _In_opt_ PVOID pPrinterNotifyInfo);
1351 
1352 BOOL
1353 WINAPI
1354 ReplyPrinterChangeNotificationEx(
1355   _In_ HANDLE hNotify,
1356   _In_ DWORD dwColor,
1357   _In_ DWORD fdwFlags,
1358   _Out_ PDWORD pdwResult,
1359   _In_ PVOID pPrinterNotifyInfo);
1360 
1361 BOOL
1362 WINAPI
1363 PartialReplyPrinterChangeNotification(
1364   _In_ HANDLE hNotify,
1365   _In_opt_ PPRINTER_NOTIFY_INFO_DATA pInfoDataSrc);
1366 
1367 PPRINTER_NOTIFY_INFO
1368 WINAPI
1369 RouterAllocPrinterNotifyInfo(
1370   _In_ DWORD cPrinterNotifyInfoData);
1371 
1372 BOOL WINAPI RouterFreePrinterNotifyInfo(_In_opt_ PPRINTER_NOTIFY_INFO pInfo);
1373 
1374 BOOL
1375 WINAPI
1376 AppendPrinterNotifyInfoData(
1377   _In_ PPRINTER_NOTIFY_INFO pInfoDest,
1378   _In_opt_ PPRINTER_NOTIFY_INFO_DATA pInfoDataSrc,
1379   _In_ DWORD fdwFlags);
1380 
1381 DWORD
1382 WINAPI
1383 CallRouterFindFirstPrinterChangeNotification(
1384   _In_ HANDLE hPrinter,
1385   _In_ DWORD fdwFlags,
1386   _In_ DWORD fdwOptions,
1387   _In_ HANDLE hNotify,
1388   _In_ PPRINTER_NOTIFY_OPTIONS pPrinterNotifyOptions);
1389 
1390 BOOL
1391 WINAPI
1392 ProvidorFindFirstPrinterChangeNotification(
1393   _In_ HANDLE hPrinter,
1394   _In_ DWORD fdwFlags,
1395   _In_ DWORD fdwOptions,
1396   _In_ HANDLE hNotify,
1397   _In_opt_ PVOID pvReserved0,
1398   _Out_opt_ PVOID pvReserved1);
1399 
1400 BOOL WINAPI ProvidorFindClosePrinterChangeNotification(_In_ HANDLE hPrinter);
1401 
1402 /* Spooler */
1403 BOOL WINAPI SpoolerFindFirstPrinterChangeNotification(HANDLE hPrinter,
1404                                                       DWORD fdwFlags,
1405                                                       DWORD fdwOptions,
1406                                                       PHANDLE phEvent,
1407                                                       PVOID pPrinterNotifyOptions,
1408                                                       PVOID pvReserved);
1409 
1410 BOOL
1411 WINAPI
1412 SpoolerFindNextPrinterChangeNotification(
1413   _In_ HANDLE hPrinter,
1414   _Out_ LPDWORD pfdwChange,
1415   _In_opt_ LPVOID pPrinterNotifyOptions,
1416   _Inout_opt_ LPVOID *ppPrinterNotifyInfo);
1417 
1418 VOID WINAPI SpoolerFreePrinterNotifyInfo(_In_ PPRINTER_NOTIFY_INFO pInfo);
1419 BOOL WINAPI SpoolerFindClosePrinterChangeNotification(_In_ HANDLE hPrinter);
1420 
1421 /* Port monitor / Language monitor / Print monitor */
1422 
1423 LPMONITOR2
1424 WINAPI
1425 InitializePrintMonitor2(
1426   _In_ PMONITORINIT pMonitorInit,
1427   _Out_ PHANDLE phMonitor);
1428 
1429 PMONITORUI WINAPI InitializePrintMonitorUI(VOID);
1430 LPMONITOREX WINAPI InitializePrintMonitor(_In_ LPWSTR pRegistryRoot);
1431 
1432 BOOL
1433 WINAPI
1434 InitializeMonitorEx(
1435   _In_ LPWSTR pRegistryRoot,
1436   _Out_ LPMONITOR pMonitor);
1437 
1438 #if (NTDDI_VERSION >= NTDDI_WINXP)
1439 
1440 PBIDI_RESPONSE_CONTAINER
1441 WINAPI
1442 RouterAllocBidiResponseContainer(
1443   _In_ DWORD Count);
1444 
1445 PVOID WINAPI RouterAllocBidiMem(_In_ size_t NumBytes);
1446 
1447 DWORD
1448 WINAPI
1449 RouterFreeBidiResponseContainer(
1450   _In_ PBIDI_RESPONSE_CONTAINER pData);
1451 
1452 VOID WINAPI RouterFreeBidiMem(_In_ PVOID pMemPointer);
1453 
1454 BOOL
1455 WINAPI
1456 SplPromptUIInUsersSession(
1457   _In_ HANDLE hPrinter,
1458   _In_ DWORD JobId,
1459   _In_ PSHOWUIPARAMS pUIParams,
1460   _Out_ DWORD *pResponse);
1461 
1462 DWORD
1463 WINAPI
1464 SplIsSessionZero(
1465   _In_ HANDLE hPrinter,
1466   _In_ DWORD JobId,
1467   _Out_ BOOL *pIsSessionZero);
1468 
1469 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
1470 
1471 #if (NTDDI_VERSION >= NTDDI_WS03)
1472 BOOL
1473 WINAPI
1474 GetJobAttributes(
1475   _In_ LPWSTR pPrinterName,
1476   _In_ LPDEVMODEW pDevmode,
1477   _Out_ PATTRIBUTE_INFO_3 pAttributeInfo);
1478 #endif
1479 
1480 #if (NTDDI_VERSION >= NTDDI_VISTA)
1481 
1482 #define FILL_WITH_DEFAULTS   0x1
1483 
1484 BOOL
1485 WINAPI
1486 GetJobAttributesEx(
1487   _In_ LPWSTR pPrinterName,
1488   _In_ LPDEVMODEW pDevmode,
1489   _In_ DWORD dwLevel,
1490   _Out_writes_bytes_(nSize) LPBYTE pAttributeInfo,
1491   _In_ DWORD nSize,
1492   _In_ DWORD dwFlags);
1493 
1494 BOOL
1495 WINAPI
1496 SpoolerRefreshPrinterChangeNotification(
1497   _In_ HANDLE hPrinter,
1498   _In_ DWORD dwColor,
1499   _In_ PPRINTER_NOTIFY_OPTIONS pOptions,
1500   _Inout_opt_ PPRINTER_NOTIFY_INFO *ppInfo);
1501 
1502 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
1503 
1504 /* FIXME : The following declarations are not present in the official header */
1505 
1506 BOOL WINAPI OpenPrinterToken(PHANDLE phToken);
1507 BOOL WINAPI SetPrinterToken(HANDLE hToken);
1508 BOOL WINAPI ClosePrinterToken(HANDLE hToken);
1509 BOOL WINAPI InstallPrintProcessor(HWND hWnd);
1510 
1511 #ifdef __cplusplus
1512 }
1513 #endif
1514 
1515 #endif /* _WINSPLP_ */
1516