[Wine-patches] [7/10] Use addresses 81000000 - 84ff0000 for winedevice.exe.

Alexander Morozov =?iso-8859-1?q?amorozov_=CE=C1_etersoft=2Eru?=
Пн Ноя 24 19:02:22 MSK 2008


----------- следующая часть -----------
From 7608fd797ccfdc21550a9fae5eba2426a4ed8f86 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Mon, 24 Nov 2008 13:26:43 +0300
Subject: [PATCH] Use addresses 81000000 - 84ff0000 for winedevice.exe.

---
 dlls/ntdll/loader.c  |    6 ++++++
 dlls/ntdll/virtual.c |   12 +++++++++++-
 libs/wine/loader.c   |    8 ++++++--
 libs/wine/mmap.c     |    5 ++---
 4 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index b6dbca0..e9c9dd8 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -2597,12 +2597,18 @@ void __wine_init_windows_dir( const WCHAR *windir, const WCHAR *sysdir )
 void __wine_process_init(void)
 {
     static const WCHAR kernel32W[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0};
+    static const char winedevice[] = "\\winedevice.exe";
 
     WINE_MODREF *wm;
     NTSTATUS status;
     ANSI_STRING func_name;
     void (* DECLSPEC_NORETURN init_func)(void);
     extern mode_t FILE_umask;
+    char *ptr;
+
+    if ((__wine_main_argc >= 2) && (ptr = strrchr( __wine_main_argv[1], '\\' ))
+        && !strcasecmp( ptr, winedevice ))
+        VIRTUAL_UseDriverAddressSpace();
 
     main_exe_file = thread_init();
 
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index f5bed62..60ae952 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -141,6 +141,7 @@ static void *working_set_limit;
 
 #define VIRTUAL_HEAP_SIZE (4*1024*1024)
 
+static void *address_space_start = (void *)0x110000;
 static HANDLE virtual_heap;
 static void *preload_reserve_start;
 static void *preload_reserve_end;
@@ -634,7 +635,6 @@ struct alloc_area
  */
 static int alloc_reserved_area_callback( void *start, size_t size, void *arg )
 {
-    static void * const address_space_start = (void *)0x110000;
     struct alloc_area *alloc = arg;
     void *end = (char *)start + size;
 
@@ -1520,6 +1520,16 @@ void VIRTUAL_UseLargeAddressSpace(void)
 
 
 /***********************************************************************
+ *           VIRTUAL_UseDriverAddressSpace
+ */
+void VIRTUAL_UseDriverAddressSpace(void)
+{
+    user_space_limit = working_set_limit = (void *)0x84ff0000;
+    address_space_start = (void *)0x81000000;
+}
+
+
+/***********************************************************************
  *             NtAllocateVirtualMemory   (NTDLL.@)
  *             ZwAllocateVirtualMemory   (NTDLL.@)
  */
diff --git a/libs/wine/loader.c b/libs/wine/loader.c
index dde5a70..88ae4b6 100644
--- a/libs/wine/loader.c
+++ b/libs/wine/loader.c
@@ -87,7 +87,7 @@ static const char **dll_paths;
 static unsigned int nb_dll_paths;
 static int dll_path_maxlen;
 
-extern void mmap_init(void);
+extern void mmap_init( char *user_space_limit );
 extern const char *get_dlldir( const char **default_dlldir );
 
 /* build the dll load path from the WINEDLLPATH variable */
@@ -620,6 +620,7 @@ static void set_max_limit( int limit )
  */
 void wine_init( int argc, char *argv[], char *error, int error_size )
 {
+    static const char winedevice[] = "\\winedevice.exe";
     struct dll_path_context context;
     char *path;
     void *ntdll = NULL;
@@ -638,7 +639,10 @@ void wine_init( int argc, char *argv[], char *error, int error_size )
     __wine_main_argc = argc;
     __wine_main_argv = argv;
     __wine_main_environ = environ;
-    mmap_init();
+    if ((argc >= 2) && (path = strrchr( argv[1], '\\' )) && !strcasecmp( path, winedevice ))
+        mmap_init( (char *)0x84fe0000 );
+    else
+        mmap_init( (char *)0x7ffe0000 );
 
     for (path = first_dll_path( "ntdll.dll", 0, &context ); path; path = next_dll_path( &context ))
     {
diff --git a/libs/wine/mmap.c b/libs/wine/mmap.c
index ff117cc..412a45e 100644
--- a/libs/wine/mmap.c
+++ b/libs/wine/mmap.c
@@ -339,14 +339,13 @@ static void reserve_dos_area(void)
 /***********************************************************************
  *           mmap_init
  */
-void mmap_init(void)
+void mmap_init( char *user_space_limit )
 {
     struct reserved_area *area;
     struct list *ptr;
 #if defined(__i386__) && !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)  /* commented out until FreeBSD gets fixed */
     char stack;
     char * const stack_ptr = &stack;
-    char *user_space_limit = (char *)0x7ffe0000;
 
     reserve_malloc_space( 8 * 1024 * 1024 );
 
@@ -402,7 +401,7 @@ static inline int munmap( void *ptr, size_t size )
     return 0;
 }
 
-void mmap_init(void)
+void mmap_init( char *user_space_limit )
 {
 }
 
-- 
1.6.0.2.GIT



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