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 DWORD cbCurrentEnvironment
= sizeof(wszCurrentEnvironment
);
28 const WCHAR wszDefaultDocumentName
[] = L
"Local Downlevel Document";
30 const WCHAR
* wszPrintProviderInfo
[3] = {
31 L
"Windows NT Local Print Providor", // Name
32 L
"Windows NT Local Printers", // Description
33 L
"Locally connected Printers" // Comment
37 static const PRINTPROVIDOR _PrintProviderFunctions
= {
38 LocalOpenPrinter
, // fpOpenPrinter
39 LocalSetJob
, // fpSetJob
40 LocalGetJob
, // fpGetJob
41 LocalEnumJobs
, // fpEnumJobs
43 NULL
, // fpDeletePrinter
46 LocalEnumPrinters
, // fpEnumPrinters
47 NULL
, // fpAddPrinterDriver
48 NULL
, // fpEnumPrinterDrivers
49 NULL
, // fpGetPrinterDriver
50 NULL
, // fpGetPrinterDriverDirectory
51 NULL
, // fpDeletePrinterDriver
52 NULL
, // fpAddPrintProcessor
53 LocalEnumPrintProcessors
, // fpEnumPrintProcessors
54 LocalGetPrintProcessorDirectory
, // fpGetPrintProcessorDirectory
55 NULL
, // fpDeletePrintProcessor
56 LocalEnumPrintProcessorDatatypes
, // fpEnumPrintProcessorDatatypes
57 LocalStartDocPrinter
, // fpStartDocPrinter
58 LocalStartPagePrinter
, // fpStartPagePrinter
59 LocalWritePrinter
, // fpWritePrinter
60 LocalEndPagePrinter
, // fpEndPagePrinter
61 NULL
, // fpAbortPrinter
62 NULL
, // fpReadPrinter
63 LocalEndDocPrinter
, // fpEndDocPrinter
64 LocalAddJob
, // fpAddJob
65 LocalScheduleJob
, // fpScheduleJob
66 NULL
, // fpGetPrinterData
67 NULL
, // fpSetPrinterData
68 NULL
, // fpWaitForPrinterChange
69 LocalClosePrinter
, // fpClosePrinter
75 LocalEnumMonitors
, // fpEnumMonitors
76 LocalEnumPorts
, // fpEnumPorts
78 NULL
, // fpConfigurePort
80 NULL
, // fpCreatePrinterIC
81 NULL
, // fpPlayGdiScriptOnPrinterIC
82 NULL
, // fpDeletePrinterIC
83 NULL
, // fpAddPrinterConnection
84 NULL
, // fpDeletePrinterConnection
85 NULL
, // fpPrinterMessageBox
87 NULL
, // fpDeleteMonitor
88 NULL
, // fpResetPrinter
89 NULL
, // fpGetPrinterDriverEx
90 NULL
, // fpFindFirstPrinterChangeNotification
91 NULL
, // fpFindClosePrinterChangeNotification
94 NULL
, // fpRefreshPrinterChangeNotification
95 NULL
, // fpOpenPrinterEx
96 NULL
, // fpAddPrinterEx
98 NULL
, // fpEnumPrinterData
99 NULL
, // fpDeletePrinterData
100 NULL
, // fpClusterSplOpen
101 NULL
, // fpClusterSplClose
102 NULL
, // fpClusterSplIsAlive
103 NULL
, // fpSetPrinterDataEx
104 NULL
, // fpGetPrinterDataEx
105 NULL
, // fpEnumPrinterDataEx
106 NULL
, // fpEnumPrinterKey
107 NULL
, // fpDeletePrinterDataEx
108 NULL
, // fpDeletePrinterKey
109 NULL
, // fpSeekPrinter
110 NULL
, // fpDeletePrinterDriverEx
111 NULL
, // fpAddPerMachineConnection
112 NULL
, // fpDeletePerMachineConnection
113 NULL
, // fpEnumPerMachineConnections
115 NULL
, // fpAddPrinterDriverEx
116 NULL
, // fpSplReadPrinter
117 NULL
, // fpDriverUnloadComplete
118 NULL
, // fpGetSpoolFileInfo
119 NULL
, // fpCommitSpoolData
120 NULL
, // fpCloseSpoolFileHandle
121 NULL
, // fpFlushPrinter
122 NULL
, // fpSendRecvBidiData
123 NULL
, // fpAddDriverCatalog
129 const WCHAR wszSpoolPath
[] = L
"\\spool";
130 const DWORD cchSpoolPath
= _countof(wszSpoolPath
) - 1;
132 // Get the system directory and append the "spool" subdirectory.
133 // Forget about length checks here. If this doesn't fit into MAX_PATH, our OS has more serious problems...
134 cchSpoolDirectory
= GetSystemDirectoryW(wszSpoolDirectory
, MAX_PATH
);
135 CopyMemory(&wszSpoolDirectory
[cchSpoolDirectory
], wszSpoolPath
, (cchSpoolPath
+ 1) * sizeof(WCHAR
));
136 cchSpoolDirectory
+= cchSpoolPath
;
140 DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
144 case DLL_PROCESS_ATTACH
:
145 DisableThreadLibraryCalls(hinstDLL
);
146 _GetSpoolDirectory();
148 return InitializePrintMonitorList() &&
149 InitializePortList() &&
150 InitializePrintProcessorList() &&
151 InitializePrinterList() &&
152 InitializeGlobalJobList();
160 InitializePrintProvidor(LPPRINTPROVIDOR pPrintProvidor
, DWORD cbPrintProvidor
, LPWSTR pFullRegistryPath
)
162 CopyMemory(pPrintProvidor
, &_PrintProviderFunctions
, min(cbPrintProvidor
, sizeof(PRINTPROVIDOR
)));
164 SetLastError(ERROR_SUCCESS
);