mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[misc] small Windows versioning improvement
* Actually define a WINDOWS_11 version and use it when Windows 11 is detected. * Also some comment cleanup.
This commit is contained in:
		
							parent
							
								
									d203c91403
								
							
						
					
					
						commit
						aba6c7d996
					
				
					 5 changed files with 37 additions and 26 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.16.1823.0" /> |     Version="3.16.1824.0" /> | ||||||
| 
 | 
 | ||||||
|   <Properties> |   <Properties> | ||||||
|     <DisplayName>Rufus</DisplayName> |     <DisplayName>Rufus</DisplayName> | ||||||
|  |  | ||||||
|  | @ -61,9 +61,12 @@ static __inline BOOL IsRegistryNode(HKEY key_root, const char* key_name) | ||||||
| 	return r; | 	return r; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* Read a generic registry key value. If a short key_name is used, assume that it belongs to
 | /*
 | ||||||
|    the application and create the app subkey if required */ |  * Read a generic registry key value. If a short key_name is used, assume that | ||||||
| static __inline BOOL _GetRegistryKey(HKEY key_root, const char* key_name, DWORD reg_type, LPBYTE dest, DWORD dest_size) |  * it belongs to the application and create the app subkey if required | ||||||
|  |  */ | ||||||
|  | static __inline BOOL _GetRegistryKey(HKEY key_root, const char* key_name, DWORD reg_type, | ||||||
|  | 	LPBYTE dest, DWORD dest_size) | ||||||
| { | { | ||||||
| 	const char software_prefix[] = "SOFTWARE\\"; | 	const char software_prefix[] = "SOFTWARE\\"; | ||||||
| 	char long_key_name[MAX_PATH] = { 0 }; | 	char long_key_name[MAX_PATH] = { 0 }; | ||||||
|  |  | ||||||
							
								
								
									
										11
									
								
								src/rufus.h
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								src/rufus.h
									
										
									
									
									
								
							|  | @ -440,12 +440,13 @@ enum WindowsVersion { | ||||||
| 	WINDOWS_UNSUPPORTED = 0, | 	WINDOWS_UNSUPPORTED = 0, | ||||||
| 	WINDOWS_XP = 0x51, | 	WINDOWS_XP = 0x51, | ||||||
| 	WINDOWS_2003 = 0x52,	// Also XP_64
 | 	WINDOWS_2003 = 0x52,	// Also XP_64
 | ||||||
| 	WINDOWS_VISTA = 0x60,	// Also 2008
 | 	WINDOWS_VISTA = 0x60,	// Also Server 2008
 | ||||||
| 	WINDOWS_7 = 0x61,		// Also 2008_R2
 | 	WINDOWS_7 = 0x61,		// Also Server 2008_R2
 | ||||||
| 	WINDOWS_8 = 0x62,		// Also 2012
 | 	WINDOWS_8 = 0x62,		// Also Server 2012
 | ||||||
| 	WINDOWS_8_1 = 0x63,		// Also 2012_R2
 | 	WINDOWS_8_1 = 0x63,		// Also Server 2012_R2
 | ||||||
| 	WINDOWS_10_PREVIEW1 = 0x64, | 	WINDOWS_10_PREVIEW1 = 0x64, | ||||||
| 	WINDOWS_10 = 0xA0, | 	WINDOWS_10 = 0xA0,		// Also Server 2016, also Server 2019
 | ||||||
|  | 	WINDOWS_11 = 0xB0,		// Also Server 2022
 | ||||||
| 	WINDOWS_MAX | 	WINDOWS_MAX | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										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.16.1823" | CAPTION "Rufus 3.16.1824" | ||||||
| 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,16,1823,0 |  FILEVERSION 3,16,1824,0 | ||||||
|  PRODUCTVERSION 3,16,1823,0 |  PRODUCTVERSION 3,16,1824,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.16.1823" |             VALUE "FileVersion", "3.16.1824" | ||||||
|             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.16.exe" |             VALUE "OriginalFilename", "rufus-3.16.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "3.16.1823" |             VALUE "ProductVersion", "3.16.1824" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
							
								
								
									
										29
									
								
								src/stdfn.c
									
										
									
									
									
								
							
							
						
						
									
										29
									
								
								src/stdfn.c
									
										
									
									
									
								
							|  | @ -310,7 +310,9 @@ static const char* GetEdition(DWORD ProductType) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // From smartmontools os_win32.cpp
 | /*
 | ||||||
|  |  * Modified from smartmontools' os_win32.cpp | ||||||
|  |  */ | ||||||
| void GetWindowsVersion(void) | void GetWindowsVersion(void) | ||||||
| { | { | ||||||
| 	OSVERSIONINFOEXA vi, vi2; | 	OSVERSIONINFOEXA vi, vi2; | ||||||
|  | @ -371,27 +373,32 @@ void GetWindowsVersion(void) | ||||||
| 			ws = (vi.wProductType <= VER_NT_WORKSTATION); | 			ws = (vi.wProductType <= VER_NT_WORKSTATION); | ||||||
| 			nWindowsVersion = vi.dwMajorVersion << 4 | vi.dwMinorVersion; | 			nWindowsVersion = vi.dwMajorVersion << 4 | vi.dwMinorVersion; | ||||||
| 			switch (nWindowsVersion) { | 			switch (nWindowsVersion) { | ||||||
| 			case 0x51: w = "XP"; | 			case WINDOWS_XP: w = "XP"; | ||||||
| 				break; | 				break; | ||||||
| 			case 0x52: w = (!GetSystemMetrics(89)?"Server 2003":"Server 2003_R2"); | 			case WINDOWS_2003: w = (ws ? "XP_64" : (!GetSystemMetrics(89) ? "Server 2003" : "Server 2003_R2")); | ||||||
| 				break; | 				break; | ||||||
| 			case 0x60: w = (ws?"Vista":"Server 2008"); | 			case WINDOWS_VISTA: w = (ws ? "Vista" : "Server 2008"); | ||||||
| 				break; | 				break; | ||||||
| 			case 0x61: w = (ws?"7":"Server 2008_R2"); | 			case WINDOWS_7: w = (ws ? "7" : "Server 2008_R2"); | ||||||
| 				break; | 				break; | ||||||
| 			case 0x62: w = (ws?"8":"Server 2012"); | 			case WINDOWS_8: w = (ws ? "8" : "Server 2012"); | ||||||
| 				break; | 				break; | ||||||
| 			case 0x63: w = (ws?"8.1":"Server 2012_R2"); | 			case WINDOWS_8_1: w = (ws ? "8.1" : "Server 2012_R2"); | ||||||
| 				break; | 				break; | ||||||
| 			case 0x64: w = (ws?"10 (Preview 1)":"Server 10 (Preview 1)"); | 			case WINDOWS_10_PREVIEW1: w = (ws ? "10 (Preview 1)" : "Server 10 (Preview 1)"); | ||||||
| 				break; | 				break; | ||||||
| 			// Starting with Windows 10 Preview 2, the major is the same as the public-facing version
 | 			// Starting with Windows 10 Preview 2, the major is the same as the public-facing version
 | ||||||
| 			case 0xA0: w = (ws?((vi.dwBuildNumber<20000)?"10":"11"):((vi.dwBuildNumber<17763)?"Server 2016":"Server 2019")); | 			case WINDOWS_10: | ||||||
|  | 				if (vi.dwBuildNumber < 20000) { | ||||||
|  | 					w = (ws ? "10" : ((vi.dwBuildNumber < 17763) ? "Server 2016" : "Server 2019")); | ||||||
| 					break; | 					break; | ||||||
| 			case 0xB0: w = (ws?"11":"Server 2022"); | 				} | ||||||
|  | 				nWindowsVersion = WINDOWS_11; | ||||||
|  | 				// Fall through
 | ||||||
|  | 			case WINDOWS_11: w = (ws ? "11" : "Server 2022"); | ||||||
| 				break; | 				break; | ||||||
| 			default: | 			default: | ||||||
| 				if (nWindowsVersion < 0x51) | 				if (nWindowsVersion < WINDOWS_XP) | ||||||
| 					nWindowsVersion = WINDOWS_UNSUPPORTED; | 					nWindowsVersion = WINDOWS_UNSUPPORTED; | ||||||
| 				else | 				else | ||||||
| 					w = "12 or later"; | 					w = "12 or later"; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue