ReactOS  0.4.15-dev-499-g1f31905
printerdata.c File Reference
#include "precomp.h"
Include dependency graph for printerdata.c:

Go to the source code of this file.

Functions

LONG WINAPI AdvancedSetupDialog (HWND hWnd, INT Unknown, PDEVMODEA pDevModeInput, PDEVMODEA pDevModeOutput)
 
LONG WINAPI AdvancedDocumentPropertiesA (HWND hWnd, HANDLE hPrinter, PSTR pDeviceName, PDEVMODEA pDevModeOutput, PDEVMODEA pDevModeInput)
 
LONG WINAPI AdvancedDocumentPropertiesW (HWND hWnd, HANDLE hPrinter, PWSTR pDeviceName, PDEVMODEW pDevModeOutput, PDEVMODEW pDevModeInput)
 
DWORD WINAPI DeletePrinterDataA (HANDLE hPrinter, PSTR pValueName)
 
DWORD WINAPI DeletePrinterDataExA (HANDLE hPrinter, PCSTR pKeyName, PCSTR pValueName)
 
DWORD WINAPI DeletePrinterDataExW (HANDLE hPrinter, PCWSTR pKeyName, PCWSTR pValueName)
 
DWORD WINAPI DeletePrinterDataW (HANDLE hPrinter, PWSTR pValueName)
 
DWORD WINAPI DeletePrinterKeyA (HANDLE hPrinter, PCSTR pKeyName)
 
DWORD WINAPI DeletePrinterKeyW (HANDLE hPrinter, PCWSTR pKeyName)
 
DWORD WINAPI EnumPrinterDataA (HANDLE hPrinter, DWORD dwIndex, PSTR pValueName, DWORD cbValueName, PDWORD pcbValueName, PDWORD pType, PBYTE pData, DWORD cbData, PDWORD pcbData)
 
DWORD WINAPI EnumPrinterDataExA (HANDLE hPrinter, PCSTR pKeyName, PBYTE pEnumValues, DWORD cbEnumValues, PDWORD pcbEnumValues, PDWORD pnEnumValues)
 
DWORD WINAPI EnumPrinterDataExW (HANDLE hPrinter, PCWSTR pKeyName, PBYTE pEnumValues, DWORD cbEnumValues, PDWORD pcbEnumValues, PDWORD pnEnumValues)
 
DWORD WINAPI EnumPrinterDataW (HANDLE hPrinter, DWORD dwIndex, PWSTR pValueName, DWORD cbValueName, PDWORD pcbValueName, PDWORD pType, PBYTE pData, DWORD cbData, PDWORD pcbData)
 
DWORD WINAPI EnumPrinterKeyA (HANDLE hPrinter, PCSTR pKeyName, PSTR pSubkey, DWORD cbSubkey, PDWORD pcbSubkey)
 
DWORD WINAPI EnumPrinterKeyW (HANDLE hPrinter, PCWSTR pKeyName, PWSTR pSubkey, DWORD cbSubkey, PDWORD pcbSubkey)
 
DWORD WINAPI GetPrinterDataA (HANDLE hPrinter, LPSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded)
 
DWORD WINAPI GetPrinterDataExA (HANDLE hPrinter, LPCSTR pKeyName, LPCSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded)
 
DWORD WINAPI GetPrinterDataExW (HANDLE hPrinter, LPCWSTR pKeyName, LPCWSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded)
 
DWORD WINAPI GetPrinterDataW (HANDLE hPrinter, LPWSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded)
 
DWORD WINAPI SetPrinterDataA (HANDLE hPrinter, PSTR pValueName, DWORD Type, PBYTE pData, DWORD cbData)
 
DWORD WINAPI SetPrinterDataExA (HANDLE hPrinter, LPCSTR pKeyName, LPCSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData)
 
DWORD WINAPI SetPrinterDataExW (HANDLE hPrinter, LPCWSTR pKeyName, LPCWSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData)
 
DWORD WINAPI SetPrinterDataW (HANDLE hPrinter, PWSTR pValueName, DWORD Type, PBYTE pData, DWORD cbData)
 

Function Documentation

◆ AdvancedDocumentPropertiesA()

LONG WINAPI AdvancedDocumentPropertiesA ( HWND  hWnd,
HANDLE  hPrinter,
PSTR  pDeviceName,
PDEVMODEA  pDevModeOutput,
PDEVMODEA  pDevModeInput 
)

Definition at line 27 of file printerdata.c.

28 {
29  TRACE("AdvancedDocumentPropertiesA(%p, %p, %s, %p, %p)\n", hWnd, hPrinter, pDeviceName, pDevModeOutput, pDevModeInput);
31  return 0;
32 }
HWND hWnd
Definition: settings.c:17
#define TRACE(s)
Definition: solgame.cpp:4
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by AdvancedSetupDialog().

◆ AdvancedDocumentPropertiesW()

LONG WINAPI AdvancedDocumentPropertiesW ( HWND  hWnd,
HANDLE  hPrinter,
PWSTR  pDeviceName,
PDEVMODEW  pDevModeOutput,
PDEVMODEW  pDevModeInput 
)

Definition at line 35 of file printerdata.c.

36 {
37  TRACE("AdvancedDocumentPropertiesW(%p, %p, %S, %p, %p)\n", hWnd, hPrinter, pDeviceName, pDevModeOutput, pDevModeInput);
39  return 0;
40 }
HWND hWnd
Definition: settings.c:17
#define TRACE(s)
Definition: solgame.cpp:4
#define UNIMPLEMENTED
Definition: debug.h:115

◆ AdvancedSetupDialog()

LONG WINAPI AdvancedSetupDialog ( HWND  hWnd,
INT  Unknown,
PDEVMODEA  pDevModeInput,
PDEVMODEA  pDevModeOutput 
)

Definition at line 11 of file printerdata.c.

