gdi32: Don't use RtlDosPathNameToNtPathName_U in get_unix_file_name.

Paths are already in NT format.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-10-04 15:03:18 +01:00 committed by Alexandre Julliard
parent f79ed7b41f
commit 002d59cf44
1 changed files with 4 additions and 9 deletions

View File

@ -1364,7 +1364,7 @@ static WCHAR *get_dos_file_name( LPCSTR str )
return buffer; return buffer;
} }
static char *get_unix_file_name( LPCWSTR dosW ) static char *get_unix_file_name( LPCWSTR path )
{ {
UNICODE_STRING nt_name; UNICODE_STRING nt_name;
OBJECT_ATTRIBUTES attr; OBJECT_ATTRIBUTES attr;
@ -1372,24 +1372,19 @@ static char *get_unix_file_name( LPCWSTR dosW )
ULONG size = 256; ULONG size = 256;
char *buffer; char *buffer;
if (!RtlDosPathNameToNtPathName_U( dosW, &nt_name, NULL, NULL )) return NULL; nt_name.Buffer = (WCHAR *)path;
nt_name.MaximumLength = nt_name.Length = lstrlenW( path ) * sizeof(WCHAR);
InitializeObjectAttributes( &attr, &nt_name, 0, 0, NULL ); InitializeObjectAttributes( &attr, &nt_name, 0, 0, NULL );
for (;;) for (;;)
{ {
if (!(buffer = malloc( size ))) if (!(buffer = malloc( size ))) return NULL;
{
RtlFreeUnicodeString( &nt_name );
return NULL;
}
status = wine_nt_to_unix_file_name( &attr, buffer, &size, FILE_OPEN_IF ); status = wine_nt_to_unix_file_name( &attr, buffer, &size, FILE_OPEN_IF );
if (status != STATUS_BUFFER_TOO_SMALL) break; if (status != STATUS_BUFFER_TOO_SMALL) break;
free( buffer ); free( buffer );
} }
RtlFreeUnicodeString( &nt_name );
if (status && status != STATUS_NO_SUCH_FILE) if (status && status != STATUS_NO_SUCH_FILE)
{ {
free( buffer ); free( buffer );
RtlSetLastWin32ErrorAndNtStatusFromNtStatus( status );
return NULL; return NULL;
} }
return buffer; return buffer;