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 Configuration Data
5 * COPYRIGHT: Copyright 2015-2017 Colin Finck (colin@reactos.org)
6 */
7
8 #include "precomp.h"
9
10 DWORD
_RpcDeletePrinterData(WINSPOOL_PRINTER_HANDLE hPrinter,WCHAR * pValueName)11 _RpcDeletePrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pValueName)
12 {
13 UNIMPLEMENTED;
14 return ERROR_INVALID_FUNCTION;
15 }
16
17 DWORD
_RpcDeletePrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter,const WCHAR * pKeyName,const WCHAR * pValueName)18 _RpcDeletePrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pKeyName, const WCHAR* pValueName)
19 {
20 UNIMPLEMENTED;
21 return ERROR_INVALID_FUNCTION;
22 }
23
24 DWORD
_RpcDeletePrinterKey(WINSPOOL_PRINTER_HANDLE hPrinter,const WCHAR * pKeyName)25 _RpcDeletePrinterKey(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pKeyName)
26 {
27 UNIMPLEMENTED;
28 return ERROR_INVALID_FUNCTION;
29 }
30
31 DWORD
_RpcEnumPrinterData(WINSPOOL_PRINTER_HANDLE hPrinter,DWORD dwIndex,WCHAR * pValueName,DWORD cbValueName,DWORD * pcbValueName,DWORD * pType,BYTE * pData,DWORD cbData,DWORD * pcbData)32 _RpcEnumPrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD dwIndex, WCHAR* pValueName, DWORD cbValueName, DWORD* pcbValueName, DWORD* pType, BYTE* pData, DWORD cbData, DWORD* pcbData)
33 {
34 UNIMPLEMENTED;
35 return ERROR_INVALID_FUNCTION;
36 }
37
38 DWORD
_RpcEnumPrinterKey(WINSPOOL_PRINTER_HANDLE hPrinter,const WCHAR * pKeyName,WCHAR * pSubkey,DWORD cbSubkey,DWORD * pcbSubkey)39 _RpcEnumPrinterKey(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pKeyName, WCHAR* pSubkey, DWORD cbSubkey, DWORD* pcbSubkey)
40 {
41 UNIMPLEMENTED;
42 return ERROR_INVALID_FUNCTION;
43 }
44
45 DWORD
_RpcEnumPrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter,const WCHAR * pKeyName,BYTE * pEnumValues,DWORD cbEnumValues,DWORD * pcbEnumValues,DWORD * pnEnumValues)46 _RpcEnumPrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pKeyName, BYTE* pEnumValues, DWORD cbEnumValues, DWORD* pcbEnumValues, DWORD* pnEnumValues)
47 {
48 UNIMPLEMENTED;
49 return ERROR_INVALID_FUNCTION;
50 }
51
52 DWORD
_RpcGetPrinterData(WINSPOOL_PRINTER_HANDLE hPrinter,WCHAR * pValueName,DWORD * pType,BYTE * pData,DWORD nSize,DWORD * pcbNeeded)53 _RpcGetPrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pValueName, DWORD* pType, BYTE* pData, DWORD nSize, DWORD* pcbNeeded)
54 {
55 return _RpcGetPrinterDataEx(hPrinter, L"PrinterDriverData", pValueName, pType, pData, nSize, pcbNeeded);
56 }
57
58 DWORD
_RpcGetPrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter,const WCHAR * pKeyName,const WCHAR * pValueName,DWORD * pType,BYTE * pData,DWORD nSize,DWORD * pcbNeeded)59 _RpcGetPrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pKeyName, const WCHAR* pValueName, DWORD* pType, BYTE* pData, DWORD nSize, DWORD* pcbNeeded)
60 {
61 DWORD dwErrorCode;
62
63 dwErrorCode = RpcImpersonateClient(NULL);
64 if (dwErrorCode != ERROR_SUCCESS)
65 {
66 ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
67 return dwErrorCode;
68 }
69
70 dwErrorCode = GetPrinterDataExW(hPrinter, pKeyName, pValueName, pType, pData, nSize, pcbNeeded);
71
72 RpcRevertToSelf();
73
74 return dwErrorCode;
75 }
76
77 DWORD
_RpcSetPrinterData(WINSPOOL_PRINTER_HANDLE hPrinter,WCHAR * pValueName,DWORD Type,BYTE * pData,DWORD cbData)78 _RpcSetPrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pValueName, DWORD Type, BYTE* pData, DWORD cbData)
79 {
80 return _RpcSetPrinterDataEx(hPrinter, L"PrinterDriverData", pValueName, Type, pData, cbData);
81 }
82
83 DWORD
_RpcSetPrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter,const WCHAR * pKeyName,const WCHAR * pValueName,DWORD Type,BYTE * pData,DWORD cbData)84 _RpcSetPrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pKeyName, const WCHAR* pValueName, DWORD Type, BYTE* pData, DWORD cbData)
85 {
86 DWORD dwErrorCode;
87
88 dwErrorCode = RpcImpersonateClient(NULL);
89 if (dwErrorCode != ERROR_SUCCESS)
90 {
91 ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
92 return dwErrorCode;
93 }
94
95 dwErrorCode = SetPrinterDataExW(hPrinter, pKeyName, pValueName, Type, pData, cbData);
96
97 RpcRevertToSelf();
98
99 return dwErrorCode;
100 }
101