VirtualProtect should return correct old protection flags

Dmitry Timoshkov dmitry at sloboda.ru
Fri Apr 20 03:44:09 CDT 2001


Hello.

I tryed to install QuarkExpress 4.0 under Wine and virtual
memory functions make it very unhappy. Luckily, installer emits
DebugBreak after each failure. This patch helps to continue
installation with -winver nt40. With -winver win95 switch installer
DebugBreak's after VirtualQuery call. Since have no access
to a win95 machine, I can't debug it.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    VirtualProtect should return correct old protection flags.

diff -u cvs/hq/wine/memory/virtual.c wine/memory/virtual.c
--- cvs/hq/wine/memory/virtual.c	Tue Feb 27 10:09:18 2001
+++ wine/memory/virtual.c	Fri Apr 20 15:18:36 2001
@@ -968,6 +968,7 @@
     FILE_VIEW *view;
     UINT base, i;
     BYTE vprot, *p;
+    DWORD prot;
 
     TRACE("%08x %08lx %08lx\n",
                      (UINT)addr, size, new_prot );
@@ -987,6 +988,7 @@
     /* Make sure all the pages are committed */
 
     p = view->prot + ((base - view->base) >> page_shift);
+    VIRTUAL_GetWin32Prot( *p, &prot, NULL );
     for (i = size >> page_shift; i; i--, p++)
     {
         if (!(*p & VPROT_COMMITTED))
@@ -996,7 +998,7 @@
         }
     }
 
-    if (old_prot) VIRTUAL_GetWin32Prot( view->prot[0], old_prot, NULL );
+    if (old_prot) *old_prot = prot;
     vprot = VIRTUAL_GetProt( new_prot ) | VPROT_COMMITTED;
     return VIRTUAL_SetProt( view, base, size, vprot );
 }






More information about the wine-patches mailing list