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 Colin Finck <colin@reactos.org>
11 WCHAR wszSpoolDirectory
[MAX_PATH
];
12 DWORD cchSpoolDirectory
;
15 const WCHAR wszCurrentEnvironment
[] =
18 #elif defined(_AMD64_)
23 #error Unsupported architecture
26 const WCHAR wszDefaultDocumentName
[] = L
"Local Downlevel Document";
28 const WCHAR
* wszPrintProviderInfo
[3] = {
29 L
"Windows NT Local Print Providor", // Name
30 L
"Windows NT Local Printers", // Description
31 L
"Locally connected Printers" // Comment
35 static const PRINTPROVIDOR _PrintProviderFunctions
= {
36 LocalOpenPrinter
, // fpOpenPrinter
38 LocalGetJob
, // fpGetJob
41 NULL
, // fpDeletePrinter
44 LocalEnumPrinters
, // fpEnumPrinters
45 NULL
, // fpAddPrinterDriver
46 NULL
, // fpEnumPrinterDrivers
47 NULL
, // fpGetPrinterDriver
48 NULL
, // fpGetPrinterDriverDirectory
49 NULL
, // fpDeletePrinterDriver
50 NULL
, // fpAddPrintProcessor
51 LocalEnumPrintProcessors
, // fpEnumPrintProcessors
52 LocalGetPrintProcessorDirectory
, // fpGetPrintProcessorDirectory
53 NULL
, // fpDeletePrintProcessor
54 LocalEnumPrintProcessorDatatypes
, // fpEnumPrintProcessorDatatypes
55 LocalStartDocPrinter
, // fpStartDocPrinter
56 LocalStartPagePrinter
, // fpStartPagePrinter
57 LocalWritePrinter
, // fpWritePrinter
58 LocalEndPagePrinter
, // fpEndPagePrinter
59 NULL
, // fpAbortPrinter
60 NULL
, // fpReadPrinter
61 LocalEndDocPrinter
, // fpEndDocPrinter
62 LocalAddJob
, // fpAddJob
63 NULL
, // fpScheduleJob
64 NULL
, // fpGetPrinterData
65 NULL
, // fpSetPrinterData
66 NULL
, // fpWaitForPrinterChange
67 LocalClosePrinter
, // fpClosePrinter
73 NULL
, // fpEnumMonitors
76 NULL
, // fpConfigurePort
78 NULL
, // fpCreatePrinterIC
79 NULL
, // fpPlayGdiScriptOnPrinterIC
80 NULL
, // fpDeletePrinterIC
81 NULL
, // fpAddPrinterConnection
82 NULL
, // fpDeletePrinterConnection
83 NULL
, // fpPrinterMessageBox
85 NULL
, // fpDeleteMonitor
86 NULL
, // fpResetPrinter
87 NULL
, // fpGetPrinterDriverEx
88 NULL
, // fpFindFirstPrinterChangeNotification
89 NULL
, // fpFindClosePrinterChangeNotification
92 NULL
, // fpRefreshPrinterChangeNotification
93 NULL
, // fpOpenPrinterEx
94 NULL
, // fpAddPrinterEx
96 NULL
, // fpEnumPrinterData
97 NULL
, // fpDeletePrinterData
98 NULL
, // fpClusterSplOpen
99 NULL
, // fpClusterSplClose
100 NULL
, // fpClusterSplIsAlive
101 NULL
, // fpSetPrinterDataEx
102 NULL
, // fpGetPrinterDataEx
103 NULL
, // fpEnumPrinterDataEx
104 NULL
, // fpEnumPrinterKey
105 NULL
, // fpDeletePrinterDataEx
106 NULL
, // fpDeletePrinterKey
107 NULL
, // fpSeekPrinter
108 NULL
, // fpDeletePrinterDriverEx
109 NULL
, // fpAddPerMachineConnection
110 NULL
, // fpDeletePerMachineConnection
111 NULL
, // fpEnumPerMachineConnections
113 NULL
, // fpAddPrinterDriverEx
114 NULL
, // fpSplReadPrinter
115 NULL
, // fpDriverUnloadComplete
116 NULL
, // fpGetSpoolFileInfo
117 NULL
, // fpCommitSpoolData
118 NULL
, // fpCloseSpoolFileHandle
119 NULL
, // fpFlushPrinter
120 NULL
, // fpSendRecvBidiData
121 NULL
, // fpAddDriverCatalog
127 const WCHAR wszSpoolPath
[] = L
"\\spool";
128 const DWORD cchSpoolPath
= _countof(wszSpoolPath
) - 1;
130 // Get the system directory and append the "spool" subdirectory.
131 // Forget about length checks here. If this doesn't fit into MAX_PATH, our OS has more serious problems...
132 cchSpoolDirectory
= GetSystemDirectoryW(wszSpoolDirectory
, MAX_PATH
);
133 CopyMemory(&wszSpoolDirectory
[cchSpoolDirectory
], wszSpoolPath
, (cchSpoolPath
+ 1) * sizeof(WCHAR
));
134 cchSpoolDirectory
+= cchSpoolPath
;
138 DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
142 case DLL_PROCESS_ATTACH
:
143 DisableThreadLibraryCalls(hinstDLL
);
144 _GetSpoolDirectory();
145 InitializePrintProcessorList();
146 InitializePrinterList();
147 InitializeGlobalJobList();
155 InitializePrintProvidor(LPPRINTPROVIDOR pPrintProvidor
, DWORD cbPrintProvidor
, LPWSTR pFullRegistryPath
)
157 CopyMemory(pPrintProvidor
, &_PrintProviderFunctions
, min(cbPrintProvidor
, sizeof(PRINTPROVIDOR
)));
159 SetLastError(ERROR_SUCCESS
);