[Printing] Part of GDI Support
[reactos.git] / win32ss / printing / base / spoolsv / printerdrivers.c
1 /*
2 * PROJECT: ReactOS Print Spooler Service
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Functions related to Printer Drivers
5 * COPYRIGHT: Copyright 2015 Colin Finck (colin@reactos.org)
6 */
7
8 #include "precomp.h"
9 #include "marshalling/printerdrivers.h"
10
11 DWORD
12 _RpcAddPrinterDriver(WINSPOOL_HANDLE pName, WINSPOOL_DRIVER_CONTAINER* pDriverContainer)
13 {
14 UNIMPLEMENTED;
15 return ERROR_INVALID_FUNCTION;
16 }
17
18 DWORD
19 _RpcAddPrinterDriverEx(WINSPOOL_HANDLE pName, WINSPOOL_DRIVER_CONTAINER* pDriverContainer, DWORD dwFileCopyFlags)
20 {
21 UNIMPLEMENTED;
22 return ERROR_INVALID_FUNCTION;
23 }
24
25 DWORD
26 _RpcDeletePrinterDriver(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, WCHAR* pDriverName)
27 {
28 UNIMPLEMENTED;
29 return ERROR_INVALID_FUNCTION;
30 }
31
32 DWORD
33 _RpcDeletePrinterDriverEx(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, WCHAR* pDriverName, DWORD dwDeleteFlag, DWORD dwVersionNum)
34 {
35 UNIMPLEMENTED;
36 return ERROR_INVALID_FUNCTION;
37 }
38
39 DWORD
40 _RpcEnumPrinterDrivers(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, DWORD Level, BYTE* pDrivers, DWORD cbBuf, DWORD* pcbNeeded, DWORD* pcReturned)
41 {
42 UNIMPLEMENTED;
43 return ERROR_INVALID_FUNCTION;
44 }
45
46 DWORD
47 _RpcGetPrinterDriver(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pEnvironment, DWORD Level, BYTE* pDriver, DWORD cbBuf, DWORD* pcbNeeded)
48 {
49 DWORD dwErrorCode;
50 PBYTE pDriverAligned;
51
52 ERR("_RpcGetPrinterDriver(%p, %lu, %lu, %p, %lu, %p)\n", hPrinter, pEnvironment, Level, pDriver, cbBuf, pcbNeeded);
53
54 dwErrorCode = RpcImpersonateClient(NULL);
55 if (dwErrorCode != ERROR_SUCCESS)
56 {
57 ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
58 return dwErrorCode;
59 }
60
61 pDriverAligned = AlignRpcPtr(pDriver, &cbBuf);
62
63 if (GetPrinterDriverW(hPrinter, pEnvironment, Level, pDriverAligned, cbBuf, pcbNeeded))
64 {
65 // Replace relative offset addresses in the output by absolute pointers.
66 ASSERT(Level >= 1 && Level <= 5);
67 MarshallDownStructure(pDriverAligned, pPrinterDriverMarshalling[Level]->pInfo, pPrinterDriverMarshalling[Level]->cbStructureSize, TRUE);
68 }
69 else
70 {
71 dwErrorCode = GetLastError();
72 }
73
74 RpcRevertToSelf();
75 UndoAlignRpcPtr(pDriver, pDriverAligned, cbBuf, pcbNeeded);
76
77 return dwErrorCode;
78 }
79
80 DWORD
81 _RpcGetPrinterDriver2(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pEnvironment, DWORD Level, BYTE* pDriver, DWORD cbBuf, DWORD* pcbNeeded, DWORD dwClientMajorVersion, DWORD dwClientMinorVersion, DWORD* pdwServerMaxVersion, DWORD* pdwServerMinVersion)
82 {
83 UNIMPLEMENTED;
84 return ERROR_INVALID_FUNCTION;
85 }
86
87 DWORD
88 _RpcGetPrinterDriverDirectory(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, DWORD Level, BYTE* pDriverDirectory, DWORD cbBuf, DWORD* pcbNeeded)
89 {
90 UNIMPLEMENTED;
91 return ERROR_INVALID_FUNCTION;
92 }