12 {
13  HANDLE hPrinter;
14  LONG Ret = -1;
15 
16  TRACE("AdvancedSetupDialog(%p, %d, %p, %p)\n", hWnd, Unknown, pDevModeOutput, pDevModeInput);
17 
18  if ( OpenPrinterA( (LPSTR)pDevModeInput->dmDeviceName, &hPrinter, NULL ) )
19  {
20  Ret = AdvancedDocumentPropertiesA( hWnd, hPrinter, (PSTR)pDevModeInput->dmDeviceName, pDevModeOutput, pDevModeInput );
21  ClosePrinter(hPrinter);
22  }
23  return Ret;
24 }
HWND hWnd
Definition: settings.c:17
char * LPSTR
Definition: xmlstorage.h:182
LONG WINAPI AdvancedDocumentPropertiesA(HWND hWnd, HANDLE hPrinter, PSTR pDeviceName, PDEVMODEA pDevModeOutput, PDEVMODEA pDevModeInput)
Definition: printerdata.c:27
long LONG
Definition: pedump.c:60
WINBOOL WINAPI ClosePrinter(HANDLE hPrinter)
Definition: printers.c:12
smooth NULL
Definition: ftsmooth.c:416
WINBOOL WINAPI OpenPrinterA(LPSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSA pDefault)
Definition: printers.c:2556
#define TRACE(s)
Definition: solgame.cpp:4
signed char * PSTR
Definition: retypes.h:7
BYTE dmDeviceName[CCHDEVICENAME]
Definition: wingdi.h:1564

◆ DeletePrinterDataA()

DWORD WINAPI DeletePrinterDataA ( HANDLE  hPrinter,
PSTR  pValueName 
)

Definition at line 43 of file printerdata.c.

44 {
45  LPWSTR valuenameW = NULL;
46  INT len;
47  DWORD res;
48 
49  TRACE("DeletePrinterDataA(%p, %s)\n", hPrinter, pValueName);
50 
51  if (pValueName)
52  {
53  len = MultiByteToWideChar(CP_ACP, 0, pValueName, -1, NULL, 0);
54  valuenameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
55  MultiByteToWideChar(CP_ACP, 0, pValueName, -1, valuenameW, len);
56  }
57 
58  res = DeletePrinterDataW( hPrinter, valuenameW );
59 
60  HeapFree(GetProcessHeap(), 0, valuenameW);
61 
62  return res;
63 
64 }
#define CP_ACP
Definition: compat.h:99
int32_t INT
Definition: typedefs.h:57
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:404
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
DWORD WINAPI DeletePrinterDataW(HANDLE hPrinter, PWSTR pValueName)
Definition: printerdata.c:107
GLuint res
Definition: glext.h:9613
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:403

◆ DeletePrinterDataExA()

DWORD WINAPI DeletePrinterDataExA ( HANDLE  hPrinter,
PCSTR  pKeyName,
PCSTR  pValueName 
)

Definition at line 67 of file printerdata.c.

68 {
69  LPWSTR keynameW = NULL;
70  LPWSTR valuenameW = NULL;
71  INT len;
72  DWORD res;
73 
74  TRACE("DeletePrinterDataExA(%p, %s, %s)\n", hPrinter, pKeyName, pValueName);
75 
76  if (pKeyName)
77  {
78  len = MultiByteToWideChar(CP_ACP, 0, pKeyName, -1, NULL, 0);
79  keynameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
80  MultiByteToWideChar(CP_ACP, 0, pKeyName, -1, keynameW, len);
81  }
82 
83  if (pValueName)
84  {
85  len = MultiByteToWideChar(CP_ACP, 0, pValueName, -1, NULL, 0);
86  valuenameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
87  MultiByteToWideChar(CP_ACP, 0, pValueName, -1, valuenameW, len);
88  }
89 
90  res = DeletePrinterDataExW( hPrinter, keynameW, valuenameW );
91 
92  HeapFree(GetProcessHeap(), 0, keynameW);
93  HeapFree(GetProcessHeap(), 0, valuenameW);
94 
95  return res;
96 }
DWORD WINAPI DeletePrinterDataExW(HANDLE hPrinter, PCWSTR pKeyName, PCWSTR pValueName)
Definition: printerdata.c:99
#define CP_ACP
Definition: compat.h:99
int32_t INT
Definition: typedefs.h:57
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:404
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
GLuint res
Definition: glext.h:9613
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:403

◆ DeletePrinterDataExW()

DWORD WINAPI DeletePrinterDataExW ( HANDLE  hPrinter,
PCWSTR  pKeyName,
PCWSTR  pValueName 
)

Definition at line 99 of file printerdata.c.

100 {
101  TRACE("DeletePrinterDataExW(%p, %S, %S)\n", hPrinter, pKeyName, pValueName);
103  return ERROR_NOT_SUPPORTED;
104 }
#define TRACE(s)
Definition: solgame.cpp:4
#define ERROR_NOT_SUPPORTED
Definition: compat.h:90
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by DeletePrinterDataExA().

◆ DeletePrinterDataW()

DWORD WINAPI DeletePrinterDataW ( HANDLE  hPrinter,
PWSTR  pValueName 
)

Definition at line 107 of file printerdata.c.

108 {
109  TRACE("DeletePrinterDataW(%p, %S)\n", hPrinter, pValueName);
111  return ERROR_NOT_SUPPORTED;
112 }
#define TRACE(s)
Definition: solgame.cpp:4
#define ERROR_NOT_SUPPORTED
Definition: compat.h:90
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by DeletePrinterDataA().

◆ DeletePrinterKeyA()

DWORD WINAPI DeletePrinterKeyA ( HANDLE  hPrinter,
PCSTR  pKeyName 
)

Definition at line 115 of file printerdata.c.

