[SPOOLSS] [SPOOLSV] [WINSPOOL]
[reactos.git] / reactos / win32ss / printing / base / winspool / jobs.c
1 /*
2 * PROJECT: ReactOS Spooler API
3 * LICENSE: GNU LGPL v2.1 or any later version as published by the Free Software Foundation
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 AddJob(HANDLE hPrinter, DWORD Level, LPBYTE pData, DWORD cbBuf, LPDWORD pcbNeeded)
12 {
13 BOOL bReturnValue = FALSE;
14 DWORD dwErrorCode;
15
16 // Do the RPC call
17 RpcTryExcept
18 {
19 dwErrorCode = _RpcAddJob(hPrinter, Level, pData, cbBuf, pcbNeeded);
20 if (dwErrorCode)
21 {
22 ERR("_RpcAddJob failed with error %lu!\n", dwErrorCode);
23 }
24
25 bReturnValue = (dwErrorCode == ERROR_SUCCESS);
26 }
27 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
28 {
29 ERR("_RpcAddJob failed with exception code %lu!\n", RpcExceptionCode());
30 }
31 RpcEndExcept;
32
33 return bReturnValue;
34 }
35
36 BOOL WINAPI
37 GetJob(HANDLE hPrinter, DWORD JobId, DWORD Level, LPBYTE pJob, DWORD cbBuf, LPDWORD pcbNeeded)
38 {
39 BOOL bReturnValue = FALSE;
40 DWORD dwErrorCode;
41
42 // Do the RPC call
43 RpcTryExcept
44 {
45 dwErrorCode = _RpcGetJob(hPrinter, JobId, Level, pJob, cbBuf, pcbNeeded);
46 if (dwErrorCode)
47 {
48 ERR("_RpcGetJob failed with error %lu!\n", dwErrorCode);
49 }
50
51 bReturnValue = (dwErrorCode == ERROR_SUCCESS);
52 }
53 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
54 {
55 ERR("_RpcGetJob failed with exception code %lu!\n", RpcExceptionCode());
56 }
57 RpcEndExcept;
58
59 return bReturnValue;
60 }