[LOCALSPL_APITEST]
[reactos.git] / reactos / win32ss / printing / base / spoolss / main.c
1 /*
2 * PROJECT: ReactOS Spooler Router
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>
6 */
7
8 #include "precomp.h"
9
10 HANDLE hProcessHeap;
11 PRINTPROVIDOR LocalSplFuncs;
12
13
14 BOOL WINAPI
15 ClosePrinter(HANDLE hPrinter)
16 {
17 return FALSE;
18 }
19
20 BOOL WINAPI
21 DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
22 {
23 switch (fdwReason)
24 {
25 case DLL_PROCESS_ATTACH:
26 DisableThreadLibraryCalls(hinstDLL);
27 hProcessHeap = GetProcessHeap();
28 break;
29 }
30
31 return TRUE;
32 }
33
34 BOOL WINAPI
35 EndDocPrinter(HANDLE hPrinter)
36 {
37 return FALSE;
38 }
39
40 BOOL WINAPI
41 EndPagePrinter(HANDLE hPrinter)
42 {
43 return FALSE;
44 }
45
46 BOOL WINAPI
47 EnumPrintersW(DWORD Flags, LPWSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
48 {
49 return FALSE;
50 }
51
52 BOOL WINAPI
53 GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
54 {
55 return FALSE;
56 }
57
58 BOOL WINAPI
59 GetPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
60 {
61 return FALSE;
62 }
63
64 BOOL WINAPI
65 GetPrintProcessorDirectoryW(LPWSTR pName, LPWSTR pEnvironment, DWORD Level, LPBYTE pPrintProcessorInfo, DWORD cbBuf, LPDWORD pcbNeeded)
66 {
67 return FALSE;
68 }
69
70 BOOL WINAPI
71 InitializeRouter(HANDLE SpoolerStatusHandle)
72 {
73 HINSTANCE hinstLocalSpl;
74 PInitializePrintProvidor pfnInitializePrintProvidor;
75
76 // Only initialize localspl.dll for now.
77 // This function should later look for all available print providers in the registry and initialize all of them.
78 hinstLocalSpl = LoadLibraryW(L"localspl");
79 if (!hinstLocalSpl)
80 {
81 ERR("LoadLibraryW for localspl failed with error %lu!\n", GetLastError());
82 return FALSE;
83 }
84
85 pfnInitializePrintProvidor = (PInitializePrintProvidor)GetProcAddress(hinstLocalSpl, "InitializePrintProvidor");
86 if (!pfnInitializePrintProvidor)
87 {
88 ERR("GetProcAddress failed with error %lu!\n", GetLastError());
89 return FALSE;
90 }
91
92 if (!pfnInitializePrintProvidor(&LocalSplFuncs, sizeof(PRINTPROVIDOR), NULL))
93 {
94 ERR("InitializePrintProvidor failed for localspl with error %lu!\n", GetLastError());
95 return FALSE;
96 }
97
98 return TRUE;
99 }
100
101 BOOL WINAPI
102 OpenPrinterW(LPWSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSW pDefault)
103 {
104 return FALSE;
105 }
106
107 DWORD WINAPI
108 StartDocPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pDocInfo)
109 {
110 return 0;
111 }
112
113 BOOL WINAPI
114 SplInitializeWinSpoolDrv(PVOID* pTable)
115 {
116 HINSTANCE hWinspool;
117 int i;
118
119 hWinspool = LoadLibraryW(L"winspool.drv");
120 if (!hWinspool)
121 {
122 ERR("Could not load winspool.drv, last error is %lu!\n", GetLastError());
123 return FALSE;
124 }
125
126 // Get the function pointers which are meant to be returned by this function.
127 pTable[0] = GetProcAddress(hWinspool, "OpenPrinterW");
128 pTable[1] = GetProcAddress(hWinspool, "ClosePrinter");
129 pTable[2] = GetProcAddress(hWinspool, "SpoolerDevQueryPrintW");
130 pTable[3] = GetProcAddress(hWinspool, "SpoolerPrinterEvent");
131 pTable[4] = GetProcAddress(hWinspool, "DocumentPropertiesW");
132 pTable[5] = GetProcAddress(hWinspool, (LPSTR)212);
133 pTable[6] = GetProcAddress(hWinspool, (LPSTR)213);
134 pTable[7] = GetProcAddress(hWinspool, (LPSTR)214);
135 pTable[8] = GetProcAddress(hWinspool, (LPSTR)215);
136
137 // Verify that all calls succeeded.
138 for (i = 0; i < 9; i++)
139 if (!pTable[i])
140 return FALSE;
141
142 return TRUE;
143 }
144
145 BOOL WINAPI
146 SplIsUpgrade()
147 {
148 return FALSE;
149 }
150
151 DWORD WINAPI
152 SpoolerInit()
153 {
154 // Nothing to do here yet
155 return ERROR_SUCCESS;
156 }
157
158 BOOL WINAPI
159 StartPagePrinter(HANDLE hPrinter)
160 {
161 return FALSE;
162 }
163
164 BOOL WINAPI
165 WritePrinter(HANDLE hPrinter, LPVOID pBuf, DWORD cbBuf, LPDWORD pcWritten)
166 {
167 return FALSE;
168 }
169
170 BOOL WINAPI
171 XcvDataW(HANDLE hXcv, PCWSTR pszDataName, PBYTE pInputData, DWORD cbInputData, PBYTE pOutputData, DWORD cbOutputData, PDWORD pcbOutputNeeded, PDWORD pdwStatus)
172 {
173 return FALSE;
174 }