提交 bb2949e5 编写于 作者: P Pete Batard

[core] limit large FAT32 to 1 TB

* 1.5 and 2 TB formatting is too flaky for now - remove it
* This limitation can be disabled with Alt-S
* Also fix various smaller issues
上级 0938c56f
......@@ -45,6 +45,7 @@ extern "C" {
MultiByteToWideChar(CP_UTF8, 0, src, -1, wdest, wdest_size)
#define Edit_ReplaceSelU(hCtrl, str) ((void)SendMessageLU(hCtrl, EM_REPLACESEL, (WPARAM)FALSE, str))
#define ComboBox_AddStringU(hCtrl, str) ((int)(DWORD)SendMessageLU(hCtrl, CB_ADDSTRING, (WPARAM)FALSE, str))
#define ComboBox_InsertStringU(hCtrl, index, str) ((int)(DWORD)SendMessageLU(hCtrl, CB_INSERTSTRING, (WPARAM)index, str))
#define ComboBox_GetTextU(hCtrl, str, max_str) GetWindowTextU(hCtrl, str, max_str)
#define GetSaveFileNameU(p) GetOpenSaveFileNameU(p, TRUE)
#define GetOpenFileNameU(p) GetOpenSaveFileNameU(p, FALSE)
......
......@@ -93,7 +93,7 @@ static const char* ClusterSizeLabel[] = { "512 bytes", "1024 bytes","2048 bytes"
static const char* BiosTypeLabel[BT_MAX] = { "BIOS", "UEFI" };
static const char* PartitionTypeLabel[2] = { "MBR", "GPT" };
static BOOL existing_key = FALSE; // For LGP set/restore
static BOOL iso_size_check = TRUE;
static BOOL size_check = TRUE;
static BOOL log_displayed = FALSE;
static BOOL iso_provided = FALSE;
extern BOOL force_large_fat32;
......@@ -159,7 +159,7 @@ static BOOL DefineClusterSizes(void)
default_fs = FS_UNKNOWN;
memset(&SelectedDrive.ClusterSize, 0, sizeof(SelectedDrive.ClusterSize));
if (SelectedDrive.DiskSize < 8*MB) {
uprintf("This application does not support volumes smaller than 8 MB\n");
uprintf("Device was eliminated because it is smaller than 8 MB\n");
goto out;
}
......@@ -210,8 +210,11 @@ static BOOL DefineClusterSizes(void)
// > 32GB FAT32 is not supported by MS and FormatEx but is achieved using fat32format
// See: http://www.ridgecrop.demon.co.uk/index.htm?fat32format.htm
// < 32 MB FAT32 is not allowed by FormatEx, so we don't bother
// We also found issues with > 1TB drives, so we use our own max threshold (can be disabled with Alt-S)
if ((size_check) && (1.0f*SelectedDrive.DiskSize >= 1.0f*MAX_FAT32_SIZE*TB))
uprintf("FAT32 support is disabled for this device, as it is larger than %.1f TB\n", 1.0f*MAX_FAT32_SIZE);
if ((SelectedDrive.DiskSize >= 32*MB) && (SelectedDrive.DiskSize < 2*TB)) {
if ((SelectedDrive.DiskSize >= 32*MB) && ((!size_check) || (1.0f*SelectedDrive.DiskSize < 1.0f*MAX_FAT32_SIZE*TB))) {
SelectedDrive.ClusterSize[FS_FAT32].Allowed = 0x000001F8;
for (i=32; i<=(32*1024); i<<=1) { // 32 MB -> 32 GB
if (SelectedDrive.DiskSize < i*MB) {
......@@ -624,7 +627,7 @@ static BOOL GetUSBDevices(DWORD devnum)
if(GetLastError() != ERROR_NO_MORE_ITEMS) {
uprintf("SetupDiEnumDeviceInterfaces failed: %s\n", WindowsErrorString());
} else {
uprintf("A device was eliminated because it didn't report itself as a removable disk\n");
uprintf("A device was eliminated because it didn't report itself as a non fixed USB disk\n");
}
break;
}
......@@ -1189,7 +1192,7 @@ static BOOL BootCheck(void)
"No ISO image selected", MB_OK|MB_ICONERROR);
return FALSE;
}
if ((iso_size_check) && (iso_report.projected_size > (uint64_t)SelectedDrive.DiskSize)) {
if ((size_check) && (iso_report.projected_size > (uint64_t)SelectedDrive.DiskSize)) {
MessageBoxU(hMainDialog, "This ISO image is too big "
"for the selected target.", "ISO image too big", MB_OK|MB_ICONERROR);
return FALSE;
......@@ -1825,7 +1828,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
uprintf("\r\n");
GetUSBDevices(DeviceNum);
if (!IS_ERROR(FormatStatus)) {
// This is the only way to achieve instantanenous progress transition to 100%
// This is the only way to achieve instantaneous progress transition to 100%
SendMessage(hProgress, PBM_SETRANGE, 0, ((MAX_PROGRESS+1)<<16) & 0xFFFF0000);
SendMessage(hProgress, PBM_SETPOS, (MAX_PROGRESS+1), 0);
SendMessage(hProgress, PBM_SETRANGE, 0, (MAX_PROGRESS<<16) & 0xFFFF0000);
......@@ -2019,8 +2022,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
// By default, Rufus will not copy ISOs that are larger than in size than
// the target USB drive. If this is enabled, the size check is disabled.
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'S')) {
iso_size_check = !iso_size_check;
PrintStatus2000("ISO size check", iso_size_check);
size_check = !size_check;
PrintStatus2000("Size checks", size_check);
GetUSBDevices(0);
continue;
}
// Alt-F => Toggle detection of fixed disks
......
......@@ -51,6 +51,7 @@
#define PROPOSEDLABEL_TOLERANCE 0.10
#define FS_DEFAULT FS_FAT32
#define LARGE_FAT32_SIZE (32*1073741824LL) // Size at which we need to use fat32format
#define MAX_FAT32_SIZE 1.0f // Threshold above which we disable FAT32 formatting (in TB)
#define WHITE RGB(255,255,255)
#define SEPARATOR_GREY RGB(223,223,223)
#define RUFUS_URL "http://rufus.akeo.ie"
......
......@@ -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.266"
CAPTION "Rufus v1.3.4.267"
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,266
PRODUCTVERSION 1,3,4,266
FILEVERSION 1,3,4,267
PRODUCTVERSION 1,3,4,267
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.266"
VALUE "FileVersion", "1.3.4.267"
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.266"
VALUE "ProductVersion", "1.3.4.267"
END
END
BLOCK "VarFileInfo"
......
......@@ -249,6 +249,8 @@ const char* StrError(DWORD error_code)
return "Read error.";
case ERROR_WRITE_FAULT:
return "Write error.";
case ERROR_INSTALL_FAILURE:
return "Installation failure";
case ERROR_OPEN_FAILED:
return "Could not open media. It may be in use by another process. "
"Please re-plug the media and try again.";
......
......@@ -157,7 +157,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter)
goto out;
fs = libfat_open(libfat_readfile, (intptr_t) d_handle);
if (fs == NULL) {
uprintf("FAT access error\n");
uprintf("Syslinux FAT access error\n");
goto out;
}
ldlinux_cluster = libfat_searchdir(fs, 0, "LDLINUX SYS", NULL);
......@@ -203,7 +203,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter)
!WriteFile(d_handle, sectbuf, SECTOR_SIZE,
&bytes_written, NULL)
|| bytes_written != SECTOR_SIZE) {
uprintf("Could not write boot record: %s\n", WindowsErrorString());
uprintf("Could not write Syslinux boot record: %s\n", WindowsErrorString());
goto out;
}
......@@ -212,7 +212,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter)
if (dt == DT_SYSLINUX_V5) {
fd = fopen(ldlinux_c32, "rb");
if (fd == NULL) {
uprintf("Caution: No '%s' was provided. The target will be missing a mandatory Syslinux file!\n", ldlinux_c32);
uprintf("Caution: No '%s' was provided. The target will be missing a required Syslinux file!\n", ldlinux_c32);
} else {
fclose(fd);
ldlinux_path[11] = 'c'; ldlinux_path[12] = '3'; ldlinux_path[13] = '2';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册