mirror of
https://github.com/pbatard/rufus.git
synced 2025-06-08 02:14:45 -04:00
[core] prevent the enumeration of Windows 10 19H1 sandbox VHDs
* The new 19H1 Windows Sandbox feature relies on VHDs labelled 'PortableBaseLayer' → Don't list those
This commit is contained in:
parent
5b1ae09df4
commit
f95aa94c57
5 changed files with 27 additions and 8 deletions
11
src/drive.c
11
src/drive.c
|
@ -954,14 +954,23 @@ BOOL GetDriveLabel(DWORD DriveIndex, char* letters, char** label)
|
|||
{
|
||||
HANDLE hPhysical;
|
||||
DWORD size, error;
|
||||
static char VolumeLabel[MAX_PATH + 1];
|
||||
static char VolumeLabel[MAX_PATH + 1] = { 0 };
|
||||
char DrivePath[] = "#:\\", AutorunPath[] = "#:\\autorun.inf", *AutorunLabel = NULL;
|
||||
WCHAR VolumeName[MAX_PATH + 1] = { 0 }, FileSystemName[64];
|
||||
DWORD VolumeSerialNumber, MaximumComponentLength, FileSystemFlags;
|
||||
|
||||
*label = STR_NO_LABEL;
|
||||
|
||||
if (!GetDriveLetters(DriveIndex, letters))
|
||||
return FALSE;
|
||||
if (letters[0] == 0) {
|
||||
// Even if we don't have a letter, try to obtain the label of the first partition
|
||||
HANDLE h = GetLogicalHandle(DriveIndex, 0, FALSE, FALSE, FALSE);
|
||||
if (GetVolumeInformationByHandleW(h, VolumeName, 64, &VolumeSerialNumber,
|
||||
&MaximumComponentLength, &FileSystemFlags, FileSystemName, 64)) {
|
||||
wchar_to_utf8_no_alloc(VolumeName, VolumeLabel, sizeof(VolumeLabel));
|
||||
*label = VolumeLabel;
|
||||
}
|
||||
// Drive without volume assigned - always enabled
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue