ReactOS  0.4.15-dev-309-g7c8d563
printerdata.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Spooler Router
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE: Functions related to Printer Configuration Data
5  * COPYRIGHT: Copyright 2017 Colin Finck (colin@reactos.org)
6  */
7 
8 #include "precomp.h"
9 
12 {
14 
15  // Sanity check.
16  if (!pHandle)
17  {
18  // Yes, Windows checks for the handle here and sets the last error to ERROR_INVALID_HANDLE,
19  // but returns FALSE and not the error code.
21  return FALSE;
22  }
23 
24  // Call GetPrinterDataEx of the Print Provider.
25  return pHandle->pPrintProvider->PrintProvider.fpGetPrinterDataEx(pHandle->hPrinter, pKeyName, pValueName, pType, pData, nSize, pcbNeeded);
26 }
27 
30 {
31  // The ReactOS Printing Stack forwards all GetPrinterData calls to GetPrinterDataEx as soon as possible.
32  // This function may only be called if spoolss.dll is used together with Windows Printing Stack components.
33  WARN("This function should never be called!\n");
34  return GetPrinterDataExW(hPrinter, L"PrinterDriverData", pValueName, pType, pData, nSize, pcbNeeded);
35 }
36 
38 SetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName, LPCWSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData)
39 {
41 
42  // Sanity check.
43  if (!pHandle)
44  {
45  // Yes, Windows checks for the handle here and sets the last error to ERROR_INVALID_HANDLE,
46  // but returns FALSE and not the error code.
48  return FALSE;
49  }
50 
51  // Call SetPrinterDataEx of the Print Provider.
52  return pHandle->pPrintProvider->PrintProvider.fpSetPrinterDataEx(pHandle->hPrinter, pKeyName, pValueName, Type, pData, cbData);
53 }
54 
56 SetPrinterDataW(HANDLE hPrinter, PWSTR pValueName, DWORD Type, PBYTE pData, DWORD cbData)
57 {
58  // The ReactOS Printing Stack forwards all SetPrinterData calls to SetPrinterDataEx as soon as possible.
59  // This function may only be called if spoolss.dll is used together with Windows Printing Stack components.
60  WARN("This function should never be called!\n");
61  return SetPrinterDataExW(hPrinter, L"PrinterDriverData", pValueName, Type, pData, cbData);
62 }
DWORD WINAPI SetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName, LPCWSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData)
Definition: printerdata.c:38
Type
Definition: Type.h:6
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
uint16_t * PWSTR
Definition: typedefs.h:55
#define WARN(fmt,...)
Definition: debug.h:112
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2037
struct _SPOOLSS_PRINTER_HANDLE * PSPOOLSS_PRINTER_HANDLE
unsigned char * LPBYTE
Definition: typedefs.h:53
DWORD WINAPI GetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName, LPCWSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded)
Definition: printerdata.c:11
#define WINAPI
Definition: msvc.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:418
static const WCHAR L[]
Definition: oid.c:1250
_In_ DWORD _Out_ PDWORD pcbNeeded
Definition: winddi.h:3827
uint32_t * LPDWORD
Definition: typedefs.h:58
DWORD WINAPI GetPrinterDataW(HANDLE hPrinter, LPWSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded)
Definition: printerdata.c:29
PRINTPROVIDOR PrintProvider
Definition: precomp.h:36
WCHAR * LPWSTR
Definition: xmlstorage.h:184
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
DWORD WINAPI SetPrinterDataW(HANDLE hPrinter, PWSTR pValueName, DWORD Type, PBYTE pData, DWORD cbData)
Definition: printerdata.c:56
BYTE * PBYTE
Definition: pedump.c:66
PSPOOLSS_PRINT_PROVIDER pPrintProvider
Definition: precomp.h:46