116 {
117  LPWSTR keynameW = NULL;
118  INT len;
119  DWORD res;
120 
121  TRACE("DeletePrinterKeyA(%p, %s)\n", hPrinter, pKeyName);
122 
123  if (pKeyName)
124  {
125  len = MultiByteToWideChar(CP_ACP, 0, pKeyName, -1, NULL, 0);
126  keynameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
127  MultiByteToWideChar(CP_ACP, 0, pKeyName, -1, keynameW, len);
128  }
129 
130  res = DeletePrinterKeyW( hPrinter, keynameW );
131 
132  HeapFree(GetProcessHeap(), 0, keynameW);
133 
134  return res;
135 }
#define CP_ACP
Definition: compat.h:99
int32_t INT
Definition: typedefs.h:57
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:404
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
GLuint res
Definition: glext.h:9613
DWORD WINAPI DeletePrinterKeyW(HANDLE hPrinter, PCWSTR pKeyName)
Definition: printerdata.c:138
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:403

◆ DeletePrinterKeyW()

DWORD WINAPI DeletePrinterKeyW ( HANDLE  hPrinter,
PCWSTR  pKeyName 
)

Definition at line 138 of file printerdata.c.

139 {
140  TRACE("DeletePrinterKeyW(%p, %S)\n", hPrinter, pKeyName);
142  return ERROR_NOT_SUPPORTED;
143 }
#define TRACE(s)
Definition: solgame.cpp:4
#define ERROR_NOT_SUPPORTED
Definition: compat.h:90
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by DeletePrinterKeyA().

◆ EnumPrinterDataA()

DWORD WINAPI EnumPrinterDataA ( HANDLE  hPrinter,
DWORD  dwIndex,
PSTR  pValueName,
DWORD  cbValueName,
PDWORD  pcbValueName,
PDWORD  pType,
PBYTE  pData,
DWORD  cbData,
PDWORD  pcbData 
)

Definition at line 146 of file printerdata.c.

147 {
148  TRACE("EnumPrinterDataA(%p, %lu, %s, %lu, %p, %p, %p, %lu, %p)\n", hPrinter, dwIndex, pValueName, cbValueName, pcbValueName, pType, pData, cbData, pcbData);
150  return ERROR_NOT_SUPPORTED;
151 }
#define TRACE(s)
Definition: solgame.cpp:4
#define ERROR_NOT_SUPPORTED
Definition: compat.h:90
#define UNIMPLEMENTED
Definition: debug.h:115
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:4949

◆ EnumPrinterDataExA()

DWORD WINAPI EnumPrinterDataExA ( HANDLE  hPrinter,
PCSTR  pKeyName,
PBYTE  pEnumValues,
DWORD  cbEnumValues,
PDWORD  pcbEnumValues,
PDWORD  pnEnumValues 
)

Definition at line 154 of file printerdata.c.

