From f8c6903d216dfc387d4124dcf670507e214420d2 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Sun, 16 Jun 2013 22:49:06 +0100 Subject: [PATCH] [iso] fix support for ISOs with >4GB files * The creation of UFDs with >4GB files should be allowed for NTFS * Closes #146 * Also switch MessageBoxA() to UTF8 and update some of the message titles --- src/rufus.c | 59 ++++++++++++++++++++++++++++------------------------ src/rufus.rc | 10 ++++----- 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/src/rufus.c b/src/rufus.c index 15d08de9..e8b6ecb7 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -1043,11 +1043,6 @@ DWORD WINAPI ISOScanThread(LPVOID param) "This ISO doesn't appear to use either...", "Unsupported ISO", MB_OK|MB_ICONINFORMATION); safe_free(iso_path); SetMBRProps(); - } else if ((iso_report.has_efi || iso_report.has_win7_efi) && (iso_report.has_4GB_file)) { - // Who the heck decided that using FAT32 for UEFI boot was a great idea?!? - MessageBoxU(hMainDialog, "This ISO image contains a file larger than 4 GB and cannot be used to boot in EFI mode from USB.\r\n" - "This is a technical limitation from the UEFI/FAT32 process, not from " APPLICATION_NAME ".", "Non USB-UEFI compatible ISO", MB_OK|MB_ICONINFORMATION); - safe_free(iso_path); } else if (!iso_report.has_syslinux_v5) { // This check is for Syslinux v4.x or earlier for (i=0; i (uint64_t)SelectedDrive.DiskSize)) { - MessageBoxA(hMainDialog, "This ISO image is too big " - "for the selected target.", "ISO image too big...", MB_OK|MB_ICONERROR); + MessageBoxU(hMainDialog, "This ISO image is too big " + "for the selected target.", "ISO image too big", MB_OK|MB_ICONERROR); return FALSE; } fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); if (bt == BT_UEFI) { if (!IS_EFI(iso_report)) { - MessageBoxA(hMainDialog, "When using UEFI Target Type, only EFI bootable ISO images are supported. " - "Please select an EFI bootable ISO or set the Target Type to BIOS.", "Unsupported ISO...", MB_OK|MB_ICONERROR); + MessageBoxU(hMainDialog, "When using UEFI Target Type, only EFI bootable ISO images are supported. " + "Please select an EFI bootable ISO or set the Target Type to BIOS.", "Unsupported ISO", MB_OK|MB_ICONERROR); return FALSE; } else if (fs > FS_FAT32) { - MessageBoxA(hMainDialog, "When using UEFI Target Type, only FAT/FAT32 is supported. " - "Please select FAT/FAT32 as the File system or set the Target Type to BIOS.", "Unsupported filesystem...", MB_OK|MB_ICONERROR); + MessageBoxU(hMainDialog, "When using UEFI Target Type, only FAT/FAT32 is supported. " + "Please select FAT/FAT32 as the File system or set the Target Type to BIOS.", "Unsupported filesystem", MB_OK|MB_ICONERROR); + return FALSE; + } else if (iso_report.has_4GB_file) { + // Who the heck decided that using FAT32 for UEFI boot was a great idea?!? + MessageBoxU(hMainDialog, "This ISO image contains a file larger than 4 GB and cannot be used to create an EFI bootable USB.\r\n" + "This is a limitation from UEFI/FAT32, not from " APPLICATION_NAME ".", + "Non UEFI compatible ISO", MB_OK|MB_ICONINFORMATION); return FALSE; } } else if ((fs == FS_NTFS) && (!iso_report.has_bootmgr) && (!IS_WINPE(iso_report.winpe))) { if (iso_report.has_isolinux) { - MessageBoxA(hMainDialog, "Only FAT/FAT32 is supported for this type of ISO. " - "Please select FAT/FAT32 as the File system.", "Unsupported filesystem...", MB_OK|MB_ICONERROR); + MessageBoxU(hMainDialog, "Only FAT/FAT32 is supported for this type of ISO. " + "Please select FAT/FAT32 as the File system.", "Unsupported filesystem", MB_OK|MB_ICONERROR); } else { - MessageBoxA(hMainDialog, "Only 'bootmgr' or 'WinPE' based ISO " - "images can currently be used with NTFS.", "Unsupported ISO...", MB_OK|MB_ICONERROR); + MessageBoxU(hMainDialog, "Only 'bootmgr' or 'WinPE' based ISO " + "images can currently be used with NTFS.", "Unsupported ISO", MB_OK|MB_ICONERROR); } return FALSE; } else if (((fs == FS_FAT16)||(fs == FS_FAT32)) && (!iso_report.has_isolinux)) { - MessageBoxA(hMainDialog, "FAT/FAT32 can only be used for isolinux based ISO images " - "or when the Target Type is UEFI.", "Unsupported ISO...", MB_OK|MB_ICONERROR); + MessageBoxU(hMainDialog, "FAT/FAT32 can only be used for isolinux based ISO images " + "or when the Target Type is UEFI.", "Unsupported ISO", MB_OK|MB_ICONERROR); + return FALSE; + } else if (((fs == FS_FAT16)||(fs == FS_FAT32)) && (iso_report.has_4GB_file)) { + MessageBoxU(hMainDialog, "This iso image contains a file larger than 4GB file, which is more than the " + "maximum size allowed for a FAT or FAT32 file system.", "Filesystem limitation", MB_OK|MB_ICONERROR); return FALSE; } if ((bt == BT_UEFI) && (iso_report.has_win7_efi) && (!WimExtractCheck())) { - if (MessageBoxA(hMainDialog, "Your platform cannot extract files from WIM archives. WIM extraction " + if (MessageBoxU(hMainDialog, "Your platform cannot extract files from WIM archives. WIM extraction " "is required to create EFI bootable Windows 7 and Windows Vista USB drives. You can fix that " "by installing a recent version of 7-Zip.\r\nDo you want to visit the 7-zip download page?", - "Missing WIM support...", MB_YESNO|MB_ICONERROR) == IDYES) + "Missing WIM support", MB_YESNO|MB_ICONERROR) == IDYES) ShellExecuteA(hMainDialog, "open", SEVENZIP_URL, NULL, NULL, SW_SHOWNORMAL); return FALSE; } @@ -1249,7 +1254,7 @@ static BOOL BootCheck(void) "Note: The file will be downloaded in the current directory and once a " "'%s' exists there, it will be reused automatically.\n", ldlinux_c32, ldlinux_c32, ldlinux_c32); safe_sprintf(msgbox_title, sizeof(msgbox_title), "Download %s?", ldlinux_c32); - r = MessageBoxA(hMainDialog, msgbox, msgbox_title, MB_YESNOCANCEL|MB_ICONWARNING); + r = MessageBoxU(hMainDialog, msgbox, msgbox_title, MB_YESNOCANCEL|MB_ICONWARNING); if (r == IDCANCEL) return FALSE; if (r == IDYES) { @@ -1503,7 +1508,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA EnableWindow(GetDlgItem(hISOProgressDlg, IDC_ISO_ABORT), FALSE); EnableWindow(GetDlgItem(hDlg, IDCANCEL), FALSE); if (format_thid != NULL) { - if (MessageBoxA(hMainDialog, "Cancelling may leave the device in an UNUSABLE state.\r\n" + if (MessageBoxU(hMainDialog, "Cancelling may leave the device in an UNUSABLE state.\r\n" "If you are sure you want to cancel, click YES. Otherwise, click NO.", RUFUS_CANCELBOX_TITLE, MB_YESNO|MB_ICONWARNING) == IDYES) { // Operation may have completed in the meantime @@ -1948,7 +1953,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine mutex = CreateMutexA(NULL, TRUE, "Global/" APPLICATION_NAME); } if ((mutex == NULL) || (GetLastError() == ERROR_ALREADY_EXISTS)) { - MessageBoxA(NULL, "Another " APPLICATION_NAME " application is running.\n" + MessageBoxU(NULL, "Another " APPLICATION_NAME " application is running.\n" "Please close the first application before running another one.", "Other instance detected", MB_ICONSTOP); goto out; @@ -1977,7 +1982,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine // Create the main Window if ( (hDlg = CreateDialogA(hInstance, MAKEINTRESOURCEA(IDD_DIALOG), NULL, MainCallback)) == NULL ) { - MessageBoxA(NULL, "Could not create Window", "DialogBox failure", MB_ICONSTOP); + MessageBoxU(NULL, "Could not create Window", "DialogBox failure", MB_ICONSTOP); goto out; } ShowWindow(hDlg, SW_SHOWNORMAL); diff --git a/src/rufus.rc b/src/rufus.rc index 2844f024..7a7cdbdb 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -30,7 +30,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 206, 329 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_APPWINDOW -CAPTION "Rufus v1.3.4.255" +CAPTION "Rufus v1.3.4.256" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,94,291,50,14 @@ -278,8 +278,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,3,4,255 - PRODUCTVERSION 1,3,4,255 + FILEVERSION 1,3,4,256 + PRODUCTVERSION 1,3,4,256 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -296,13 +296,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "1.3.4.255" + VALUE "FileVersion", "1.3.4.256" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2013 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "1.3.4.255" + VALUE "ProductVersion", "1.3.4.256" END END BLOCK "VarFileInfo"