From 6b968b21438e2e9bc73f60b08a7d7384dc58227d Mon Sep 17 00:00:00 2001 From: Colin Finck Date: Fri, 17 Jul 2015 15:09:31 +0000 Subject: [PATCH] [SPOOLSV, WINSPOOL] Add MarshallUp/MarshallDown functions for ADDJOB_INFO_1W as well. svn path=/branches/colins-printing-for-freedom/; revision=68413 --- reactos/win32ss/printing/base/spoolsv/jobs.c | 14 ++++++++------ reactos/win32ss/printing/base/winspool/jobs.c | 14 ++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/reactos/win32ss/printing/base/spoolsv/jobs.c b/reactos/win32ss/printing/base/spoolsv/jobs.c index e9c2bf027fb..1a2843afccc 100644 --- a/reactos/win32ss/printing/base/spoolsv/jobs.c +++ b/reactos/win32ss/printing/base/spoolsv/jobs.c @@ -7,6 +7,13 @@ #include "precomp.h" +static void +_MarshallDownAddJobInfo(PADDJOB_INFO_1W pAddJobInfo1) +{ + // Replace absolute pointer addresses in the output by relative offsets. + pAddJobInfo1->Path = (PWSTR)((ULONG_PTR)pAddJobInfo1->Path - (ULONG_PTR)pAddJobInfo1); +} + static void _MarshallDownJobInfo(PBYTE pJobInfo, DWORD Level) { @@ -53,7 +60,6 @@ DWORD _RpcAddJob(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD Level, BYTE* pAddJob, DWORD cbBuf, DWORD* pcbNeeded) { DWORD dwErrorCode; - PADDJOB_INFO_1W pAddJobInfo1; dwErrorCode = RpcImpersonateClient(NULL); if (dwErrorCode != ERROR_SUCCESS) @@ -66,11 +72,7 @@ _RpcAddJob(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD Level, BYTE* pAddJob, DWORD c dwErrorCode = GetLastError(); if (dwErrorCode == ERROR_SUCCESS) - { - // Replace absolute pointer addresses in the output by relative offsets. - pAddJobInfo1 = (PADDJOB_INFO_1W)pAddJob; - pAddJobInfo1->Path = (PWSTR)((ULONG_PTR)pAddJobInfo1->Path - (ULONG_PTR)pAddJobInfo1); - } + _MarshallDownAddJobInfo((PADDJOB_INFO_1W)pAddJob); RpcRevertToSelf(); return dwErrorCode; diff --git a/reactos/win32ss/printing/base/winspool/jobs.c b/reactos/win32ss/printing/base/winspool/jobs.c index f5553f61a8d..ab0069d3c33 100644 --- a/reactos/win32ss/printing/base/winspool/jobs.c +++ b/reactos/win32ss/printing/base/winspool/jobs.c @@ -7,6 +7,13 @@ #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) { @@ -60,7 +67,6 @@ BOOL WINAPI AddJobW(HANDLE hPrinter, DWORD Level, PBYTE pData, DWORD cbBuf, PDWORD pcbNeeded) { DWORD dwErrorCode; - PADDJOB_INFO_1W pAddJobInfo1; PSPOOLER_HANDLE pHandle = (PSPOOLER_HANDLE)hPrinter; if (!pHandle) @@ -82,11 +88,7 @@ AddJobW(HANDLE hPrinter, DWORD Level, PBYTE pData, DWORD cbBuf, PDWORD pcbNeeded RpcEndExcept; if (dwErrorCode == ERROR_SUCCESS) - { - // Replace relative offset addresses in the output by absolute pointers. - pAddJobInfo1 = (PADDJOB_INFO_1W)pData; - pAddJobInfo1->Path = (PWSTR)((ULONG_PTR)pAddJobInfo1->Path + (ULONG_PTR)pAddJobInfo1); - } + _MarshallUpAddJobInfo((PADDJOB_INFO_1W)pData); Cleanup: SetLastError(dwErrorCode); -- 2.17.1