2 * PROJECT: ReactOS Local Spooler
3 * LICENSE: GNU LGPL v2.1 or any later version as published by the Free Software Foundation
4 * PURPOSE: Main functions
5 * COPYRIGHT: Copyright 2015-2016 Colin Finck <colin@reactos.org>
11 WCHAR wszSpoolDirectory
[MAX_PATH
];
12 DWORD cchSpoolDirectory
;
15 #include <prtprocenv.h>
17 const WCHAR wszDefaultDocumentName
[] = L
"Local Downlevel Document";
19 const WCHAR
* wszPrintProviderInfo
[3] = {
20 L
"Windows NT Local Print Providor", // Name
21 L
"Windows NT Local Printers", // Description
22 L
"Locally connected Printers" // Comment
26 static const PRINTPROVIDOR _PrintProviderFunctions
= {
27 LocalOpenPrinter
, // fpOpenPrinter
28 LocalSetJob
, // fpSetJob
29 LocalGetJob
, // fpGetJob
30 LocalEnumJobs
, // fpEnumJobs
32 NULL
, // fpDeletePrinter
35 LocalEnumPrinters
, // fpEnumPrinters
36 NULL
, // fpAddPrinterDriver
37 NULL
, // fpEnumPrinterDrivers
38 NULL
, // fpGetPrinterDriver
39 NULL
, // fpGetPrinterDriverDirectory
40 NULL
, // fpDeletePrinterDriver
41 NULL
, // fpAddPrintProcessor
42 LocalEnumPrintProcessors
, // fpEnumPrintProcessors
43 LocalGetPrintProcessorDirectory
, // fpGetPrintProcessorDirectory
44 NULL
, // fpDeletePrintProcessor
45 LocalEnumPrintProcessorDatatypes
, // fpEnumPrintProcessorDatatypes
46 LocalStartDocPrinter
, // fpStartDocPrinter
47 LocalStartPagePrinter
, // fpStartPagePrinter
48 LocalWritePrinter
, // fpWritePrinter
49 LocalEndPagePrinter
, // fpEndPagePrinter
50 NULL
, // fpAbortPrinter
51 LocalReadPrinter
, // fpReadPrinter
52 LocalEndDocPrinter
, // fpEndDocPrinter
53 LocalAddJob
, // fpAddJob
54 LocalScheduleJob
, // fpScheduleJob
55 NULL
, // fpGetPrinterData
56 NULL
, // fpSetPrinterData
57 NULL
, // fpWaitForPrinterChange
58 LocalClosePrinter
, // fpClosePrinter
64 LocalEnumMonitors
, // fpEnumMonitors
65 LocalEnumPorts
, // fpEnumPorts
67 NULL
, // fpConfigurePort
69 NULL
, // fpCreatePrinterIC
70 NULL
, // fpPlayGdiScriptOnPrinterIC
71 NULL
, // fpDeletePrinterIC
72 NULL
, // fpAddPrinterConnection
73 NULL
, // fpDeletePrinterConnection
74 NULL
, // fpPrinterMessageBox
76 NULL
, // fpDeleteMonitor
77 NULL
, // fpResetPrinter
78 NULL
, // fpGetPrinterDriverEx
79 NULL
, // fpFindFirstPrinterChangeNotification
80 NULL
, // fpFindClosePrinterChangeNotification
83 NULL
, // fpRefreshPrinterChangeNotification
84 NULL
, // fpOpenPrinterEx
85 NULL
, // fpAddPrinterEx
87 NULL
, // fpEnumPrinterData
88 NULL
, // fpDeletePrinterData
89 NULL
, // fpClusterSplOpen
90 NULL
, // fpClusterSplClose
91 NULL
, // fpClusterSplIsAlive
92 NULL
, // fpSetPrinterDataEx
93 NULL
, // fpGetPrinterDataEx
94 NULL
, // fpEnumPrinterDataEx
95 NULL
, // fpEnumPrinterKey
96 NULL
, // fpDeletePrinterDataEx
97 NULL
, // fpDeletePrinterKey
98 NULL
, // fpSeekPrinter
99 NULL
, // fpDeletePrinterDriverEx
100 NULL
, // fpAddPerMachineConnection
101 NULL
, // fpDeletePerMachineConnection
102 NULL
, // fpEnumPerMachineConnections
104 NULL
, // fpAddPrinterDriverEx
105 NULL
, // fpSplReadPrinter
106 NULL
, // fpDriverUnloadComplete
107 NULL
, // fpGetSpoolFileInfo
108 NULL
, // fpCommitSpoolData
109 NULL
, // fpCloseSpoolFileHandle
110 NULL
, // fpFlushPrinter
111 NULL
, // fpSendRecvBidiData
112 NULL
, // fpAddDriverCatalog
118 const WCHAR wszSpoolPath
[] = L
"\\spool";
119 const DWORD cchSpoolPath
= _countof(wszSpoolPath
) - 1;
121 // Get the system directory and append the "spool" subdirectory.
122 // Forget about length checks here. If this doesn't fit into MAX_PATH, our OS has more serious problems...
123 cchSpoolDirectory
= GetSystemDirectoryW(wszSpoolDirectory
, MAX_PATH
);
124 CopyMemory(&wszSpoolDirectory
[cchSpoolDirectory
], wszSpoolPath
, (cchSpoolPath
+ 1) * sizeof(WCHAR
));
125 cchSpoolDirectory
+= cchSpoolPath
;
129 DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
133 case DLL_PROCESS_ATTACH
:
134 DisableThreadLibraryCalls(hinstDLL
);
135 _GetSpoolDirectory();
137 return InitializePrintMonitorList() &&
138 InitializePortList() &&
139 InitializePrintProcessorList() &&
140 InitializePrinterList() &&
141 InitializeGlobalJobList();
149 InitializePrintProvidor(LPPRINTPROVIDOR pPrintProvidor
, DWORD cbPrintProvidor
, LPWSTR pFullRegistryPath
)
151 CopyMemory(pPrintProvidor
, &_PrintProviderFunctions
, min(cbPrintProvidor
, sizeof(PRINTPROVIDOR
)));
153 SetLastError(ERROR_SUCCESS
);