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 10 BOOL WINAPI 11 AddFormW(HANDLE hPrinter, DWORD Level, PBYTE pForm) 12 { 13 PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter; 14 15 // Sanity checks. 16 if (!pHandle) 17 { 18 SetLastError(ERROR_INVALID_PARAMETER); 19 return FALSE; 20 } 21 22 return pHandle->pPrintProvider->PrintProvider.fpAddForm(pHandle->hPrinter, Level, pForm); 23 } 24 25 BOOL WINAPI 26 DeleteFormW(HANDLE hPrinter, PWSTR pFormName) 27 { 28 PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter; 29 30 // Sanity checks. 31 if (!pHandle) 32 { 33 SetLastError(ERROR_INVALID_PARAMETER); 34 return FALSE; 35 } 36 37 return pHandle->pPrintProvider->PrintProvider.fpDeleteForm(pHandle->hPrinter, pFormName); 38 } 39 40 BOOL WINAPI 41 EnumFormsW(HANDLE hPrinter, DWORD Level, PBYTE pForm, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned) 42 { 43 PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter; 44 45 // Sanity checks. 46 if (!pHandle) 47 { 48 SetLastError(ERROR_INVALID_PARAMETER); 49 return FALSE; 50 } 51 52 if ( cbBuf && !pForm ) 53 { 54 SetLastError(ERROR_INVALID_USER_BUFFER); 55 return FALSE; 56 } 57 58 return pHandle->pPrintProvider->PrintProvider.fpEnumForms(pHandle->hPrinter, Level, pForm, cbBuf, pcbNeeded, pcReturned); 59 } 60 61 BOOL WINAPI 62 GetFormW(HANDLE hPrinter, PWSTR pFormName, DWORD Level, PBYTE pForm, DWORD cbBuf, PDWORD pcbNeeded) 63 { 64 PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter; 65 66 // Sanity checks. 67 if (!pHandle) 68 { 69 SetLastError(ERROR_INVALID_PARAMETER); 70 return FALSE; 71 } 72 73 if ( cbBuf && pForm ) 74 { 75 SetLastError(ERROR_INVALID_USER_BUFFER); 76 return FALSE; 77 } 78 79 return pHandle->pPrintProvider->PrintProvider.fpGetForm(pHandle->hPrinter, pFormName, Level, pForm, cbBuf, pcbNeeded); 80 } 81 82 BOOL WINAPI 83 SetFormW(HANDLE hPrinter, PWSTR pFormName, DWORD Level, PBYTE pForm) 84 { 85 PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter; 86 87 // Sanity checks. 88 if (!pHandle) 89 { 90 SetLastError(ERROR_INVALID_PARAMETER); 91 return FALSE; 92 } 93 94 return pHandle->pPrintProvider->PrintProvider.fpSetForm(pHandle->hPrinter, pFormName, Level, pForm); 95 } 96