Commit 76f94957 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Avoid calling NtOpenFile() from the Unix side.

parent f690266c
......@@ -162,7 +162,6 @@ static NTSTATUS open_nls_data_file( ULONG type, ULONG id, HANDLE *file )
's','o','r','t','i','n','g','\\',0};
NTSTATUS status = STATUS_OBJECT_NAME_NOT_FOUND;
IO_STATUS_BLOCK io;
OBJECT_ATTRIBUTES attr;
UNICODE_STRING valueW;
WCHAR buffer[ARRAY_SIZE(sortdirW) + 16];
......@@ -179,10 +178,12 @@ static NTSTATUS open_nls_data_file( ULONG type, ULONG id, HANDLE *file )
status = open_unix_file( file, path, GENERIC_READ, &attr, 0, FILE_SHARE_READ,
FILE_OPEN, FILE_SYNCHRONOUS_IO_ALERT, NULL, 0 );
if (status == STATUS_NO_SUCH_FILE)
/* try to open file in system dir */
status = NtOpenFile( file, GENERIC_READ, &attr, &io, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_ALERT );
free( path );
if (status != STATUS_NO_SUCH_FILE) return status;
if ((status = nt_to_unix_file_name( &attr, &path, FILE_OPEN ))) return status;
status = open_unix_file( file, path, GENERIC_READ, &attr, 0, FILE_SHARE_READ,
FILE_OPEN, FILE_SYNCHRONOUS_IO_ALERT, NULL, 0 );
free( path );
return status;
}
......
......@@ -353,21 +353,26 @@ static WCHAR *get_nt_pathname( const UNICODE_STRING *str )
*/
static int get_unix_curdir( const RTL_USER_PROCESS_PARAMETERS *params )
{
UNICODE_STRING nt_name;
UNICODE_STRING nt_name, redir;
OBJECT_ATTRIBUTES attr;
IO_STATUS_BLOCK io;
NTSTATUS status;
HANDLE handle;
int fd = -1;
char *unix_name;
if (!(nt_name.Buffer = get_nt_pathname( &params->CurrentDirectory.DosPath ))) return -1;
nt_name.Length = wcslen( nt_name.Buffer ) * sizeof(WCHAR);
InitializeObjectAttributes( &attr, &nt_name, OBJ_CASE_INSENSITIVE, 0, NULL );
status = NtOpenFile( &handle, FILE_TRAVERSE | SYNCHRONIZE, &attr, &io,
FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
get_redirect( &attr, &redir );
status = nt_to_unix_file_name( &attr, &unix_name, FILE_OPEN );
free( nt_name.Buffer );
free( redir.Buffer );
if (status) return -1;
status = open_unix_file( &handle, unix_name, FILE_TRAVERSE | SYNCHRONIZE, &attr, 0,
FILE_SHARE_READ | FILE_SHARE_DELETE,
FILE_OPEN, FILE_SYNCHRONOUS_IO_NONALERT, NULL, 0 );
free( unix_name );
if (status) return -1;
wine_server_handle_to_fd( handle, FILE_TRAVERSE, &fd, NULL );
NtClose( handle );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment