Use GlobalPageLock for GetVDMPointer32W16 Pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



dlls/kernel/wowthunk.c: GetVDMPointer32W16
			Use GlobalPageLock for GetVDMPointer32W16 Pointers

memory/global.c: GlobalReAlloc16
		 If heap has GlobalPageLock set, try only with
		 HEAP_REALLOC_IN_PLACE_ONLY flag set


Remarks: This makes the MS Encarta 99 Installer work. The installer is
a mixture of 16 and 32 bit code.

Bye

Uwe Bonnes                bon@elektron.ikp.physik.tu-darmstadt.de

Free Software: If you contribute nothing, expect nothing
--
Index: wine/memory/global.c
===================================================================
RCS file: /home/wine/wine/memory/global.c,v
retrieving revision 1.59
diff -u -r1.59 global.c
--- wine/memory/global.c	20 Nov 2001 20:26:35 -0000	1.59
+++ wine/memory/global.c	15 Dec 2001 18:15:26 -0000
@@ -318,17 +318,24 @@
 
     ptr = (void *)pArena->base;
     oldsize = pArena->size;
-    TRACE("oldsize %08lx\n",oldsize);
+    TRACE("oldbase %p oldsize %08lx newsize %08lx\n", ptr,oldsize,size);
     if (ptr && (size == oldsize)) return handle;  /* Nothing to do */
 
     if (pArena->flags & GA_DOSMEM)
         ptr = DOSMEM_ResizeBlock(ptr, size, NULL);
     else
-        ptr = HeapReAlloc( GetProcessHeap(), 0, ptr, size );
+        /* if more then one reader (e.g. some pointer has been given out by GetVDMPointer32W16),
+	   only try to realloc in place */
+        ptr = HeapReAlloc( GetProcessHeap(), 
+			   (pArena->pageLockCount > 0)?HEAP_REALLOC_IN_PLACE_ONLY:0, ptr, size );
     if (!ptr)
     {
-        SELECTOR_FreeBlock( sel );
-        memset( pArena, 0, sizeof(GLOBALARENA) );
+        FIXME("Realloc failed lock %d\n",pArena->pageLockCount);
+        if (pArena->pageLockCount <1)
+	  {
+	    SELECTOR_FreeBlock( sel );
+	    memset( pArena, 0, sizeof(GLOBALARENA) );
+	  }
         return 0;
     }
 
@@ -350,9 +357,10 @@
         return 0;
     }
 
-      /* Fill the new arena block */
+      /* Fill the new arena block 
+         As we may have used HEAP_REALLOC_IN_PLACE_ONLY, areas may overlap*/
 
-    if (pNewArena != pArena) memcpy( pNewArena, pArena, sizeof(GLOBALARENA) );
+    if (pNewArena != pArena) memmove( pNewArena, pArena, sizeof(GLOBALARENA) );
     pNewArena->base = (DWORD)ptr;
     pNewArena->size = GetSelectorLimit16(sel) + 1;
     pNewArena->selCount = selcount;
Index: wine/dlls/kernel/wowthunk.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/wowthunk.c,v
retrieving revision 1.16
diff -u -r1.16 wowthunk.c
--- wine/dlls/kernel/wowthunk.c	25 Jul 2001 00:43:30 -0000	1.16
+++ wine/dlls/kernel/wowthunk.c	15 Dec 2001 18:15:26 -0000
@@ -294,6 +294,7 @@
  */
 DWORD WINAPI GetVDMPointer32W16( SEGPTR vp, UINT16 fMode )
 {
+    GlobalPageLock16(GlobalHandle16(SELECTOROF(vp)));
     return (DWORD)K32WOWGetVDMPointer( vp, 0, (DWORD)fMode );
 }
 




[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux