mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 22:20:26 +00:00
kernel32: Handle device paths in GetVolumePathName.
NT-style paths that have a device prefix (\??\) also return the drive of the current working directory (even if they're valid devices).
This commit is contained in:
parent
5a84969f39
commit
ed151a5efc
@ -675,6 +675,14 @@ static void test_GetVolumePathNameA(void)
|
|||||||
"InvalidDrive:\\AnInvalidFolder", "%CurrentDrive%\\", sizeof(volume_path),
|
"InvalidDrive:\\AnInvalidFolder", "%CurrentDrive%\\", sizeof(volume_path),
|
||||||
NO_ERROR, NO_ERROR
|
NO_ERROR, NO_ERROR
|
||||||
},
|
},
|
||||||
|
{ /* test 18: a reasonable device path */
|
||||||
|
"\\??\\CdRom0", "%CurrentDrive%\\", sizeof(volume_path),
|
||||||
|
NO_ERROR, NO_ERROR
|
||||||
|
},
|
||||||
|
{ /* test 19: an unreasonable device path */
|
||||||
|
"\\??\\ReallyBogus", "%CurrentDrive%\\", sizeof(volume_path),
|
||||||
|
NO_ERROR, NO_ERROR
|
||||||
|
},
|
||||||
};
|
};
|
||||||
BOOL ret, success;
|
BOOL ret, success;
|
||||||
DWORD error;
|
DWORD error;
|
||||||
|
@ -1817,6 +1817,7 @@ BOOL WINAPI GetVolumePathNameA(LPCSTR filename, LPSTR volumepathname, DWORD bufl
|
|||||||
*/
|
*/
|
||||||
BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD buflen)
|
BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD buflen)
|
||||||
{
|
{
|
||||||
|
static const WCHAR deviceprefixW[] = { '\\','?','?','\\',0 };
|
||||||
static const WCHAR ntprefixW[] = { '\\','\\','?','\\',0 };
|
static const WCHAR ntprefixW[] = { '\\','\\','?','\\',0 };
|
||||||
WCHAR fallbackpathW[] = { 'C',':','\\',0 };
|
WCHAR fallbackpathW[] = { 'C',':','\\',0 };
|
||||||
NTSTATUS status = STATUS_SUCCESS;
|
NTSTATUS status = STATUS_SUCCESS;
|
||||||
@ -1892,9 +1893,9 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu
|
|||||||
WCHAR cwdW[MAX_PATH];
|
WCHAR cwdW[MAX_PATH];
|
||||||
|
|
||||||
/* the path was completely invalid */
|
/* the path was completely invalid */
|
||||||
if (filename[0] == '\\')
|
if (filename[0] == '\\' && strncmpW(deviceprefixW, filename, strlenW(deviceprefixW)) != 0)
|
||||||
{
|
{
|
||||||
/* NT-style paths fail */
|
/* NT-style paths (that are not device paths) fail */
|
||||||
status = STATUS_OBJECT_NAME_INVALID;
|
status = STATUS_OBJECT_NAME_INVALID;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user