[extfs] add standalone ext2/ext3 formatting

* Only enabled when Advanced format options are shown
* Also enable reading of extfs volume label
* Also improve GRUB lookup fallback
* Also fix possible truncation when sanitizing labels
* Also write a zeroed MBR when non-bootable is selected
This commit is contained in:
Pete Batard 2019-05-03 23:51:05 +01:00
parent a696e041e1
commit 2ff6da49f0
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
12 changed files with 691 additions and 54 deletions

View file

@ -844,7 +844,7 @@ out:
BOOL GetDriveLabel(DWORD DriveIndex, char* letters, char** label)
{
HANDLE hPhysical;
DWORD size;
DWORD size, error;
static char VolumeLabel[MAX_PATH + 1];
char DrivePath[] = "#:\\", AutorunPath[] = "#:\\autorun.inf", *AutorunLabel = NULL;
@ -879,9 +879,15 @@ BOOL GetDriveLabel(DWORD DriveIndex, char* letters, char** label)
NULL, NULL, NULL, NULL, 0) && (VolumeLabel[0] != 0)) {
*label = VolumeLabel;
} else {
duprintf("Failed to read label: %s", WindowsErrorString());
// Might be an extfs label
error = GetLastError();
*label = (char*)GetExtFsLabel(DriveIndex, 0);
if (*label == NULL) {
SetLastError(error);
duprintf("Failed to read label: %s", WindowsErrorString());
*label = STR_NO_LABEL;
}
}
return TRUE;
}