kernel: add execution permission to DOS memory area

Mikolaj Zalewski mikolaj at zalewski.pl
Mon Aug 13 15:48:30 CDT 2007


  Execution permission is needed because we store some (mostly 
DPMI-related) code in UMB (in winedos/himem.c) that is executed for each 
Win16 app. The user may put even more code there. Ntvdm.exe also makes 
the DOS memory executable (except for some parts of the UMB)
  Why is the DOS memory block available for any application not only in 
winevdm? Is it for compatibility with Win95 or Win32s?
-------------- next part --------------
>From a6dbf0b651297c144a5b9fce2d22116e77411ec0 Mon Sep 17 00:00:00 2001
From: Mikolaj Zalewski <mikolajz at mikolajz.smo.corp.google.com>
Date: Mon, 13 Aug 2007 13:29:44 -0700
Subject: [PATCH] kernel: add execution permission to DOS memory area
---
 dlls/kernel32/dosmem.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/kernel32/dosmem.c b/dlls/kernel32/dosmem.c
index a976cba..81d8187 100644
--- a/dlls/kernel32/dosmem.c
+++ b/dlls/kernel32/dosmem.c
@@ -99,7 +99,7 @@ BOOL load_winedos(void)
 	    /* ok, we're the winning thread */
             if (!VirtualProtect( DOSMEM_dosmem + DOSMEM_protect,
                                  DOSMEM_SIZE - DOSMEM_protect,
-                                 PAGE_READWRITE, NULL ) ||
+                                 PAGE_EXECUTE_READWRITE, NULL ) ||
                 !(hModule = LoadLibraryA( "winedos.dll" )))
             {
                 ERR("Could not load winedos.dll, DOS subsystem unavailable\n");
@@ -166,7 +166,7 @@ static char* setup_dos_mem(void)
     if (wine_mmap_is_in_reserved_area( NULL, DOSMEM_SIZE ) != 1)
     {
         addr = wine_anon_mmap( (void *)page_size, DOSMEM_SIZE-page_size,
-                               PROT_READ | PROT_WRITE, 0 );
+                               PROT_READ | PROT_WRITE | PROT_EXEC, 0 );
         if (addr == (void *)page_size) addr = NULL; /* we got what we wanted */
         else munmap( addr, DOSMEM_SIZE - page_size );
     }
-- 
1.4.1



More information about the wine-patches mailing list