[ros-diffs] [jimtabor] 44397: [Win32k] - Patch by Huw Davies huw at codeweavers.com : Fix incorrect initialization of path array. - Patch was modified from wine. Tested with Area.exe path test, still fails.

jimtabor at svn.reactos.org jimtabor at svn.reactos.org
Fri Dec 4 07:47:24 CET 2009


Author: jimtabor
Date: Fri Dec  4 07:47:23 2009
New Revision: 44397

URL: http://svn.reactos.org/svn/reactos?rev=44397&view=rev
Log:
[Win32k]
- Patch by Huw Davies huw at codeweavers.com : Fix incorrect initialization of path array.
- Patch was modified from wine. Tested with Area.exe path test, still fails.

Modified:
    trunk/reactos/subsystems/win32/win32k/objects/path.c

Modified: trunk/reactos/subsystems/win32/win32k/objects/path.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/path.c?rev=44397&r1=44396&r2=44397&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] Fri Dec  4 07:47:23 2009
@@ -1504,9 +1504,9 @@
 FASTCALL
 PATH_WidenPath(DC *dc)
 {
-    INT i, j, numStrokes, numOldStrokes, penWidth, penWidthIn, penWidthOut, size, penStyle;
+    INT i, j, numStrokes, penWidth, penWidthIn, penWidthOut, size, penStyle;
     BOOL ret = FALSE;
-    PPATH pPath, pNewPath, *pStrokes, *pOldStrokes, pUpPath, pDownPath;
+    PPATH pPath, pNewPath, *pStrokes = NULL, *pOldStrokes, pUpPath, pDownPath;
     EXTLOGPEN *elp;
     DWORD obj_type, joint, endcap, penType;
     PDC_ATTR pdcattr = dc->pdcattr;
@@ -1572,14 +1572,6 @@
         penWidthOut++;
 
     numStrokes = 0;
-    numOldStrokes = 1;
-
-    pStrokes    = ExAllocatePoolWithTag(PagedPool, sizeof(PPATH), TAG_PATH);
-    pStrokes[0] = ExAllocatePoolWithTag(PagedPool, sizeof(PATH), TAG_PATH);
-    PATH_InitGdiPath(pStrokes[0]);
-    pStrokes[0]->pFlags =   ExAllocatePoolWithTag(PagedPool, pPath->numEntriesUsed * sizeof(INT), TAG_PATH);
-    pStrokes[0]->pPoints =  ExAllocatePoolWithTag(PagedPool, pPath->numEntriesUsed * sizeof(POINT), TAG_PATH);
-    pStrokes[0]->numEntriesUsed = 0;
 
     for(i = 0, j = 0; i < pPath->numEntriesUsed; i++, j++)
     {
@@ -1601,11 +1593,17 @@
                 }
                 numStrokes++;
                 j = 0;
-                pOldStrokes = pStrokes; // Save old pointer.
-                pStrokes = ExAllocatePoolWithTag(PagedPool, numStrokes * sizeof(PPATH), TAG_PATH);
-                RtlCopyMemory(pStrokes, pOldStrokes, numOldStrokes * sizeof(PPATH));
-                numOldStrokes = numStrokes; // Save orig count.
-                ExFreePoolWithTag(pOldStrokes, TAG_PATH); // Free old pointer.
+                if (numStrokes == 1)
+                   pStrokes = ExAllocatePoolWithTag(PagedPool, numStrokes * sizeof(PPATH), TAG_PATH);                
+                else
+                {
+                   pOldStrokes = pStrokes; // Save old pointer.
+                   pStrokes = ExAllocatePoolWithTag(PagedPool, numStrokes * sizeof(PPATH), TAG_PATH);
+                   if (!pStrokes) return FALSE;
+                   RtlCopyMemory(pStrokes, pOldStrokes, numStrokes * sizeof(PPATH));
+                   ExFreePoolWithTag(pOldStrokes, TAG_PATH); // Free old pointer.
+                }
+                if (!pStrokes) return FALSE;
                 pStrokes[numStrokes - 1] = ExAllocatePoolWithTag(PagedPool, sizeof(PATH), TAG_PATH);
 
                 PATH_InitGdiPath(pStrokes[numStrokes - 1]);




More information about the Ros-diffs mailing list