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