155 {
156  INT len;
157  LPWSTR pKeyNameW;
158  DWORD ret, dwIndex, dwBufSize;
159  HANDLE hHeap;
160  LPSTR pBuffer;
161 
162  TRACE("EnumPrinterDataExA(%p, %s, %p, %lu, %p, %p)\n", hPrinter, pKeyName, pEnumValues, cbEnumValues, pcbEnumValues, pnEnumValues);
163 
164  if (pKeyName == NULL || *pKeyName == 0)
166 
167  len = MultiByteToWideChar (CP_ACP, 0, pKeyName, -1, NULL, 0);
168  if (len == 0)
169  {
170  ret = GetLastError ();
171  ERR ("MultiByteToWideChar failed with code %i\n", ret);
172  return ret;
173  }
174 
175  hHeap = GetProcessHeap ();
176  if (hHeap == NULL)
177  {
178  ERR ("GetProcessHeap failed\n");
179  return ERROR_OUTOFMEMORY;
180  }
181 
182  pKeyNameW = HeapAlloc (hHeap, 0, len * sizeof (WCHAR));
183  if (pKeyNameW == NULL)
184  {
185  ERR ("Failed to allocate %i bytes from process heap\n",
186  (LONG)(len * sizeof (WCHAR)));
187  return ERROR_OUTOFMEMORY;
188  }
189 
190  if (MultiByteToWideChar (CP_ACP, 0, pKeyName, -1, pKeyNameW, len) == 0)
191  {
192  ret = GetLastError ();
193  ERR ("MultiByteToWideChar failed with code %i\n", ret);
194  if (HeapFree (hHeap, 0, pKeyNameW) == 0)
195  WARN ("HeapFree failed with code %i\n", GetLastError ());
196  return ret;
197  }
198 
199  ret = EnumPrinterDataExW (hPrinter, pKeyNameW, pEnumValues, cbEnumValues, pcbEnumValues, pnEnumValues);
200 
201  if (ret != ERROR_SUCCESS)
202  {
203  if (HeapFree (hHeap, 0, pKeyNameW) == 0)
204  WARN ("HeapFree failed with code %i\n", GetLastError ());
205  TRACE ("EnumPrinterDataExW returned %i\n", ret);
206  return ret;
207  }
208 
209  if (HeapFree (hHeap, 0, pKeyNameW) == 0)
210  {
211  ret = GetLastError ();
212  ERR ("HeapFree failed with code %i\n", ret);
213  return ret;
214  }
215 
216  if (*pnEnumValues == 0) /* empty key */
217  return ERROR_SUCCESS;
218 
219  dwBufSize = 0;
220  for (dwIndex = 0; dwIndex < *pnEnumValues; ++dwIndex)
221  {
222  PPRINTER_ENUM_VALUESW ppev =
223  &((PPRINTER_ENUM_VALUESW) pEnumValues)[dwIndex];
224 
225  if (dwBufSize < ppev->cbValueName)
226  dwBufSize = ppev->cbValueName;
227 
228  if (dwBufSize < ppev->cbData && (ppev->dwType == REG_SZ ||
229  ppev->dwType == REG_EXPAND_SZ || ppev->dwType == REG_MULTI_SZ))
230  dwBufSize = ppev->cbData;
231  }
232 
233  TRACE ("Largest Unicode name or value is %i bytes\n", dwBufSize);
234 
235  pBuffer = HeapAlloc (hHeap, 0, dwBufSize);
236  if (pBuffer == NULL)
237  {
238  ERR ("Failed to allocate %i bytes from process heap\n", dwBufSize);
239  return ERROR_OUTOFMEMORY;
240  }
241 
242  for (dwIndex = 0; dwIndex < *pnEnumValues; ++dwIndex)
243  {
244  PPRINTER_ENUM_VALUESW ppev =
245  &((PPRINTER_ENUM_VALUESW) pEnumValues)[dwIndex];
246 
248  ppev->cbValueName / sizeof (WCHAR), pBuffer, dwBufSize, NULL,
249  NULL);
250  if (len == 0)
251  {
252  ret = GetLastError ();
253  ERR ("WideCharToMultiByte failed with code %i\n", ret);
254  if (HeapFree (hHeap, 0, pBuffer) == 0)
255  WARN ("HeapFree failed with code %i\n", GetLastError ());
256  return ret;
257  }
258 
259  memcpy (ppev->pValueName, pBuffer, len);
260 
261  TRACE ("Converted '%s' from Unicode to ASCII\n", pBuffer);
262 
263  if (ppev->dwType != REG_SZ && ppev->dwType != REG_EXPAND_SZ &&
264  ppev->dwType != REG_MULTI_SZ)
265  continue;
266 
267  len = WideCharToMultiByte (CP_ACP, 0, (LPWSTR) ppev->pData,
268  ppev->cbData / sizeof (WCHAR), pBuffer, dwBufSize, NULL, NULL);
269  if (len == 0)
270  {
271  ret = GetLastError ();
272  ERR ("WideCharToMultiByte failed with code %i\n", ret);
273  if (HeapFree (hHeap, 0, pBuffer) == 0)
274  WARN ("HeapFree failed with code %i\n", GetLastError ());
275  return ret;
276  }
277 
278  memcpy (ppev->pData, pBuffer, len);
279 
280  TRACE ("Converted '%s' from Unicode to ASCII\n", pBuffer);
281  TRACE (" (only first string of REG_MULTI_SZ printed)\n");
282  }
283 
284  if (HeapFree (hHeap, 0, pBuffer) == 0)
285  {
286  ret = GetLastError ();
287  ERR ("HeapFree failed with code %i\n", ret);
288  return ret;
289  }
290 
291  return ERROR_SUCCESS;
292 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WideCharToMultiByte
Definition: compat.h:101
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define CP_ACP
Definition: compat.h:99
#define WARN(fmt,...)
Definition: debug.h:112
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
char * LPSTR
Definition: xmlstorage.h:182
int32_t INT
Definition: typedefs.h:57
long LONG
Definition: pedump.c:60
#define REG_MULTI_SZ
Definition: nt_native.h:1501
smooth NULL
Definition: ftsmooth.c:416
PVOID pBuffer
struct _PRINTER_ENUM_VALUESW * PPRINTER_ENUM_VALUESW
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:404
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define ERR(fmt,...)
Definition: debug.h:110
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define MultiByteToWideChar
Definition: compat.h:100
DWORD WINAPI EnumPrinterDataExW(HANDLE hPrinter, PCWSTR pKeyName, PBYTE pEnumValues, DWORD cbEnumValues, PDWORD pcbEnumValues, PDWORD pnEnumValues)
Definition: printerdata.c:295
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:403
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define REG_SZ
Definition: layer.c:22

◆ EnumPrinterDataExW()

DWORD WINAPI EnumPrinterDataExW ( HANDLE  hPrinter,
PCWSTR  pKeyName,
PBYTE  pEnumValues,
DWORD  cbEnumValues,
PDWORD  pcbEnumValues,
PDWORD  pnEnumValues 
)

Definition at line 295 of file printerdata.c.

296 {
297  TRACE("EnumPrinterDataExW(%p, %S, %p, %lu, %p, %p)\n", hPrinter, pKeyName, pEnumValues, cbEnumValues, pcbEnumValues, pnEnumValues);
299  return ERROR_NOT_SUPPORTED;
300 }
#define TRACE(s)
Definition: solgame.cpp:4
#define ERROR_NOT_SUPPORTED
Definition: compat.h:90
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by EnumPrinterDataExA().

◆ EnumPrinterDataW()

DWORD WINAPI EnumPrinterDataW ( HANDLE  hPrinter,
DWORD  dwIndex,
PWSTR  pValueName,
DWORD  cbValueName,
PDWORD  pcbValueName,
PDWORD  pType,
PBYTE  pData,
DWORD  cbData,
PDWORD  pcbData 
)

Definition at line 303 of file printerdata.c.

304 {
305  TRACE("EnumPrinterDataW(%p, %lu, %S, %lu, %p, %p, %p, %lu, %p)\n", hPrinter, dwIndex, pValueName, cbValueName, pcbValueName, pType, pData, cbData, pcbData);
307  return ERROR_NOT_SUPPORTED;
308 }
#define TRACE(s)
Definition: solgame.cpp:4
#define ERROR_NOT_SUPPORTED
Definition: compat.h:90
#define UNIMPLEMENTED
Definition: debug.h:115
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:4949

◆ EnumPrinterKeyA()

DWORD WINAPI EnumPrinterKeyA ( HANDLE  hPrinter,
PCSTR  pKeyName,
PSTR  pSubkey,
DWORD  cbSubkey,
PDWORD  pcbSubkey 
)

Definition at line 311 of file printerdata.c.

