Commit f32600d3 authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Check NT symlink first for all devices in QueryDosDeviceW.

parent c0ac2afb
...@@ -1282,34 +1282,35 @@ DWORD WINAPI QueryDosDeviceW( LPCWSTR devname, LPWSTR target, DWORD bufsize ) ...@@ -1282,34 +1282,35 @@ DWORD WINAPI QueryDosDeviceW( LPCWSTR devname, LPWSTR target, DWORD bufsize )
{ {
WCHAR *p, name[5]; WCHAR *p, name[5];
char *path, *link; char *path, *link;
WCHAR *buffer;
DWORD dosdev, ret = 0; DWORD dosdev, ret = 0;
if ((dosdev = RtlIsDosDeviceName_U( devname ))) if ((dosdev = RtlIsDosDeviceName_U( devname )))
{ {
memcpy( name, devname + HIWORD(dosdev)/sizeof(WCHAR), LOWORD(dosdev) ); memcpy( name, devname + HIWORD(dosdev)/sizeof(WCHAR), LOWORD(dosdev) );
name[LOWORD(dosdev)/sizeof(WCHAR)] = 0; name[LOWORD(dosdev)/sizeof(WCHAR)] = 0;
devname = name;
} }
else
{
WCHAR *buffer;
if (!(buffer = HeapAlloc( GetProcessHeap(), 0, sizeof(dosdevW) + strlenW(devname)*sizeof(WCHAR) ))) if (!(buffer = HeapAlloc( GetProcessHeap(), 0, sizeof(dosdevW) + strlenW(devname)*sizeof(WCHAR) )))
{ {
SetLastError( ERROR_OUTOFMEMORY ); SetLastError( ERROR_OUTOFMEMORY );
return 0; return 0;
} }
memcpy( buffer, dosdevW, sizeof(dosdevW) ); memcpy( buffer, dosdevW, sizeof(dosdevW) );
strcatW( buffer, devname ); strcatW( buffer, devname );
status = read_nt_symlink( buffer, target, bufsize ); status = read_nt_symlink( buffer, target, bufsize );
HeapFree( GetProcessHeap(), 0, buffer ); HeapFree( GetProcessHeap(), 0, buffer );
if (status) if (!status)
{ {
SetLastError( RtlNtStatusToDosError(status) );
return 0;
}
ret = strlenW( target ) + 1; ret = strlenW( target ) + 1;
goto done; goto done;
} }
if (!dosdev) /* not a special DOS device */
{
SetLastError( RtlNtStatusToDosError(status) );
return 0;
}
/* FIXME: should read NT symlink for all devices */ /* FIXME: should read NT symlink for all devices */
...@@ -1322,7 +1323,7 @@ DWORD WINAPI QueryDosDeviceW( LPCWSTR devname, LPWSTR target, DWORD bufsize ) ...@@ -1322,7 +1323,7 @@ DWORD WINAPI QueryDosDeviceW( LPCWSTR devname, LPWSTR target, DWORD bufsize )
ret = MultiByteToWideChar( CP_UNIXCP, 0, link, -1, target, bufsize ); ret = MultiByteToWideChar( CP_UNIXCP, 0, link, -1, target, bufsize );
HeapFree( GetProcessHeap(), 0, link ); HeapFree( GetProcessHeap(), 0, link );
} }
else if (dosdev) /* look for device defaults */ else /* look for device defaults */
{ {
if (!strcmpiW( name, auxW )) if (!strcmpiW( name, auxW ))
{ {
......
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