[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 SetLastError(dwErrorCode);
21 bReturnValue = (dwErrorCode == ERROR_SUCCESS);
22 }
23 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
24 {
25 ERR("_RpcAddJob failed with exception code %lu!\n", RpcExceptionCode());
26 }
27 RpcEndExcept;
28
29 return bReturnValue;
30 }
31
32 BOOL WINAPI
33 GetJob(HANDLE hPrinter, DWORD JobId, DWORD Level, LPBYTE pJob, DWORD cbBuf, LPDWORD pcbNeeded)
34 {
35 BOOL bReturnValue = FALSE;
36 DWORD dwErrorCode;
37
38 // Do the RPC call
39 RpcTryExcept
40 {
41 dwErrorCode = _RpcGetJob(hPrinter, JobId, Level, pJob, cbBuf, pcbNeeded);
42 SetLastError(dwErrorCode);
43 bReturnValue = (dwErrorCode == ERROR_SUCCESS);
44 }
45 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
46 {
47 ERR("_RpcGetJob failed with exception code %lu!\n", RpcExceptionCode());
48 }
49 RpcEndExcept;
50
51 return bReturnValue;
52 }