Reactos
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
10DWORD
11_RpcDeletePrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pValueName)
12{
13 UNIMPLEMENTED;
14 return ERROR_INVALID_FUNCTION;
15}
16
17DWORD
18_RpcDeletePrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pKeyName, const WCHAR* pValueName)
19{
20 UNIMPLEMENTED;
21 return ERROR_INVALID_FUNCTION;
22}
23
24DWORD
25_RpcDeletePrinterKey(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pKeyName)
26{
27 UNIMPLEMENTED;
28 return ERROR_INVALID_FUNCTION;
29}
30
31DWORD
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
38DWORD
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
45DWORD
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
52DWORD
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
58DWORD
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
77DWORD
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
83DWORD
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}