[KERNEL32] GetDriveTypeW: Fix the case with unformatted volumes and volume GUID names

Fix the case when GetDriveTypeW would return DRIVE_NO_ROOT_DIR when it
got a volume GUID name and had to access an unformatted volume.
Fixes Rufus not being able to find an unformatted volume after writting new MBR.
This commit is contained in:
Adam Słaboń 2024-03-03 21:02:06 +01:00 committed by Hermès BÉLUSCA - MAÏTO
parent 5c5cd20b9d
commit 32e65f2f8d

View file

@ -608,6 +608,9 @@ GetDriveTypeW(IN LPCWSTR lpRootPathName)
return DRIVE_NO_ROOT_DIR;
}
/* We will work with a device object, so trim the trailing backslash now */
PathName.Length -= sizeof(WCHAR);
/* Let's probe for it, by forcing open failure! */
RetryOpen = TRUE;
InitializeObjectAttributes(&ObjectAttributes, &PathName,