mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[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:
		
							parent
							
								
									32b083e535
								
							
						
					
					
						commit
						05382d8c7d
					
				
					 5 changed files with 62 additions and 18 deletions
				
			
		|  | @ -11,7 +11,7 @@ | ||||||
|   <Identity |   <Identity | ||||||
|     Name="19453.net.Rufus" |     Name="19453.net.Rufus" | ||||||
|     Publisher="CN=7AC86D13-3E5A-491A-ADD5-80095C212740" |     Publisher="CN=7AC86D13-3E5A-491A-ADD5-80095C212740" | ||||||
|     Version="3.17.1840.0" /> |     Version="3.17.1841.0" /> | ||||||
| 
 | 
 | ||||||
|   <Properties> |   <Properties> | ||||||
|     <DisplayName>Rufus</DisplayName> |     <DisplayName>Rufus</DisplayName> | ||||||
|  |  | ||||||
							
								
								
									
										49
									
								
								src/rufus.c
									
										
									
									
									
								
							
							
						
						
									
										49
									
								
								src/rufus.c
									
										
									
									
									
								
							|  | @ -394,6 +394,41 @@ static BOOL SetClusterSizes(int FSType) | ||||||
| 	return TRUE; | 	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
 | // Populate the File System and Cluster Size dropdowns
 | ||||||
| static BOOL SetFileSystemAndClusterSize(char* fs_name) | static BOOL SetFileSystemAndClusterSize(char* fs_name) | ||||||
| { | { | ||||||
|  | @ -513,12 +548,14 @@ static BOOL SetFileSystemAndClusterSize(char* fs_name) | ||||||
| 			SelectedDrive.ClusterSize[FS_EXT3].Default = 1; | 			SelectedDrive.ClusterSize[FS_EXT3].Default = 1; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		// ReFS (only supported for Windows 8.1 and later and for fixed disks)
 | 		// ReFS (only applicable for a select number of Windows platforms and editions)
 | ||||||
| 		// TODO: Check later versions of Windows 10 for disabled ReFS (IVdsService::QueryFileSystemTypes?)
 | 		if ((SelectedDrive.DiskSize >= 512 * MB) && (IsRefsAvailable(SelectedDrive.MediaType))) { | ||||||
| 		if (SelectedDrive.DiskSize >= 512*MB) { | 			if (SelectedDrive.DiskSize < 16 * TB) {	// < 16 TB
 | ||||||
| 			if ((nWindowsVersion >= WINDOWS_8_1) && (SelectedDrive.MediaType == FixedMedia)) { | 				SelectedDrive.ClusterSize[FS_REFS].Allowed = 64 * KB + 4 * KB; | ||||||
| 				SelectedDrive.ClusterSize[FS_REFS].Allowed = SINGLE_CLUSTERSIZE_DEFAULT; | 				SelectedDrive.ClusterSize[FS_REFS].Default = 4 * KB; | ||||||
| 				SelectedDrive.ClusterSize[FS_REFS].Default = 1; | 			} else { | ||||||
|  | 				SelectedDrive.ClusterSize[FS_REFS].Allowed = 64 * KB; | ||||||
|  | 				SelectedDrive.ClusterSize[FS_REFS].Default = 64 * KB; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -499,7 +499,7 @@ extern uint64_t persistence_size; | ||||||
| extern size_t ubuffer_pos; | extern size_t ubuffer_pos; | ||||||
| extern const int nb_steps[FS_MAX]; | extern const int nb_steps[FS_MAX]; | ||||||
| extern float fScale; | 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 int fs_type, boot_type, partition_type, target_type; | ||||||
| extern unsigned long syslinux_ldlinux_len[2]; | extern unsigned long syslinux_ldlinux_len[2]; | ||||||
| extern char WindowsVersionStr[128], ubuffer[UBUFFER_SIZE], embedded_sl_version_str[2][12]; | extern char WindowsVersionStr[128], ubuffer[UBUFFER_SIZE], embedded_sl_version_str[2][12]; | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 232, 326 | IDD_DIALOG DIALOGEX 12, 12, 232, 326 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| EXSTYLE WS_EX_ACCEPTFILES | EXSTYLE WS_EX_ACCEPTFILES | ||||||
| CAPTION "Rufus 3.17.1840" | CAPTION "Rufus 3.17.1841" | ||||||
| FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | ||||||
| BEGIN | BEGIN | ||||||
|     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP |     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP | ||||||
|  | @ -395,8 +395,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 3,17,1840,0 |  FILEVERSION 3,17,1841,0 | ||||||
|  PRODUCTVERSION 3,17,1840,0 |  PRODUCTVERSION 3,17,1841,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -414,13 +414,13 @@ BEGIN | ||||||
|             VALUE "Comments", "https://rufus.ie" |             VALUE "Comments", "https://rufus.ie" | ||||||
|             VALUE "CompanyName", "Akeo Consulting" |             VALUE "CompanyName", "Akeo Consulting" | ||||||
|             VALUE "FileDescription", "Rufus" |             VALUE "FileDescription", "Rufus" | ||||||
|             VALUE "FileVersion", "3.17.1840" |             VALUE "FileVersion", "3.17.1841" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)" | ||||||
|             VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" |             VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" | ||||||
|             VALUE "OriginalFilename", "rufus-3.17.exe" |             VALUE "OriginalFilename", "rufus-3.17.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "3.17.1840" |             VALUE "ProductVersion", "3.17.1841" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
							
								
								
									
										13
									
								
								src/stdfn.c
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								src/stdfn.c
									
										
									
									
									
								
							|  | @ -36,6 +36,7 @@ | ||||||
| 
 | 
 | ||||||
| int nWindowsVersion = WINDOWS_UNDEFINED; | int nWindowsVersion = WINDOWS_UNDEFINED; | ||||||
| int nWindowsBuildNumber = -1; | int nWindowsBuildNumber = -1; | ||||||
|  | int nWindowsEdition = 0; | ||||||
| char WindowsVersionStr[128] = "Windows "; | char WindowsVersionStr[128] = "Windows "; | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  | @ -279,6 +280,10 @@ static const char* GetEdition(DWORD ProductType) | ||||||
| 	case 0x00000048: return "Enterprise Eval"; | 	case 0x00000048: return "Enterprise Eval"; | ||||||
| 	case 0x00000054: return "Enterprise N Eval"; | 	case 0x00000054: return "Enterprise N Eval"; | ||||||
| 	case 0x00000057: return "Thin PC"; | 	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 0x0000006F: return "Core Connected"; | ||||||
| 	case 0x00000070: return "Pro Student"; | 	case 0x00000070: return "Pro Student"; | ||||||
| 	case 0x00000071: return "Core Connected N"; | 	case 0x00000071: return "Core Connected N"; | ||||||
|  | @ -321,7 +326,7 @@ static const char* GetEdition(DWORD ProductType) | ||||||
| void GetWindowsVersion(void) | void GetWindowsVersion(void) | ||||||
| { | { | ||||||
| 	OSVERSIONINFOEXA vi, vi2; | 	OSVERSIONINFOEXA vi, vi2; | ||||||
| 	DWORD dwProductType; | 	DWORD dwProductType = 0; | ||||||
| 	const char* w = 0; | 	const char* w = 0; | ||||||
| 	const char* w64 = "32 bit"; | 	const char* w64 = "32 bit"; | ||||||
| 	char *vptr; | 	char *vptr; | ||||||
|  | @ -419,7 +424,7 @@ void GetWindowsVersion(void) | ||||||
| 	vptr = &WindowsVersionStr[sizeof("Windows ") - 1]; | 	vptr = &WindowsVersionStr[sizeof("Windows ") - 1]; | ||||||
| 	vlen = sizeof(WindowsVersionStr) - sizeof("Windows ") - 1; | 	vlen = sizeof(WindowsVersionStr) - sizeof("Windows ") - 1; | ||||||
| 	if (!w) | 	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); | 			(unsigned)vi.dwMajorVersion, (unsigned)vi.dwMinorVersion, w64); | ||||||
| 	else if (vi.wServicePackMinor) | 	else if (vi.wServicePackMinor) | ||||||
| 		safe_sprintf(vptr, vlen, "%s SP%u.%u %s", w, vi.wServicePackMajor, vi.wServicePackMinor, w64); | 		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); | 		safe_sprintf(vptr, vlen, "%s SP%u %s", w, vi.wServicePackMajor, w64); | ||||||
| 	else | 	else | ||||||
| 		safe_sprintf(vptr, vlen, "%s%s%s, %s", | 		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
 | 	// Add the build number (including UBR if available) for Windows 8.0 and later
 | ||||||
| 	nWindowsBuildNumber = vi.dwBuildNumber; | 	nWindowsBuildNumber = vi.dwBuildNumber; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue