[PRINTING] Replace all my custom marshalling code by calls to the newly implemented APIs, thereby significantly reducing the codebase and providing a sane template to implement more Printing APIs.

This commit is contained in:
Colin Finck 2018-01-17 12:52:12 +01:00
parent 35ef5a3c24
commit 22ffe5300b
16 changed files with 359 additions and 546 deletions

View file

@ -2,59 +2,11 @@
* PROJECT: ReactOS Spooler API
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: Functions for managing print jobs
* COPYRIGHT: Copyright 2015-2017 Colin Finck (colin@reactos.org)
* COPYRIGHT: Copyright 2015-2018 Colin Finck (colin@reactos.org)
*/
#include "precomp.h"
static void
_MarshallUpAddJobInfo(PADDJOB_INFO_1W pAddJobInfo1)
{
// Replace relative offset addresses in the output by absolute pointers.
pAddJobInfo1->Path = (PWSTR)((ULONG_PTR)pAddJobInfo1->Path + (ULONG_PTR)pAddJobInfo1);
}
static void
_MarshallUpJobInfo(PBYTE pJobInfo, DWORD Level)
{
PJOB_INFO_1W pJobInfo1;
PJOB_INFO_2W pJobInfo2;
// Replace relative offset addresses in the output by absolute pointers.
if (Level == 1)
{
pJobInfo1 = (PJOB_INFO_1W)pJobInfo;
pJobInfo1->pDatatype = (PWSTR)((ULONG_PTR)pJobInfo1->pDatatype + (ULONG_PTR)pJobInfo1);
pJobInfo1->pDocument = (PWSTR)((ULONG_PTR)pJobInfo1->pDocument + (ULONG_PTR)pJobInfo1);
pJobInfo1->pMachineName = (PWSTR)((ULONG_PTR)pJobInfo1->pMachineName + (ULONG_PTR)pJobInfo1);
pJobInfo1->pPrinterName = (PWSTR)((ULONG_PTR)pJobInfo1->pPrinterName + (ULONG_PTR)pJobInfo1);
if (pJobInfo1->pStatus)
pJobInfo1->pStatus = (PWSTR)((ULONG_PTR)pJobInfo1->pStatus + (ULONG_PTR)pJobInfo1);
pJobInfo1->pUserName = (PWSTR)((ULONG_PTR)pJobInfo1->pUserName + (ULONG_PTR)pJobInfo1);
}
else if (Level == 2)
{
pJobInfo2 = (PJOB_INFO_2W)pJobInfo;
pJobInfo2->pDatatype = (PWSTR)((ULONG_PTR)pJobInfo2->pDatatype + (ULONG_PTR)pJobInfo2);
pJobInfo2->pDevMode = (PDEVMODEW)((ULONG_PTR)pJobInfo2->pDevMode + (ULONG_PTR)pJobInfo2);
pJobInfo2->pDocument = (PWSTR)((ULONG_PTR)pJobInfo2->pDocument + (ULONG_PTR)pJobInfo2);
pJobInfo2->pDriverName = (PWSTR)((ULONG_PTR)pJobInfo2->pDriverName + (ULONG_PTR)pJobInfo2);
pJobInfo2->pMachineName = (PWSTR)((ULONG_PTR)pJobInfo2->pMachineName + (ULONG_PTR)pJobInfo2);
pJobInfo2->pNotifyName = (PWSTR)((ULONG_PTR)pJobInfo2->pNotifyName + (ULONG_PTR)pJobInfo2);
pJobInfo2->pPrinterName = (PWSTR)((ULONG_PTR)pJobInfo2->pPrinterName + (ULONG_PTR)pJobInfo2);
pJobInfo2->pPrintProcessor = (PWSTR)((ULONG_PTR)pJobInfo2->pPrintProcessor + (ULONG_PTR)pJobInfo2);
if (pJobInfo2->pParameters)
pJobInfo2->pParameters = (PWSTR)((ULONG_PTR)pJobInfo2->pParameters + (ULONG_PTR)pJobInfo2);
if (pJobInfo2->pStatus)
pJobInfo2->pStatus = (PWSTR)((ULONG_PTR)pJobInfo2->pStatus + (ULONG_PTR)pJobInfo2);
pJobInfo2->pUserName = (PWSTR)((ULONG_PTR)pJobInfo2->pUserName + (ULONG_PTR)pJobInfo2);
}
}
#include <marshalling/jobs.h>
BOOL WINAPI
AddJobA(HANDLE hPrinter, DWORD Level, PBYTE pData, DWORD cbBuf, PDWORD pcbNeeded)
@ -91,7 +43,10 @@ AddJobW(HANDLE hPrinter, DWORD Level, PBYTE pData, DWORD cbBuf, PDWORD pcbNeeded
RpcEndExcept;
if (dwErrorCode == ERROR_SUCCESS)
_MarshallUpAddJobInfo((PADDJOB_INFO_1W)pData);
{
// Replace relative offset addresses in the output by absolute pointers.
MarshallUpStructure(cbBuf, pData, AddJobInfo1Marshalling.pInfo, AddJobInfo1Marshalling.cbStructureSize, TRUE);
}
Cleanup:
SetLastError(dwErrorCode);
@ -110,8 +65,6 @@ BOOL WINAPI
EnumJobsW(HANDLE hPrinter, DWORD FirstJob, DWORD NoJobs, DWORD Level, PBYTE pJob, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
{
DWORD dwErrorCode;
DWORD i;
PBYTE p = pJob;
PSPOOLER_HANDLE pHandle = (PSPOOLER_HANDLE)hPrinter;
TRACE("EnumJobsW(%p, %lu, %lu, %lu, %p, %lu, %p, %p)\n", hPrinter, FirstJob, NoJobs, Level, pJob, cbBuf, pcbNeeded, pcReturned);
@ -136,15 +89,11 @@ EnumJobsW(HANDLE hPrinter, DWORD FirstJob, DWORD NoJobs, DWORD Level, PBYTE pJob
if (dwErrorCode == ERROR_SUCCESS)
{
// Replace relative offset addresses in the output by absolute pointers.
for (i = 0; i < *pcReturned; i++)
// Replace relative offset addresses in the output by absolute pointers for JOB_INFO_1W and JOB_INFO_2W.
if (Level <= 2)
{
_MarshallUpJobInfo(p, Level);
if (Level == 1)
p += sizeof(JOB_INFO_1W);
else if (Level == 2)
p += sizeof(JOB_INFO_2W);
ASSERT(Level >= 1);
MarshallUpStructuresArray(cbBuf, pJob, *pcReturned, pJobInfoMarshalling[Level]->pInfo, pJobInfoMarshalling[Level]->cbStructureSize, TRUE);
}
}
@ -190,7 +139,8 @@ GetJobW(HANDLE hPrinter, DWORD JobId, DWORD Level, PBYTE pJob, DWORD cbBuf, PDWO
if (dwErrorCode == ERROR_SUCCESS)
{
// Replace relative offset addresses in the output by absolute pointers.
_MarshallUpJobInfo(pJob, Level);
ASSERT(Level >= 1 && Level <= 2);
MarshallUpStructure(cbBuf, pJob, pJobInfoMarshalling[Level]->pInfo, pJobInfoMarshalling[Level]->cbStructureSize, TRUE);
}
Cleanup:

View file

@ -2,25 +2,11 @@
* PROJECT: ReactOS Spooler API
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: Functions related to Print Monitors
* COPYRIGHT: Copyright 2015-2017 Colin Finck (colin@reactos.org)
* COPYRIGHT: Copyright 2015-2018 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);
}
}
#include <marshalling/monitors.h>
BOOL WINAPI
AddMonitorA(PSTR pName, DWORD Level, PBYTE pMonitors)
@ -66,8 +52,6 @@ BOOL WINAPI
EnumMonitorsW(PWSTR pName, DWORD Level, PBYTE pMonitors, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
{
DWORD dwErrorCode;
DWORD i;
PBYTE p = pMonitors;
TRACE("EnumMonitorsW(%S, %lu, %p, %lu, %p, %p)\n", pName, Level, pMonitors, cbBuf, pcbNeeded, pcReturned);
@ -86,15 +70,8 @@ EnumMonitorsW(PWSTR pName, DWORD Level, PBYTE pMonitors, DWORD cbBuf, PDWORD pcb
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);
}
ASSERT(Level >= 1 && Level <= 2);
MarshallUpStructuresArray(cbBuf, pMonitors, *pcReturned, pMonitorInfoMarshalling[Level]->pInfo, pMonitorInfoMarshalling[Level]->cbStructureSize, TRUE);
}
SetLastError(dwErrorCode);

View file

@ -2,25 +2,11 @@
* PROJECT: ReactOS Spooler API
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: Functions related to Ports
* COPYRIGHT: Copyright 2015-2017 Colin Finck (colin@reactos.org)
* COPYRIGHT: Copyright 2015-2018 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);
}
}
#include <marshalling/ports.h>
BOOL WINAPI
AddPortA(PSTR pName, HWND hWnd, PSTR pMonitorName)
@ -98,8 +84,6 @@ BOOL WINAPI
EnumPortsW(PWSTR pName, DWORD Level, PBYTE pPorts, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
{
DWORD dwErrorCode;
DWORD i;
PBYTE p = pPorts;
TRACE("EnumPortsW(%S, %lu, %p, %lu, %p, %p)\n", pName, Level, pPorts, cbBuf, pcbNeeded, pcReturned);
@ -118,15 +102,8 @@ EnumPortsW(PWSTR pName, DWORD Level, PBYTE pPorts, DWORD cbBuf, PDWORD pcbNeeded
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);
}
ASSERT(Level >= 1 && Level <= 2);
MarshallUpStructuresArray(cbBuf, pPorts, *pcReturned, pPortInfoMarshalling[Level]->pInfo, pPortInfoMarshalling[Level]->cbStructureSize, TRUE);
}
SetLastError(dwErrorCode);

