--- /dev/null
+/*
+ * PROJECT: ReactOS Print Spooler Service
+ * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
+ * PURPOSE: Functions related to Printers and printing
+ * COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
+ */
+
+#include "precomp.h"
+
+DWORD
+_RpcEnumPrinters(DWORD Flags, WINSPOOL_HANDLE Name, DWORD Level, BYTE* pPrinterEnum, DWORD cbBuf, DWORD* pcbNeeded, DWORD* pcReturned)
+{
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ dwErrorCode = EnumPrintersW(Flags, Name, Level, pPrinterEnum, cbBuf, pcbNeeded, pcReturned);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("EnumPrintersW failed with error %lu!\n", dwErrorCode);
+ RpcRevertToSelf();
+ return dwErrorCode;
+ }
+
+ return RpcRevertToSelf();
+}
+
+DWORD
+_RpcOpenPrinter(WINSPOOL_HANDLE pPrinterName, WINSPOOL_PRINTER_HANDLE* phPrinter, WCHAR* pDatatype, WINSPOOL_DEVMODE_CONTAINER* pDevModeContainer, DWORD AccessRequired)
+{
+ DWORD dwErrorCode;
+ PRINTER_DEFAULTSW Default;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ Default.DesiredAccess = AccessRequired;
+ Default.pDatatype = pDatatype;
+ Default.pDevMode = (PDEVMODEW)pDevModeContainer->pDevMode;
+
+ dwErrorCode = OpenPrinterW(pPrinterName, phPrinter, &Default);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("OpenPrinterW failed with error %lu!\n", dwErrorCode);
+ RpcRevertToSelf();
+ return dwErrorCode;
+ }
+
+ return RpcRevertToSelf();
+}