[Wine-patches] [eter-1.0.10] Prevent loading winedevice below 0x80000000 on Fedora 10 (eterbug #4055).

Alexander Morozov amorozov на etersoft.ru
Вт Июл 14 15:51:43 MSD 2009


----------- следующая часть -----------
From 8b9c8615f83cdb9cbd9a105128a5751358dd5fad Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Tue, 14 Jul 2009 15:13:54 +0400
Subject: [eter-1.0.10] Prevent loading winedevice below 0x80000000 on Fedora 10 (eterbug #4055).

---
 dlls/ntdll/virtual.c |    2 +-
 libs/wine/loader.c   |    2 +-
 loader/preloader.c   |   27 +++++++++++++++++++++++++--
 3 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index c6e8bf4..174375c 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1660,7 +1660,7 @@ void VIRTUAL_UseLargeAddressSpace(void)
  */
 void VIRTUAL_UseDriverAddressSpace(void)
 {
-    user_space_limit = working_set_limit = (void *)0x84ff0000;
+    user_space_limit = working_set_limit = (void *)0x8fff0000;
     address_space_start = (void *)0x81000000;
 }
 
diff --git a/libs/wine/loader.c b/libs/wine/loader.c
index 7d4ca81..ef7cf8d 100644
--- a/libs/wine/loader.c
+++ b/libs/wine/loader.c
@@ -641,7 +641,7 @@ void wine_init( int argc, char *argv[], char *error, int error_size )
     __wine_main_argv = argv;
     __wine_main_environ = environ;
     if ((argc >= 2) && (path = strrchr( argv[1], '\\' )) && !strcasecmp( path, winedevice ))
-        mmap_init( (char *)0x84fe0000 );
+        mmap_init( (char *)0x8ffe0000 );
     else
         mmap_init( (char *)0x7ffe0000 );
 
diff --git a/loader/preloader.c b/loader/preloader.c
index 8110dfb..e550b0b 100644
--- a/loader/preloader.c
+++ b/loader/preloader.c
@@ -109,7 +109,7 @@
 /* missed in some old systems */
 typedef uint32_t Elf_Symndx;
 
-static struct wine_preload_info preload_info[] =
+static struct wine_preload_info common_preload_info[] =
 {
     { (void *)0x00000000, 0x00010000 },  /* low 64k */
     { (void *)0x00010000, 0x00100000 },  /* DOS area */
@@ -119,6 +119,20 @@ static struct wine_preload_info preload_info[] =
     { 0, 0 }                             /* end of list */
 };
 
+/* special address space layout for winedevice */
+static struct wine_preload_info winedevice_preload_info[] =
+{
+    { (void *)0x00000000, 0x00010000 },
+    { (void *)0x00010000, 0x00100000 },
+    { (void *)0x00110000, 0x7b800000 },
+    { (void *)0x7bf00000, 0x00100000 },
+    { (void *)0x7c010000, 0x05ff0000 },
+    { 0, 0 },
+    { 0, 0 }
+};
+
+static struct wine_preload_info *preload_info = common_preload_info;
+
 /* debugging */
 #undef DUMP_SEGMENTS
 #undef DUMP_AUX_INFO
@@ -1048,7 +1062,7 @@ void* wld_start( void **stack )
 {
     int i, *pargc;
     char **argv, **p;
-    char *interp, *reserve = NULL;
+    char *interp, *reserve = NULL, *ptr, *exec = NULL;
     ElfW(auxv_t) new_av[12], delete_av[3], *av;
     struct wld_link_map main_binary_map, ld_so_map;
     struct wine_preload_info **wine_main_preload_info;
@@ -1081,6 +1095,15 @@ void* wld_start( void **stack )
     dump_auxiliary( av );
 #endif
 
+    /* use special address space layout for winedevice */
+    if (*pargc > 2)
+    {
+        ptr = argv[2];
+        while (*ptr++) if (*ptr == '\\') exec = ptr;
+        if (exec && !wld_strcmp( "\\winedevice.exe", exec ))
+            preload_info = winedevice_preload_info;
+    }
+
     /* reserve memory that Wine needs */
     if (reserve) preload_reserve( reserve );
     for (i = 0; preload_info[i].size; i++)
-- 
1.6.3.3



Подробная информация о списке рассылки Wine-patches