1c2c66affSColin Finck /*
2c2c66affSColin Finck  * PROJECT:     ReactOS Spooler Router
3c2c66affSColin Finck  * LICENSE:     GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4c2c66affSColin Finck  * PURPOSE:     Functions related to Print Processors
5c2c66affSColin Finck  * COPYRIGHT:   Copyright 2015-2017 Colin Finck (colin@reactos.org)
6c2c66affSColin Finck  */
7c2c66affSColin Finck 
8c2c66affSColin Finck #include "precomp.h"
9*62c4b828SJames Tabor #include <prtprocenv.h>
10*62c4b828SJames Tabor 
11*62c4b828SJames Tabor BOOL WINAPI
AddPrintProcessorW(PWSTR pName,PWSTR pEnvironment,PWSTR pPathName,PWSTR pPrintProcessorName)12*62c4b828SJames Tabor AddPrintProcessorW(PWSTR pName, PWSTR pEnvironment, PWSTR pPathName, PWSTR pPrintProcessorName)
13*62c4b828SJames Tabor {
14*62c4b828SJames Tabor     if (!pEnvironment || !*pEnvironment)
15*62c4b828SJames Tabor         pEnvironment = (PWSTR)wszCurrentEnvironment;
16*62c4b828SJames Tabor     return FALSE;
17*62c4b828SJames Tabor }
18*62c4b828SJames Tabor 
19*62c4b828SJames Tabor BOOL WINAPI
DeletePrintProcessorW(PWSTR pName,PWSTR pEnvironment,PWSTR pPrintProcessorName)20*62c4b828SJames Tabor DeletePrintProcessorW(PWSTR pName, PWSTR pEnvironment, PWSTR pPrintProcessorName)
21*62c4b828SJames Tabor {
22*62c4b828SJames Tabor     if (!pEnvironment || !*pEnvironment)
23*62c4b828SJames Tabor         pEnvironment = (PWSTR)wszCurrentEnvironment;
24*62c4b828SJames Tabor     return FALSE;
25*62c4b828SJames Tabor }
26c2c66affSColin Finck 
27c2c66affSColin Finck BOOL WINAPI
EnumPrintProcessorDatatypesW(PWSTR pName,PWSTR pPrintProcessorName,DWORD Level,PBYTE pDatatypes,DWORD cbBuf,PDWORD pcbNeeded,PDWORD pcReturned)28c2c66affSColin Finck EnumPrintProcessorDatatypesW(PWSTR pName, PWSTR pPrintProcessorName, DWORD Level, PBYTE pDatatypes, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
29c2c66affSColin Finck {
30c2c66affSColin Finck     PSPOOLSS_PRINT_PROVIDER pPrintProvider;
31c2c66affSColin Finck 
32c2c66affSColin Finck     // Sanity checks
33c2c66affSColin Finck     if (cbBuf && !pDatatypes)
34c2c66affSColin Finck     {
35c2c66affSColin Finck         SetLastError(ERROR_INVALID_USER_BUFFER);
36c2c66affSColin Finck         return FALSE;
37c2c66affSColin Finck     }
38c2c66affSColin Finck 
39*62c4b828SJames Tabor     if ( cbBuf && !pDatatypes )
40*62c4b828SJames Tabor     {
41*62c4b828SJames Tabor         SetLastError(ERROR_INVALID_USER_BUFFER);
42*62c4b828SJames Tabor         return FALSE;
43*62c4b828SJames Tabor     }
44*62c4b828SJames Tabor 
45c2c66affSColin Finck     // Always call this function on the Local Spooler.
46c2c66affSColin Finck     pPrintProvider = CONTAINING_RECORD(PrintProviderList.Flink, SPOOLSS_PRINT_PROVIDER, Entry);
47c2c66affSColin Finck     return pPrintProvider->PrintProvider.fpEnumPrintProcessorDatatypes(pName, pPrintProcessorName, Level, pDatatypes, cbBuf, pcbNeeded, pcReturned);
48c2c66affSColin Finck }
49c2c66affSColin Finck 
50c2c66affSColin Finck BOOL WINAPI
EnumPrintProcessorsW(PWSTR pName,PWSTR pEnvironment,DWORD Level,PBYTE pPrintProcessorInfo,DWORD cbBuf,PDWORD pcbNeeded,PDWORD pcReturned)51c2c66affSColin Finck EnumPrintProcessorsW(PWSTR pName, PWSTR pEnvironment, DWORD Level, PBYTE pPrintProcessorInfo, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
52c2c66affSColin Finck {
53c2c66affSColin Finck     // Always call this function on the Local Spooler.
54c2c66affSColin Finck     PSPOOLSS_PRINT_PROVIDER pPrintProvider = CONTAINING_RECORD(PrintProviderList.Flink, SPOOLSS_PRINT_PROVIDER, Entry);
55*62c4b828SJames Tabor 
56*62c4b828SJames Tabor     if ( cbBuf && !pPrintProcessorInfo )
57*62c4b828SJames Tabor     {
58*62c4b828SJames Tabor         SetLastError(ERROR_INVALID_USER_BUFFER);
59*62c4b828SJames Tabor         return FALSE;
60*62c4b828SJames Tabor     }
61*62c4b828SJames Tabor 
62c2c66affSColin Finck     return pPrintProvider->PrintProvider.fpEnumPrintProcessors(pName, pEnvironment, Level, pPrintProcessorInfo, cbBuf, pcbNeeded, pcReturned);
63c2c66affSColin Finck }
64c2c66affSColin Finck 
65c2c66affSColin Finck BOOL WINAPI
GetPrintProcessorDirectoryW(PWSTR pName,PWSTR pEnvironment,DWORD Level,PBYTE pPrintProcessorInfo,DWORD cbBuf,PDWORD pcbNeeded)66c2c66affSColin Finck GetPrintProcessorDirectoryW(PWSTR pName, PWSTR pEnvironment, DWORD Level, PBYTE pPrintProcessorInfo, DWORD cbBuf, PDWORD pcbNeeded)
67c2c66affSColin Finck {
68c2c66affSColin Finck     PSPOOLSS_PRINT_PROVIDER pPrintProvider;
69c2c66affSColin Finck 
70c2c66affSColin Finck     // Sanity checks
71c2c66affSColin Finck     if (cbBuf && !pPrintProcessorInfo)
72c2c66affSColin Finck     {
73c2c66affSColin Finck         SetLastError(ERROR_INVALID_USER_BUFFER);
74c2c66affSColin Finck         return FALSE;
75c2c66affSColin Finck     }
76c2c66affSColin Finck 
77*62c4b828SJames Tabor     if ( cbBuf && !pPrintProcessorInfo )
78*62c4b828SJames Tabor     {
79*62c4b828SJames Tabor         SetLastError(ERROR_INVALID_USER_BUFFER);
80*62c4b828SJames Tabor         return FALSE;
81*62c4b828SJames Tabor     }
82*62c4b828SJames Tabor 
83c2c66affSColin Finck     // Always call this function on the Local Spooler.
84c2c66affSColin Finck     pPrintProvider = CONTAINING_RECORD(PrintProviderList.Flink, SPOOLSS_PRINT_PROVIDER, Entry);
85c2c66affSColin Finck     return pPrintProvider->PrintProvider.fpGetPrintProcessorDirectory(pName, pEnvironment, Level, pPrintProcessorInfo, cbBuf, pcbNeeded);
86c2c66affSColin Finck }
87