View file

@ -2,10 +2,11 @@
* PROJECT: ReactOS Spooler API
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: Functions related to Printers and printing
* COPYRIGHT: Copyright 2015-2017 Colin Finck (colin@reactos.org)
* COPYRIGHT: Copyright 2015-2018 Colin Finck (colin@reactos.org)
*/
#include "precomp.h"
#include <marshalling/printers.h>
// Local Constants
@ -14,114 +15,6 @@
static const WCHAR wszWindowsKey[] = L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows";
static const WCHAR wszDeviceValue[] = L"Device";
static void
_MarshallUpPrinterInfo(PBYTE* ppPrinterInfo, DWORD Level)
{
// Replace relative offset addresses in the output by absolute pointers and advance to the next structure.
if (Level == 0)
{
PPRINTER_INFO_STRESS pPrinterInfo0 = (PPRINTER_INFO_STRESS)(*ppPrinterInfo);
pPrinterInfo0->pPrinterName = (PWSTR)((ULONG_PTR)pPrinterInfo0->pPrinterName + (ULONG_PTR)pPrinterInfo0);
if (pPrinterInfo0->pServerName)
pPrinterInfo0->pServerName = (PWSTR)((ULONG_PTR)pPrinterInfo0->pServerName + (ULONG_PTR)pPrinterInfo0);
*ppPrinterInfo += sizeof(PRINTER_INFO_STRESS);
}
else if (Level == 1)
{
PPRINTER_INFO_1W pPrinterInfo1 = (PPRINTER_INFO_1W)(*ppPrinterInfo);
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);
*ppPrinterInfo += sizeof(PRINTER_INFO_1W);
}
else if (Level == 2)
{
PPRINTER_INFO_2W pPrinterInfo2 = (PPRINTER_INFO_2W)(*ppPrinterInfo);
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 = (PSECURITY_DESCRIPTOR)((ULONG_PTR)pPrinterInfo2->pSecurityDescriptor + (ULONG_PTR)pPrinterInfo2);
*ppPrinterInfo += sizeof(PRINTER_INFO_2W);
}
else if (Level == 3)
{
PPRINTER_INFO_3 pPrinterInfo3 = (PPRINTER_INFO_3)(*ppPrinterInfo);
pPrinterInfo3->pSecurityDescriptor = (PSECURITY_DESCRIPTOR)((ULONG_PTR)pPrinterInfo3->pSecurityDescriptor + (ULONG_PTR)pPrinterInfo3);
*ppPrinterInfo += sizeof(PRINTER_INFO_3);
}
else if (Level == 4)
{
PPRINTER_INFO_4W pPrinterInfo4 = (PPRINTER_INFO_4W)(*ppPrinterInfo);
pPrinterInfo4->pPrinterName = (PWSTR)((ULONG_PTR)pPrinterInfo4->pPrinterName + (ULONG_PTR)pPrinterInfo4);
if (pPrinterInfo4->pServerName)
pPrinterInfo4->pServerName = (PWSTR)((ULONG_PTR)pPrinterInfo4->pServerName + (ULONG_PTR)pPrinterInfo4);
*ppPrinterInfo += sizeof(PRINTER_INFO_4W);
}
else if (Level == 5)
{
PPRINTER_INFO_5W pPrinterInfo5 = (PPRINTER_INFO_5W)(*ppPrinterInfo);
pPrinterInfo5->pPrinterName = (PWSTR)((ULONG_PTR)pPrinterInfo5->pPrinterName + (ULONG_PTR)pPrinterInfo5);
pPrinterInfo5->pPortName = (PWSTR)((ULONG_PTR)pPrinterInfo5->pPortName + (ULONG_PTR)pPrinterInfo5);
*ppPrinterInfo += sizeof(PRINTER_INFO_5W);
}
else if (Level == 6)
{
*ppPrinterInfo += sizeof(PRINTER_INFO_6);
}
else if (Level == 7)
{
PPRINTER_INFO_7W pPrinterInfo7 = (PPRINTER_INFO_7W)(*ppPrinterInfo);
if (pPrinterInfo7->pszObjectGUID)
pPrinterInfo7->pszObjectGUID = (PWSTR)((ULONG_PTR)pPrinterInfo7->pszObjectGUID + (ULONG_PTR)pPrinterInfo7);
*ppPrinterInfo += sizeof(PRINTER_INFO_7W);
}
else if (Level == 8)
{
PPRINTER_INFO_8W pPrinterInfo8 = (PPRINTER_INFO_8W)(*ppPrinterInfo);
pPrinterInfo8->pDevMode = (PDEVMODEW)((ULONG_PTR)pPrinterInfo8->pDevMode + (ULONG_PTR)pPrinterInfo8);
*ppPrinterInfo += sizeof(PRINTER_INFO_8W);
}
else if (Level == 9)
{
PPRINTER_INFO_9W pPrinterInfo9 = (PPRINTER_INFO_9W)(*ppPrinterInfo);
pPrinterInfo9->pDevMode = (PDEVMODEW)((ULONG_PTR)pPrinterInfo9->pDevMode + (ULONG_PTR)pPrinterInfo9);
*ppPrinterInfo += sizeof(PRINTER_INFO_9W);
}
}
static DWORD
_StartDocPrinterSpooled(PSPOOLER_HANDLE pHandle, PDOC_INFO_1W pDocInfo1, PADDJOB_INFO_1W pAddJobInfo1)
{
@ -448,11 +341,9 @@ EnumPrintersW(DWORD Flags, PWSTR Name, DWORD Level, PBYTE pPrinterEnum, DWORD cb
if (dwErrorCode == ERROR_SUCCESS)
{
DWORD i;
PBYTE p = pPrinterEnum;
for (i = 0; i < *pcReturned; i++)
_MarshallUpPrinterInfo(&p, Level);
// Replace relative offset addresses in the output by absolute pointers.
ASSERT(Level <= 9);
MarshallUpStructuresArray(cbBuf, pPrinterEnum, *pcReturned, pPrinterInfoMarshalling[Level]->pInfo, pPrinterInfoMarshalling[Level]->cbStructureSize, TRUE);
}
Cleanup:
@ -665,8 +556,9 @@ GetPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD
if (dwErrorCode == ERROR_SUCCESS)
{
PBYTE p = pPrinter;
_MarshallUpPrinterInfo(&p, Level);
// Replace relative offset addresses in the output by absolute pointers.
ASSERT(Level <= 9);
MarshallUpStructure(cbBuf, pPrinter, pPrinterInfoMarshalling[Level]->pInfo, pPrinterInfoMarshalling[Level]->cbStructureSize, TRUE);
}
Cleanup:

View file

@ -2,30 +2,13 @@
* PROJECT: ReactOS Spooler API
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: Functions related to Print Processors
* COPYRIGHT: Copyright 2015-2017 Colin Finck (colin@reactos.org)
* COPYRIGHT: Copyright 2015-2018 Colin Finck (colin@reactos.org)
*/
#include "precomp.h"
#include <marshalling/printprocessors.h>
#include <prtprocenv.h>
static void
_MarshallUpDatatypesInfo(PDATATYPES_INFO_1W* ppDatatypesInfo1)
{
// Replace relative offset addresses in the output by absolute pointers.
PDATATYPES_INFO_1W pDatatypesInfo1 = *ppDatatypesInfo1;
pDatatypesInfo1->pName = (PWSTR)((ULONG_PTR)pDatatypesInfo1->pName + (ULONG_PTR)pDatatypesInfo1);
*ppDatatypesInfo1 += sizeof(DATATYPES_INFO_1W);
}
static void
_MarshallUpPrintProcessorInfo(PPRINTPROCESSOR_INFO_1W* ppPrintProcessorInfo1)
{
// Replace relative offset addresses in the output by absolute pointers.
PPRINTPROCESSOR_INFO_1W pPrintProcessorInfo1 = *ppPrintProcessorInfo1;
pPrintProcessorInfo1->pName = (PWSTR)((ULONG_PTR)pPrintProcessorInfo1->pName + (ULONG_PTR)pPrintProcessorInfo1);
*ppPrintProcessorInfo1 += sizeof(PRINTPROCESSOR_INFO_1W);
}
BOOL WINAPI
AddPrintProcessorA(PSTR pName, PSTR pEnvironment, PSTR pPathName, PSTR pPrintProcessorName)
{
@ -85,7 +68,7 @@ EnumPrintProcessorDatatypesW(PWSTR pName, LPWSTR pPrintProcessorName, DWORD Leve
{
dwErrorCode = _RpcEnumPrintProcessorDatatypes(pName, pPrintProcessorName, Level, pDatatypes, cbBuf, pcbNeeded, pcReturned);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
dwErrorCode = RpcExceptionCode();
ERR("_RpcEnumPrintProcessorDatatypes failed with exception code %lu!\n", dwErrorCode);
@ -94,11 +77,8 @@ EnumPrintProcessorDatatypesW(PWSTR pName, LPWSTR pPrintProcessorName, DWORD Leve
if (dwErrorCode == ERROR_SUCCESS)
{
DWORD i;
PDATATYPES_INFO_1W p = (PDATATYPES_INFO_1W)pDatatypes;
for (i = 0; i < *pcReturned; i++)
_MarshallUpDatatypesInfo(&p);
// Replace relative offset addresses in the output by absolute pointers.
MarshallUpStructuresArray(cbBuf, pDatatypes, *pcReturned, DatatypesInfo1Marshalling.pInfo, DatatypesInfo1Marshalling.cbStructureSize, TRUE);
}
Cleanup:
@ -130,7 +110,7 @@ EnumPrintProcessorsW(PWSTR pName, PWSTR pEnvironment, DWORD Level, PBYTE pPrintP
{
dwErrorCode = _RpcEnumPrintProcessors(pName, pEnvironment, Level, pPrintProcessorInfo, cbBuf, pcbNeeded, pcReturned);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
dwErrorCode = RpcExceptionCode();
}
@ -138,11 +118,8 @@ EnumPrintProcessorsW(PWSTR pName, PWSTR pEnvironment, DWORD Level, PBYTE pPrintP
if (dwErrorCode == ERROR_SUCCESS)
{
DWORD i;
PPRINTPROCESSOR_INFO_1W p = (PPRINTPROCESSOR_INFO_1W)pPrintProcessorInfo;
for (i = 0; i < *pcReturned; i++)
_MarshallUpPrintProcessorInfo(&p);
// Replace relative offset addresses in the output by absolute pointers.
MarshallUpStructuresArray(cbBuf, pPrintProcessorInfo, *pcReturned, PrintProcessorInfo1Marshalling.pInfo, PrintProcessorInfo1Marshalling.cbStructureSize, TRUE);
}
SetLastError(dwErrorCode);
@ -250,7 +227,7 @@ GetPrintProcessorDirectoryW(PWSTR pName, PWSTR pEnvironment, DWORD Level, PBYTE
{
dwErrorCode = _RpcGetPrintProcessorDirectory(pName, pEnvironment, Level, pPrintProcessorInfo, cbBuf, pcbNeeded);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
dwErrorCode = RpcExceptionCode();
}