312 {
313  TRACE("EnumPrinterKeyA(%p, %s, %s, %lu, %p)\n", hPrinter, pKeyName, pSubkey, cbSubkey, pcbSubkey);
315  return ERROR_NOT_SUPPORTED;
316 }
#define TRACE(s)
Definition: solgame.cpp:4
#define ERROR_NOT_SUPPORTED
Definition: compat.h:90
#define UNIMPLEMENTED
Definition: debug.h:115

◆ EnumPrinterKeyW()

DWORD WINAPI EnumPrinterKeyW ( HANDLE  hPrinter,
PCWSTR  pKeyName,
PWSTR  pSubkey,
DWORD  cbSubkey,
PDWORD  pcbSubkey 
)

Definition at line 319 of file printerdata.c.

320 {
321  TRACE("EnumPrinterKeyW(%p, %S, %S, %lu, %p)\n", hPrinter, pKeyName, pSubkey, cbSubkey, pcbSubkey);
323  return ERROR_NOT_SUPPORTED;
324 }
#define TRACE(s)
Definition: solgame.cpp:4
#define ERROR_NOT_SUPPORTED
Definition: compat.h:90
#define UNIMPLEMENTED
Definition: debug.h:115

◆ GetPrinterDataA()

DWORD WINAPI GetPrinterDataA ( HANDLE  hPrinter,
LPSTR  pValueName,
LPDWORD  pType,
LPBYTE  pData,
DWORD  nSize,
LPDWORD  pcbNeeded 
)

Definition at line 327 of file printerdata.c.

328 {
329  TRACE("GetPrinterDataA(%p, %s, %p, %p, %lu, %p)\n", hPrinter, pValueName, pType, pData, nSize, pcbNeeded);
330  return GetPrinterDataExA(hPrinter, "PrinterDriverData", pValueName, pType, pData, nSize, pcbNeeded);
331 }
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2037
#define TRACE(s)
Definition: solgame.cpp:4
DWORD WINAPI GetPrinterDataExA(HANDLE hPrinter, LPCSTR pKeyName, LPCSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded)
Definition: printerdata.c:334
_In_ DWORD _Out_ PDWORD pcbNeeded
Definition: winddi.h:3827
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827

Referenced by test_GetPrinterData().

◆ GetPrinterDataExA()

DWORD WINAPI GetPrinterDataExA ( HANDLE  hPrinter,
LPCSTR  pKeyName,
LPCSTR  pValueName,
LPDWORD  pType,
LPBYTE  pData,
DWORD  nSize,
LPDWORD  pcbNeeded 
)

Definition at line 334 of file printerdata.c.

