winedos: make UMB executable

Mikolaj Zalewski mikolaj at zalewski.pl
Tue Aug 14 12:15:28 CDT 2007


  This sets the executable bit in winedos. The current code didn't work 
as it runs only when a DOS application starts or we switch to real mode 
and the code in UMB is also executed for pure Win16 apps.
  If the PM-only code that is currently stored in the UMB can be also 
stored somewhere else we could keep the current mechanism but I guess it 
is in UMB for a purpose.
-------------- next part --------------
>From e6d1886fdc206141fe505bb95b9c0d6e9dde67ed Mon Sep 17 00:00:00 2001
From: Mikolaj Zalewski <mikolajz at mikolajz.smo.corp.google.com>
Date: Tue, 14 Aug 2007 10:05:39 -0700
Subject: [PATCH] winedos: make UMB executable
---
 dlls/winedos/himem.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/dlls/winedos/himem.c b/dlls/winedos/himem.c
index 240ba3e..baa9d71 100644
--- a/dlls/winedos/himem.c
+++ b/dlls/winedos/himem.c
@@ -156,6 +156,7 @@ LPVOID DOSVM_AllocDataUMB( DWORD size, W
  */
 void DOSVM_InitSegments( void )
 {
+    DWORD old_protect;
     LPSTR ptr;
     int   i;
 
@@ -291,4 +292,9 @@ void DOSVM_InitSegments( void )
     ptr = DOSVM_AllocDataUMB( DOSVM_RELAY_DATA_SIZE, 
                               0, &DOSVM_dpmi_segments->relay_data_sel);
     memset( ptr, 0, DOSVM_RELAY_DATA_SIZE );
+    
+    /*
+     * As we store code in UMB we should make sure it is executable
+     */
+    VirtualProtect((void *)DOSVM_UMB_BOTTOM, DOSVM_UMB_TOP - DOSVM_UMB_BOTTOM, PAGE_EXECUTE_READWRITE, &old_protect);
 }
-- 
1.4.1



More information about the wine-patches mailing list