[SPOOLSV, WINSPOOL]
authorColin Finck <colin@reactos.org>
Fri, 17 Jul 2015 15:09:31 +0000 (15:09 +0000)
committerColin Finck <colin@reactos.org>
Fri, 17 Jul 2015 15:09:31 +0000 (15:09 +0000)
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
reactos/win32ss/printing/base/winspool/jobs.c

index e9c2bf0..1a2843a 100644 (file)
@@ -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;
index f5553f6..ab0069d 100644 (file)
@@ -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);