335 {
336  DWORD cbUnicodeData;
337  DWORD cch;
338  DWORD dwReturnValue;
339  DWORD dwType;
340  POSVERSIONINFOEXA pInfoA;
341  POSVERSIONINFOEXW pInfoW;
342  PVOID pUnicodeData = NULL;
343  PWSTR pwszKeyName = NULL;
345 
346  TRACE("GetPrinterDataExA(%p, %s, %s, %p, %p, %lu, %p)\n", hPrinter, pKeyName, pValueName, pType, pData, nSize, pcbNeeded);
347 
348  if (pKeyName)
349  {
350  // Convert pKeyName to a Unicode string pwszKeyName
351  cch = strlen(pKeyName);
352 
353  pwszKeyName = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(WCHAR));
354  if (!pwszKeyName)
355  {
356  dwReturnValue = ERROR_NOT_ENOUGH_MEMORY;
357  ERR("HeapAlloc failed!\n");
358  goto Cleanup;
359  }
360 
361  MultiByteToWideChar(CP_ACP, 0, pKeyName, -1, pwszKeyName, cch + 1);
362  }
363 
364  if (pValueName)
365  {
366  // Convert pValueName to a Unicode string pwszValueName
367  cch = strlen(pValueName);
368 
369  pwszValueName = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(WCHAR));
370  if (!pwszValueName)
371  {
372  dwReturnValue = ERROR_NOT_ENOUGH_MEMORY;
373  ERR("HeapAlloc failed!\n");
374  goto Cleanup;
375  }
376 
377  MultiByteToWideChar(CP_ACP, 0, pValueName, -1, pwszValueName, cch + 1);
378  }
379 
380  // We need the data type information, even if no pData was passed.
381  if (!pType)
382  pType = &dwType;
383 
384  // Call GetPrinterDataExW for the first time.
385  // If we're lucky, the supplied buffer is already large enough and we don't need to do the expensive RPC call a second time.
386  dwReturnValue = GetPrinterDataExW(hPrinter, pwszKeyName, pwszValueName, pType, pData, nSize, pcbNeeded);
387 
388  // If a critical error occurred, just return it. We cannot do anything else in this case.
389  if (dwReturnValue != ERROR_SUCCESS && dwReturnValue != ERROR_MORE_DATA)
390  goto Cleanup;
391 
392  // Save the needed buffer size for the Unicode data. We may alter *pcbNeeded for an ANSI buffer size.
393  cbUnicodeData = *pcbNeeded;
394 
395  if (*pType == REG_SZ || *pType == REG_MULTI_SZ || *pType == REG_EXPAND_SZ)
396  {
397  // This is a string that needs to be converted from Unicode to ANSI.
398  // Output the required buffer size for the ANSI string.
399  *pcbNeeded /= sizeof(WCHAR);
400  }
401  else if (*pType == REG_NONE)
402  {
403  if (cbUnicodeData == sizeof(OSVERSIONINFOW) && wcsicmp(pwszValueName, SPLREG_OS_VERSION) == 0)
404  {
405  // This is a Unicode OSVERSIONINFOW structure that needs to be converted to an ANSI OSVERSIONINFOA.
406  *pcbNeeded = sizeof(OSVERSIONINFOA);
407  }
408  else if (cbUnicodeData == sizeof(OSVERSIONINFOEXW) && wcsicmp(pwszValueName, SPLREG_OS_VERSIONEX) == 0)
409  {
410  // This is a Unicode OSVERSIONINFOEXW structure that needs to be converted to an ANSI OSVERSIONINFOEXA.
411  *pcbNeeded = sizeof(OSVERSIONINFOEXA);
412  }
413  else
414  {
415  // Other REG_NONE value, nothing to do.
416  goto Cleanup;
417  }
418  }
419 
420  // Check if the supplied buffer is large enough for the ANSI data.
421  if (nSize < *pcbNeeded)
422  {
423  dwReturnValue = ERROR_MORE_DATA;
424  goto Cleanup;
425  }
426 
427  // Allocate a temporary buffer for the Unicode data.
428  pUnicodeData = HeapAlloc(hProcessHeap, 0, cbUnicodeData);
429  if (!pUnicodeData)
430  {
431  dwReturnValue = ERROR_NOT_ENOUGH_MEMORY;
432  ERR("HeapAlloc failed!\n");
433  goto Cleanup;
434  }
435 
436  if (dwReturnValue == ERROR_SUCCESS)
437  {
438  // ERROR_SUCCESS: The buffer is large enough for the ANSI and the Unicode string,
439  // so the Unicode string has been copied into pData. Copy it to pUnicodeData.
440  CopyMemory(pUnicodeData, pData, cbUnicodeData);
441  }
442  else
443  {
444  // ERROR_MORE_DATA: The buffer is large enough for the ANSI string, but not for the Unicode string.
445  // We have to call GetPrinterDataExW again with the temporary buffer.
446  dwReturnValue = GetPrinterDataExW(hPrinter, pwszKeyName, pwszValueName, NULL, (PBYTE)pUnicodeData, cbUnicodeData, &cbUnicodeData);
447  if (dwReturnValue != ERROR_SUCCESS)
448  goto Cleanup;
449  }
450 
451  if (*pType == REG_SZ || *pType == REG_MULTI_SZ || *pType == REG_EXPAND_SZ)
452  {
453  // Convert the Unicode string to ANSI.
454  WideCharToMultiByte(CP_ACP, 0, (PWSTR)pUnicodeData, -1, (PSTR)pData, *pcbNeeded, NULL, NULL);
455  }
456  else
457  {
458  // This is a REG_NONE with either OSVERSIONINFOW or OSVERSIONINFOEXW.
459  // Copy the fields and convert the Unicode CSD Version string to ANSI.
460  pInfoW = (POSVERSIONINFOEXW)pUnicodeData;
461  pInfoA = (POSVERSIONINFOEXA)pData;
462  pInfoA->dwMajorVersion = pInfoW->dwMajorVersion;
463  pInfoA->dwMinorVersion = pInfoW->dwMinorVersion;
464  pInfoA->dwBuildNumber = pInfoW->dwBuildNumber;
465  pInfoA->dwPlatformId = pInfoW->dwPlatformId;
466  WideCharToMultiByte(CP_ACP, 0, pInfoW->szCSDVersion, -1, pInfoA->szCSDVersion, sizeof(pInfoA->szCSDVersion), NULL, NULL);
467 
468  if (cbUnicodeData == sizeof(OSVERSIONINFOW))
469  {
470  pInfoA->dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
471  }
472  else
473  {
474  pInfoA->dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
475  pInfoA->wServicePackMajor = pInfoW->wServicePackMajor;
476  pInfoA->wServicePackMinor = pInfoW->wServicePackMinor;
477  pInfoA->wSuiteMask = pInfoW->wSuiteMask;
478  pInfoA->wProductType = pInfoW->wProductType;
479  pInfoA->wReserved = pInfoW->wReserved;
480  }
481  }
482 
483 Cleanup:
484  if (pwszKeyName)
485  HeapFree(hProcessHeap, 0, pwszKeyName);
486 
487  if (pwszValueName)
489 
490  if (pUnicodeData)
491  HeapFree(hProcessHeap, 0, pUnicodeData);
492 
493  return dwReturnValue;
494 }
ULONG dwBuildNumber
Definition: rtltypes.h:268
UCHAR wProductType
Definition: rtltypes.h:274
#define ERROR_SUCCESS
Definition: deptool.c:10
USHORT wSuiteMask
Definition: rtltypes.h:259
#define WideCharToMultiByte
Definition: compat.h:101
ULONG dwPlatformId
Definition: rtltypes.h:269
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
struct _OSVERSIONINFOEXW * POSVERSIONINFOEXW
ULONG dwMinorVersion
Definition: rtltypes.h:267
uint16_t * PWSTR
Definition: typedefs.h:55
#define CP_ACP
Definition: compat.h:99
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2037
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
USHORT wSuiteMask
Definition: rtltypes.h:273
ULONG dwMajorVersion
Definition: rtltypes.h:252
ULONG dwMajorVersion
Definition: rtltypes.h:266
DWORD WINAPI GetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName, LPCWSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded)
Definition: printerdata.c:11
#define REG_MULTI_SZ
Definition: nt_native.h:1501
USHORT wServicePackMinor
Definition: rtltypes.h:258
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:201
smooth NULL
Definition: ftsmooth.c:416
struct _OSVERSIONINFOEXA OSVERSIONINFOEXA
ULONG dwMinorVersion
Definition: rtltypes.h:253
#define TRACE(s)
Definition: solgame.cpp:4
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:251
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_z_ PCWSTR pwszValueName
Definition: ntuser.h:36
#define CopyMemory
Definition: winbase.h:1646
unsigned long DWORD
Definition: ntddk_ex.h:95
USHORT wServicePackMajor
Definition: rtltypes.h:257
WCHAR szCSDVersion[128]
Definition: rtltypes.h:270
static const WCHAR Cleanup[]
Definition: register.c:80
CHAR szCSDVersion[128]
Definition: rtltypes.h:256
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define wcsicmp
Definition: string.h:1152
#define ERR(fmt,...)
Definition: debug.h:110
struct _OSVERSIONINFOA OSVERSIONINFOA
_In_ DWORD _Out_ PDWORD pcbNeeded
Definition: winddi.h:3827
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
signed char * PSTR
Definition: retypes.h:7
USHORT wServicePackMajor
Definition: rtltypes.h:271
#define SPLREG_OS_VERSIONEX
Definition: winspool.h:1352
struct _OSVERSIONINFOEXA * POSVERSIONINFOEXA
#define SPLREG_OS_VERSION
Definition: winspool.h:1351
#define MultiByteToWideChar
Definition: compat.h:100
ULONG dwPlatformId
Definition: rtltypes.h:255
UCHAR wProductType
Definition: rtltypes.h:260
#define REG_NONE
Definition: nt_native.h:1492
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
BYTE * PBYTE
Definition: pedump.c:66
ULONG dwBuildNumber
Definition: rtltypes.h:254
#define HeapFree(x, y, z)
Definition: compat.h:403
USHORT wServicePackMinor
Definition: rtltypes.h:272
HANDLE hProcessHeap
Definition: kbswitch.c:25
#define REG_SZ
Definition: layer.c:22

