[core] add ReFS formatting support

* Windows 8.1 or later and fixed disks ONLY
This commit is contained in:
Pete Batard 2014-03-29 00:22:54 +00:00
parent 5519212dd3
commit 027d0d7c3a
4 changed files with 21 additions and 12 deletions

View File

@ -615,7 +615,8 @@ int GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSyst
}
SelectedDrive.DiskSize = DiskGeometry->DiskSize.QuadPart;
memcpy(&SelectedDrive.Geometry, &DiskGeometry->Geometry, sizeof(DISK_GEOMETRY));
uprintf("Sector Size: %d bytes\n", DiskGeometry->Geometry.BytesPerSector);
uprintf("Disk type: %s, Sector Size: %d bytes\n", (DiskGeometry->Geometry.MediaType == FixedMedia)?"Fixed":"Removable",
DiskGeometry->Geometry.BytesPerSector);
uprintf("Cylinders: %lld, TracksPerCylinder: %d, SectorsPerTrack: %d\n",
DiskGeometry->Geometry.Cylinders, DiskGeometry->Geometry.TracksPerCylinder, DiskGeometry->Geometry.SectorsPerTrack);
@ -900,7 +901,8 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m
case FS_NTFS:
case FS_EXFAT:
case FS_UDF:
DriveLayoutEx.PartitionEntry[0].Mbr.PartitionType = 0x07; // NTFS
case FS_REFS:
DriveLayoutEx.PartitionEntry[0].Mbr.PartitionType = 0x07;
break;
case FS_FAT32:
DriveLayoutEx.PartitionEntry[0].Mbr.PartitionType = 0x0c; // FAT32 LBA

View File

@ -107,7 +107,7 @@ typedef ULONG (WINAPI *SHChangeNotifyRegister_t)(
const MY_SHChangeNotifyEntry *pshcne
);
const char* FileSystemLabel[FS_MAX] = { "FAT", "FAT32", "NTFS", "UDF", "exFAT" };
const char* FileSystemLabel[FS_MAX] = { "FAT", "FAT32", "NTFS", "UDF", "exFAT", "ReFS" };
// Number of steps for each FS for FCC_STRUCTURE_PROGRESS
const int nb_steps[FS_MAX] = { 5, 5, 12, 1, 10 };
static const char* PartitionTypeLabel[2] = { "MBR", "GPT" };
@ -310,6 +310,12 @@ static BOOL DefineClusterSizes(void)
SelectedDrive.ClusterSize[FS_UDF].Allowed = 0x00000100;
SelectedDrive.ClusterSize[FS_UDF].Default = 1;
}
// ReFS (only supported for Windows 8.1 and later and for fixed disks)
if ((nWindowsVersion >= WINDOWS_8_1_OR_LATER) && (SelectedDrive.Geometry.MediaType == FixedMedia)) {
SelectedDrive.ClusterSize[FS_REFS].Allowed = 0x00000100;
SelectedDrive.ClusterSize[FS_REFS].Default = 1;
}
}
out:
@ -2012,8 +2018,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
break;
}
SetClusterSizes(fs);
// Disable/restore the quick format control depending on large FAT32
if ((fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32))) {
// Disable/restore the quick format control depending on large FAT32 or ReFS
if ( ((fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32))) || (fs == FS_REFS) ) {
if (IsWindowEnabled(GetDlgItem(hMainDialog, IDC_QUICKFORMAT))) {
uQFChecked = IsChecked(IDC_QUICKFORMAT);
CheckDlgButton(hMainDialog, IDC_QUICKFORMAT, BST_CHECKED);
@ -2036,7 +2042,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
}
break;
}
if ((fs == FS_EXFAT) || (fs == FS_UDF)) {
if ((fs == FS_EXFAT) || (fs == FS_UDF) || (fs == FS_REFS)) {
if (IsWindowEnabled(hBoot)) {
// unlikely to be supported by BIOSes => don't bother
IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, 0));

View File

@ -171,6 +171,7 @@ enum {
FS_NTFS,
FS_UDF,
FS_EXFAT,
FS_REFS,
FS_MAX
};

View File

@ -32,7 +32,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
CAPTION "Rufus 1.4.6.443"
CAPTION "Rufus 1.4.6.444"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -165,7 +165,7 @@ END
RTL_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_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
CAPTION "Rufus 1.4.6.443"
CAPTION "Rufus 1.4.6.444"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -427,8 +427,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,6,443
PRODUCTVERSION 1,4,6,443
FILEVERSION 1,4,6,444
PRODUCTVERSION 1,4,6,444
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -445,13 +445,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.4.6.443"
VALUE "FileVersion", "1.4.6.444"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2014 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.4.6.443"
VALUE "ProductVersion", "1.4.6.444"
END
END
BLOCK "VarFileInfo"