ReactOS  0.4.14-dev-323-g6fe6a88
printerdata.c
Go to the documentation of this file.
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
12 {
15 }
16 
17 DWORD
18 _RpcDeletePrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pKeyName, const WCHAR* pValueName)
19 {
22 }
23 
24 DWORD
26 {
29 }
30 
31 DWORD
32 _RpcEnumPrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD dwIndex, WCHAR* pValueName, DWORD cbValueName, DWORD* pcbValueName, DWORD* pType, BYTE* pData, DWORD cbData, DWORD* pcbData)
33 {
36 }
37 
38 DWORD
39 _RpcEnumPrinterKey(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pKeyName, WCHAR* pSubkey, DWORD cbSubkey, DWORD* pcbSubkey)
40 {
43 }
44 
45 DWORD
46 _RpcEnumPrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pKeyName, BYTE* pEnumValues, DWORD cbEnumValues, DWORD* pcbEnumValues, DWORD* pnEnumValues)
47 {
50 }
51 
52 DWORD
54 {
55  return _RpcGetPrinterDataEx(hPrinter, L"PrinterDriverData", pValueName, pType, pData, nSize, pcbNeeded);
56 }
57 
58 DWORD
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 
73 
74  return dwErrorCode;
75 }
76 
77 DWORD
79 {
80  return _RpcSetPrinterDataEx(hPrinter, L"PrinterDriverData", pValueName, Type, pData, cbData);
81 }
82 
83 DWORD
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 
98 
99  return dwErrorCode;
100 }
DWORD WINAPI SetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName, LPCWSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData)
Definition: printerdata.c:38
Type
Definition: Type.h:6
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
DWORD _RpcSetPrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR *pKeyName, const WCHAR *pValueName, DWORD Type, BYTE *pData, DWORD cbData)
Definition: printerdata.c:84
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2031
DWORD _RpcEnumPrinterKey(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR *pKeyName, WCHAR *pSubkey, DWORD cbSubkey, DWORD *pcbSubkey)
Definition: printerdata.c:39
DWORD _RpcSetPrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR *pValueName, DWORD Type, BYTE *pData, DWORD cbData)
Definition: printerdata.c:78
DWORD WINAPI GetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName, LPCWSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded)
Definition: printerdata.c:11
DWORD _RpcEnumPrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR *pKeyName, BYTE *pEnumValues, DWORD cbEnumValues, DWORD *pcbEnumValues, DWORD *pnEnumValues)
Definition: printerdata.c:46
smooth NULL
Definition: ftsmooth.c:416
DWORD _RpcGetPrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR *pValueName, DWORD *pType, BYTE *pData, DWORD nSize, DWORD *pcbNeeded)
Definition: printerdata.c:53
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1460
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD _RpcDeletePrinterKey(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR *pKeyName)
Definition: printerdata.c:25
DWORD _RpcDeletePrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR *pKeyName, const WCHAR *pValueName)
Definition: printerdata.c:18
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD _RpcDeletePrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR *pValueName)
Definition: printerdata.c:11
static const WCHAR L[]
Definition: oid.c:1250
unsigned char BYTE
Definition: mem.h:68
#define ERR(fmt,...)
Definition: debug.h:109
DWORD _RpcGetPrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR *pKeyName, const WCHAR *pValueName, DWORD *pType, BYTE *pData, DWORD nSize, DWORD *pcbNeeded)
Definition: printerdata.c:59
_In_ DWORD _Out_ PDWORD pcbNeeded
Definition: winddi.h:3827
DWORD _RpcEnumPrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD dwIndex, WCHAR *pValueName, DWORD cbValueName, DWORD *pcbValueName, DWORD *pType, BYTE *pData, DWORD cbData, DWORD *pcbData)
Definition: printerdata.c:32
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1053
#define UNIMPLEMENTED
Definition: debug.h:114
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
_In_ DWORD _Out_writes_bytes_to_opt_ pcbData void _Inout_ DWORD * pcbData
Definition: wincrypt.h:4953