[core] ReFS improvements

* Allow 4K/64K cluster size selection
* Only enable ReFS on relevant platforms
* Also recognize a few more Windows editions
This commit is contained in:
Pete Batard 2021-10-21 02:02:17 +01:00
parent 32b083e535
commit 05382d8c7d
No known key found for this signature in database
GPG Key ID: 38E0CF5E69EDD671
5 changed files with 62 additions and 18 deletions

View File

@ -11,7 +11,7 @@
<Identity
Name="19453.net.Rufus"
Publisher="CN=7AC86D13-3E5A-491A-ADD5-80095C212740"
Version="3.17.1840.0" />
Version="3.17.1841.0" />
<Properties>
<DisplayName>Rufus</DisplayName>

View File

@ -394,6 +394,41 @@ static BOOL SetClusterSizes(int FSType)
return TRUE;
}
static BOOL IsRefsAvailable(MEDIA_TYPE MediaType)
{
// The creation of ReFS drives was added in Windows 8.1... but then removed by
// Microsoft in Windows 10 1709, except for the Enterprise and Pro Workstation
// versions. Oh and VdsService::QueryFileSystemTypes() is *USELESS* to detect
// if ReFS is available on the system. Oh, and it only applies to fixed media.
if (MediaType != FixedMedia)
return FALSE;
if (nWindowsVersion < WINDOWS_8_1 || nWindowsBuildNumber <= 0)
return FALSE;
if (nWindowsBuildNumber < 16000)
return TRUE;
switch (nWindowsEdition) {
case 0x0000000A: // Enterprise Server
case 0x0000001B: // Enterprise N
case 0x00000046: // Enterprise E
case 0x00000048: // Enterprise Eval
case 0x00000054: // Enterprise N Eval
case 0x0000007D: // Enterprise S
case 0x0000007E: // Enterprise S N
case 0x00000081: // Enterprise S Eval
case 0x00000082: // Enterprise S N Eval
case 0x0000008C: // Enterprise Subscription
case 0x0000008D: // Enterprise Subscription N
case 0x000000A1: // Pro Workstation
case 0x000000A2: // Pro Workstation N
case 0x000000AB: // Enterprise G
case 0x000000AC: // Enterprise G N
return TRUE;
default:
return FALSE;
}
}
// Populate the File System and Cluster Size dropdowns
static BOOL SetFileSystemAndClusterSize(char* fs_name)
{
@ -513,12 +548,14 @@ static BOOL SetFileSystemAndClusterSize(char* fs_name)
SelectedDrive.ClusterSize[FS_EXT3].Default = 1;
}
// ReFS (only supported for Windows 8.1 and later and for fixed disks)
// TODO: Check later versions of Windows 10 for disabled ReFS (IVdsService::QueryFileSystemTypes?)
if (SelectedDrive.DiskSize >= 512*MB) {
if ((nWindowsVersion >= WINDOWS_8_1) && (SelectedDrive.MediaType == FixedMedia)) {
SelectedDrive.ClusterSize[FS_REFS].Allowed = SINGLE_CLUSTERSIZE_DEFAULT;
SelectedDrive.ClusterSize[FS_REFS].Default = 1;
// ReFS (only applicable for a select number of Windows platforms and editions)
if ((SelectedDrive.DiskSize >= 512 * MB) && (IsRefsAvailable(SelectedDrive.MediaType))) {
if (SelectedDrive.DiskSize < 16 * TB) { // < 16 TB
SelectedDrive.ClusterSize[FS_REFS].Allowed = 64 * KB + 4 * KB;
SelectedDrive.ClusterSize[FS_REFS].Default = 4 * KB;
} else {
SelectedDrive.ClusterSize[FS_REFS].Allowed = 64 * KB;
SelectedDrive.ClusterSize[FS_REFS].Default = 64 * KB;
}
}
}

View File

@ -499,7 +499,7 @@ extern uint64_t persistence_size;
extern size_t ubuffer_pos;
extern const int nb_steps[FS_MAX];
extern float fScale;
extern int nWindowsVersion, nWindowsBuildNumber, dialog_showing, force_update;
extern int nWindowsVersion, nWindowsBuildNumber, nWindowsEdition, dialog_showing, force_update;
extern int fs_type, boot_type, partition_type, target_type;
extern unsigned long syslinux_ldlinux_len[2];
extern char WindowsVersionStr[128], ubuffer[UBUFFER_SIZE], embedded_sl_version_str[2][12];

View File

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.17.1840"
CAPTION "Rufus 3.17.1841"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -395,8 +395,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,17,1840,0
PRODUCTVERSION 3,17,1840,0
FILEVERSION 3,17,1841,0
PRODUCTVERSION 3,17,1841,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -414,13 +414,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.17.1840"
VALUE "FileVersion", "3.17.1841"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.17.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.17.1840"
VALUE "ProductVersion", "3.17.1841"
END
END
BLOCK "VarFileInfo"

View File

@ -34,8 +34,9 @@
#include "settings.h"
int nWindowsVersion = WINDOWS_UNDEFINED;
int nWindowsBuildNumber = -1;
int nWindowsVersion = WINDOWS_UNDEFINED;
int nWindowsBuildNumber = -1;
int nWindowsEdition = 0;
char WindowsVersionStr[128] = "Windows ";
/*
@ -279,6 +280,10 @@ static const char* GetEdition(DWORD ProductType)
case 0x00000048: return "Enterprise Eval";
case 0x00000054: return "Enterprise N Eval";
case 0x00000057: return "Thin PC";
case 0x00000058: case 0x00000059: case 0x0000005A: case 0x0000005B: case 0x0000005C: return "Embedded";
case 0x00000065: return "Core";
case 0x00000067: return "Professional WMC";
case 0x00000069: case 0x0000006A: case 0x0000006B: case 0x0000006C: return "Embedded";
case 0x0000006F: return "Core Connected";
case 0x00000070: return "Pro Student";
case 0x00000071: return "Core Connected N";
@ -321,7 +326,7 @@ static const char* GetEdition(DWORD ProductType)
void GetWindowsVersion(void)
{
OSVERSIONINFOEXA vi, vi2;
DWORD dwProductType;
DWORD dwProductType = 0;
const char* w = 0;
const char* w64 = "32 bit";
char *vptr;
@ -419,7 +424,7 @@ void GetWindowsVersion(void)
vptr = &WindowsVersionStr[sizeof("Windows ") - 1];
vlen = sizeof(WindowsVersionStr) - sizeof("Windows ") - 1;
if (!w)
safe_sprintf(vptr, vlen, "%s %u.%u %s", (vi.dwPlatformId==VER_PLATFORM_WIN32_NT?"NT":"??"),
safe_sprintf(vptr, vlen, "%s %u.%u %s", (vi.dwPlatformId == VER_PLATFORM_WIN32_NT ? "NT" : "??"),
(unsigned)vi.dwMajorVersion, (unsigned)vi.dwMinorVersion, w64);
else if (vi.wServicePackMinor)
safe_sprintf(vptr, vlen, "%s SP%u.%u %s", w, vi.wServicePackMajor, vi.wServicePackMinor, w64);
@ -427,7 +432,9 @@ void GetWindowsVersion(void)
safe_sprintf(vptr, vlen, "%s SP%u %s", w, vi.wServicePackMajor, w64);
else
safe_sprintf(vptr, vlen, "%s%s%s, %s",
w, (dwProductType != PRODUCT_UNDEFINED) ? " " : "", GetEdition(dwProductType), w64);
w, (dwProductType != 0) ? " " : "", GetEdition(dwProductType), w64);
nWindowsEdition = (int)dwProductType;
// Add the build number (including UBR if available) for Windows 8.0 and later
nWindowsBuildNumber = vi.dwBuildNumber;