xref: /reactos/win32ss/printing/base/spoolss/jobs.c (revision 1734f297)
1 /*
2  * PROJECT:     ReactOS Spooler Router
3  * LICENSE:     GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE:     Functions for managing print jobs
5  * COPYRIGHT:   Copyright 2015 Colin Finck (colin@reactos.org)
6  */
7 
8 #include "precomp.h"
9 
10 BOOL WINAPI
11 AddJobW(HANDLE hPrinter, DWORD Level, PBYTE pData, DWORD cbBuf, PDWORD pcbNeeded)
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.fpAddJob(pHandle->hPrinter, Level, pData, cbBuf, pcbNeeded);
23 }
24 
25 BOOL WINAPI
26 EnumJobsW(HANDLE hPrinter, DWORD FirstJob, DWORD NoJobs, DWORD Level, PBYTE pJob, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
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.fpEnumJobs(pHandle->hPrinter, FirstJob, NoJobs, Level, pJob, cbBuf, pcbNeeded, pcReturned);
38 }
39 
40 BOOL WINAPI
41 GetJobW(HANDLE hPrinter, DWORD JobId, DWORD Level, PBYTE pJob, DWORD cbBuf, PDWORD pcbNeeded)
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     return pHandle->pPrintProvider->PrintProvider.fpGetJob(pHandle->hPrinter, JobId, Level, pJob, cbBuf, pcbNeeded);
53 }
54 
55 BOOL WINAPI
56 ScheduleJob(HANDLE hPrinter, DWORD dwJobID)
57 {
58     PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
59 
60     // Sanity checks.
61     if (!pHandle)
62     {
63         SetLastError(ERROR_INVALID_PARAMETER);
64         return FALSE;
65     }
66 
67     return pHandle->pPrintProvider->PrintProvider.fpScheduleJob(pHandle->hPrinter, dwJobID);
68 }
69 
70 BOOL WINAPI
71 SetJobW(HANDLE hPrinter, DWORD JobId, DWORD Level, PBYTE pJobInfo, DWORD Command)
72 {
73     PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
74 
75     // Sanity checks.
76     if (!pHandle)
77     {
78         SetLastError(ERROR_INVALID_PARAMETER);
79         return FALSE;
80     }
81 
82     return pHandle->pPrintProvider->PrintProvider.fpSetJob(pHandle->hPrinter, JobId, Level, pJobInfo, Command);
83 }
84