mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
[SPOOLSV]
Implement the RPC calls for EnumMonitors, EnumPorts, ClosePrinter, EndDocPrinter, EndPagePrinter, ReadPrinter, StartDocPrinter, StartPagePrinter and WritePrinter. svn path=/branches/colins-printing-for-freedom/; revision=68404
This commit is contained in:
parent
843622e20a
commit
f848e96f26
5 changed files with 191 additions and 63 deletions
|
@ -6,6 +6,8 @@ list(APPEND SOURCE
|
|||
init.c
|
||||
jobs.c
|
||||
main.c
|
||||
monitors.c
|
||||
ports.c
|
||||
printers.c
|
||||
printprocessors.c
|
||||
precomp.h
|
||||
|
|
27
reactos/win32ss/printing/base/spoolsv/monitors.c
Normal file
27
reactos/win32ss/printing/base/spoolsv/monitors.c
Normal file
|
@ -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;
|
||||
}
|
27
reactos/win32ss/printing/base/spoolsv/ports.c
Normal file
27
reactos/win32ss/printing/base/spoolsv/ports.c
Normal file
|
@ -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;
|
||||
}
|
|
@ -7,6 +7,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 @@ _RpcOpenPrinter(WINSPOOL_HANDLE pPrinterName, WINSPOOL_PRINTER_HANDLE* phPrinter
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -70,34 +70,6 @@ _RpcDeletePrinterDriver(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, WCHAR *pDriv
|
|||
return ERROR_INVALID_FUNCTION;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -105,20 +77,6 @@ _RpcAbortPrinter(WINSPOOL_PRINTER_HANDLE hPrinter)
|
|||
return ERROR_INVALID_FUNCTION;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -140,13 +98,6 @@ _RpcWaitForPrinterChange(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD Flags, DWORD *p
|
|||
return ERROR_INVALID_FUNCTION;
|
||||
}
|
||||
|
||||
DWORD
|
||||
_RpcClosePrinter(WINSPOOL_PRINTER_HANDLE *phPrinter)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return ERROR_INVALID_FUNCTION;
|
||||
}
|
||||
|
||||
DWORD
|
||||
_RpcAddForm(WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_FORM_CONTAINER *pFormInfoContainer)
|
||||
{
|
||||
|
@ -182,20 +133,6 @@ _RpcEnumForms(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD Level, BYTE *pForm, DWORD
|
|||
return ERROR_INVALID_FUNCTION;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue