mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-20 01:45:12 -04:00
[iso] fixes for Joliet and > 4GB ISO9660 images
* scan would fail on lowercase vs mixed case dir name comparison due to Joliet (eg. using Slackware 13.37 ISO) * extraction would fail for 4 GB ISO9660 ISOs * also fixes cases issue when checking for isolinux/bootmgr * also don't restrict NTFS labels
This commit is contained in:
parent
f4ed6e4650
commit
3cd83869c4
5 changed files with 87 additions and 80 deletions
50
src/format.c
50
src/format.c
|
@ -136,6 +136,47 @@ static BOOLEAN __stdcall FormatExCallback(FILE_SYSTEM_CALLBACK_COMMAND Command,
|
|||
return (!IS_ERROR(FormatStatus));
|
||||
}
|
||||
|
||||
/*
|
||||
* Converts an UTF-16 label to a valid FAT/NTFS one
|
||||
*/
|
||||
static void ToValidLabel(WCHAR* name, BOOL bFAT)
|
||||
{
|
||||
size_t i, j, k;
|
||||
BOOL found;
|
||||
WCHAR unauthorized[] = L"*?.,;:/\\|+=<>[]";
|
||||
WCHAR to_underscore[] = L"\t";
|
||||
|
||||
if (name == NULL)
|
||||
return;
|
||||
|
||||
for (i=0, k=0; i<wcslen(name); i++) {
|
||||
if (bFAT) { // NTFS does allows all the FAT unauthorized above
|
||||
found = FALSE;
|
||||
for (j=0; j<wcslen(unauthorized); j++) {
|
||||
if (name[i] == unauthorized[j]) {
|
||||
found = TRUE; break;
|
||||
}
|
||||
}
|
||||
if (found) continue;
|
||||
}
|
||||
found = FALSE;
|
||||
for (j=0; j<wcslen(to_underscore); j++) {
|
||||
if (name[i] == to_underscore[j]) {
|
||||
name[k++] = '_';
|
||||
found = TRUE; break;
|
||||
}
|
||||
}
|
||||
if (found) continue;
|
||||
name[k++] = name[i];
|
||||
}
|
||||
name[k] = 0;
|
||||
if (bFAT) {
|
||||
name[11] = 0;
|
||||
} else {
|
||||
name[32] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Call on fmifs.dll's FormatEx() to format the drive
|
||||
*/
|
||||
|
@ -145,7 +186,7 @@ static BOOL FormatDrive(char DriveLetter)
|
|||
PF_DECL(FormatEx);
|
||||
WCHAR wDriveRoot[] = L"?:\\";
|
||||
WCHAR wFSType[32];
|
||||
WCHAR wLabel[128];
|
||||
WCHAR wLabel[64];
|
||||
size_t i;
|
||||
|
||||
wDriveRoot[0] = (WCHAR)DriveLetter;
|
||||
|
@ -161,11 +202,8 @@ static BOOL FormatDrive(char DriveLetter)
|
|||
}
|
||||
}
|
||||
GetWindowTextW(hLabel, wLabel, ARRAYSIZE(wLabel));
|
||||
// If using FAT/FAT32, truncate the label to 11 characters
|
||||
// TODO: use a wchar_t to_valid_label() here
|
||||
if ((wFSType[0] == 'F') && (wFSType[1] == 'A') && (wFSType[2] == 'T')) {
|
||||
wLabel[11] = 0;
|
||||
}
|
||||
// Make sure the label is valid
|
||||
ToValidLabel(wLabel, (wFSType[0] == 'F') && (wFSType[1] == 'A') && (wFSType[2] == 'T'));
|
||||
uprintf("Using cluster size: %d bytes\n", ComboBox_GetItemData(hClusterSize, ComboBox_GetCurSel(hClusterSize)));
|
||||
format_percent = 0.0f;
|
||||
task_number = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue