1c2c66affSColin Finck /*
2c2c66affSColin Finck  * PROJECT:     ReactOS Local Spooler
3c2c66affSColin Finck  * LICENSE:     GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4c2c66affSColin Finck  * PURPOSE:     Precompiled Header for all source files
5c2c66affSColin Finck  * COPYRIGHT:   Copyright 2015-2017 Colin Finck (colin@reactos.org)
6c2c66affSColin Finck  */
7c2c66affSColin Finck 
8c2c66affSColin Finck #ifndef _PRECOMP_H
9c2c66affSColin Finck #define _PRECOMP_H
10c2c66affSColin Finck 
11c2c66affSColin Finck #define WIN32_NO_STATUS
12c2c66affSColin Finck #include <limits.h>
13c2c66affSColin Finck #include <stdlib.h>
14c2c66affSColin Finck #include <wchar.h>
15c2c66affSColin Finck 
16c2c66affSColin Finck #include <lmcons.h>
17c2c66affSColin Finck #include <rpc.h>
18c2c66affSColin Finck #include <strsafe.h>
19c2c66affSColin Finck #include <windef.h>
20c2c66affSColin Finck #include <winbase.h>
21c2c66affSColin Finck #include <wingdi.h>
22c2c66affSColin Finck #include <winreg.h>
23c2c66affSColin Finck #include <winspool.h>
24c2c66affSColin Finck #include <winsplp.h>
2562c4b828SJames Tabor #include <winddiui.h>
26c2c66affSColin Finck #include <dsrole.h>
27c2c66affSColin Finck #include <secext.h>
28c2c66affSColin Finck #include <ndk/rtlfuncs.h>
29c2c66affSColin Finck 
30c2c66affSColin Finck #define SKIPLIST_LEVELS 16
31c2c66affSColin Finck #include <skiplist.h>
32c2c66affSColin Finck #include <spoolss.h>
33c2c66affSColin Finck 
34c2c66affSColin Finck #include <wine/debug.h>
35c2c66affSColin Finck WINE_DEFAULT_DEBUG_CHANNEL(localspl);
36c2c66affSColin Finck 
37c2c66affSColin Finck // Macros
38c2c66affSColin Finck #define IS_VALID_JOB_ID(ID)     (ID >= 1 && ID <= 99999)
39c2c66affSColin Finck #define IS_VALID_PRIORITY(P)    (P >= MIN_PRIORITY && P <= MAX_PRIORITY)
40c2c66affSColin Finck 
41c2c66affSColin Finck // Constants
42c2c66affSColin Finck #define SHD_WIN2003_SIGNATURE   0x4968
43c2c66affSColin Finck 
44c2c66affSColin Finck // Function pointers
45c2c66affSColin Finck typedef BOOL (WINAPI *PClosePrintProcessor)(HANDLE);
46c2c66affSColin Finck typedef BOOL (WINAPI *PControlPrintProcessor)(HANDLE, DWORD);
47c2c66affSColin Finck typedef BOOL (WINAPI *PEnumPrintProcessorDatatypesW)(LPWSTR, LPWSTR, DWORD, LPBYTE, DWORD, LPDWORD, LPDWORD);
48c2c66affSColin Finck typedef DWORD (WINAPI *PGetPrintProcessorCapabilities)(LPWSTR, DWORD, LPBYTE, DWORD, LPDWORD);
49c2c66affSColin Finck typedef HANDLE (WINAPI *POpenPrintProcessor)(LPWSTR, PPRINTPROCESSOROPENDATA);
50c2c66affSColin Finck typedef BOOL (WINAPI *PPrintDocumentOnPrintProcessor)(HANDLE, LPWSTR);
51c2c66affSColin Finck typedef LPMONITOREX(WINAPI *PInitializePrintMonitor)(PWSTR);
52c2c66affSColin Finck typedef LPMONITOR2(WINAPI *PInitializePrintMonitor2)(PMONITORINIT, PHANDLE);
5362c4b828SJames Tabor typedef PMONITORUI(WINAPI *PInitializePrintMonitorUI)(VOID);
54c2c66affSColin Finck 
55c2c66affSColin Finck // Forward declarations
56c2c66affSColin Finck typedef struct _LOCAL_HANDLE            LOCAL_HANDLE, *PLOCAL_HANDLE;
57c2c66affSColin Finck typedef struct _LOCAL_JOB               LOCAL_JOB, *PLOCAL_JOB;
58c2c66affSColin Finck typedef struct _LOCAL_PORT              LOCAL_PORT, *PLOCAL_PORT;
59c2c66affSColin Finck typedef struct _LOCAL_PORT_HANDLE       LOCAL_PORT_HANDLE, *PLOCAL_PORT_HANDLE;
60c2c66affSColin Finck typedef struct _LOCAL_PRINT_MONITOR     LOCAL_PRINT_MONITOR, *PLOCAL_PRINT_MONITOR;
61c2c66affSColin Finck typedef struct _LOCAL_PRINT_PROCESSOR   LOCAL_PRINT_PROCESSOR, *PLOCAL_PRINT_PROCESSOR;
62c2c66affSColin Finck typedef struct _LOCAL_PRINTER           LOCAL_PRINTER, *PLOCAL_PRINTER;
63c2c66affSColin Finck typedef struct _LOCAL_PRINTER_HANDLE    LOCAL_PRINTER_HANDLE, *PLOCAL_PRINTER_HANDLE;
64c2c66affSColin Finck typedef struct _LOCAL_XCV_HANDLE        LOCAL_XCV_HANDLE, *PLOCAL_XCV_HANDLE;
65c2c66affSColin Finck typedef struct _SHD_HEADER              SHD_HEADER, *PSHD_HEADER;
66c2c66affSColin Finck 
67c2c66affSColin Finck // Structures
68c2c66affSColin Finck /**
69c2c66affSColin Finck  * Describes a Print Monitor.
70c2c66affSColin Finck  */
71c2c66affSColin Finck struct _LOCAL_PRINT_MONITOR
72c2c66affSColin Finck {
73c2c66affSColin Finck     LIST_ENTRY Entry;
7462c4b828SJames Tabor     DWORD refcount;
75c2c66affSColin Finck     PWSTR pwszName;                             /** Name of the Print Monitor as read from the registry. */
76c2c66affSColin Finck     PWSTR pwszFileName;                         /** DLL File Name of the Print Monitor. */
7762c4b828SJames Tabor     HMODULE hModule;
78c2c66affSColin Finck     BOOL bIsLevel2;                             /** Whether this Print Monitor supplies an InitializePrintMonitor2 API (preferred) instead of InitializePrintMonitor. */
79c2c66affSColin Finck     PVOID pMonitor;                             /** For bIsLevel2 == TRUE:  LPMONITOR2 pointer returned by InitializePrintMonitor2.
80c2c66affSColin Finck                                                     For bIsLevel2 == FALSE: LPMONITOREX pointer returned by InitializePrintMonitor. */
81c2c66affSColin Finck     HANDLE hMonitor;                            /** Only used when bIsLevel2 == TRUE: Handle returned by InitializePrintMonitor2. */
82c2c66affSColin Finck };
83c2c66affSColin Finck 
84c2c66affSColin Finck /**
85c2c66affSColin Finck  * Describes a Port handled by a Print Monitor.
86c2c66affSColin Finck  */
87c2c66affSColin Finck struct _LOCAL_PORT
88c2c66affSColin Finck {
89c2c66affSColin Finck     LIST_ENTRY Entry;
90c2c66affSColin Finck     PWSTR pwszName;                             /** The name of the port (including the trailing colon). */
91c2c66affSColin Finck     PLOCAL_PRINT_MONITOR pPrintMonitor;         /** The Print Monitor handling this port. */
92c2c66affSColin Finck     PLOCAL_JOB pNextJobToProcess;               /** The Print Job that will be processed by the next created Port handle. */
93c2c66affSColin Finck };
94c2c66affSColin Finck 
95c2c66affSColin Finck /**
96c2c66affSColin Finck  * Describes a Print Processor.
97c2c66affSColin Finck  */
98c2c66affSColin Finck struct _LOCAL_PRINT_PROCESSOR
99c2c66affSColin Finck {
100c2c66affSColin Finck     LIST_ENTRY Entry;
101c2c66affSColin Finck     PWSTR pwszName;
102c2c66affSColin Finck     PDATATYPES_INFO_1W pDatatypesInfo1;
103c2c66affSColin Finck     DWORD dwDatatypeCount;
104c2c66affSColin Finck     PClosePrintProcessor pfnClosePrintProcessor;
105c2c66affSColin Finck     PControlPrintProcessor pfnControlPrintProcessor;
106c2c66affSColin Finck     PEnumPrintProcessorDatatypesW pfnEnumPrintProcessorDatatypesW;
107c2c66affSColin Finck     PGetPrintProcessorCapabilities pfnGetPrintProcessorCapabilities;
108c2c66affSColin Finck     POpenPrintProcessor pfnOpenPrintProcessor;
109c2c66affSColin Finck     PPrintDocumentOnPrintProcessor pfnPrintDocumentOnPrintProcessor;
110c2c66affSColin Finck };
111c2c66affSColin Finck 
112c2c66affSColin Finck /**
113c2c66affSColin Finck  * Describes a printer and manages its print jobs.
114c2c66affSColin Finck  * Created once for every printer at startup.
115c2c66affSColin Finck  */
116c2c66affSColin Finck struct _LOCAL_PRINTER
117c2c66affSColin Finck {
118c2c66affSColin Finck     // This sort key must be the first element for LookupElementSkiplist to work!
119c2c66affSColin Finck     PWSTR pwszPrinterName;
120c2c66affSColin Finck 
121c2c66affSColin Finck     DWORD dwAttributes;
122c2c66affSColin Finck     DWORD dwStatus;
123c2c66affSColin Finck     PWSTR pwszLocation;
124c2c66affSColin Finck     PWSTR pwszPrinterDriver;
125c2c66affSColin Finck     PWSTR pwszDescription;
126c2c66affSColin Finck     PWSTR pwszDefaultDatatype;
127c2c66affSColin Finck     PDEVMODEW pDefaultDevMode;
128c2c66affSColin Finck     PLOCAL_PRINT_PROCESSOR pPrintProcessor;
129c2c66affSColin Finck     PLOCAL_PORT pPort;
130c2c66affSColin Finck     SKIPLIST JobList;
131c2c66affSColin Finck };
132c2c66affSColin Finck 
133c2c66affSColin Finck /**
134c2c66affSColin Finck  * Describes an entire print job associated to a specific printer through the Printer member.
135c2c66affSColin Finck  * Created with every valid call to LocalStartDocPrinter.
136c2c66affSColin Finck  */
137c2c66affSColin Finck struct _LOCAL_JOB
138c2c66affSColin Finck {
139c2c66affSColin Finck     // This sort key must be the first element for LookupElementSkiplist to work!
140c2c66affSColin Finck     DWORD dwJobID;                              /** Internal and external ID of this Job */
141c2c66affSColin Finck 
142c2c66affSColin Finck     BOOL bAddedJob : 1;                         /** Whether AddJob has already been called on this Job. */
143c2c66affSColin Finck     HANDLE hPrintProcessor;                     /** Handle returned by OpenPrintProcessor while the Job is printing. */
144c2c66affSColin Finck     PLOCAL_PRINTER pPrinter;                    /** Associated Printer to this Job */
145c2c66affSColin Finck     PLOCAL_PRINT_PROCESSOR pPrintProcessor;     /** Associated Print Processor to this Job */
146c2c66affSColin Finck     DWORD dwPriority;                           /** Priority of this Job from MIN_PRIORITY to MAX_PRIORITY, default being DEF_PRIORITY */
147c2c66affSColin Finck     SYSTEMTIME stSubmitted;                     /** Time of the submission of this Job */
148c2c66affSColin Finck     PWSTR pwszUserName;                         /** Optional; User that submitted the Job */
149c2c66affSColin Finck     PWSTR pwszNotifyName;                       /** Optional; User that shall be notified about the status of the Job */
150c2c66affSColin Finck     PWSTR pwszDocumentName;                     /** Optional; Name of the Document that is printed */
151c2c66affSColin Finck     PWSTR pwszDatatype;                         /** Datatype of the Document */
152c2c66affSColin Finck     PWSTR pwszOutputFile;                       /** Output File to spool the Job to */
153c2c66affSColin Finck     PWSTR pwszPrintProcessorParameters;         /** Optional; Parameters for the chosen Print Processor */
154c2c66affSColin Finck     PWSTR pwszStatus;                           /** Optional; a Status Message for the Job */
155c2c66affSColin Finck     DWORD dwTotalPages;                         /** Total pages of the Document */
156c2c66affSColin Finck     DWORD dwPagesPrinted;                       /** Number of pages that have already been printed */
157c2c66affSColin Finck     DWORD dwStartTime;                          /** Earliest time in minutes since 12:00 AM UTC when this document can be printed */
158c2c66affSColin Finck     DWORD dwUntilTime;                          /** Latest time in minutes since 12:00 AM UTC when this document can be printed */
159c2c66affSColin Finck     DWORD dwStatus;                             /** JOB_STATUS_* flags of the Job */
160c2c66affSColin Finck     PWSTR pwszMachineName;                      /** Name of the machine that submitted the Job (prepended with two backslashes) */
161c2c66affSColin Finck     PDEVMODEW pDevMode;                         /** Associated Device Mode to this Job */
162c2c66affSColin Finck };
163c2c66affSColin Finck 
164c2c66affSColin Finck /**
165c2c66affSColin Finck  * Specific handle returned by LocalOpenPrinter for every valid call that opens a Printer or Print Job.
166c2c66affSColin Finck  */
167c2c66affSColin Finck struct _LOCAL_PRINTER_HANDLE
168c2c66affSColin Finck {
169c2c66affSColin Finck     BOOL bStartedDoc : 1;                       /** Whether StartDocPrinter has already been called. */
170c2c66affSColin Finck     HANDLE hSPLFile;                            /** Handle to an opened SPL file for Printer Job handles. */
171c2c66affSColin Finck     PLOCAL_PRINTER pPrinter;                    /** Printer associated with this handle. */
172c2c66affSColin Finck     PLOCAL_JOB pJob;                            /** Print Job associated with this handle. This can be the specified Job if this is a Print Job handle or the started job through LocalStartDocPrinter. */
173c2c66affSColin Finck     PWSTR pwszDatatype;                         /** Datatype used for newly started jobs. */
174c2c66affSColin Finck     PDEVMODEW pDevMode;                         /** DevMode used for newly started jobs. */
175c2c66affSColin Finck };
176c2c66affSColin Finck 
177c2c66affSColin Finck /**
178c2c66affSColin Finck  * Specific handle returned by LocalOpenPrinter for every valid call that opens a Port.
179c2c66affSColin Finck  */
180c2c66affSColin Finck struct _LOCAL_PORT_HANDLE
181c2c66affSColin Finck {
182c2c66affSColin Finck     HANDLE hPort;                               /** Handle returned by pfnOpenPort. */
183c2c66affSColin Finck     PLOCAL_PORT pPort;                          /** Port associated with this handle. */
184c2c66affSColin Finck };
185c2c66affSColin Finck 
186c2c66affSColin Finck /**
187c2c66affSColin Finck  * Specific handle returned by LocalOpenPrinter for every valid call that opens an XcvMonitor or XcvPort.
188c2c66affSColin Finck  */
189c2c66affSColin Finck struct _LOCAL_XCV_HANDLE
190c2c66affSColin Finck {
191c2c66affSColin Finck     HANDLE hXcv;                                /** Handle returned by pfnXcvOpenPort. */
192c2c66affSColin Finck     PLOCAL_PRINT_MONITOR pPrintMonitor;         /** Print Monitor associated with this handle. */
193c2c66affSColin Finck };
194c2c66affSColin Finck 
195c2c66affSColin Finck /**
196c2c66affSColin Finck  * Describes a handle returned by LocalOpenPrinter.
197c2c66affSColin Finck  * Suitable for all things that can be opened through LocalOpenPrinter.
198c2c66affSColin Finck  */
199c2c66affSColin Finck struct _LOCAL_HANDLE
200c2c66affSColin Finck {
201c2c66affSColin Finck     enum {
202c2c66affSColin Finck         HandleType_Port,                        /** pSpecificHandle is a PLOCAL_PORT_HANDLE. */
203c2c66affSColin Finck         HandleType_Printer,                     /** pSpecificHandle is a PLOCAL_PRINTER_HANDLE. */
204c2c66affSColin Finck         HandleType_PrintServer,                 /** pSpecificHandle is NULL (no additional information needed for a handle to the Print Server) */
205c2c66affSColin Finck         HandleType_Xcv                          /** pSpecificHandle is a PLOCAL_XCV_HANDLE. */
206c2c66affSColin Finck     }
207c2c66affSColin Finck     HandleType;
208c2c66affSColin Finck     PVOID pSpecificHandle;
209c2c66affSColin Finck };
210c2c66affSColin Finck 
211c2c66affSColin Finck /**
212c2c66affSColin Finck  * Describes the header of a print job serialized into a shadow file (.SHD)
213c2c66affSColin Finck  * Documented in http://www.undocprint.org/formats/winspool/shd
214c2c66affSColin Finck  * Compatible with Windows Server 2003
215c2c66affSColin Finck  */
216c2c66affSColin Finck struct _SHD_HEADER
217c2c66affSColin Finck {
218c2c66affSColin Finck     DWORD dwSignature;
219c2c66affSColin Finck     DWORD cbHeader;
220c2c66affSColin Finck     WORD wStatus;
221c2c66affSColin Finck     WORD wUnknown1;
222c2c66affSColin Finck     DWORD dwJobID;
223c2c66affSColin Finck     DWORD dwPriority;
224c2c66affSColin Finck     DWORD offUserName;
225c2c66affSColin Finck     DWORD offNotifyName;
226c2c66affSColin Finck     DWORD offDocumentName;
227c2c66affSColin Finck     DWORD offPort;
228c2c66affSColin Finck     DWORD offPrinterName;
229c2c66affSColin Finck     DWORD offDriverName;
230c2c66affSColin Finck     DWORD offDevMode;
231c2c66affSColin Finck     DWORD offPrintProcessor;
232c2c66affSColin Finck     DWORD offDatatype;
233c2c66affSColin Finck     DWORD offPrintProcessorParameters;
234c2c66affSColin Finck     SYSTEMTIME stSubmitted;
235c2c66affSColin Finck     DWORD dwStartTime;
236c2c66affSColin Finck     DWORD dwUntilTime;
237c2c66affSColin Finck     DWORD dwUnknown6;
238c2c66affSColin Finck     DWORD dwTotalPages;
239c2c66affSColin Finck     DWORD cbSecurityDescriptor;
240c2c66affSColin Finck     DWORD offSecurityDescriptor;
241c2c66affSColin Finck     DWORD dwUnknown3;
242c2c66affSColin Finck     DWORD dwUnknown4;
243c2c66affSColin Finck     DWORD dwUnknown5;
244c2c66affSColin Finck     DWORD offMachineName;
245c2c66affSColin Finck     DWORD dwSPLSize;
246c2c66affSColin Finck };
247c2c66affSColin Finck 
24862c4b828SJames Tabor // forms.c
24962c4b828SJames Tabor BOOL InitializeFormList(VOID);
25062c4b828SJames Tabor BOOL WINAPI LocalAddForm(HANDLE hPrinter, DWORD Level, PBYTE pForm);
25162c4b828SJames Tabor BOOL WINAPI LocalDeleteForm(HANDLE hPrinter, PWSTR pFormName);
25262c4b828SJames Tabor BOOL WINAPI LocalEnumForms(HANDLE hPrinter, DWORD Level, PBYTE pForm, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned);
25362c4b828SJames Tabor BOOL WINAPI LocalGetForm(HANDLE hPrinter, PWSTR pFormName, DWORD Level, PBYTE pForm, DWORD cbBuf, PDWORD pcbNeeded);
254*24020769SJames Tabor BOOL WINAPI LocalSetForm(HANDLE hPrinter, PWSTR pFormName, DWORD Level, PBYTE pForm);
25562c4b828SJames Tabor 
256c2c66affSColin Finck // jobs.c
257c2c66affSColin Finck extern SKIPLIST GlobalJobList;
258c2c66affSColin Finck DWORD WINAPI CreateJob(PLOCAL_PRINTER_HANDLE pPrinterHandle);
259c2c66affSColin Finck void FreeJob(PLOCAL_JOB pJob);
260c2c66affSColin Finck DWORD GetJobFilePath(PCWSTR pwszExtension, DWORD dwJobID, PWSTR pwszOutput);
261d56c9a89SAmine Khaldi BOOL InitializeGlobalJobList(VOID);
262c2c66affSColin Finck void InitializePrinterJobList(PLOCAL_PRINTER pPrinter);
263c2c66affSColin Finck BOOL WINAPI LocalAddJob(HANDLE hPrinter, DWORD Level, LPBYTE pData, DWORD cbBuf, LPDWORD pcbNeeded);
264c2c66affSColin Finck BOOL WINAPI LocalEnumJobs(HANDLE hPrinter, DWORD FirstJob, DWORD NoJobs, DWORD Level, PBYTE pStart, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned);
265c2c66affSColin Finck BOOL WINAPI LocalGetJob(HANDLE hPrinter, DWORD JobId, DWORD Level, PBYTE pStart, DWORD cbBuf, LPDWORD pcbNeeded);
266c2c66affSColin Finck BOOL WINAPI LocalScheduleJob(HANDLE hPrinter, DWORD dwJobID);
267c2c66affSColin Finck BOOL WINAPI LocalSetJob(HANDLE hPrinter, DWORD JobId, DWORD Level, PBYTE pJobInfo, DWORD Command);
268c2c66affSColin Finck PLOCAL_JOB ReadJobShadowFile(PCWSTR pwszFilePath);
269c2c66affSColin Finck BOOL WriteJobShadowFile(PWSTR pwszFilePath, const PLOCAL_JOB pJob);
270c2c66affSColin Finck 
271c2c66affSColin Finck // main.c
272c2c66affSColin Finck extern const WCHAR wszCurrentEnvironment[];
273c2c66affSColin Finck extern const DWORD cbCurrentEnvironment;
274c2c66affSColin Finck extern const DWORD dwSpoolerMajorVersion;
275c2c66affSColin Finck extern const DWORD dwSpoolerMinorVersion;
276c2c66affSColin Finck extern const WCHAR wszDefaultDocumentName[];
277c2c66affSColin Finck extern HKEY hPrintKey;
278c2c66affSColin Finck extern HKEY hPrintersKey;
2792e4457f2SMark Jansen extern PCWSTR wszPrintProviderInfo[3];
280c2c66affSColin Finck extern WCHAR wszJobDirectory[MAX_PATH];
281c2c66affSColin Finck extern DWORD cchJobDirectory;
282c2c66affSColin Finck extern WCHAR wszSpoolDirectory[MAX_PATH];
283c2c66affSColin Finck extern DWORD cchSpoolDirectory;
284c2c66affSColin Finck 
285c2c66affSColin Finck // monitors.c
286c2c66affSColin Finck extern LIST_ENTRY PrintMonitorList;
287c2c66affSColin Finck PLOCAL_PRINT_MONITOR FindPrintMonitor(PCWSTR pwszName);
288c2c66affSColin Finck BOOL InitializePrintMonitorList(void);
289c2c66affSColin Finck BOOL WINAPI LocalEnumMonitors(PWSTR pName, DWORD Level, PBYTE pMonitors, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned);
29062c4b828SJames Tabor BOOL WINAPI LocalAddMonitor(PWSTR pName, DWORD Level, PBYTE pMonitors);
29162c4b828SJames Tabor BOOL WINAPI LocalDeleteMonitor(PWSTR pName, PWSTR pEnvironment, PWSTR pMonitorName);
292c2c66affSColin Finck 
293c2c66affSColin Finck // ports.c
294c2c66affSColin Finck PLOCAL_PORT FindPort(PCWSTR pwszName);
295c2c66affSColin Finck BOOL InitializePortList(void);
296c2c66affSColin Finck BOOL WINAPI LocalEnumPorts(PWSTR pName, DWORD Level, PBYTE pPorts, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned);
29762c4b828SJames Tabor BOOL WINAPI LocalAddPortEx(PWSTR pName, DWORD Level, PBYTE lpBuffer, PWSTR lpMonitorName);
29862c4b828SJames Tabor BOOL WINAPI LocalAddPort(LPWSTR pName, HWND hWnd, LPWSTR pMonitorName);
29962c4b828SJames Tabor BOOL WINAPI LocalConfigurePort(PWSTR pName, HWND hWnd, PWSTR pPortName);
30062c4b828SJames Tabor BOOL WINAPI LocalDeletePort(PWSTR pName, HWND hWnd, PWSTR pPortName);
30162c4b828SJames Tabor BOOL WINAPI LocalSetPort(PWSTR pName, PWSTR pPortName, DWORD dwLevel, PBYTE pPortInfo);
30262c4b828SJames Tabor BOOL CreatePortEntry( PCWSTR pwszName, PLOCAL_PRINT_MONITOR pPrintMonitor );
303c2c66affSColin Finck 
304c2c66affSColin Finck // printerdata.c
305c2c66affSColin Finck DWORD WINAPI LocalGetPrinterData(HANDLE hPrinter, PWSTR pValueName, PDWORD pType, PBYTE pData, DWORD nSize, PDWORD pcbNeeded);
306c2c66affSColin Finck DWORD WINAPI LocalGetPrinterDataEx(HANDLE hPrinter, PCWSTR pKeyName, PCWSTR pValueName, PDWORD pType, PBYTE pData, DWORD nSize, PDWORD pcbNeeded);
307c2c66affSColin Finck DWORD WINAPI LocalSetPrinterData(HANDLE hPrinter, PWSTR pValueName, DWORD Type, PBYTE pData, DWORD cbData);
308c2c66affSColin Finck DWORD WINAPI LocalSetPrinterDataEx(HANDLE hPrinter, LPCWSTR pKeyName, LPCWSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData);
309c2c66affSColin Finck 
31062c4b828SJames Tabor // printerdrivers.c
31162c4b828SJames Tabor BOOL InitializePrinterDrivers(VOID);
31262c4b828SJames Tabor BOOL WINAPI LocalAddPrinterDriver(LPWSTR pName, DWORD level, LPBYTE pDriverInfo);
31362c4b828SJames Tabor BOOL WINAPI LocalAddPrinterDriverEx(LPWSTR pName, DWORD level, LPBYTE pDriverInfo, DWORD dwFileCopyFlags);
314796dd5f5SMark Jansen BOOL WINAPI LocalGetPrinterDriver(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded);
31562c4b828SJames Tabor BOOL WINAPI LocalGetPrinterDriverDirectory(PWSTR pName, PWSTR pEnvironment, DWORD Level, PBYTE pDriverDirectory, DWORD cbBuf, PDWORD pcbNeeded);
31662c4b828SJames Tabor BOOL WINAPI LocalGetPrinterDriverEx(HANDLE hPrinter,LPWSTR pEnvironment,DWORD Level,LPBYTE pDriverInfo,DWORD cbBuf,LPDWORD pcbNeeded,DWORD dwClientMajorVersion,DWORD dwClientMinorVersion,PDWORD pdwServerMajorVersion,PDWORD pdwServerMinorVersion );
31762c4b828SJames Tabor BOOL WINAPI LocalEnumPrinterDrivers(PWSTR pName, PWSTR pEnvironment, DWORD Level, PBYTE pDriverInfo, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned);
318796dd5f5SMark Jansen 
31962c4b828SJames Tabor // wine codes
32062c4b828SJames Tabor typedef struct _PRINTENV_T
32162c4b828SJames Tabor {
32262c4b828SJames Tabor     LPCWSTR  envname;
32362c4b828SJames Tabor     LPCWSTR  subdir;
32462c4b828SJames Tabor     DWORD    driverversion;
32562c4b828SJames Tabor     LPCWSTR  versionregpath;
32662c4b828SJames Tabor     LPCWSTR  versionsubdir;
32762c4b828SJames Tabor } PRINTENV_T, *PPRINTENV_T;
32862c4b828SJames Tabor 
32962c4b828SJames Tabor PPRINTENV_T validate_envW(LPCWSTR env);
330796dd5f5SMark Jansen 
331c2c66affSColin Finck // printers.c
332c2c66affSColin Finck extern SKIPLIST PrinterList;
333c2c66affSColin Finck BOOL InitializePrinterList(void);
334c2c66affSColin Finck BOOL WINAPI LocalEnumPrinters(DWORD Flags, LPWSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned);
335c2c66affSColin Finck BOOL WINAPI LocalGetPrinter(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded);
336c2c66affSColin Finck BOOL WINAPI LocalOpenPrinter(PWSTR lpPrinterName, HANDLE* phPrinter, PPRINTER_DEFAULTSW pDefault);
33762c4b828SJames Tabor DWORD WINAPI LocalPrinterMessageBox(HANDLE hPrinter, DWORD Error, HWND hWnd, LPWSTR pText, LPWSTR pCaption, DWORD dwType);
338c2c66affSColin Finck BOOL WINAPI LocalReadPrinter(HANDLE hPrinter, PVOID pBuf, DWORD cbBuf, PDWORD pNoBytesRead);
339c2c66affSColin Finck DWORD WINAPI LocalStartDocPrinter(HANDLE hPrinter, DWORD Level, LPBYTE pDocInfo);
340c2c66affSColin Finck BOOL WINAPI LocalStartPagePrinter(HANDLE hPrinter);
341c2c66affSColin Finck BOOL WINAPI LocalWritePrinter(HANDLE hPrinter, LPVOID pBuf, DWORD cbBuf, LPDWORD pcWritten);
342c2c66affSColin Finck BOOL WINAPI LocalEndPagePrinter(HANDLE hPrinter);
343c2c66affSColin Finck BOOL WINAPI LocalEndDocPrinter(HANDLE hPrinter);
344c2c66affSColin Finck BOOL WINAPI LocalClosePrinter(HANDLE hPrinter);
34562c4b828SJames Tabor VOID BroadcastChange(PLOCAL_HANDLE pHandle);
346c2c66affSColin Finck 
347c2c66affSColin Finck // printingthread.c
348c2c66affSColin Finck DWORD WINAPI PrintingThreadProc(PLOCAL_JOB pJob);
349c2c66affSColin Finck 
350c2c66affSColin Finck // printprocessors.c
351c2c66affSColin Finck BOOL FindDatatype(const PLOCAL_PRINT_PROCESSOR pPrintProcessor, PCWSTR pwszDatatype);
352c2c66affSColin Finck PLOCAL_PRINT_PROCESSOR FindPrintProcessor(PCWSTR pwszName);
353c2c66affSColin Finck BOOL InitializePrintProcessorList(void);
354c2c66affSColin Finck BOOL WINAPI LocalEnumPrintProcessorDatatypes(LPWSTR pName, LPWSTR pPrintProcessorName, DWORD Level, LPBYTE pDatatypes, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned);
355c2c66affSColin Finck BOOL WINAPI LocalEnumPrintProcessors(LPWSTR pName, LPWSTR pEnvironment, DWORD Level, LPBYTE pPrintProcessorInfo, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned);
356c2c66affSColin Finck BOOL WINAPI LocalGetPrintProcessorDirectory(LPWSTR pName, LPWSTR pEnvironment, DWORD Level, LPBYTE pPrintProcessorInfo, DWORD cbBuf, LPDWORD pcbNeeded);
357c2c66affSColin Finck 
35889e716a7SJames Tabor // spoolfile.c
35989e716a7SJames Tabor BOOL WINAPI LocalGetSpoolFileInfo(HANDLE hPrinter,LPWSTR *pSpoolDir,LPHANDLE phFile,HANDLE hSpoolerProcess,HANDLE hAppProcess);
36089e716a7SJames Tabor BOOL WINAPI LocalCommitSpoolData(HANDLE hPrinter,DWORD cbCommit);
36189e716a7SJames Tabor BOOL WINAPI LocalCloseSpoolFileHandle(HANDLE hPrinter);
36289e716a7SJames Tabor 
363c2c66affSColin Finck // tools.c
364c2c66affSColin Finck PWSTR AllocAndRegQueryWSZ(HKEY hKey, PCWSTR pwszValueName);
365c2c66affSColin Finck PDEVMODEW DuplicateDevMode(PDEVMODEW pInput);
36662c4b828SJames Tabor // wine codes
36762c4b828SJames Tabor LONG copy_servername_from_name(LPCWSTR name, LPWSTR target);
36862c4b828SJames Tabor 
36962c4b828SJames Tabor // Xcv.c
37062c4b828SJames Tabor BOOL WINAPI LocalXcvData(HANDLE hXcv, const WCHAR* pszDataName, BYTE* pInputData, DWORD cbInputData, BYTE* pOutputData, DWORD cbOutputData, DWORD* pcbOutputNeeded, DWORD* pdwStatus);
37162c4b828SJames Tabor 
372c2c66affSColin Finck 
373c2c66affSColin Finck #endif
374