Referenced by GetPrinterDataA(), and START_TEST().

◆ GetPrinterDataExW()

DWORD WINAPI GetPrinterDataExW ( HANDLE  hPrinter,
LPCWSTR  pKeyName,
LPCWSTR  pValueName,
LPDWORD  pType,
LPBYTE  pData,
DWORD  nSize,
LPDWORD  pcbNeeded 
)

Definition at line 497 of file printerdata.c.

498 {
499  const WCHAR wszEmptyString[] = L"";
500 
501  BYTE DummyData;
502  DWORD dwErrorCode;
503  DWORD dwType = REG_NONE;
504  PSPOOLER_HANDLE pHandle = (PSPOOLER_HANDLE)hPrinter;
505 
506  TRACE("GetPrinterDataExW(%p, %S, %S, %p, %p, %lu, %p)\n", hPrinter, pKeyName, pValueName, pType, pData, nSize, pcbNeeded);
507 
508  // Sanity checks
509  if (!pHandle)
510  return ERROR_INVALID_HANDLE;
511 
512  // Yes, instead of declaring these pointers unique in the IDL file (and perfectly accepting NULL pointers this way),
513  // Windows does it differently for GetPrinterDataExW and points them to empty variables.
514  if (!pKeyName)
515  pKeyName = wszEmptyString;
516 
517  if (!pType)
518  pType = &dwType;
519 
520  if (!pData && !nSize)
521  pData = &DummyData;
522 
523  // Do the RPC call
525  {
526  dwErrorCode = _RpcGetPrinterDataEx(pHandle->hPrinter, pKeyName, pValueName, pType, pData, nSize, pcbNeeded);
527  }
529  {
530  dwErrorCode = RpcExceptionCode();
531  }
532  RpcEndExcept;
533 
534  return dwErrorCode;
535 }
#define RpcEndExcept
Definition: rpc.h:128
ULONG DummyData
Definition: cmdata.c:18
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2037
#define RpcTryExcept
Definition: rpc.h:126
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
unsigned char BYTE
Definition: xxhash.c:193
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
#define REG_NONE
Definition: nt_native.h:1492
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
struct _SPOOLER_HANDLE * PSPOOLER_HANDLE
#define RpcExcept(expr)
Definition: rpc.h:127
HANDLE hPrinter
Definition: precomp.h:50

Referenced by START_TEST().

◆ GetPrinterDataW()

DWORD WINAPI GetPrinterDataW ( HANDLE  hPrinter,
LPWSTR  pValueName,
LPDWORD  pType,
LPBYTE  pData,
DWORD  nSize,
LPDWORD  pcbNeeded 
)

Definition at line 538 of file printerdata.c.

539 {
540  TRACE("GetPrinterDataW(%p, %S, %p, %p, %lu, %p)\n", hPrinter, pValueName, pType, pData, nSize, pcbNeeded);
541  return GetPrinterDataExW(hPrinter, L"PrinterDriverData", pValueName, pType, pData, nSize, pcbNeeded);
542 }
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2037
DWORD WINAPI GetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName, LPCWSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded)
Definition: printerdata.c:11
#define TRACE(s)
Definition: solgame.cpp:4
static const WCHAR L[]
Definition: oid.c:1250
_In_ DWORD _Out_ PDWORD pcbNeeded
Definition: winddi.h:3827
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827

◆ SetPrinterDataA()

DWORD WINAPI SetPrinterDataA ( HANDLE  hPrinter,
PSTR  pValueName,
DWORD  Type,
PBYTE  pData,
DWORD  cbData 
)

Definition at line 545 of file printerdata.c.

546 {
547  TRACE("SetPrinterDataA(%p, %s, %lu, %p, %lu)\n", hPrinter, pValueName, Type, pData, cbData);
548  return SetPrinterDataExA(hPrinter, "PrinterDriverData", pValueName, Type, pData, cbData);
549 }
Type
Definition: Type.h:6
#define TRACE(s)
Definition: solgame.cpp:4
DWORD WINAPI SetPrinterDataExA(HANDLE hPrinter, LPCSTR pKeyName, LPCSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData)
Definition: printerdata.c:552
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827

◆ SetPrinterDataExA()

DWORD WINAPI SetPrinterDataExA ( HANDLE  hPrinter,
LPCSTR  pKeyName,
LPCSTR  pValueName,
DWORD  Type,
LPBYTE  pData,
DWORD  cbData 
)

Definition at line 552 of file printerdata.c.

