Author: cfinck Date: Fri Jul 17 10:57:10 2015 New Revision: 68408
URL: http://svn.reactos.org/svn/reactos?rev=68408&view=rev Log: [SPOOLSV, WINSPOOL] - Add RPC calls, proper marshalling and exports for all implemented functions. - Move the spoolsv stubs into categories, so that future implementations in winspool, spoolsv, spoolss and localspl can follow a consistent naming scheme.
Added: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/forms.c (with props) branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/notifications.c (with props) branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printerdata.c (with props) branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printerdrivers.c (with props) branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printproviders.c (with props) branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/xcv.c (with props) branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/monitors.c (with props) branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/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/monitors.c branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/ports.c branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printers.c branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printprocessors.c branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/rpcstubs.c branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/CMakeLists.txt branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/jobs.c branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/printers.c branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/printprocessors.c branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/winspool.spec
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] Fri Jul 17 10:57:10 2015 @@ -3,16 +3,22 @@ add_rpc_files(server ${REACTOS_SOURCE_DIR}/include/reactos/idl/winspool.idl)
list(APPEND SOURCE + forms.c init.c jobs.c main.c monitors.c + notifications.c ports.c + precomp.h + printerdata.c + printerdrivers.c printers.c printprocessors.c - precomp.h + printproviders.c rpcserver.c rpcstubs.c + xcv.c ${CMAKE_CURRENT_BINARY_DIR}/winspool_s.c)
add_executable(spoolsv ${SOURCE} spoolsv.rc)
Added: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/forms.c URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/forms.c (added) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/forms.c [iso-8859-1] Fri Jul 17 10:57:10 2015 @@ -0,0 +1,43 @@ +/* + * PROJECT: ReactOS Print Spooler Service + * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation + * PURPOSE: Functions related to Forms + * COPYRIGHT: Copyright 2015 Colin Finck colin@reactos.org + */ + +#include "precomp.h" + +DWORD +_RpcAddForm(WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_FORM_CONTAINER* pFormInfoContainer) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcDeleteForm(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pFormName) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcEnumForms(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD Level, BYTE* pForm, DWORD cbBuf, DWORD* pcbNeeded, DWORD* pcReturned) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcGetForm(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pFormName, DWORD Level, BYTE* pForm, DWORD cbBuf, DWORD* pcbNeeded) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcSetForm(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pFormName, WINSPOOL_FORM_CONTAINER* pFormInfoContainer) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +}
Propchange: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/forms.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: 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 [iso-8859-1] (original) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/monitors.c [iso-8859-1] Fri Jul 17 10:57:10 2015 @@ -7,10 +7,41 @@
#include "precomp.h"
+static void +_MarshallDownMonitorInfo(PBYTE pMonitorInfo, DWORD Level) +{ + PMONITOR_INFO_2W pMonitorInfo2 = (PMONITOR_INFO_2W)pMonitorInfo; // MONITOR_INFO_1W is a subset of MONITOR_INFO_2W + + // Replace absolute pointer addresses in the output by relative offsets. + pMonitorInfo2->pName = (PWSTR)((ULONG_PTR)pMonitorInfo2->pName - (ULONG_PTR)pMonitorInfo2); + + if (Level == 2) + { + pMonitorInfo2->pDLLName = (PWSTR)((ULONG_PTR)pMonitorInfo2->pDLLName - (ULONG_PTR)pMonitorInfo2); + pMonitorInfo2->pEnvironment = (PWSTR)((ULONG_PTR)pMonitorInfo2->pEnvironment - (ULONG_PTR)pMonitorInfo2); + } +} + +DWORD +_RpcAddMonitor(WINSPOOL_HANDLE pName, WINSPOOL_MONITOR_CONTAINER* pMonitorContainer) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcDeleteMonitor(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, WCHAR* pMonitorName) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + DWORD _RpcEnumMonitors(WINSPOOL_HANDLE pName, DWORD Level, BYTE* pMonitor, DWORD cbBuf, DWORD* pcbNeeded, DWORD* pcReturned) { DWORD dwErrorCode; + DWORD i; + PBYTE p = pMonitor;
dwErrorCode = RpcImpersonateClient(NULL); if (dwErrorCode != ERROR_SUCCESS) @@ -22,6 +53,20 @@ EnumMonitorsW(pName, Level, pMonitor, cbBuf, pcbNeeded, pcReturned); dwErrorCode = GetLastError();
+ if (dwErrorCode == ERROR_SUCCESS) + { + // Replace absolute pointer addresses in the output by relative offsets. + for (i = 0; i < *pcReturned; i++) + { + _MarshallDownMonitorInfo(p, Level); + + if (Level == 1) + p += sizeof(MONITOR_INFO_1W); + else if (Level == 2) + p += sizeof(MONITOR_INFO_2W); + } + } + RpcRevertToSelf(); return dwErrorCode; }
Added: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/notifications.c URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/notifications.c (added) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/notifications.c [iso-8859-1] Fri Jul 17 10:57:10 2015 @@ -0,0 +1,92 @@ +/* + * PROJECT: ReactOS Print Spooler Service + * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation + * PURPOSE: Functions related to Printer Configuration Data + * COPYRIGHT: Copyright 2015 Colin Finck colin@reactos.org + */ + +#include "precomp.h" + +DWORD +_RpcClientFindFirstPrinterChangeNotification() +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcFindClosePrinterChangeNotification() +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcFindNextPrinterChangeNotification() +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcRemoteFindFirstPrinterChangeNotification(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD fdwFlags, DWORD fdwOptions, WCHAR* pszLocalMachine, DWORD dwPrinterLocal, DWORD cbBuffer, BYTE* pBuffer) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcRemoteFindFirstPrinterChangeNotificationEx(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD fdwFlags, DWORD fdwOptions, WCHAR* pszLocalMachine, DWORD dwPrinterLocal, WINSPOOL_V2_NOTIFY_OPTIONS* pOptions) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcReplyClosePrinter(WINSPOOL_PRINTER_HANDLE* phNotify) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcReplyOpenPrinter(WINSPOOL_HANDLE pMachine, WINSPOOL_PRINTER_HANDLE* phPrinterNotify, DWORD dwPrinterRemote, DWORD dwType, DWORD cbBuffer, BYTE* pBuffer) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcRouterFindFirstPrinterChangeNotificationOld() +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcRouterRefreshPrinterChangeNotification(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD dwColor, WINSPOOL_V2_NOTIFY_OPTIONS* pOptions, WINSPOOL_V2_NOTIFY_INFO** ppInfo) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcRouterReplyPrinter(WINSPOOL_PRINTER_HANDLE hNotify, DWORD fdwFlags, DWORD cbBuffer, BYTE* pBuffer) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcRouterReplyPrinterEx(WINSPOOL_PRINTER_HANDLE hNotify, DWORD dwColor, DWORD fdwFlags, DWORD* pdwResult, DWORD dwReplyType, WINSPOOL_V2_UREPLY_PRINTER Reply) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcWaitForPrinterChange(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD Flags, DWORD* pFlags) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +}
Propchange: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/notifications.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: 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 [iso-8859-1] (original) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/ports.c [iso-8859-1] Fri Jul 17 10:57:10 2015 @@ -7,10 +7,55 @@
#include "precomp.h"
+static void +_MarshallDownPortInfo(PBYTE pPortInfo, DWORD Level) +{ + PPORT_INFO_2W pPortInfo2 = (PPORT_INFO_2W)pPortInfo; // PORT_INFO_1W is a subset of PORT_INFO_2W + + // Replace absolute pointer addresses in the output by relative offsets. + pPortInfo2->pPortName = (PWSTR)((ULONG_PTR)pPortInfo2->pPortName - (ULONG_PTR)pPortInfo2); + + if (Level == 2) + { + pPortInfo2->pDescription = (PWSTR)((ULONG_PTR)pPortInfo2->pDescription - (ULONG_PTR)pPortInfo2); + pPortInfo2->pMonitorName = (PWSTR)((ULONG_PTR)pPortInfo2->pMonitorName - (ULONG_PTR)pPortInfo2); + } +} + +DWORD +_RpcAddPort(WINSPOOL_HANDLE pName, ULONG_PTR hWnd, WCHAR* pMonitorName) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcAddPortEx(WINSPOOL_HANDLE pName, WINSPOOL_PORT_CONTAINER* pPortContainer, WINSPOOL_PORT_VAR_CONTAINER* pPortVarContainer, WCHAR* pMonitorName) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcConfigurePort(WINSPOOL_HANDLE pName, ULONG_PTR hWnd, WCHAR* pPortName) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcDeletePort(WINSPOOL_HANDLE pName, ULONG_PTR hWnd, WCHAR* pPortName) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + DWORD _RpcEnumPorts(WINSPOOL_HANDLE pName, DWORD Level, BYTE* pPort, DWORD cbBuf, DWORD* pcbNeeded, DWORD* pcReturned) { DWORD dwErrorCode; + DWORD i; + PBYTE p = pPort;
dwErrorCode = RpcImpersonateClient(NULL); if (dwErrorCode != ERROR_SUCCESS) @@ -22,6 +67,27 @@ EnumPortsW(pName, Level, pPort, cbBuf, pcbNeeded, pcReturned); dwErrorCode = GetLastError();
+ if (dwErrorCode == ERROR_SUCCESS) + { + // Replace absolute pointer addresses in the output by relative offsets. + for (i = 0; i < *pcReturned; i++) + { + _MarshallDownPortInfo(p, Level); + + if (Level == 1) + p += sizeof(PORT_INFO_1W); + else if (Level == 2) + p += sizeof(PORT_INFO_2W); + } + } + RpcRevertToSelf(); return dwErrorCode; } + +DWORD +_RpcSetPort(WINSPOOL_HANDLE pName, WCHAR* pPortName, WINSPOOL_PORT_CONTAINER* pPortContainer) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +}
Added: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printerdata.c URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printerdata.c (added) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printerdata.c [iso-8859-1] Fri Jul 17 10:57:10 2015 @@ -0,0 +1,78 @@ +/* + * PROJECT: ReactOS Print Spooler Service + * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation + * PURPOSE: Functions related to Printer Configuration Data + * COPYRIGHT: Copyright 2015 Colin Finck colin@reactos.org + */ + +#include "precomp.h" + +DWORD +_RpcDeletePrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pValueName) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcDeletePrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pKeyName, const WCHAR* pValueName) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcDeletePrinterKey(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pKeyName) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcEnumPrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD dwIndex, WCHAR* pValueName, DWORD cbValueName, DWORD* pcbValueName, DWORD* pType, BYTE* pData, DWORD cbData, DWORD* pcbData) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcEnumPrinterKey(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pKeyName, WCHAR* pSubkey, DWORD cbSubkey, DWORD* pcbSubkey) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcEnumPrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pKeyName, BYTE* pEnumValues, DWORD cbEnumValues, DWORD* pcbEnumValues, DWORD* pnEnumValues) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcGetPrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pValueName, DWORD* pType, BYTE* pData, DWORD nSize, DWORD* pcbNeeded) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcGetPrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pKeyName, const WCHAR* pValueName, DWORD* pType, BYTE* pData, DWORD nSize, DWORD* pcbNeeded) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcSetPrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pValueName, DWORD Type, BYTE* pData, DWORD cbData) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcSetPrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pKeyName, const WCHAR* pValueName, DWORD Type, BYTE* pData, DWORD cbData) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +}
Propchange: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printerdata.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printerdrivers.c URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printerdrivers.c (added) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printerdrivers.c [iso-8859-1] Fri Jul 17 10:57:10 2015 @@ -0,0 +1,64 @@ +/* + * PROJECT: ReactOS Print Spooler Service + * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation + * PURPOSE: Functions related to Printer Drivers + * COPYRIGHT: Copyright 2015 Colin Finck colin@reactos.org + */ + +#include "precomp.h" + +DWORD +_RpcAddPrinterDriver(WINSPOOL_HANDLE pName, WINSPOOL_DRIVER_CONTAINER* pDriverContainer) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcAddPrinterDriverEx(WINSPOOL_HANDLE pName, WINSPOOL_DRIVER_CONTAINER* pDriverContainer, DWORD dwFileCopyFlags) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcDeletePrinterDriver(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, WCHAR* pDriverName) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcDeletePrinterDriverEx(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, WCHAR* pDriverName, DWORD dwDeleteFlag, DWORD dwVersionNum) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcEnumPrinterDrivers(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, DWORD Level, BYTE* pDrivers, DWORD cbBuf, DWORD* pcbNeeded, DWORD* pcReturned) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcGetPrinterDriver(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pEnvironment, DWORD Level, BYTE* pDriver, DWORD cbBuf, DWORD* pcbNeeded) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcGetPrinterDriver2(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pEnvironment, DWORD Level, BYTE* pDriver, DWORD cbBuf, DWORD* pcbNeeded, DWORD dwClientMajorVersion, DWORD dwClientMinorVersion, DWORD* pdwServerMaxVersion, DWORD* pdwServerMinVersion) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcGetPrinterDriverDirectory(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, DWORD Level, BYTE* pDriverDirectory, DWORD cbBuf, DWORD* pcbNeeded) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +}
Propchange: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printerdrivers.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] Fri Jul 17 10:57:10 2015 @@ -7,8 +7,68 @@
#include "precomp.h"
-DWORD -_RpcClosePrinter(WINSPOOL_PRINTER_HANDLE *phPrinter) +static void +_MarshallDownPrinterInfo(PBYTE pPrinterInfo, DWORD Level) +{ + PPRINTER_INFO_1W pPrinterInfo1; + PPRINTER_INFO_2W pPrinterInfo2; + + // Replace absolute pointer addresses in the output by relative offsets. + if (Level == 1) + { + pPrinterInfo1 = (PPRINTER_INFO_1W)pPrinterInfo; + + pPrinterInfo1->pName = (PWSTR)((ULONG_PTR)pPrinterInfo1->pName - (ULONG_PTR)pPrinterInfo1); + pPrinterInfo1->pDescription = (PWSTR)((ULONG_PTR)pPrinterInfo1->pDescription - (ULONG_PTR)pPrinterInfo1); + pPrinterInfo1->pComment = (PWSTR)((ULONG_PTR)pPrinterInfo1->pComment - (ULONG_PTR)pPrinterInfo1); + } + else if (Level == 2) + { + pPrinterInfo2 = (PPRINTER_INFO_2W)pPrinterInfo; + + pPrinterInfo2->pPrinterName = (PWSTR)((ULONG_PTR)pPrinterInfo2->pPrinterName - (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pShareName = (PWSTR)((ULONG_PTR)pPrinterInfo2->pShareName - (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pPortName = (PWSTR)((ULONG_PTR)pPrinterInfo2->pPortName - (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pDriverName = (PWSTR)((ULONG_PTR)pPrinterInfo2->pDriverName - (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pComment = (PWSTR)((ULONG_PTR)pPrinterInfo2->pComment - (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pLocation = (PWSTR)((ULONG_PTR)pPrinterInfo2->pLocation - (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pDevMode = (PDEVMODEW)((ULONG_PTR)pPrinterInfo2->pDevMode - (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pSepFile = (PWSTR)((ULONG_PTR)pPrinterInfo2->pSepFile - (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pPrintProcessor = (PWSTR)((ULONG_PTR)pPrinterInfo2->pPrintProcessor - (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pDatatype = (PWSTR)((ULONG_PTR)pPrinterInfo2->pDatatype - (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pParameters = (PWSTR)((ULONG_PTR)pPrinterInfo2->pParameters - (ULONG_PTR)pPrinterInfo2); + + if (pPrinterInfo2->pServerName) + pPrinterInfo2->pServerName = (PWSTR)((ULONG_PTR)pPrinterInfo2->pServerName - (ULONG_PTR)pPrinterInfo2); + + if (pPrinterInfo2->pSecurityDescriptor) + pPrinterInfo2->pSecurityDescriptor = (PWSTR)((ULONG_PTR)pPrinterInfo2->pSecurityDescriptor - (ULONG_PTR)pPrinterInfo2); + } +} + +DWORD +_RpcAbortPrinter(WINSPOOL_PRINTER_HANDLE hPrinter) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcAddPrinter(WINSPOOL_HANDLE pName, WINSPOOL_PRINTER_CONTAINER* pPrinterContainer, WINSPOOL_DEVMODE_CONTAINER* pDevModeContainer, WINSPOOL_SECURITY_CONTAINER* pSecurityContainer, WINSPOOL_PRINTER_HANDLE* pHandle) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcAddPrinterEx(WINSPOOL_HANDLE pName, WINSPOOL_PRINTER_CONTAINER* pPrinterContainer, WINSPOOL_DEVMODE_CONTAINER* pDevModeContainer, WINSPOOL_SECURITY_CONTAINER* pSecurityContainer, WINSPOOL_SPLCLIENT_CONTAINER* pClientInfo, WINSPOOL_PRINTER_HANDLE* pHandle) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcClosePrinter(WINSPOOL_PRINTER_HANDLE* phPrinter) { DWORD dwErrorCode;
@@ -29,6 +89,13 @@ }
DWORD +_RpcDeletePrinter(WINSPOOL_PRINTER_HANDLE hPrinter) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD _RpcEndDocPrinter(WINSPOOL_PRINTER_HANDLE hPrinter) { DWORD dwErrorCode; @@ -70,6 +137,8 @@ _RpcEnumPrinters(DWORD Flags, WINSPOOL_HANDLE Name, DWORD Level, BYTE* pPrinterEnum, DWORD cbBuf, DWORD* pcbNeeded, DWORD* pcReturned) { DWORD dwErrorCode; + DWORD i; + PBYTE p = pPrinterEnum;
dwErrorCode = RpcImpersonateClient(NULL); if (dwErrorCode != ERROR_SUCCESS) @@ -81,8 +150,36 @@ EnumPrintersW(Flags, Name, Level, pPrinterEnum, cbBuf, pcbNeeded, pcReturned); dwErrorCode = GetLastError();
- RpcRevertToSelf(); - return dwErrorCode; + if (dwErrorCode == ERROR_SUCCESS) + { + // Replace absolute pointer addresses in the output by relative offsets. + for (i = 0; i < *pcReturned; i++) + { + _MarshallDownPrinterInfo(p, Level); + + if (Level == 1) + p += sizeof(PRINTER_INFO_1W); + else if (Level == 2) + p += sizeof(PRINTER_INFO_2W); + } + } + + RpcRevertToSelf(); + return dwErrorCode; +} + +DWORD +_RpcFlushPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, BYTE* pBuf, DWORD cbBuf, DWORD* pcWritten, DWORD cSleep) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcGetPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD Level, BYTE* pPrinter, DWORD cbBuf, DWORD* pcbNeeded) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; }
DWORD @@ -110,7 +207,14 @@ }
DWORD -_RpcReadPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, BYTE *pBuf, DWORD cbBuf, DWORD *pcNoBytesRead) +_RpcOpenPrinterEx(WINSPOOL_HANDLE pPrinterName, WINSPOOL_PRINTER_HANDLE* pHandle, WCHAR* pDatatype, WINSPOOL_DEVMODE_CONTAINER* pDevModeContainer, DWORD AccessRequired, WINSPOOL_SPLCLIENT_CONTAINER* pClientInfo) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcReadPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, BYTE* pBuf, DWORD cbBuf, DWORD* pcNoBytesRead) { DWORD dwErrorCode;
@@ -129,6 +233,34 @@ }
DWORD +_RpcResetPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pDatatype, WINSPOOL_DEVMODE_CONTAINER* pDevModeContainer) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcResetPrinterEx() +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcSeekPrinter() +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcSetPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_PRINTER_CONTAINER* pPrinterContainer, WINSPOOL_DEVMODE_CONTAINER* pDevModeContainer, WINSPOOL_SECURITY_CONTAINER* pSecurityContainer, DWORD Command) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD _RpcStartDocPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_DOC_INFO_CONTAINER* pDocInfoContainer, DWORD* pJobId) { DWORD dwErrorCode; @@ -167,7 +299,7 @@ }
DWORD -_RpcWritePrinter(WINSPOOL_PRINTER_HANDLE hPrinter, BYTE *pBuf, DWORD cbBuf, DWORD *pcWritten) +_RpcWritePrinter(WINSPOOL_PRINTER_HANDLE hPrinter, BYTE* pBuf, DWORD cbBuf, DWORD* pcWritten) { DWORD dwErrorCode;
Modified: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printprocessors.c URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printprocessors.c [iso-8859-1] (original) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printprocessors.c [iso-8859-1] Fri Jul 17 10:57:10 2015 @@ -7,17 +7,40 @@
#include "precomp.h"
+static void +_MarshallDownDatatypesInfo(PDATATYPES_INFO_1W pDatatypesInfo1) +{ + // Replace absolute pointer addresses in the output by relative offsets. + pDatatypesInfo1->pName = (PWSTR)((ULONG_PTR)pDatatypesInfo1->pName - (ULONG_PTR)pDatatypesInfo1); +} + +static void +_MarshallDownPrintProcessorInfo(PPRINTPROCESSOR_INFO_1W pPrintProcessorInfo1) +{ + // Replace absolute pointer addresses in the output by relative offsets. + pPrintProcessorInfo1->pName = (PWSTR)((ULONG_PTR)pPrintProcessorInfo1->pName - (ULONG_PTR)pPrintProcessorInfo1); +} + DWORD -_RpcAddPrintProcessor(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, WCHAR *pPathName, WCHAR *pPrintProcessorName) +_RpcAddPrintProcessor(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, WCHAR* pPathName, WCHAR* pPrintProcessorName) { UNIMPLEMENTED; return ERROR_INVALID_FUNCTION; }
DWORD -_RpcEnumPrintProcessorDatatypes(WINSPOOL_HANDLE pName, WCHAR *pPrintProcessorName, DWORD Level, BYTE *pDatatypes, DWORD cbBuf, DWORD *pcbNeeded, DWORD *pcReturned) +_RpcDeletePrintProcessor(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, WCHAR* pPrintProcessorName) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcEnumPrintProcessorDatatypes(WINSPOOL_HANDLE pName, WCHAR* pPrintProcessorName, DWORD Level, BYTE* pDatatypes, DWORD cbBuf, DWORD* pcbNeeded, DWORD* pcReturned) { DWORD dwErrorCode; + DWORD i; + PBYTE p = pDatatypes;
dwErrorCode = RpcImpersonateClient(NULL); if (dwErrorCode != ERROR_SUCCESS) @@ -29,14 +52,26 @@ EnumPrintProcessorDatatypesW(pName, pPrintProcessorName, Level, pDatatypes, cbBuf, pcbNeeded, pcReturned); dwErrorCode = GetLastError();
+ if (dwErrorCode == ERROR_SUCCESS) + { + // Replace absolute pointer addresses in the output by relative offsets. + for (i = 0; i < *pcReturned; i++) + { + _MarshallDownDatatypesInfo((PDATATYPES_INFO_1W)p); + p += sizeof(DATATYPES_INFO_1W); + } + } + RpcRevertToSelf(); return dwErrorCode; }
DWORD -_RpcEnumPrintProcessors(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, DWORD Level, BYTE *pPrintProcessorInfo, DWORD cbBuf, DWORD *pcbNeeded, DWORD *pcReturned) +_RpcEnumPrintProcessors(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, DWORD Level, BYTE* pPrintProcessorInfo, DWORD cbBuf, DWORD* pcbNeeded, DWORD* pcReturned) { DWORD dwErrorCode; + DWORD i; + PBYTE p = pPrintProcessorInfo;
dwErrorCode = RpcImpersonateClient(NULL); if (dwErrorCode != ERROR_SUCCESS) @@ -48,12 +83,22 @@ EnumPrintProcessorsW(pName, pEnvironment, Level, pPrintProcessorInfo, cbBuf, pcbNeeded, pcReturned); dwErrorCode = GetLastError();
+ if (dwErrorCode == ERROR_SUCCESS) + { + // Replace absolute pointer addresses in the output by relative offsets. + for (i = 0; i < *pcReturned; i++) + { + _MarshallDownPrintProcessorInfo((PPRINTPROCESSOR_INFO_1W)p); + p += sizeof(PRINTPROCESSOR_INFO_1W); + } + } + RpcRevertToSelf(); return dwErrorCode; }
DWORD -_RpcGetPrintProcessorDirectory(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, DWORD Level, BYTE *pPrintProcessorDirectory, DWORD cbBuf, DWORD *pcbNeeded) +_RpcGetPrintProcessorDirectory(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, DWORD Level, BYTE* pPrintProcessorDirectory, DWORD cbBuf, DWORD* pcbNeeded) { DWORD dwErrorCode;
Added: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printproviders.c URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printproviders.c (added) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printproviders.c [iso-8859-1] Fri Jul 17 10:57:10 2015 @@ -0,0 +1,22 @@ +/* + * PROJECT: ReactOS Print Spooler Service + * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation + * PURPOSE: Functions related to Print Providers + * COPYRIGHT: Copyright 2015 Colin Finck colin@reactos.org + */ + +#include "precomp.h" + +DWORD +_RpcAddPrintProvidor(WINSPOOL_HANDLE pName, WINSPOOL_PROVIDOR_CONTAINER* pProvidorContainer) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +} + +DWORD +_RpcDeletePrintProvidor(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, WCHAR* pPrintProviderName) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +}
Propchange: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/printproviders.c ------------------------------------------------------------------------------ svn:eol-style = native
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] Fri Jul 17 10:57:10 2015 @@ -8,168 +8,21 @@ #include "precomp.h"
DWORD -_RpcAddPrinter(WINSPOOL_HANDLE pName, WINSPOOL_PRINTER_CONTAINER *pPrinterContainer, WINSPOOL_DEVMODE_CONTAINER *pDevModeContainer, WINSPOOL_SECURITY_CONTAINER *pSecurityContainer, WINSPOOL_PRINTER_HANDLE *pHandle) +_RpcCreatePrinterIC(WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_GDI_HANDLE* pHandle, WINSPOOL_DEVMODE_CONTAINER* pDevModeContainer) { UNIMPLEMENTED; return ERROR_INVALID_FUNCTION; }
DWORD -_RpcDeletePrinter(WINSPOOL_PRINTER_HANDLE hPrinter) +_RpcPlayGdiScriptOnPrinterIC(WINSPOOL_GDI_HANDLE hPrinterIC, BYTE* pIn, DWORD cIn, BYTE* pOut, DWORD cOut, DWORD ul) { UNIMPLEMENTED; return ERROR_INVALID_FUNCTION; }
DWORD -_RpcSetPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_PRINTER_CONTAINER *pPrinterContainer, WINSPOOL_DEVMODE_CONTAINER *pDevModeContainer, WINSPOOL_SECURITY_CONTAINER *pSecurityContainer, DWORD Command) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcGetPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD Level, BYTE *pPrinter, DWORD cbBuf, DWORD *pcbNeeded) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcAddPrinterDriver(WINSPOOL_HANDLE pName, WINSPOOL_DRIVER_CONTAINER *pDriverContainer) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcEnumPrinterDrivers(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, DWORD Level, BYTE *pDrivers, DWORD cbBuf, DWORD *pcbNeeded, DWORD *pcReturned) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcGetPrinterDriver(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR *pEnvironment, DWORD Level, BYTE *pDriver, DWORD cbBuf, DWORD *pcbNeeded) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcGetPrinterDriverDirectory(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, DWORD Level, BYTE *pDriverDirectory, DWORD cbBuf, DWORD *pcbNeeded) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcDeletePrinterDriver(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, WCHAR *pDriverName) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcAbortPrinter(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; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcSetPrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR *pValueName, DWORD Type, BYTE *pData, DWORD cbData) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcWaitForPrinterChange(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD Flags, DWORD *pFlags) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcAddForm(WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_FORM_CONTAINER *pFormInfoContainer) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcDeleteForm(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR *pFormName) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcGetForm(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR *pFormName, DWORD Level, BYTE *pForm, DWORD cbBuf, DWORD *pcbNeeded) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcSetForm(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR *pFormName, WINSPOOL_FORM_CONTAINER *pFormInfoContainer) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcEnumForms(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD Level, BYTE *pForm, DWORD cbBuf, DWORD *pcbNeeded, DWORD *pcReturned) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcAddPort(WINSPOOL_HANDLE pName, ULONG_PTR hWnd, WCHAR *pMonitorName) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcConfigurePort(WINSPOOL_HANDLE pName, ULONG_PTR hWnd, WCHAR *pPortName) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcDeletePort(WINSPOOL_HANDLE pName, ULONG_PTR hWnd, WCHAR *pPortName) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcCreatePrinterIC(WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_GDI_HANDLE *pHandle, WINSPOOL_DEVMODE_CONTAINER *pDevModeContainer) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcPlayGdiScriptOnPrinterIC(WINSPOOL_GDI_HANDLE hPrinterIC, BYTE *pIn, DWORD cIn, BYTE *pOut, DWORD cOut, DWORD ul) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcDeletePrinterIC(WINSPOOL_GDI_HANDLE *phPrinterIC) +_RpcDeletePrinterIC(WINSPOOL_GDI_HANDLE* phPrinterIC) { UNIMPLEMENTED; return ERROR_INVALID_FUNCTION; @@ -190,147 +43,7 @@ }
DWORD -_RpcPrinterMessageBox(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD Error, ULONG_PTR hWnd, WCHAR *pText, WCHAR *pCaption, DWORD dwType) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcAddMonitor(WINSPOOL_HANDLE pName, WINSPOOL_MONITOR_CONTAINER *pMonitorContainer) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcDeleteMonitor(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, WCHAR *pMonitorName) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcDeletePrintProcessor(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, WCHAR *pPrintProcessorName) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcAddPrintProvidor(WINSPOOL_HANDLE pName, WINSPOOL_PROVIDOR_CONTAINER *pProvidorContainer) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcDeletePrintProvidor(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, WCHAR *pPrintProviderName) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcResetPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR *pDatatype, WINSPOOL_DEVMODE_CONTAINER *pDevModeContainer) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcGetPrinterDriver2(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR *pEnvironment, DWORD Level, BYTE *pDriver, DWORD cbBuf, DWORD *pcbNeeded, DWORD dwClientMajorVersion, DWORD dwClientMinorVersion, DWORD *pdwServerMaxVersion, DWORD *pdwServerMinVersion) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcClientFindFirstPrinterChangeNotification() -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcFindNextPrinterChangeNotification() -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcFindClosePrinterChangeNotification() -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcRouterFindFirstPrinterChangeNotificationOld() -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcReplyOpenPrinter(WINSPOOL_HANDLE pMachine, WINSPOOL_PRINTER_HANDLE *phPrinterNotify, DWORD dwPrinterRemote, DWORD dwType, DWORD cbBuffer, BYTE *pBuffer) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcRouterReplyPrinter(WINSPOOL_PRINTER_HANDLE hNotify, DWORD fdwFlags, DWORD cbBuffer, BYTE *pBuffer) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcReplyClosePrinter(WINSPOOL_PRINTER_HANDLE *phNotify) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcAddPortEx(WINSPOOL_HANDLE pName, WINSPOOL_PORT_CONTAINER *pPortContainer, WINSPOOL_PORT_VAR_CONTAINER *pPortVarContainer, WCHAR *pMonitorName) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcRemoteFindFirstPrinterChangeNotification(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD fdwFlags, DWORD fdwOptions, WCHAR *pszLocalMachine, DWORD dwPrinterLocal, DWORD cbBuffer, BYTE *pBuffer) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcResetPrinterEx() -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcRemoteFindFirstPrinterChangeNotificationEx(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD fdwFlags, DWORD fdwOptions, WCHAR *pszLocalMachine, DWORD dwPrinterLocal, WINSPOOL_V2_NOTIFY_OPTIONS *pOptions) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcRouterReplyPrinterEx(WINSPOOL_PRINTER_HANDLE hNotify, DWORD dwColor, DWORD fdwFlags, DWORD *pdwResult, DWORD dwReplyType, WINSPOOL_V2_UREPLY_PRINTER Reply) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcRouterRefreshPrinterChangeNotification(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD dwColor, WINSPOOL_V2_NOTIFY_OPTIONS *pOptions, WINSPOOL_V2_NOTIFY_INFO **ppInfo) +_RpcPrinterMessageBox(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD Error, ULONG_PTR hWnd, WCHAR* pText, WCHAR* pCaption, DWORD dwType) { UNIMPLEMENTED; return ERROR_INVALID_FUNCTION; @@ -338,41 +51,6 @@
DWORD _RpcSetAllocFailCount() -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcOpenPrinterEx(WINSPOOL_HANDLE pPrinterName, WINSPOOL_PRINTER_HANDLE *pHandle, WCHAR *pDatatype, WINSPOOL_DEVMODE_CONTAINER *pDevModeContainer, DWORD AccessRequired, WINSPOOL_SPLCLIENT_CONTAINER *pClientInfo) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcAddPrinterEx(WINSPOOL_HANDLE pName, WINSPOOL_PRINTER_CONTAINER *pPrinterContainer, WINSPOOL_DEVMODE_CONTAINER *pDevModeContainer, WINSPOOL_SECURITY_CONTAINER *pSecurityContainer, WINSPOOL_SPLCLIENT_CONTAINER *pClientInfo, WINSPOOL_PRINTER_HANDLE *pHandle) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcSetPort(WINSPOOL_HANDLE pName, WCHAR *pPortName, WINSPOOL_PORT_CONTAINER *pPortContainer) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcEnumPrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD dwIndex, WCHAR *pValueName, DWORD cbValueName, DWORD *pcbValueName, DWORD *pType, BYTE *pData, DWORD cbData, DWORD *pcbData) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcDeletePrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR *pValueName) { UNIMPLEMENTED; return ERROR_INVALID_FUNCTION; @@ -400,91 +78,21 @@ }
DWORD -_RpcSetPrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR *pKeyName, const WCHAR *pValueName, DWORD Type, BYTE *pData, DWORD cbData) +_RpcAddPerMachineConnection(WINSPOOL_HANDLE pServer, const WCHAR* pPrinterName, const WCHAR* pPrintServer, const WCHAR* pProvider) { UNIMPLEMENTED; return ERROR_INVALID_FUNCTION; }
DWORD -_RpcGetPrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR *pKeyName, const WCHAR *pValueName, DWORD *pType, BYTE *pData, DWORD nSize, DWORD *pcbNeeded) +_RpcDeletePerMachineConnection(WINSPOOL_HANDLE pServer, const WCHAR* pPrinterName) { UNIMPLEMENTED; return ERROR_INVALID_FUNCTION; }
DWORD -_RpcEnumPrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR *pKeyName, BYTE *pEnumValues, DWORD cbEnumValues, DWORD *pcbEnumValues, DWORD *pnEnumValues) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcEnumPrinterKey(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR *pKeyName, WCHAR *pSubkey, DWORD cbSubkey, DWORD *pcbSubkey) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcDeletePrinterDataEx(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR *pKeyName, const WCHAR *pValueName) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcDeletePrinterKey(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR *pKeyName) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcSeekPrinter() -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcDeletePrinterDriverEx(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, WCHAR *pDriverName, DWORD dwDeleteFlag, DWORD dwVersionNum) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcAddPerMachineConnection(WINSPOOL_HANDLE pServer, const WCHAR *pPrinterName, const WCHAR *pPrintServer, const WCHAR *pProvider) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcDeletePerMachineConnection(WINSPOOL_HANDLE pServer, const WCHAR *pPrinterName) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcEnumPerMachineConnections(WINSPOOL_HANDLE pServer, BYTE *pPrinterEnum, DWORD cbBuf, DWORD *pcbNeeded, DWORD *pcReturned) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcXcvData(WINSPOOL_PRINTER_HANDLE hXcv, const WCHAR *pszDataName, BYTE *pInputData, DWORD cbInputData, BYTE *pOutputData, DWORD cbOutputData, DWORD *pcbOutputNeeded, DWORD *pdwStatus) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcAddPrinterDriverEx(WINSPOOL_HANDLE pName, WINSPOOL_DRIVER_CONTAINER *pDriverContainer, DWORD dwFileCopyFlags) +_RpcEnumPerMachineConnections(WINSPOOL_HANDLE pServer, BYTE* pPrinterEnum, DWORD cbBuf, DWORD* pcbNeeded, DWORD* pcReturned) { UNIMPLEMENTED; return ERROR_INVALID_FUNCTION; @@ -519,14 +127,7 @@ }
DWORD -_RpcFlushPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, BYTE *pBuf, DWORD cbBuf, DWORD *pcWritten, DWORD cSleep) -{ - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; -} - -DWORD -_RpcSendRecvBidiData(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR *pAction, WINSPOOL_BIDI_REQUEST_CONTAINER *pReqData, WINSPOOL_BIDI_RESPONSE_CONTAINER **ppRespData) +_RpcSendRecvBidiData(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pAction, WINSPOOL_BIDI_REQUEST_CONTAINER* pReqData, WINSPOOL_BIDI_RESPONSE_CONTAINER** ppRespData) { UNIMPLEMENTED; return ERROR_INVALID_FUNCTION;
Added: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/xcv.c URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/xcv.c (added) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/xcv.c [iso-8859-1] Fri Jul 17 10:57:10 2015 @@ -0,0 +1,15 @@ +/* + * PROJECT: ReactOS Print Spooler Service + * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation + * PURPOSE: Xcv* functions + * COPYRIGHT: Copyright 2015 Colin Finck colin@reactos.org + */ + +#include "precomp.h" + +DWORD +_RpcXcvData(WINSPOOL_PRINTER_HANDLE hXcv, const WCHAR* pszDataName, BYTE* pInputData, DWORD cbInputData, BYTE* pOutputData, DWORD cbOutputData, DWORD* pcbOutputNeeded, DWORD* pdwStatus) +{ + UNIMPLEMENTED; + return ERROR_INVALID_FUNCTION; +}
Propchange: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/spoolsv/xcv.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/CMakeLists.txt [iso-8859-1] (original) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/CMakeLists.txt [iso-8859-1] Fri Jul 17 10:57:10 2015 @@ -6,6 +6,8 @@ list(APPEND SOURCE jobs.c main.c + monitors.c + ports.c precomp.h printers.c printprocessors.c
Modified: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/jobs.c URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/jobs.c [iso-8859-1] (original) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/jobs.c [iso-8859-1] Fri Jul 17 10:57:10 2015 @@ -13,7 +13,7 @@ PJOB_INFO_1W pJobInfo1; PJOB_INFO_2W pJobInfo2;
- // Replace absolute pointer addresses in the output by relative offsets. + // Replace relative offset addresses in the output by absolute pointers. if (Level == 1) { pJobInfo1 = (PJOB_INFO_1W)pJobInfo;
Added: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/monitors.c URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/monitors.c (added) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/monitors.c [iso-8859-1] Fri Jul 17 10:57:10 2015 @@ -0,0 +1,60 @@ +/* + * PROJECT: ReactOS Spooler API + * LICENSE: GNU LGPL v2.1 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" + +static void +_MarshallUpMonitorInfo(PBYTE pMonitorInfo, DWORD Level) +{ + PMONITOR_INFO_2W pMonitorInfo2 = (PMONITOR_INFO_2W)pMonitorInfo; // MONITOR_INFO_1W is a subset of MONITOR_INFO_2W + + // Replace relative offset addresses in the output by absolute pointers. + pMonitorInfo2->pName = (PWSTR)((ULONG_PTR)pMonitorInfo2->pName + (ULONG_PTR)pMonitorInfo2); + + if (Level == 2) + { + pMonitorInfo2->pDLLName = (PWSTR)((ULONG_PTR)pMonitorInfo2->pDLLName + (ULONG_PTR)pMonitorInfo2); + pMonitorInfo2->pEnvironment = (PWSTR)((ULONG_PTR)pMonitorInfo2->pEnvironment + (ULONG_PTR)pMonitorInfo2); + } +} + +BOOL WINAPI +EnumMonitorsW(PWSTR pName, DWORD Level, PBYTE pMonitors, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned) +{ + DWORD dwErrorCode; + DWORD i; + PBYTE p = pMonitors; + + // Do the RPC call + RpcTryExcept + { + dwErrorCode = _RpcEnumMonitors(pName, Level, pMonitors, cbBuf, pcbNeeded, pcReturned); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + dwErrorCode = RpcExceptionCode(); + ERR("_RpcEnumPorts failed with exception code %lu!\n", dwErrorCode); + } + RpcEndExcept; + + if (dwErrorCode == ERROR_SUCCESS) + { + // Replace relative offset addresses in the output by absolute pointers. + for (i = 0; i < *pcReturned; i++) + { + _MarshallUpMonitorInfo(p, Level); + + if (Level == 1) + p += sizeof(MONITOR_INFO_1W); + else if (Level == 2) + p += sizeof(MONITOR_INFO_2W); + } + } + + SetLastError(dwErrorCode); + return (dwErrorCode == ERROR_SUCCESS); +}
Propchange: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/monitors.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/ports.c URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/ports.c (added) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/ports.c [iso-8859-1] Fri Jul 17 10:57:10 2015 @@ -0,0 +1,60 @@ +/* + * PROJECT: ReactOS Spooler API + * LICENSE: GNU LGPL v2.1 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" + +static void +_MarshallUpPortInfo(PBYTE pPortInfo, DWORD Level) +{ + PPORT_INFO_2W pPortInfo2 = (PPORT_INFO_2W)pPortInfo; // PORT_INFO_1W is a subset of PORT_INFO_2W + + // Replace relative offset addresses in the output by absolute pointers. + pPortInfo2->pPortName = (PWSTR)((ULONG_PTR)pPortInfo2->pPortName + (ULONG_PTR)pPortInfo2); + + if (Level == 2) + { + pPortInfo2->pDescription = (PWSTR)((ULONG_PTR)pPortInfo2->pDescription + (ULONG_PTR)pPortInfo2); + pPortInfo2->pMonitorName = (PWSTR)((ULONG_PTR)pPortInfo2->pMonitorName + (ULONG_PTR)pPortInfo2); + } +} + +BOOL WINAPI +EnumPortsW(PWSTR pName, DWORD Level, PBYTE pPorts, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned) +{ + DWORD dwErrorCode; + DWORD i; + PBYTE p = pPorts; + + // Do the RPC call + RpcTryExcept + { + dwErrorCode = _RpcEnumPorts(pName, Level, pPorts, cbBuf, pcbNeeded, pcReturned); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + dwErrorCode = RpcExceptionCode(); + ERR("_RpcEnumPorts failed with exception code %lu!\n", dwErrorCode); + } + RpcEndExcept; + + if (dwErrorCode == ERROR_SUCCESS) + { + // Replace relative offset addresses in the output by absolute pointers. + for (i = 0; i < *pcReturned; i++) + { + _MarshallUpPortInfo(p, Level); + + if (Level == 1) + p += sizeof(PORT_INFO_1W); + else if (Level == 2) + p += sizeof(PORT_INFO_2W); + } + } + + SetLastError(dwErrorCode); + return (dwErrorCode == ERROR_SUCCESS); +}
Propchange: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/ports.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/printers.c URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/printers.c [iso-8859-1] (original) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/printers.c [iso-8859-1] Fri Jul 17 10:57:10 2015 @@ -7,6 +7,45 @@
#include "precomp.h"
+static void +_MarshallUpPrinterInfo(PBYTE pPrinterInfo, DWORD Level) +{ + PPRINTER_INFO_1W pPrinterInfo1; + PPRINTER_INFO_2W pPrinterInfo2; + + // Replace relative offset addresses in the output by absolute pointers. + if (Level == 1) + { + pPrinterInfo1 = (PPRINTER_INFO_1W)pPrinterInfo; + + pPrinterInfo1->pName = (PWSTR)((ULONG_PTR)pPrinterInfo1->pName + (ULONG_PTR)pPrinterInfo1); + pPrinterInfo1->pDescription = (PWSTR)((ULONG_PTR)pPrinterInfo1->pDescription + (ULONG_PTR)pPrinterInfo1); + pPrinterInfo1->pComment = (PWSTR)((ULONG_PTR)pPrinterInfo1->pComment + (ULONG_PTR)pPrinterInfo1); + } + else if (Level == 2) + { + pPrinterInfo2 = (PPRINTER_INFO_2W)pPrinterInfo; + + pPrinterInfo2->pPrinterName = (PWSTR)((ULONG_PTR)pPrinterInfo2->pPrinterName + (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pShareName = (PWSTR)((ULONG_PTR)pPrinterInfo2->pShareName + (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pPortName = (PWSTR)((ULONG_PTR)pPrinterInfo2->pPortName + (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pDriverName = (PWSTR)((ULONG_PTR)pPrinterInfo2->pDriverName + (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pComment = (PWSTR)((ULONG_PTR)pPrinterInfo2->pComment + (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pLocation = (PWSTR)((ULONG_PTR)pPrinterInfo2->pLocation + (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pDevMode = (PDEVMODEW)((ULONG_PTR)pPrinterInfo2->pDevMode + (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pSepFile = (PWSTR)((ULONG_PTR)pPrinterInfo2->pSepFile + (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pPrintProcessor = (PWSTR)((ULONG_PTR)pPrinterInfo2->pPrintProcessor + (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pDatatype = (PWSTR)((ULONG_PTR)pPrinterInfo2->pDatatype + (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pParameters = (PWSTR)((ULONG_PTR)pPrinterInfo2->pParameters + (ULONG_PTR)pPrinterInfo2); + + if (pPrinterInfo2->pServerName) + pPrinterInfo2->pServerName = (PWSTR)((ULONG_PTR)pPrinterInfo2->pServerName + (ULONG_PTR)pPrinterInfo2); + + if (pPrinterInfo2->pSecurityDescriptor) + pPrinterInfo2->pSecurityDescriptor = (PWSTR)((ULONG_PTR)pPrinterInfo2->pSecurityDescriptor + (ULONG_PTR)pPrinterInfo2); + } +} + static DWORD _StartDocPrinterSpooled(PSPOOLER_HANDLE pHandle, PDOC_INFO_1W pDocInfo1, PADDJOB_INFO_1W pAddJobInfo1) { @@ -96,33 +135,6 @@ }
BOOL WINAPI -EnumPrintersA(DWORD Flags, LPSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned) -{ - return FALSE; -} - -BOOL WINAPI -EnumPrintersW(DWORD Flags, LPWSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned) -{ - DWORD dwErrorCode; - - // Do the RPC call - RpcTryExcept - { - dwErrorCode = _RpcEnumPrinters(Flags, Name, Level, pPrinterEnum, cbBuf, pcbNeeded, pcReturned); - } - RpcExcept(EXCEPTION_EXECUTE_HANDLER) - { - dwErrorCode = RpcExceptionCode(); - ERR("_RpcEnumPrinters failed with exception code %lu!\n", dwErrorCode); - } - RpcEndExcept; - - SetLastError(dwErrorCode); - return (dwErrorCode == ERROR_SUCCESS); -} - -BOOL WINAPI ClosePrinter(HANDLE hPrinter) { DWORD dwErrorCode; @@ -271,6 +283,49 @@ }
Cleanup: + SetLastError(dwErrorCode); + return (dwErrorCode == ERROR_SUCCESS); +} + +BOOL WINAPI +EnumPrintersA(DWORD Flags, PSTR Name, DWORD Level, PBYTE pPrinterEnum, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned) +{ + return FALSE; +} + +BOOL WINAPI +EnumPrintersW(DWORD Flags, PWSTR Name, DWORD Level, PBYTE pPrinterEnum, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned) +{ + DWORD dwErrorCode; + DWORD i; + PBYTE p = pPrinterEnum; + + // Do the RPC call + RpcTryExcept + { + dwErrorCode = _RpcEnumPrinters(Flags, Name, Level, pPrinterEnum, cbBuf, pcbNeeded, pcReturned); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + dwErrorCode = RpcExceptionCode(); + ERR("_RpcEnumPrinters failed with exception code %lu!\n", dwErrorCode); + } + RpcEndExcept; + + if (dwErrorCode == ERROR_SUCCESS) + { + // Replace relative offset addresses in the output by absolute pointers. + for (i = 0; i < *pcReturned; i++) + { + _MarshallUpPrinterInfo(p, Level); + + if (Level == 1) + p += sizeof(PRINTER_INFO_1W); + else if (Level == 2) + p += sizeof(PRINTER_INFO_2W); + } + } + SetLastError(dwErrorCode); return (dwErrorCode == ERROR_SUCCESS); }
Modified: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/printprocessors.c URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/printprocessors.c [iso-8859-1] (original) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/printprocessors.c [iso-8859-1] Fri Jul 17 10:57:10 2015 @@ -7,58 +7,94 @@
#include "precomp.h"
+static void +_MarshallUpDatatypesInfo(PDATATYPES_INFO_1W pDatatypesInfo1) +{ + // Replace relative offset addresses in the output by absolute pointers. + pDatatypesInfo1->pName = (PWSTR)((ULONG_PTR)pDatatypesInfo1->pName + (ULONG_PTR)pDatatypesInfo1); +} + +static void +_MarshallUpPrintProcessorInfo(PPRINTPROCESSOR_INFO_1W pPrintProcessorInfo1) +{ + // Replace relative offset addresses in the output by absolute pointers. + pPrintProcessorInfo1->pName = (PWSTR)((ULONG_PTR)pPrintProcessorInfo1->pName + (ULONG_PTR)pPrintProcessorInfo1); +} + BOOL WINAPI -EnumPrintProcessorDatatypesA(LPSTR pName, LPSTR pPrintProcessorName, DWORD Level, LPBYTE pDatatypes, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned) +EnumPrintProcessorDatatypesA(PSTR pName, LPSTR pPrintProcessorName, DWORD Level, PBYTE pDatatypes, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned) { return FALSE; }
BOOL WINAPI -EnumPrintProcessorDatatypesW(LPWSTR pName, LPWSTR pPrintProcessorName, DWORD Level, LPBYTE pDatatypes, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned) +EnumPrintProcessorDatatypesW(PWSTR pName, LPWSTR pPrintProcessorName, DWORD Level, PBYTE pDatatypes, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned) { - BOOL bReturnValue = FALSE; DWORD dwErrorCode; + DWORD i; + PBYTE p = pDatatypes;
// Do the RPC call RpcTryExcept { dwErrorCode = _RpcEnumPrintProcessorDatatypes(pName, pPrintProcessorName, Level, pDatatypes, cbBuf, pcbNeeded, pcReturned); - SetLastError(dwErrorCode); - bReturnValue = (dwErrorCode == ERROR_SUCCESS); } RpcExcept(EXCEPTION_EXECUTE_HANDLER) { - ERR("_RpcEnumPrintProcessorDatatypes failed with exception code %lu!\n", RpcExceptionCode()); + dwErrorCode = RpcExceptionCode(); + ERR("_RpcEnumPrintProcessorDatatypes failed with exception code %lu!\n", dwErrorCode); } RpcEndExcept;
- return bReturnValue; + if (dwErrorCode == ERROR_SUCCESS) + { + // Replace relative offset addresses in the output by absolute pointers. + for (i = 0; i < *pcReturned; i++) + { + _MarshallUpDatatypesInfo((PDATATYPES_INFO_1W)p); + p += sizeof(DATATYPES_INFO_1W); + } + } + + SetLastError(dwErrorCode); + return (dwErrorCode == ERROR_SUCCESS); }
BOOL WINAPI -EnumPrintProcessorsW(LPWSTR pName, LPWSTR pEnvironment, DWORD Level, LPBYTE pPrintProcessorInfo, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned) +EnumPrintProcessorsW(PWSTR pName, PWSTR pEnvironment, DWORD Level, PBYTE pPrintProcessorInfo, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned) { - BOOL bReturnValue = FALSE; DWORD dwErrorCode; + DWORD i; + PBYTE p = pPrintProcessorInfo;
// Do the RPC call RpcTryExcept { dwErrorCode = _RpcEnumPrintProcessors(pName, pEnvironment, Level, pPrintProcessorInfo, cbBuf, pcbNeeded, pcReturned); - SetLastError(dwErrorCode); - bReturnValue = (dwErrorCode == ERROR_SUCCESS); } RpcExcept(EXCEPTION_EXECUTE_HANDLER) { - ERR("_RpcEnumPrintProcessors failed with exception code %lu!\n", RpcExceptionCode()); + dwErrorCode = RpcExceptionCode(); + ERR("_RpcEnumPrintProcessors failed with exception code %lu!\n", dwErrorCode); } RpcEndExcept;
- return bReturnValue; + if (dwErrorCode == ERROR_SUCCESS) + { + // Replace relative offset addresses in the output by absolute pointers. + for (i = 0; i < *pcReturned; i++) + { + _MarshallUpPrintProcessorInfo((PPRINTPROCESSOR_INFO_1W)p); + p += sizeof(PRINTPROCESSOR_INFO_1W); + } + } + + SetLastError(dwErrorCode); + return (dwErrorCode == ERROR_SUCCESS); }
BOOL WINAPI -GetPrintProcessorDirectoryW(LPWSTR pName, LPWSTR pEnvironment, DWORD Level, LPBYTE pPrintProcessorInfo, DWORD cbBuf, LPDWORD pcbNeeded) +GetPrintProcessorDirectoryW(PWSTR pName, PWSTR pEnvironment, DWORD Level, PBYTE pPrintProcessorInfo, DWORD cbBuf, PDWORD pcbNeeded) { BOOL bReturnValue = FALSE; DWORD dwErrorCode;
Modified: branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/winspool.spec URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/winspool.spec [iso-8859-1] (original) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/winspool.spec [iso-8859-1] Fri Jul 17 10:57:10 2015 @@ -86,9 +86,9 @@ 185 stdcall EnumJobsA(long long long long ptr long ptr ptr) 186 stdcall EnumJobsW(long long long long ptr long ptr ptr) 187 stub EnumMonitorsA -188 stub EnumMonitorsW +188 stdcall EnumMonitorsW(wstr long ptr long ptr ptr) 189 stub EnumPortsA -190 stub EnumPortsW +190 stdcall EnumPortsW(wstr long ptr long ptr ptr) 191 stdcall EnumPrintProcessorDatatypesA(ptr ptr long ptr long ptr ptr) 192 stdcall EnumPrintProcessorDatatypesW(ptr ptr long ptr long ptr ptr) 193 stub EnumPrintProcessorsA