ntdll: Only reset the Unix current directory on removable devices.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49545
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-12-18 15:20:45 +01:00
parent 74aa42a529
commit cdaa72c728
2 changed files with 10 additions and 2 deletions

View File

@ -1348,7 +1348,6 @@ void CDECL get_initial_directory( UNICODE_STRING *dir )
MESSAGE("Warning: could not find DOS drive for current working directory '%s', "
"starting in the Windows directory.\n", cwd ? cwd : "" );
free( cwd );
chdir( "/" ); /* avoid locking removable devices */
}

View File

@ -1466,7 +1466,16 @@ void server_init_process_done(void)
IMAGE_NT_HEADERS *nt = get_exe_nt_header();
void *entry = (char *)peb->ImageBaseAddress + nt->OptionalHeader.AddressOfEntryPoint;
NTSTATUS status;
int suspend;
int suspend, needs_close, unixdir;
if (peb->ProcessParameters->CurrentDirectory.Handle &&
!server_get_unix_fd( peb->ProcessParameters->CurrentDirectory.Handle,
FILE_TRAVERSE, &unixdir, &needs_close, NULL, NULL ))
{
fchdir( unixdir );
if (needs_close) close( unixdir );
}
else chdir( "/" ); /* avoid locking removable devices */
#ifdef __APPLE__
send_server_task_port();