553 {
554  DWORD cch;
555  DWORD dwReturnValue;
556  PWSTR pwszKeyName = NULL;
558  PWSTR pUnicodeData = NULL;
559 
560  TRACE("SetPrinterDataExA(%p, %s, %s, %lu, %p, %lu)\n", hPrinter, pKeyName, pValueName, Type, pData, cbData);
561 
562  if (pKeyName)
563  {
564  // Convert pKeyName to a Unicode string pwszKeyName
565  cch = strlen(pKeyName);
566 
567  pwszKeyName = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(WCHAR));
568  if (!pwszKeyName)
569  {
570  dwReturnValue = ERROR_NOT_ENOUGH_MEMORY;
571  ERR("HeapAlloc failed!\n");
572  goto Cleanup;
573  }
574 
575  MultiByteToWideChar(CP_ACP, 0, pKeyName, -1, pwszKeyName, cch + 1);
576  }
577 
578  if (pValueName)
579  {
580  // Convert pValueName to a Unicode string pwszValueName
581  cch = strlen(pValueName);
582 
583  pwszValueName = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(WCHAR));
584  if (!pwszValueName)
585  {
586  dwReturnValue = ERROR_NOT_ENOUGH_MEMORY;
587  ERR("HeapAlloc failed!\n");
588  goto Cleanup;
589  }
590 
591  MultiByteToWideChar(CP_ACP, 0, pValueName, -1, pwszValueName, cch + 1);
592  }
593 
594  if (Type == REG_SZ || Type == REG_MULTI_SZ || Type == REG_EXPAND_SZ)
595  {
596  // Convert pData to a Unicode string pUnicodeData.
597  pUnicodeData = HeapAlloc(hProcessHeap, 0, cbData * sizeof(WCHAR));
598  if (!pUnicodeData)
599  {
600  dwReturnValue = ERROR_NOT_ENOUGH_MEMORY;
601  ERR("HeapAlloc failed!\n");
602  goto Cleanup;
603  }
604 
605  MultiByteToWideChar(CP_ACP, 0, (PCSTR)pData, -1, pUnicodeData, cbData);
606 
607  pData = (PBYTE)pUnicodeData;
608  cbData *= sizeof(WCHAR);
609  }
610 
611  dwReturnValue = SetPrinterDataExW(hPrinter, pwszKeyName, pwszValueName, Type, pData, cbData);
612 
613 Cleanup:
614  if (pwszKeyName)
615  HeapFree(hProcessHeap, 0, pwszKeyName);
616 
617  if (pwszValueName)
619 
620  if (pUnicodeData)
621  HeapFree(hProcessHeap, 0, pUnicodeData);
622 
623  return dwReturnValue;
624 }
DWORD WINAPI SetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName, LPCWSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData)
Definition: printerdata.c:38
Type
Definition: Type.h:6
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
uint16_t * PWSTR
Definition: typedefs.h:55
#define CP_ACP
Definition: compat.h:99
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define REG_MULTI_SZ
Definition: nt_native.h:1501
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:201
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_z_ PCWSTR pwszValueName
Definition: ntuser.h:36
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR Cleanup[]
Definition: register.c:80
#define ERR(fmt,...)
Definition: debug.h:110
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define MultiByteToWideChar
Definition: compat.h:100
const char * PCSTR
Definition: typedefs.h:52
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
BYTE * PBYTE
Definition: pedump.c:66
#define HeapFree(x, y, z)
Definition: compat.h:403
HANDLE hProcessHeap
Definition: kbswitch.c:25
#define REG_SZ
Definition: layer.c:22

Referenced by SetPrinterDataA().

◆ SetPrinterDataExW()

DWORD WINAPI SetPrinterDataExW ( HANDLE  hPrinter,
LPCWSTR  pKeyName,
LPCWSTR  pValueName,
DWORD  Type,
LPBYTE  pData,
DWORD  cbData 
)

Definition at line 627 of file printerdata.c.

628 {
629  const WCHAR wszEmptyString[] = L"";
630 
631  DWORD dwErrorCode;
632  PSPOOLER_HANDLE pHandle = (PSPOOLER_HANDLE)hPrinter;
633 
634  TRACE("SetPrinterDataExW(%p, %S, %S, %lu, %p, %lu)\n", hPrinter, pKeyName, pValueName, Type, pData, cbData);
635 
636  // Sanity checks
637  if (!pHandle)
638  return ERROR_INVALID_HANDLE;
639 
640  if (!pKeyName)
641  pKeyName = wszEmptyString;
642 
643  // Do the RPC call
645  {
646  dwErrorCode = _RpcSetPrinterDataEx(pHandle->hPrinter, pKeyName, pValueName, Type, pData, cbData);
647  }
649  {
650  dwErrorCode = RpcExceptionCode();
651  }
652  RpcEndExcept;
653 
654  return dwErrorCode;
655 }
#define RpcEndExcept
Definition: rpc.h:128
Type
Definition: Type.h:6
DWORD _RpcSetPrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR *pKeyName, const WCHAR *pValueName, DWORD Type, BYTE *pData, DWORD cbData)
Definition: printerdata.c:84
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define RpcTryExcept
Definition: rpc.h:126
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
struct _SPOOLER_HANDLE * PSPOOLER_HANDLE
#define RpcExcept(expr)
Definition: rpc.h:127
HANDLE hPrinter
Definition: precomp.h:50

Referenced by START_TEST().

◆ SetPrinterDataW()

DWORD WINAPI SetPrinterDataW ( HANDLE  hPrinter,
PWSTR  pValueName,
DWORD  Type,
PBYTE  pData,
DWORD  cbData 
)

Definition at line 658 of file printerdata.c.

659 {
660  TRACE("SetPrinterDataW(%p, %S, %lu, %p, %lu)\n", hPrinter, pValueName, Type, pData, cbData);
661  return SetPrinterDataExW(hPrinter, L"PrinterDriverData", pValueName, Type, pData, cbData);
662 }
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 TRACE(s)
Definition: solgame.cpp:4
static const WCHAR L[]
Definition: oid.c:1250
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827