Huw Davies : winspool: Correct the padding calculation when there is no buffer.

Alexandre Julliard julliard at winehq.org
Tue Apr 3 12:17:39 CDT 2012


Module: wine
Branch: master
Commit: fa00fce68409b65318755179b5cfe0e1bcccafe2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fa00fce68409b65318755179b5cfe0e1bcccafe2

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue Apr  3 11:43:39 2012 +0100

winspool: Correct the padding calculation when there is no buffer.

---

 dlls/winspool.drv/info.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index 8e3fdf3..4845447 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -7299,7 +7299,7 @@ static BOOL get_job_info_2(job_t *job, JOB_INFO_2W *ji2, LPBYTE buf, DWORD cbBuf
         else
         {
             /* align DEVMODE to a DWORD boundary */
-            shift= (4 - ( (DWORD_PTR) ptr & 3)) & 3;
+            shift = (4 - (*pcbNeeded & 3)) & 3;
             size += shift;
 
             if (size <= left)
@@ -7308,7 +7308,7 @@ static BOOL get_job_info_2(job_t *job, JOB_INFO_2W *ji2, LPBYTE buf, DWORD cbBuf
                 memcpy(ptr, devmode, size-shift);
                 ji2->pDevMode = (LPDEVMODEW)ptr;
                 if (!unicode) HeapFree(GetProcessHeap(), 0, dmA);
-                ptr += size;
+                ptr += size-shift;
                 left -= size;
             }
             else




More information about the wine-cvs mailing list