ReactOS  0.4.15-dev-1207-g698a8e6
forms.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 for managing print Forms
5  * COPYRIGHT: Copyright 2020 ReactOS
6  */
7 
8 #include "precomp.h"
9 
11 AddFormW(HANDLE hPrinter, DWORD Level, PBYTE pForm)
12 {
14 
15  // Sanity checks.
16  if (!pHandle)
17  {
19  return FALSE;
20  }
21 
22  return pHandle->pPrintProvider->PrintProvider.fpAddForm(pHandle->hPrinter, Level, pForm);
23 }
24 
26 DeleteFormW(HANDLE hPrinter, PWSTR pFormName)
27 {
29 
30  // Sanity checks.
31  if (!pHandle)
32  {
34  return FALSE;
35  }
36 
37  return pHandle->pPrintProvider->PrintProvider.fpDeleteForm(pHandle->hPrinter, pFormName);
38 }
39 
41 EnumFormsW(HANDLE hPrinter, DWORD Level, PBYTE pForm, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
42 {
44 
45  // Sanity checks.
46  if (!pHandle)
47  {
49  return FALSE;
50  }
51 
52  if ( cbBuf && !pForm )
53  {
55  return FALSE;
56  }
57 
58  return pHandle->pPrintProvider->PrintProvider.fpEnumForms(pHandle->hPrinter, Level, pForm, cbBuf, pcbNeeded, pcReturned);
59 }
60 
62 GetFormW(HANDLE hPrinter, PWSTR pFormName, DWORD Level, PBYTE pForm, DWORD cbBuf, PDWORD pcbNeeded)
63 {
65 
66  // Sanity checks.
67  if (!pHandle)
68  {
70  return FALSE;
71  }
72 
73  if ( cbBuf && pForm )
74  {
76  return FALSE;
77  }
78 
79  return pHandle->pPrintProvider->PrintProvider.fpGetForm(pHandle->hPrinter, pFormName, Level, pForm, cbBuf, pcbNeeded);
80 }
81 
83 SetFormW(HANDLE hPrinter, PWSTR pFormName, DWORD Level, PBYTE pForm)
84 {
86 
87  // Sanity checks.
88  if (!pHandle)
89  {
91  return FALSE;
92  }
93 
94  return pHandle->pPrintProvider->PrintProvider.fpSetForm(pHandle->hPrinter, pFormName, Level, pForm);
95 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
uint16_t * PWSTR
Definition: typedefs.h:56
BOOL WINAPI SetFormW(HANDLE hPrinter, PWSTR pFormName, DWORD Level, PBYTE pForm)
Definition: forms.c:83
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
struct _SPOOLSS_PRINTER_HANDLE * PSPOOLSS_PRINTER_HANDLE
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1091
BOOL WINAPI AddFormW(HANDLE hPrinter, DWORD Level, PBYTE pForm)
Definition: forms.c:11
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WINAPI
Definition: msvc.h:6
BOOL WINAPI DeleteFormW(HANDLE hPrinter, PWSTR pFormName)
Definition: forms.c:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
_In_ DWORD _Out_ PDWORD pcbNeeded
Definition: winddi.h:3827
BOOL WINAPI EnumFormsW(HANDLE hPrinter, DWORD Level, PBYTE pForm, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
Definition: forms.c:41
DWORD * PDWORD
Definition: pedump.c:68
PRINTPROVIDOR PrintProvider
Definition: precomp.h:36
BYTE * PBYTE
Definition: pedump.c:66
PSPOOLSS_PRINT_PROVIDER pPrintProvider
Definition: precomp.h:46
BOOL WINAPI GetFormW(HANDLE hPrinter, PWSTR pFormName, DWORD Level, PBYTE pForm, DWORD cbBuf, PDWORD pcbNeeded)
Definition: forms.c:62