From 98eab245d3c3377af0c3da6880bb8ede80cb0925 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sat, 13 Jun 2020 12:59:17 +0200 Subject: [PATCH] ntdll: Initialize file redirects only after the server is connected. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49380 Signed-off-by: Alexandre Julliard --- dlls/ntdll/unix/file.c | 4 ++-- dlls/ntdll/unix/loader.c | 2 -- dlls/ntdll/unix/thread.c | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 469fe55fe42..d39ca8cd635 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -2689,7 +2689,7 @@ static void init_redirects(void) char *dir; struct stat st; - if (!(dir = RtlAllocateHeap( GetProcessHeap(), 0, strlen(config_dir) + sizeof(windows_dir) ))) return; + if (!(dir = malloc( strlen(config_dir) + sizeof(windows_dir) ))) return; strcpy( dir, config_dir ); strcat( dir, windows_dir ); if (!stat( dir, &st )) @@ -2699,7 +2699,7 @@ static void init_redirects(void) nb_redirects = ARRAY_SIZE( redirects ); } else ERR( "%s: %s\n", dir, strerror(errno) ); - RtlFreeHeap( GetProcessHeap(), 0, dir ); + free( dir ); } diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 3bb805103d8..73be77e7afc 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1227,7 +1227,6 @@ void __wine_main( int argc, char *argv[], char *envp[] ) fixup_ntdll_imports( &__wine_spec_nt_header, module ); init_environment( argc, argv, envp ); - init_files(); #ifdef __APPLE__ apple_main_thread(); @@ -1262,7 +1261,6 @@ NTSTATUS __cdecl __wine_init_unix_lib( HMODULE module, const void *ptr_in, void map_so_dll( nt, module ); fixup_ntdll_imports( &__wine_spec_nt_header, module ); init_environment( __wine_main_argc, __wine_main_argv, envp ); - init_files(); *(struct unix_funcs **)ptr_out = &unix_funcs; wine_mmap_enum_reserved_areas( add_area, NULL, 0 ); return STATUS_SUCCESS; diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 97b191e1a5b..0470f5eaa8a 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -110,6 +110,7 @@ TEB * CDECL init_threading( int *nb_threads_ptr, struct ldt_copy **ldt_copy, SIZ server_init_process(); info_size = server_init_thread( teb->Peb, suspend ); virtual_map_user_shared_data(); + init_files(); NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 ); if (size) *size = info_size;