ntdll: Stop when we can't map the shared user data (try 2)

André Hentschel nerv at dawncrow.de
Tue Mar 8 12:51:19 CST 2011


---
 dlls/ntdll/thread.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 56eca23..41377a5 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -197,6 +197,7 @@ HANDLE thread_init(void)
     SIZE_T size, info_size;
     HANDLE exe_file = 0;
     LARGE_INTEGER now;
+    NTSTATUS status;
     struct ntdll_thread_data *thread_data;
     static struct debug_info debug_info;  /* debug info for initial thread */
 
@@ -206,8 +207,12 @@ HANDLE thread_init(void)
 
     addr = (void *)0x7ffe0000;
     size = 0x10000;
-    NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 0, &size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE );
-    user_shared_data = addr;
+    status = NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 0, &size,
+                                      MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE );
+    if (status)
+        MESSAGE( "wine: failed to map the shared user data: %x\n", status );
+    else
+        user_shared_data = addr;
 
     /* allocate and initialize the PEB */
 
@@ -286,6 +291,8 @@ HANDLE thread_init(void)
             wine_server_fd_to_handle( 2, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, &params.hStdError );
     }
 
+    if(!user_shared_data) return exe_file;
+
     /* initialize time values in user_shared_data */
     NtQuerySystemTime( &now );
     user_shared_data->SystemTime.LowPart = now.u.LowPart;
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list