mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[core] add Super Floppy Disk support
This commit is contained in:
parent
65f5ccd28b
commit
c82842ce2a
4 changed files with 50 additions and 20 deletions
14
src/drive.c
14
src/drive.c
|
@ -703,7 +703,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys
|
|||
PDRIVE_LAYOUT_INFORMATION_EX DriveLayout = (PDRIVE_LAYOUT_INFORMATION_EX)(void*)layout;
|
||||
char* volume_name;
|
||||
char tmp[256];
|
||||
DWORD i, j, big_floppy = FALSE;
|
||||
DWORD i, j, super_floppy_disk = FALSE;
|
||||
|
||||
if (FileSystemName == NULL)
|
||||
return FALSE;
|
||||
|
@ -768,7 +768,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys
|
|||
if ((DriveLayout->PartitionEntry[0].Mbr.PartitionType != PARTITION_ENTRY_UNUSED) &&
|
||||
(DriveLayout->PartitionEntry[0].StartingOffset.QuadPart == 0LL)) {
|
||||
suprintf("Partition type: SFD (Super Floppy Disk) or Unpartitioned");
|
||||
big_floppy = TRUE;
|
||||
super_floppy_disk = TRUE;
|
||||
} else {
|
||||
suprintf("Partition type: MBR, NB Partitions: %d\n", SelectedDrive.nPartitions);
|
||||
SelectedDrive.has_mbr_uefi_marker = (DriveLayout->Mbr.Signature == MBR_UEFI_MARKER);
|
||||
|
@ -780,7 +780,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys
|
|||
part_type = DriveLayout->PartitionEntry[i].Mbr.PartitionType;
|
||||
isUefiNtfs = (i == 1) && (part_type == 0xef) &&
|
||||
(DriveLayout->PartitionEntry[i].PartitionLength.QuadPart <= 1*MB);
|
||||
suprintf("Partition %d%s:\n", i+(big_floppy?0:1), isUefiNtfs?" (UEFI:NTFS)":"");
|
||||
suprintf("Partition %d%s:\n", i+(super_floppy_disk?0:1), isUefiNtfs?" (UEFI:NTFS)":"");
|
||||
for (j=0; j<ARRAYSIZE(mbr_mountable); j++) {
|
||||
if (part_type == mbr_mountable[j]) {
|
||||
ret = TRUE;
|
||||
|
@ -789,7 +789,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys
|
|||
}
|
||||
// NB: MinGW's gcc 4.9.2 broke "%lld" printout on XP so we use the inttypes.h "PRI##" qualifiers
|
||||
suprintf(" Type: %s (0x%02x)\r\n Size: %s (%" PRIi64 " bytes)\r\n Start Sector: %" PRIi64 ", Boot: %s",
|
||||
((part_type==0x07||big_floppy)&&(FileSystemName[0]!=0))?FileSystemName:GetPartitionType(part_type), big_floppy?0:part_type,
|
||||
((part_type==0x07||super_floppy_disk)&&(FileSystemName[0]!=0))?FileSystemName:GetPartitionType(part_type), super_floppy_disk?0:part_type,
|
||||
SizeToHumanReadable(DriveLayout->PartitionEntry[i].PartitionLength.QuadPart, TRUE, FALSE),
|
||||
DriveLayout->PartitionEntry[i].PartitionLength.QuadPart,
|
||||
DriveLayout->PartitionEntry[i].StartingOffset.QuadPart / SelectedDrive.SectorSize,
|
||||
|
@ -1078,7 +1078,7 @@ typedef struct _DRIVE_LAYOUT_INFORMATION_EX4 {
|
|||
*/
|
||||
BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL mbr_uefi_marker, uint8_t extra_partitions)
|
||||
{
|
||||
const char* PartitionTypeName[2] = { "MBR", "GPT" };
|
||||
const char* PartitionTypeName[] = { "MBR", "GPT", "SFD" };
|
||||
unsigned char* buffer;
|
||||
size_t uefi_ntfs_size = 0;
|
||||
CREATE_DISK CreateDisk = {PARTITION_STYLE_RAW, {{0}}};
|
||||
|
@ -1090,6 +1090,10 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m
|
|||
|
||||
PrintInfoDebug(0, MSG_238, PartitionTypeName[partition_style]);
|
||||
|
||||
if (partition_style == PARTITION_STYLE_SFD)
|
||||
// Nothing to do
|
||||
return TRUE;
|
||||
|
||||
if (extra_partitions & XP_UEFI_NTFS) {
|
||||
uefi_ntfs_size = GetResourceSize(hMainInstance, MAKEINTRESOURCEA(IDR_UEFI_NTFS), _RT_RCDATA, "uefi-ntfs.img");
|
||||
if (uefi_ntfs_size == 0)
|
||||
|
|
45
src/rufus.c
45
src/rufus.c
|
@ -456,6 +456,10 @@ static BOOL SetDriveInfo(int ComboIndex)
|
|||
lmprintf(MSG_033, PartitionTypeLabel[pt])), (TT_UEFI<<16)|pt));
|
||||
}
|
||||
}
|
||||
if (advanced_mode) {
|
||||
IGNORE_RETVAL(ComboBox_SetItemData(hPartitionScheme,
|
||||
ComboBox_AddStringU(hPartitionScheme, "Super Floppy Disk"), PARTITION_STYLE_SFD));
|
||||
}
|
||||
|
||||
// At least one filesystem is go => enable formatting
|
||||
EnableWindow(hStart, TRUE);
|
||||
|
@ -578,13 +582,17 @@ static void SetPartitionSchemeTooltip(void)
|
|||
int tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
|
||||
int pt = GETPARTTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
|
||||
if (tt == TT_BIOS) {
|
||||
CreateTooltip(hPartitionScheme, lmprintf(MSG_150), 15000);
|
||||
if (pt != PARTITION_STYLE_SFD)
|
||||
CreateTooltip(hPartitionScheme, lmprintf(MSG_150), 15000);
|
||||
else
|
||||
DestroyTooltip(hPartitionScheme);
|
||||
} else {
|
||||
if (pt == PARTITION_STYLE_MBR) {
|
||||
if (pt == PARTITION_STYLE_MBR)
|
||||
CreateTooltip(hPartitionScheme, lmprintf(MSG_151), 15000);
|
||||
} else {
|
||||
else if (pt == PARTITION_STYLE_GPT)
|
||||
CreateTooltip(hPartitionScheme, lmprintf(MSG_152), 15000);
|
||||
}
|
||||
else
|
||||
DestroyTooltip(hPartitionScheme);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1122,7 +1130,8 @@ static void ToggleAdvanced(BOOL enable)
|
|||
float dialog_shift = -3.22807f*fScale*fScale*fScale + 6.69173f*fScale*fScale + 15.8822f*fScale + 62.9737f;
|
||||
RECT rect;
|
||||
POINT point;
|
||||
int toggle;
|
||||
BOOL needs_resel = FALSE;
|
||||
int i, toggle;
|
||||
|
||||
if (!enable)
|
||||
dialog_shift = -dialog_shift;
|
||||
|
@ -1171,6 +1180,21 @@ static void ToggleAdvanced(BOOL enable)
|
|||
ShowWindow(GetDlgItem(hMainDialog, IDC_DISK_ID), toggle);
|
||||
ShowWindow(GetDlgItem(hMainDialog, IDS_ADVANCED_OPTIONS_GRP), toggle);
|
||||
|
||||
if (enable) {
|
||||
IGNORE_RETVAL(ComboBox_SetItemData(hPartitionScheme,
|
||||
ComboBox_AddStringU(hPartitionScheme, "Super Floppy Disk"), PARTITION_STYLE_SFD));
|
||||
} else {
|
||||
for (i = 0; i < ComboBox_GetCount(hPartitionScheme); i++) {
|
||||
if (ComboBox_GetItemData(hPartitionScheme, i) == PARTITION_STYLE_SFD) {
|
||||
if (ComboBox_GetCurSel(hPartitionScheme) == i)
|
||||
needs_resel = TRUE;
|
||||
ComboBox_DeleteString(hPartitionScheme, i);
|
||||
}
|
||||
}
|
||||
if (needs_resel)
|
||||
SetTargetSystem();
|
||||
}
|
||||
|
||||
// Toggle the up/down icon
|
||||
SendMessage(GetDlgItem(hMainDialog, IDC_ADVANCED), BCM_SETIMAGELIST, 0, (LPARAM)(enable?&bi_up:&bi_down));
|
||||
|
||||
|
@ -1986,7 +2010,7 @@ static void ShowLanguageMenu(RECT rcExclude)
|
|||
DestroyMenu(menu);
|
||||
}
|
||||
|
||||
static void SetBoot(int fs, int tt)
|
||||
static void SetBoot(int fs, int tt, int pt)
|
||||
{
|
||||
int i;
|
||||
char tmp[32];
|
||||
|
@ -2026,7 +2050,7 @@ static void SetBoot(int fs, int tt)
|
|||
if (i == ComboBox_GetCount(hBootType))
|
||||
IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, 0));
|
||||
|
||||
if (!IsWindowEnabled(hBoot)) {
|
||||
if ((pt != PARTITION_STYLE_SFD) && !IsWindowEnabled(hBoot)) {
|
||||
EnableWindow(hBoot, TRUE);
|
||||
EnableWindow(hBootType, TRUE);
|
||||
EnableWindow(hSelectISO, TRUE);
|
||||
|
@ -2411,10 +2435,11 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
break;
|
||||
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
|
||||
tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
|
||||
pt = GETPARTTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
|
||||
if ((selection_default == BT_IMG) && IsChecked(IDC_BOOT)) {
|
||||
ToggleImage(FALSE);
|
||||
EnableAdvancedBootOptions(FALSE, TRUE);
|
||||
SetBoot(fs, tt);
|
||||
SetBoot(fs, tt, pt);
|
||||
SetToGo();
|
||||
break;
|
||||
}
|
||||
|
@ -2443,7 +2468,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
}
|
||||
break;
|
||||
}
|
||||
if ((fs == FS_EXFAT) || (fs == FS_UDF) || (fs == FS_REFS)) {
|
||||
if ((fs == FS_EXFAT) || (fs == FS_UDF) || (fs == FS_REFS) || (pt == PARTITION_STYLE_SFD)) {
|
||||
if (IsWindowEnabled(hBoot)) {
|
||||
// unlikely to be supported by BIOSes => don't bother
|
||||
IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, 0));
|
||||
|
@ -2458,7 +2483,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
break;
|
||||
}
|
||||
EnableAdvancedBootOptions(TRUE, TRUE);
|
||||
SetBoot(fs, tt);
|
||||
SetBoot(fs, tt, pt);
|
||||
SetMBRProps();
|
||||
SetToGo();
|
||||
break;
|
||||
|
|
|
@ -235,6 +235,7 @@ enum target_type {
|
|||
TT_MAX
|
||||
};
|
||||
// For the partition types we'll use Microsoft's PARTITION_STYLE_### constants
|
||||
#define PARTITION_STYLE_SFD PARTITION_STYLE_RAW
|
||||
#define GETTARGETTYPE(x) (((x)>0)?(((x) >> 16) & 0xFFFF):0)
|
||||
#define GETPARTTYPE(x) (((x)>0)?((x) & 0xFFFF):0);
|
||||
|
||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
|||
IDD_DIALOG DIALOGEX 12, 12, 242, 376
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_ACCEPTFILES
|
||||
CAPTION "Rufus 2.17.1177"
|
||||
CAPTION "Rufus 2.17.1178"
|
||||
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
|
||||
|
@ -366,8 +366,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,17,1177,0
|
||||
PRODUCTVERSION 2,17,1177,0
|
||||
FILEVERSION 2,17,1178,0
|
||||
PRODUCTVERSION 2,17,1178,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -384,13 +384,13 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "2.17.1177"
|
||||
VALUE "FileVersion", "2.17.1178"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
||||
VALUE "OriginalFilename", "rufus.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "2.17.1177"
|
||||
VALUE "ProductVersion", "2.17.1178"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
Loading…
Reference in a new issue