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>
12 WCHAR wszSpoolDirectory
[MAX_PATH
];
13 DWORD cchSpoolDirectory
;
16 const WCHAR wszCurrentEnvironment
[] =
19 #elif defined(_AMD64_)
24 #error Unsupported architecture
27 static const PRINTPROVIDOR PrintProviderFunctions
= {
28 LocalOpenPrinter
, // fpOpenPrinter
33 NULL
, // fpDeletePrinter
36 LocalEnumPrinters
, // fpEnumPrinters
37 NULL
, // fpAddPrinterDriver
38 NULL
, // fpEnumPrinterDrivers
39 NULL
, // fpGetPrinterDriver
40 NULL
, // fpGetPrinterDriverDirectory
41 NULL
, // fpDeletePrinterDriver
42 NULL
, // fpAddPrintProcessor
43 LocalEnumPrintProcessors
, // fpEnumPrintProcessors
44 LocalGetPrintProcessorDirectory
, // fpGetPrintProcessorDirectory
45 NULL
, // fpDeletePrintProcessor
46 LocalEnumPrintProcessorDatatypes
, // fpEnumPrintProcessorDatatypes
47 LocalStartDocPrinter
, // fpStartDocPrinter
48 LocalStartPagePrinter
, // fpStartPagePrinter
49 LocalWritePrinter
, // fpWritePrinter
50 LocalEndPagePrinter
, // fpEndPagePrinter
51 NULL
, // fpAbortPrinter
52 NULL
, // fpReadPrinter
53 LocalEndDocPrinter
, // fpEndDocPrinter
55 NULL
, // fpScheduleJob
56 NULL
, // fpGetPrinterData
57 NULL
, // fpSetPrinterData
58 NULL
, // fpWaitForPrinterChange
59 LocalClosePrinter
, // fpClosePrinter
65 NULL
, // fpEnumMonitors
68 NULL
, // fpConfigurePort
70 NULL
, // fpCreatePrinterIC
71 NULL
, // fpPlayGdiScriptOnPrinterIC
72 NULL
, // fpDeletePrinterIC
73 NULL
, // fpAddPrinterConnection
74 NULL
, // fpDeletePrinterConnection
75 NULL
, // fpPrinterMessageBox
77 NULL
, // fpDeleteMonitor
78 NULL
, // fpResetPrinter
79 NULL
, // fpGetPrinterDriverEx
80 NULL
, // fpFindFirstPrinterChangeNotification
81 NULL
, // fpFindClosePrinterChangeNotification
84 NULL
, // fpRefreshPrinterChangeNotification
85 NULL
, // fpOpenPrinterEx
86 NULL
, // fpAddPrinterEx
88 NULL
, // fpEnumPrinterData
89 NULL
, // fpDeletePrinterData
90 NULL
, // fpClusterSplOpen
91 NULL
, // fpClusterSplClose
92 NULL
, // fpClusterSplIsAlive
93 NULL
, // fpSetPrinterDataEx
94 NULL
, // fpGetPrinterDataEx
95 NULL
, // fpEnumPrinterDataEx
96 NULL
, // fpEnumPrinterKey
97 NULL
, // fpDeletePrinterDataEx
98 NULL
, // fpDeletePrinterKey
99 NULL
, // fpSeekPrinter
100 NULL
, // fpDeletePrinterDriverEx
101 NULL
, // fpAddPerMachineConnection
102 NULL
, // fpDeletePerMachineConnection
103 NULL
, // fpEnumPerMachineConnections
105 NULL
, // fpAddPrinterDriverEx
106 NULL
, // fpSplReadPrinter
107 NULL
, // fpDriverUnloadComplete
108 NULL
, // fpGetSpoolFileInfo
109 NULL
, // fpCommitSpoolData
110 NULL
, // fpCloseSpoolFileHandle
111 NULL
, // fpFlushPrinter
112 NULL
, // fpSendRecvBidiData
113 NULL
, // fpAddDriverCatalog
119 const WCHAR wszSpoolPath
[] = L
"\\spool";
120 const DWORD cchSpoolPath
= sizeof(wszSpoolPath
) / sizeof(WCHAR
) - 1;
122 // Get the system directory and append the "spool" subdirectory.
123 // Forget about length checks here. If this doesn't fit into MAX_PATH, our OS has more serious problems...
124 cchSpoolDirectory
= GetSystemDirectoryW(wszSpoolDirectory
, MAX_PATH
);
125 CopyMemory(&wszSpoolDirectory
[cchSpoolDirectory
], wszSpoolPath
, (cchSpoolPath
+ 1) * sizeof(WCHAR
));
126 cchSpoolDirectory
+= cchSpoolPath
;
130 DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
134 case DLL_PROCESS_ATTACH
:
135 DisableThreadLibraryCalls(hinstDLL
);
136 hProcessHeap
= GetProcessHeap();
137 _GetSpoolDirectory();
138 InitializePrintProcessorTable();
139 InitializePrinterTable();
147 InitializePrintProvidor(LPPRINTPROVIDOR pPrintProvidor
, DWORD cbPrintProvidor
, LPWSTR pFullRegistryPath
)
151 if (cbPrintProvidor
< sizeof(PRINTPROVIDOR
))
152 cbCopy
= cbPrintProvidor
;
154 cbCopy
= sizeof(PRINTPROVIDOR
);
156 CopyMemory(pPrintProvidor
, &PrintProviderFunctions
, cbCopy
);