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;
}
static char *get_unix_file_name( LPCWSTR dosW )
static char *get_unix_file_name( LPCWSTR path )
{
UNICODE_STRING nt_name;
OBJECT_ATTRIBUTES attr;
@ -1372,24 +1372,19 @@ static char *get_unix_file_name( LPCWSTR dosW )
ULONG size = 256;
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 );
for (;;)
{
if (!(buffer = malloc( size )))
{
RtlFreeUnicodeString( &nt_name );
return NULL;
}
if (!(buffer = malloc( size ))) return NULL;
status = wine_nt_to_unix_file_name( &attr, buffer, &size, FILE_OPEN_IF );
if (status != STATUS_BUFFER_TOO_SMALL) break;
free( buffer );
}
RtlFreeUnicodeString( &nt_name );
if (status && status != STATUS_NO_SUCH_FILE)
{
free( buffer );
RtlSetLastWin32ErrorAndNtStatusFromNtStatus( status );
return NULL;
}
return buffer;