[PRINTING] [SKIPLIST] Use the new header with SPDX license identifier and relicense...
[reactos.git] / reactos / win32ss / printing / base / spoolss / printerdata.c
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
10 DWORD WINAPI
11 GetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName, LPCWSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded)
12 {
13 PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
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.
20 SetLastError(ERROR_INVALID_HANDLE);
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
28 DWORD WINAPI
29 GetPrinterDataW(HANDLE hPrinter, LPWSTR pValueName, LPDWORD pType, LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded)
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
37 DWORD WINAPI
38 SetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName, LPCWSTR pValueName, DWORD Type, LPBYTE pData, DWORD cbData)
39 {
40 PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
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.
47 SetLastError(ERROR_INVALID_HANDLE);
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
55 DWORD WINAPI
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 }