ReactOS  0.4.15-dev-499-g1f31905
precomp.h
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Local Spooler
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE: Precompiled Header for all source files
5  * COPYRIGHT: Copyright 2015-2017 Colin Finck (colin@reactos.org)
6  */
7 
8 #ifndef _PRECOMP_H
9 #define _PRECOMP_H
10 
11 #define WIN32_NO_STATUS
12 #include <limits.h>
13 #include <stdlib.h>
14 #include <wchar.h>
15 
16 #include <lmcons.h>
17 #include <rpc.h>
18 #include <strsafe.h>
19 #include <windef.h>
20 #include <winbase.h>
21 #include <wingdi.h>
22 #include <winreg.h>
23 #include <winspool.h>
24 #include <winsplp.h>
25 #include <dsrole.h>
26 #include <secext.h>
27 #include <ndk/rtlfuncs.h>
28 
29 #define SKIPLIST_LEVELS 16
30 #include <skiplist.h>
31 #include <spoolss.h>
32 
33 #include <wine/debug.h>
35 
36 // Macros
37 #define IS_VALID_JOB_ID(ID) (ID >= 1 && ID <= 99999)
38 #define IS_VALID_PRIORITY(P) (P >= MIN_PRIORITY && P <= MAX_PRIORITY)
39 
40 // Constants
41 #define SHD_WIN2003_SIGNATURE 0x4968
42 
43 // Function pointers
52 
53 // Forward declarations
55 typedef struct _LOCAL_JOB LOCAL_JOB, *PLOCAL_JOB;
64 
65 // Structures
70 {
78 };
79 
84 {
89 };
90 
95 {
106 };
107 
113 {
114  // This sort key must be the first element for LookupElementSkiplist to work!
116 
127 };
128 
134 {
135  // This sort key must be the first element for LookupElementSkiplist to work!
158 };
159 
164 {
171 };
172 
177 {
180 };
181 
186 {
189 };
190 
196 {
197  enum {
202  }
203  HandleType;
205 };
206 
213 {
242 };
243 
244 // jobs.c
245 extern SKIPLIST GlobalJobList;
247 void FreeJob(PLOCAL_JOB pJob);
248 DWORD GetJobFilePath(PCWSTR pwszExtension, DWORD dwJobID, PWSTR pwszOutput);
252 BOOL WINAPI LocalEnumJobs(HANDLE hPrinter, DWORD FirstJob, DWORD NoJobs, DWORD Level, PBYTE pStart, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned);
253 BOOL WINAPI LocalGetJob(HANDLE hPrinter, DWORD JobId, DWORD Level, PBYTE pStart, DWORD cbBuf, LPDWORD pcbNeeded);
254 BOOL WINAPI LocalScheduleJob(HANDLE hPrinter, DWORD dwJobID);
255 BOOL WINAPI LocalSetJob(HANDLE hPrinter, DWORD JobId, DWORD Level, PBYTE pJobInfo, DWORD Command);
256 PLOCAL_JOB ReadJobShadowFile(PCWSTR pwszFilePath);
257 BOOL WriteJobShadowFile(PWSTR pwszFilePath, const PLOCAL_JOB pJob);
258 
259 // main.c
260 extern const WCHAR wszCurrentEnvironment[];
261 extern const DWORD cbCurrentEnvironment;
262 extern const DWORD dwSpoolerMajorVersion;
263 extern const DWORD dwSpoolerMinorVersion;
264 extern const WCHAR wszDefaultDocumentName[];
265 extern HKEY hPrintKey;
266 extern HKEY hPrintersKey;
267 extern PCWSTR wszPrintProviderInfo[3];
269 extern DWORD cchJobDirectory;
271 extern DWORD cchSpoolDirectory;
272 
273 // monitors.c
278 
279 // ports.c
280 PLOCAL_PORT FindPort(PCWSTR pwszName);
283 
284 // printerdata.c
286 DWORD WINAPI LocalGetPrinterDataEx(HANDLE hPrinter, PCWSTR pKeyName, PCWSTR pValueName, PDWORD pType, PBYTE pData, DWORD nSize, PDWORD pcbNeeded);
287 DWORD WINAPI LocalSetPrinterData(HANDLE hPrinter, PWSTR pValueName, DWORD Type, PBYTE pData, DWORD cbData);
288 DWORD WINAPI LocalSetPrinterDataEx(HANDLE hPrinter, LPCWSTR pKeyName, LPCWSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData);
289 
290 // printerdriver.c
291 BOOL WINAPI LocalGetPrinterDriver(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded);
292 
293 
294 // printers.c
295 extern SKIPLIST PrinterList;
299 BOOL WINAPI LocalOpenPrinter(PWSTR lpPrinterName, HANDLE* phPrinter, PPRINTER_DEFAULTSW pDefault);
300 BOOL WINAPI LocalReadPrinter(HANDLE hPrinter, PVOID pBuf, DWORD cbBuf, PDWORD pNoBytesRead);
303 BOOL WINAPI LocalWritePrinter(HANDLE hPrinter, LPVOID pBuf, DWORD cbBuf, LPDWORD pcWritten);
307 
308 // printingthread.c
310 
311 // printprocessors.c
312 BOOL FindDatatype(const PLOCAL_PRINT_PROCESSOR pPrintProcessor, PCWSTR pwszDatatype);
315 BOOL WINAPI LocalEnumPrintProcessorDatatypes(LPWSTR pName, LPWSTR pPrintProcessorName, DWORD Level, LPBYTE pDatatypes, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned);
316 BOOL WINAPI LocalEnumPrintProcessors(LPWSTR pName, LPWSTR pEnvironment, DWORD Level, LPBYTE pPrintProcessorInfo, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned);
318 
319 // spoolfile.c
320 BOOL WINAPI LocalGetSpoolFileInfo(HANDLE hPrinter,LPWSTR *pSpoolDir,LPHANDLE phFile,HANDLE hSpoolerProcess,HANDLE hAppProcess);
321 BOOL WINAPI LocalCommitSpoolData(HANDLE hPrinter,DWORD cbCommit);
323 
324 // tools.c
327 
328 #endif
PLOCAL_PORT pPort
Definition: precomp.h:179
SYSTEMTIME stSubmitted
Definition: precomp.h:143
PDEVMODEW pDevMode
Definition: precomp.h:170
DWORD WINAPI LocalGetPrinterDataEx(HANDLE hPrinter, PCWSTR pKeyName, PCWSTR pValueName, PDWORD pType, PBYTE pData, DWORD nSize, PDWORD pcbNeeded)
Definition: printerdata.c:314
LPMONITOR2(WINAPI * PInitializePrintMonitor2)(PMONITORINIT, PHANDLE)
Definition: precomp.h:51
const uint16_t * PCWSTR
Definition: typedefs.h:56
DWORD offDocumentName
Definition: precomp.h:222
DWORD dwStartTime
Definition: precomp.h:231
enum _LOCAL_HANDLE::@4210 HandleType
LIST_ENTRY Entry
Definition: precomp.h:85
PWSTR pwszName
Definition: precomp.h:86
DWORD offNotifyName
Definition: precomp.h:221
DWORD offDriverName
Definition: precomp.h:225
WCHAR wszSpoolDirectory[MAX_PATH]
Definition: main.c:15
Type
Definition: Type.h:6
BOOL bAddedJob
Definition: precomp.h:138
void InitializePrinterJobList(PLOCAL_PRINTER pPrinter)
Definition: jobs.c:247
PDATATYPES_INFO_1W pDatatypesInfo1
Definition: precomp.h:98
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
DWORD offUserName
Definition: precomp.h:220
DWORD dwStartTime
Definition: precomp.h:153
PEnumPrintProcessorDatatypesW pfnEnumPrintProcessorDatatypesW
Definition: precomp.h:102
DWORD dwUnknown3
Definition: precomp.h:237
PPrintDocumentOnPrintProcessor pfnPrintDocumentOnPrintProcessor
Definition: precomp.h:105
PLOCAL_PRINT_MONITOR FindPrintMonitor(PCWSTR pwszName)
Definition: monitors.c:28
PWSTR pwszOutputFile
Definition: precomp.h:148
BOOL InitializeGlobalJobList(VOID)
Definition: jobs.c:161
uint16_t * PWSTR
Definition: typedefs.h:55
const DWORD dwSpoolerMajorVersion
Definition: main.c:22
DWORD dwAttributes
Definition: precomp.h:117
PWSTR pwszPrinterDriver
Definition: precomp.h:120
BOOL WINAPI LocalEnumPrinters(DWORD Flags, LPWSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
Definition: printers.c:865
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2037
const DWORD dwSpoolerMinorVersion
Definition: main.c:23
PLOCAL_JOB pNextJobToProcess
Definition: precomp.h:88
PWSTR pwszMachineName
Definition: precomp.h:156
PLOCAL_PRINT_MONITOR pPrintMonitor
Definition: precomp.h:87
struct _MONITORINIT * PMONITORINIT
DWORD offPort
Definition: precomp.h:223
DWORD WINAPI PrintingThreadProc(PLOCAL_JOB pJob)
SKIPLIST JobList
Definition: precomp.h:126
DWORD WINAPI CreateJob(PLOCAL_PRINTER_HANDLE pPrinterHandle)
Definition: jobs.c:257
PLOCAL_PORT FindPort(PCWSTR pwszName)
Definition: ports.c:15
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
DWORD WINAPI LocalSetPrinterDataEx(HANDLE hPrinter, LPCWSTR pKeyName, LPCWSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData)
struct _LOCAL_PORT_HANDLE * PLOCAL_PORT_HANDLE
Definition: precomp.h:57
Definition: shell.h:41
PWSTR pwszLocation
Definition: precomp.h:119
BOOL(WINAPI * PEnumPrintProcessorDatatypesW)(LPWSTR, LPWSTR, DWORD, LPBYTE, DWORD, LPDWORD, LPDWORD)
Definition: precomp.h:46
#define BOOL
Definition: nt_native.h:43
WORD wStatus
Definition: precomp.h:216
#define DWORD
Definition: nt_native.h:44
DWORD dwPriority
Definition: precomp.h:142
PDEVMODEW pDevMode
Definition: precomp.h:157
BOOL InitializePrinterList(void)
Definition: printers.c:107
PCWSTR wszPrintProviderInfo[3]
Definition: main.c:27
const DWORD cbCurrentEnvironment
struct _LOCAL_PORT * PLOCAL_PORT
Definition: precomp.h:56
DWORD dwSignature
Definition: precomp.h:214
DWORD(WINAPI * PGetPrintProcessorCapabilities)(LPWSTR, DWORD, LPBYTE, DWORD, LPDWORD)
Definition: precomp.h:47
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
DWORD dwJobID
Definition: precomp.h:136
struct _LOCAL_HANDLE * PLOCAL_HANDLE
Definition: precomp.h:54
unsigned char * LPBYTE
Definition: typedefs.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL InitializePrintMonitorList(void)
Definition: monitors.c:50
DWORD dwUnknown4
Definition: precomp.h:238
BOOL WINAPI LocalReadPrinter(HANDLE hPrinter, PVOID pBuf, DWORD cbBuf, PDWORD pNoBytesRead)
Definition: printers.c:1499
PLOCAL_PRINT_MONITOR pPrintMonitor
Definition: precomp.h:188
PWSTR pwszDatatype
Definition: precomp.h:147
PLOCAL_PRINT_PROCESSOR pPrintProcessor
Definition: precomp.h:124
DWORD dwUntilTime
Definition: precomp.h:154
PVOID pSpecificHandle
Definition: precomp.h:204
PWSTR AllocAndRegQueryWSZ(HKEY hKey, PCWSTR pwszValueName)
Definition: tools.c:26
BOOL WINAPI LocalEnumMonitors(PWSTR pName, DWORD Level, PBYTE pMonitors, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
Definition: monitors.c:311
PLOCAL_JOB ReadJobShadowFile(PCWSTR pwszFilePath)
Definition: jobs.c:1187
struct _SHD_HEADER * PSHD_HEADER
Definition: precomp.h:63
DWORD offPrintProcessor
Definition: precomp.h:227
PWSTR pwszPrintProcessorParameters
Definition: precomp.h:149
WINE_DEFAULT_DEBUG_CHANNEL(cmd)
BOOL WINAPI LocalWritePrinter(HANDLE hPrinter, LPVOID pBuf, DWORD cbBuf, LPDWORD pcWritten)
DWORD offDevMode
Definition: precomp.h:226
DWORD WINAPI LocalSetPrinterData(HANDLE hPrinter, PWSTR pValueName, DWORD Type, PBYTE pData, DWORD cbData)
Definition: printerdata.c:361
DWORD dwStatus
Definition: precomp.h:155
static LPSTR pName
Definition: security.c:75
BOOL WINAPI LocalStartPagePrinter(HANDLE hPrinter)
Definition: printers.c:1689
WCHAR wszJobDirectory[MAX_PATH]
Definition: main.c:13
const WCHAR wszCurrentEnvironment[]
Definition: prtprocenv.h:11
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD offSecurityDescriptor
Definition: precomp.h:236
_In_z_ PCWSTR pwszValueName
Definition: ntuser.h:36
PLOCAL_PRINTER pPrinter
Definition: precomp.h:140
DWORD dwTotalPages
Definition: precomp.h:151
struct _LOCAL_PRINT_MONITOR * PLOCAL_PRINT_MONITOR
Definition: precomp.h:58
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:6
BOOL FindDatatype(const PLOCAL_PRINT_PROCESSOR pPrintProcessor, PCWSTR pwszDatatype)
SKIPLIST PrinterList
Definition: printers.c:11
unsigned short WORD
Definition: ntddk_ex.h:93
struct _PRINTPROCESSOROPENDATA * PPRINTPROCESSOROPENDATA
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID HANDLE
Definition: typedefs.h:72
BOOL WINAPI LocalEndPagePrinter(HANDLE hPrinter)
Definition: printers.c:1799
BOOL WINAPI LocalEndDocPrinter(HANDLE hPrinter)
Definition: printers.c:1822
DWORD dwSPLSize
Definition: precomp.h:241
BOOL WINAPI LocalSetJob(HANDLE hPrinter, DWORD JobId, DWORD Level, PBYTE pJobInfo, DWORD Command)
Definition: jobs.c:949
BOOL WINAPI LocalGetPrinterDriver(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
BOOL WINAPI LocalEnumPrintProcessors(LPWSTR pName, LPWSTR pEnvironment, DWORD Level, LPBYTE pPrintProcessorInfo, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
BOOL WINAPI LocalGetJob(HANDLE hPrinter, DWORD JobId, DWORD Level, PBYTE pStart, DWORD cbBuf, LPDWORD pcbNeeded)
Definition: jobs.c:655
struct _LOCAL_XCV_HANDLE * PLOCAL_XCV_HANDLE
Definition: precomp.h:62
DWORD dwUnknown6
Definition: precomp.h:233
BOOL WINAPI LocalCloseSpoolFileHandle(HANDLE hPrinter)
Definition: spoolfile.c:30
LIST_ENTRY PrintMonitorList
Definition: monitors.c:11
DWORD WINAPI LocalStartDocPrinter(HANDLE hPrinter, DWORD Level, LPBYTE pDocInfo)
#define LPDWORD
Definition: nt_native.h:46
PWSTR pwszNotifyName
Definition: precomp.h:145
LIST_ENTRY Entry
Definition: precomp.h:71
PWSTR pwszDefaultDatatype
Definition: precomp.h:122
BOOL WINAPI LocalOpenPrinter(PWSTR lpPrinterName, HANDLE *phPrinter, PPRINTER_DEFAULTSW pDefault)
Definition: printers.c:1364
LIST_ENTRY Entry
Definition: precomp.h:96
PClosePrintProcessor pfnClosePrintProcessor
Definition: precomp.h:100
DWORD offDatatype
Definition: precomp.h:228
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:454
HKEY hPrintersKey
Definition: main.c:12
DWORD dwPriority
Definition: precomp.h:219
Definition: typedefs.h:118
BOOL InitializePrintProcessorList(void)
DWORD WINAPI LocalGetPrinterData(HANDLE hPrinter, PWSTR pValueName, PDWORD pType, PBYTE pData, DWORD nSize, PDWORD pcbNeeded)
Definition: printerdata.c:11
DWORD dwUnknown5
Definition: precomp.h:239
PWSTR pwszDescription
Definition: precomp.h:121
BOOL(WINAPI * PControlPrintProcessor)(HANDLE, DWORD)
Definition: precomp.h:45
PDEVMODEW pDefaultDevMode
Definition: precomp.h:123
struct _LOCAL_JOB * PLOCAL_JOB
Definition: precomp.h:55
SKIPLIST GlobalJobList
Definition: jobs.c:11
struct _LOCAL_PRINTER * PLOCAL_PRINTER
Definition: precomp.h:60
BOOL WINAPI LocalGetSpoolFileInfo(HANDLE hPrinter, LPWSTR *pSpoolDir, LPHANDLE phFile, HANDLE hSpoolerProcess, HANDLE hAppProcess)
Definition: spoolfile.c:11
DWORD cchJobDirectory
Definition: main.c:14
BOOL WINAPI LocalEnumPrintProcessorDatatypes(LPWSTR pName, LPWSTR pPrintProcessorName, DWORD Level, LPBYTE pDatatypes, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
SYSTEMTIME stSubmitted
Definition: precomp.h:230
_In_ DWORD _Out_ PDWORD pcbNeeded
Definition: winddi.h:3827
DWORD dwTotalPages
Definition: precomp.h:234
DWORD dwStatus
Definition: precomp.h:118
PWSTR pwszDocumentName
Definition: precomp.h:146
HANDLE hPrintProcessor
Definition: precomp.h:139
DWORD GetJobFilePath(PCWSTR pwszExtension, DWORD dwJobID, PWSTR pwszOutput)
Definition: jobs.c:146
PDEVMODEW DuplicateDevMode(PDEVMODEW pInput)
Definition: tools.c:61
PGetPrintProcessorCapabilities pfnGetPrintProcessorCapabilities
Definition: precomp.h:103
BOOL(WINAPI * PPrintDocumentOnPrintProcessor)(HANDLE, LPWSTR)
Definition: precomp.h:49
BOOL WINAPI LocalScheduleJob(HANDLE hPrinter, DWORD dwJobID)
Definition: jobs.c:1112
BOOL WINAPI LocalGetPrintProcessorDirectory(LPWSTR pName, LPWSTR pEnvironment, DWORD Level, LPBYTE pPrintProcessorInfo, DWORD cbBuf, LPDWORD pcbNeeded)
struct _LOCAL_PRINT_PROCESSOR * PLOCAL_PRINT_PROCESSOR
Definition: precomp.h:59
DWORD offMachineName
Definition: precomp.h:240
BOOL WriteJobShadowFile(PWSTR pwszFilePath, const PLOCAL_JOB pJob)
Definition: jobs.c:1300
DWORD * PDWORD
Definition: pedump.c:68
DWORD cbSecurityDescriptor
Definition: precomp.h:235
PLOCAL_JOB pJob
Definition: precomp.h:168
DWORD dwPagesPrinted
Definition: precomp.h:152
HKEY hPrintKey
Definition: main.c:11
HANDLE(WINAPI * POpenPrintProcessor)(LPWSTR, PPRINTPROCESSOROPENDATA)
Definition: precomp.h:48
struct _MONITOR2 * LPMONITOR2
PLOCAL_PRINT_PROCESSOR pPrintProcessor
Definition: precomp.h:141
LPMONITOREX(WINAPI * PInitializePrintMonitor)(PWSTR)
Definition: precomp.h:50
BOOL WINAPI LocalClosePrinter(HANDLE hPrinter)
Definition: printers.c:1923
uint32_t * LPDWORD
Definition: typedefs.h:58
BOOL WINAPI LocalEnumJobs(HANDLE hPrinter, DWORD FirstJob, DWORD NoJobs, DWORD Level, PBYTE pStart, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
Definition: jobs.c:1022
DWORD cbHeader
Definition: precomp.h:215
struct _LOCAL_PRINTER_HANDLE * PLOCAL_PRINTER_HANDLE
Definition: precomp.h:61
DWORD cchSpoolDirectory
Definition: main.c:16
BOOL WINAPI LocalGetPrinter(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
Definition: printers.c:966
WORD wUnknown1
Definition: precomp.h:217
BOOL WINAPI LocalAddJob(HANDLE hPrinter, DWORD Level, LPBYTE pData, DWORD cbBuf, LPDWORD pcbNeeded)
POpenPrintProcessor pfnOpenPrintProcessor
Definition: precomp.h:104
PControlPrintProcessor pfnControlPrintProcessor
Definition: precomp.h:101
const WCHAR wszDefaultDocumentName[]
Definition: main.c:25
WCHAR * LPWSTR
Definition: xmlstorage.h:184
DWORD dwUntilTime
Definition: precomp.h:232
PLOCAL_PRINT_PROCESSOR FindPrintProcessor(PCWSTR pwszName)
PLOCAL_PRINTER pPrinter
Definition: precomp.h:167
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
struct _MONITOREX * LPMONITOREX
PLOCAL_PORT pPort
Definition: precomp.h:125
PWSTR pwszStatus
Definition: precomp.h:150
BOOL WINAPI LocalEnumPorts(PWSTR pName, DWORD Level, PBYTE pPorts, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
Definition: ports.c:141
BYTE * PBYTE
Definition: pedump.c:66
PWSTR pwszPrinterName
Definition: precomp.h:115
BOOL(WINAPI * PClosePrintProcessor)(HANDLE)
Definition: precomp.h:44
PWSTR pwszUserName
Definition: precomp.h:144
DWORD offPrinterName
Definition: precomp.h:224
void FreeJob(PLOCAL_JOB pJob)
Definition: jobs.c:1452
DWORD offPrintProcessorParameters
Definition: precomp.h:229
BOOL WINAPI LocalCommitSpoolData(HANDLE hPrinter, DWORD cbCommit)
Definition: spoolfile.c:23
BOOL InitializePortList(void)
Definition: ports.c:37
DWORD dwJobID
Definition: precomp.h:218