1*62c4b828SJames Tabor /*
2*62c4b828SJames Tabor * PROJECT: ReactOS Spooler Router
3*62c4b828SJames Tabor * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4*62c4b828SJames Tabor * PURPOSE: Functions for managing print Forms
5*62c4b828SJames Tabor * COPYRIGHT: Copyright 2020 ReactOS
6*62c4b828SJames Tabor */
7*62c4b828SJames Tabor
8*62c4b828SJames Tabor #include "precomp.h"
9*62c4b828SJames Tabor
10*62c4b828SJames Tabor BOOL WINAPI
AddFormW(HANDLE hPrinter,DWORD Level,PBYTE pForm)11*62c4b828SJames Tabor AddFormW(HANDLE hPrinter, DWORD Level, PBYTE pForm)
12*62c4b828SJames Tabor {
13*62c4b828SJames Tabor PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
14*62c4b828SJames Tabor
15*62c4b828SJames Tabor // Sanity checks.
16*62c4b828SJames Tabor if (!pHandle)
17*62c4b828SJames Tabor {
18*62c4b828SJames Tabor SetLastError(ERROR_INVALID_PARAMETER);
19*62c4b828SJames Tabor return FALSE;
20*62c4b828SJames Tabor }
21*62c4b828SJames Tabor
22*62c4b828SJames Tabor return pHandle->pPrintProvider->PrintProvider.fpAddForm(pHandle->hPrinter, Level, pForm);
23*62c4b828SJames Tabor }
24*62c4b828SJames Tabor
25*62c4b828SJames Tabor BOOL WINAPI
DeleteFormW(HANDLE hPrinter,PWSTR pFormName)26*62c4b828SJames Tabor DeleteFormW(HANDLE hPrinter, PWSTR pFormName)
27*62c4b828SJames Tabor {
28*62c4b828SJames Tabor PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
29*62c4b828SJames Tabor
30*62c4b828SJames Tabor // Sanity checks.
31*62c4b828SJames Tabor if (!pHandle)
32*62c4b828SJames Tabor {
33*62c4b828SJames Tabor SetLastError(ERROR_INVALID_PARAMETER);
34*62c4b828SJames Tabor return FALSE;
35*62c4b828SJames Tabor }
36*62c4b828SJames Tabor
37*62c4b828SJames Tabor return pHandle->pPrintProvider->PrintProvider.fpDeleteForm(pHandle->hPrinter, pFormName);
38*62c4b828SJames Tabor }
39*62c4b828SJames Tabor
40*62c4b828SJames Tabor BOOL WINAPI
EnumFormsW(HANDLE hPrinter,DWORD Level,PBYTE pForm,DWORD cbBuf,PDWORD pcbNeeded,PDWORD pcReturned)41*62c4b828SJames Tabor EnumFormsW(HANDLE hPrinter, DWORD Level, PBYTE pForm, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
42*62c4b828SJames Tabor {
43*62c4b828SJames Tabor PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
44*62c4b828SJames Tabor
45*62c4b828SJames Tabor // Sanity checks.
46*62c4b828SJames Tabor if (!pHandle)
47*62c4b828SJames Tabor {
48*62c4b828SJames Tabor SetLastError(ERROR_INVALID_PARAMETER);
49*62c4b828SJames Tabor return FALSE;
50*62c4b828SJames Tabor }
51*62c4b828SJames Tabor
52*62c4b828SJames Tabor if ( cbBuf && !pForm )
53*62c4b828SJames Tabor {
54*62c4b828SJames Tabor SetLastError(ERROR_INVALID_USER_BUFFER);
55*62c4b828SJames Tabor return FALSE;
56*62c4b828SJames Tabor }
57*62c4b828SJames Tabor
58*62c4b828SJames Tabor return pHandle->pPrintProvider->PrintProvider.fpEnumForms(pHandle->hPrinter, Level, pForm, cbBuf, pcbNeeded, pcReturned);
59*62c4b828SJames Tabor }
60*62c4b828SJames Tabor
61*62c4b828SJames Tabor BOOL WINAPI
GetFormW(HANDLE hPrinter,PWSTR pFormName,DWORD Level,PBYTE pForm,DWORD cbBuf,PDWORD pcbNeeded)62*62c4b828SJames Tabor GetFormW(HANDLE hPrinter, PWSTR pFormName, DWORD Level, PBYTE pForm, DWORD cbBuf, PDWORD pcbNeeded)
63*62c4b828SJames Tabor {
64*62c4b828SJames Tabor PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
65*62c4b828SJames Tabor
66*62c4b828SJames Tabor // Sanity checks.
67*62c4b828SJames Tabor if (!pHandle)
68*62c4b828SJames Tabor {
69*62c4b828SJames Tabor SetLastError(ERROR_INVALID_PARAMETER);
70*62c4b828SJames Tabor return FALSE;
71*62c4b828SJames Tabor }
72*62c4b828SJames Tabor
73*62c4b828SJames Tabor if ( cbBuf && pForm )
74*62c4b828SJames Tabor {
75*62c4b828SJames Tabor SetLastError(ERROR_INVALID_USER_BUFFER);
76*62c4b828SJames Tabor return FALSE;
77*62c4b828SJames Tabor }
78*62c4b828SJames Tabor
79*62c4b828SJames Tabor return pHandle->pPrintProvider->PrintProvider.fpGetForm(pHandle->hPrinter, pFormName, Level, pForm, cbBuf, pcbNeeded);
80*62c4b828SJames Tabor }
81*62c4b828SJames Tabor
82*62c4b828SJames Tabor BOOL WINAPI
SetFormW(HANDLE hPrinter,PWSTR pFormName,DWORD Level,PBYTE pForm)83*62c4b828SJames Tabor SetFormW(HANDLE hPrinter, PWSTR pFormName, DWORD Level, PBYTE pForm)
84*62c4b828SJames Tabor {
85*62c4b828SJames Tabor PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
86*62c4b828SJames Tabor
87*62c4b828SJames Tabor // Sanity checks.
88*62c4b828SJames Tabor if (!pHandle)
89*62c4b828SJames Tabor {
90*62c4b828SJames Tabor SetLastError(ERROR_INVALID_PARAMETER);
91*62c4b828SJames Tabor return FALSE;
92*62c4b828SJames Tabor }
93*62c4b828SJames Tabor
94*62c4b828SJames Tabor return pHandle->pPrintProvider->PrintProvider.fpSetForm(pHandle->hPrinter, pFormName, Level, pForm);
95*62c4b828SJames Tabor }
96