Author: cfinck Date: Thu Jul 16 13:59:20 2015 New Revision: 68404
URL: http://svn.reactos.org/svn/reactos?rev=68404&view=rev Log: [SPOOLSV] Implement the RPC calls for EnumMonitors, EnumPorts, ClosePrinter, EndDocPrinter, EndPagePrinter, ReadPrinter, StartDocPrinter, StartPagePrinter and WritePrinter.
Added: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/monitors.c (with props) branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/ports.c (with props) Modified: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/CMakeLists.txt branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printers.c branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/rpcstubs.c
Modified: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/CMakeLists.txt [iso-8859-1] (original) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/CMakeLists.txt [iso-8859-1] Thu Jul 16 13:59:20 2015 @@ -6,6 +6,8 @@ init.c jobs.c main.c + monitors.c + ports.c printers.c printprocessors.c precomp.h
Added: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/monitors.c URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/monitors.c (added) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/monitors.c [iso-8859-1] Thu Jul 16 13:59:20 2015 @@ -0,0 +1,27 @@ +/* + * PROJECT: ReactOS Print Spooler Service + * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation + * PURPOSE: Functions related to Print Monitors + * COPYRIGHT: Copyright 2015 Colin Finck colin@reactos.org + */ + +#include "precomp.h" + +DWORD +_RpcEnumMonitors(WINSPOOL_HANDLE pName, DWORD Level, BYTE* pMonitor, 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; + } + + EnumMonitorsW(pName, Level, pMonitor, cbBuf, pcbNeeded, pcReturned); + dwErrorCode = GetLastError(); + + RpcRevertToSelf(); + return dwErrorCode; +}
Propchange: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/monitors.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/ports.c URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/ports.c (added) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/ports.c [iso-8859-1] Thu Jul 16 13:59:20 2015 @@ -0,0 +1,27 @@ +/* + * PROJECT: ReactOS Print Spooler Service + * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation + * PURPOSE: Functions related to Ports + * COPYRIGHT: Copyright 2015 Colin Finck colin@reactos.org + */ + +#include "precomp.h" + +DWORD +_RpcEnumPorts(WINSPOOL_HANDLE pName, DWORD Level, BYTE* pPort, 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; + } + + EnumPortsW(pName, Level, pPort, cbBuf, pcbNeeded, pcReturned); + dwErrorCode = GetLastError(); + + RpcRevertToSelf(); + return dwErrorCode; +}
Propchange: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/ports.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printers.c URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printers.c [iso-8859-1] (original) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printers.c [iso-8859-1] Thu Jul 16 13:59:20 2015 @@ -6,6 +6,65 @@ */
#include "precomp.h" + +DWORD +_RpcClosePrinter(WINSPOOL_PRINTER_HANDLE *phPrinter) +{ + DWORD dwErrorCode; + + dwErrorCode = RpcImpersonateClient(NULL); + if (dwErrorCode != ERROR_SUCCESS) + { + ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode); + return dwErrorCode; + } + + if (ClosePrinter(*phPrinter)) + *phPrinter = NULL; + + dwErrorCode = GetLastError(); + + RpcRevertToSelf(); + return dwErrorCode; +} + +DWORD +_RpcEndDocPrinter(WINSPOOL_PRINTER_HANDLE hPrinter) +{ + DWORD dwErrorCode; + + dwErrorCode = RpcImpersonateClient(NULL); + if (dwErrorCode != ERROR_SUCCESS) + { + ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode); + return dwErrorCode; + } + + EndDocPrinter(hPrinter); + dwErrorCode = GetLastError(); + + RpcRevertToSelf(); + return dwErrorCode; +} + +DWORD +_RpcEndPagePrinter(WINSPOOL_PRINTER_HANDLE hPrinter) +{ + DWORD dwErrorCode; + + dwErrorCode = RpcImpersonateClient(NULL); + if (dwErrorCode != ERROR_SUCCESS) + { + ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode); + return dwErrorCode; + } + + EndPagePrinter(hPrinter); + dwErrorCode = GetLastError(); + + RpcRevertToSelf(); + return dwErrorCode; +}
DWORD _RpcEnumPrinters(DWORD Flags, WINSPOOL_HANDLE Name, DWORD Level, BYTE* pPrinterEnum, DWORD cbBuf, DWORD* pcbNeeded, DWORD* pcReturned) @@ -49,3 +108,79 @@ RpcRevertToSelf(); return dwErrorCode; } + +DWORD +_RpcReadPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, BYTE *pBuf, DWORD cbBuf, DWORD *pcNoBytesRead) +{ + DWORD dwErrorCode; + + dwErrorCode = RpcImpersonateClient(NULL); + if (dwErrorCode != ERROR_SUCCESS) + { + ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode); + return dwErrorCode; + } + + ReadPrinter(hPrinter, pBuf, cbBuf, pcNoBytesRead); + dwErrorCode = GetLastError(); + + RpcRevertToSelf(); + return dwErrorCode; +} + +DWORD +_RpcStartDocPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_DOC_INFO_CONTAINER* pDocInfoContainer, DWORD* pJobId) +{ + DWORD dwErrorCode; + + dwErrorCode = RpcImpersonateClient(NULL); + if (dwErrorCode != ERROR_SUCCESS) + { + ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode); + return dwErrorCode; + } + + *pJobId = StartDocPrinterW(hPrinter, pDocInfoContainer->Level, (PBYTE)pDocInfoContainer->DocInfo.pDocInfo1); + dwErrorCode = GetLastError(); + + RpcRevertToSelf(); + return dwErrorCode; +} + +DWORD +_RpcStartPagePrinter(WINSPOOL_PRINTER_HANDLE hPrinter) +{ + DWORD dwErrorCode; + + dwErrorCode = RpcImpersonateClient(NULL); + if (dwErrorCode != ERROR_SUCCESS) + { + ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode); + return dwErrorCode; + } + + StartPagePrinter(hPrinter); + dwErrorCode = GetLastError(); + + RpcRevertToSelf(); + return dwErrorCode; +} + +DWORD +_RpcWritePrinter(WINSPOOL_PRINTER_HANDLE hPrinter, BYTE *pBuf, DWORD cbBuf, DWORD *pcWritten) +{ + DWORD dwErrorCode; + + dwErrorCode = RpcImpersonateClient(NULL); + if (dwErrorCode != ERROR_SUCCESS) + { + ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode); + return dwErrorCode; + } + + WritePrinter(hPrinter, pBuf, cbBuf, pcWritten); + dwErrorCode = GetLastError(); + + RpcRevertToSelf(); + return dwErrorCode; +}
Modified: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/rpcstubs.c URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/rpcstubs.c [iso-8859-1] (original) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/rpcstubs.c [iso-8859-1] Thu Jul 16 13:59:20 2015 @@ -71,34 +71,6 @@ }
DWORD -_RpcStartDocPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_DOC_INFO_CONTAINER *pDocInfoContainer, DWORD *pJobId) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcStartPagePrinter(WINSPOOL_PRINTER_HANDLE hPrinter) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcWritePrinter(WINSPOOL_PRINTER_HANDLE hPrinter, BYTE *pBuf, DWORD cbBuf, DWORD *pcWritten) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcEndPagePrinter(WINSPOOL_PRINTER_HANDLE hPrinter) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD _RpcAbortPrinter(WINSPOOL_PRINTER_HANDLE hPrinter) { UNIMPLEMENTED; @@ -106,20 +78,6 @@ }
DWORD -_RpcReadPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, BYTE *pBuf, DWORD cbBuf, DWORD *pcNoBytesRead) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcEndDocPrinter(WINSPOOL_PRINTER_HANDLE hPrinter) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD _RpcGetPrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR *pValueName, DWORD *pType, BYTE *pData, DWORD nSize, DWORD *pcbNeeded) { UNIMPLEMENTED; @@ -141,13 +99,6 @@ }
DWORD -_RpcClosePrinter(WINSPOOL_PRINTER_HANDLE *phPrinter) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD _RpcAddForm(WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_FORM_CONTAINER *pFormInfoContainer) { UNIMPLEMENTED; @@ -183,20 +134,6 @@ }
DWORD -_RpcEnumPorts(WINSPOOL_HANDLE pName, DWORD Level, BYTE *pPort, DWORD cbBuf, DWORD *pcbNeeded, DWORD *pcReturned) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcEnumMonitors(WINSPOOL_HANDLE pName, DWORD Level, BYTE *pMonitor, DWORD cbBuf, DWORD *pcbNeeded, DWORD *pcReturned) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD _RpcAddPort(WINSPOOL_HANDLE pName, ULONG_PTR hWnd, WCHAR *pMonitorName) { UNIMPLEMENTED;