2 * PROJECT: ReactOS Print Spooler Service
3 * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
4 * PURPOSE: Functions related to Printers and printing
5 * COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
11 _RpcEnumPrinters(DWORD Flags
, WINSPOOL_HANDLE Name
, DWORD Level
, BYTE
* pPrinterEnum
, DWORD cbBuf
, DWORD
* pcbNeeded
, DWORD
* pcReturned
)
15 dwErrorCode
= RpcImpersonateClient(NULL
);
16 if (dwErrorCode
!= ERROR_SUCCESS
)
18 ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode
);
22 dwErrorCode
= EnumPrintersW(Flags
, Name
, Level
, pPrinterEnum
, cbBuf
, pcbNeeded
, pcReturned
);
23 if (dwErrorCode
!= ERROR_SUCCESS
)
25 ERR("EnumPrintersW failed with error %lu!\n", dwErrorCode
);
30 return RpcRevertToSelf();
34 _RpcOpenPrinter(WINSPOOL_HANDLE pPrinterName
, WINSPOOL_PRINTER_HANDLE
* phPrinter
, WCHAR
* pDatatype
, WINSPOOL_DEVMODE_CONTAINER
* pDevModeContainer
, DWORD AccessRequired
)
37 PRINTER_DEFAULTSW Default
;
39 dwErrorCode
= RpcImpersonateClient(NULL
);
40 if (dwErrorCode
!= ERROR_SUCCESS
)
42 ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode
);
46 Default
.DesiredAccess
= AccessRequired
;
47 Default
.pDatatype
= pDatatype
;
48 Default
.pDevMode
= (PDEVMODEW
)pDevModeContainer
->pDevMode
;
50 dwErrorCode
= OpenPrinterW(pPrinterName
, phPrinter
, &Default
);
51 if (dwErrorCode
!= ERROR_SUCCESS
)
53 ERR("OpenPrinterW failed with error %lu!\n", dwErrorCode
);
58 return RpcRevertToSelf();