diff --git a/.vs/rufus.vcxproj b/.vs/rufus.vcxproj index 5b3df00b..3c8b6f47 100644 --- a/.vs/rufus.vcxproj +++ b/.vs/rufus.vcxproj @@ -133,7 +133,7 @@ /utf-8 $(ExternalCompilerOptions) %(AdditionalOptions) - advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;psapi.lib;%(AdditionalDependencies) + advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;psapi.lib;%(AdditionalDependencies) RequireAdministrator true Windows @@ -157,7 +157,7 @@ /utf-8 $(ExternalCompilerOptions) %(AdditionalOptions) - advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies) + advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies) RequireAdministrator true Windows @@ -183,7 +183,7 @@ /utf-8 $(ExternalCompilerOptions) %(AdditionalOptions) - advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies) + advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies) RequireAdministrator true Windows @@ -214,7 +214,7 @@ /utf-8 $(ExternalCompilerOptions) %(AdditionalOptions) - advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;psapi.lib;%(AdditionalDependencies) + advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;psapi.lib;%(AdditionalDependencies) RequireAdministrator true Windows @@ -240,7 +240,7 @@ true - advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;psapi.lib;%(AdditionalDependencies) + advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;psapi.lib;%(AdditionalDependencies) RequireAdministrator false Windows @@ -267,7 +267,7 @@ true - advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies) + advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies) RequireAdministrator false Windows @@ -296,7 +296,7 @@ true - advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies) + advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies) RequireAdministrator false Windows @@ -328,7 +328,7 @@ true - advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;psapi.lib;%(AdditionalDependencies) + advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;psapi.lib;%(AdditionalDependencies) RequireAdministrator false Windows diff --git a/ChangeLog.txt b/ChangeLog.txt index 984e9c90..841f17a4 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -3,6 +3,7 @@ o Version 3.16 (2021.10.??) Fix BIOS boot support for Arch derivatives Fix removal of some boot entries for Ubuntu derivatives Fix log not being saved on exit + Add UEFI Shell ISO downloads Add support for Intel NUC card readers Improve Windows version reporting Improve Windows 11 support diff --git a/res/appstore/Package.appxmanifest b/res/appstore/Package.appxmanifest index c7874d1b..8a7f3742 100644 --- a/res/appstore/Package.appxmanifest +++ b/res/appstore/Package.appxmanifest @@ -11,7 +11,7 @@ + Version="3.16.1831.0" /> Rufus diff --git a/src/Makefile.am b/src/Makefile.am index 67be243c..9dbbb8ea 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -16,4 +16,4 @@ rufus_CFLAGS = -I$(srcdir)/ms-sys/inc -I$(srcdir)/syslinux/libfat -I$(srcdir)/sy -DEXT2_FLAT_INCLUDES=0 -DSOLUTION=rufus rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows rufus_LDADD = rufus_rc.o bled/libbled.a ext2fs/libext2fs.a ms-sys/libmssys.a syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a syslinux/win/libwin.a \ - libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a libcdio/driver/libdriver.a -lsetupapi -lole32 -lgdi32 -lshlwapi -lcrypt32 -lwintrust -lcomdlg32 -lcomctl32 -luuid -lpsapi + libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a libcdio/driver/libdriver.a -lsetupapi -lole32 -lgdi32 -lshlwapi -lcrypt32 -lwintrust -lcomdlg32 -lcomctl32 -luuid -lpsapi -lversion diff --git a/src/Makefile.in b/src/Makefile.in index 8e25bf07..bb17f6da 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -282,7 +282,7 @@ rufus_CFLAGS = -I$(srcdir)/ms-sys/inc -I$(srcdir)/syslinux/libfat -I$(srcdir)/sy rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows rufus_LDADD = rufus_rc.o bled/libbled.a ext2fs/libext2fs.a ms-sys/libmssys.a syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a syslinux/win/libwin.a \ - libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a libcdio/driver/libdriver.a -lsetupapi -lole32 -lgdi32 -lshlwapi -lcrypt32 -lwintrust -lcomdlg32 -lcomctl32 -luuid -lpsapi + libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a libcdio/driver/libdriver.a -lsetupapi -lole32 -lgdi32 -lshlwapi -lcrypt32 -lwintrust -lcomdlg32 -lcomctl32 -luuid -lpsapi -lversion all: all-recursive diff --git a/src/format.c b/src/format.c index f55eefab..b016383d 100644 --- a/src/format.c +++ b/src/format.c @@ -342,10 +342,12 @@ static BOOL FormatNativeVds(DWORD DriveIndex, uint64_t PartitionOffset, DWORD Cl WCHAR *wVolumeName = NULL, *wLabel = utf8_to_wchar(Label), *wFSName = utf8_to_wchar(FSName); if ((strcmp(FSName, FileSystemLabel[FS_EXFAT]) == 0) && !((dur_mins == 0) && (dur_secs == 0))) { - PrintInfoDebug(0, MSG_220, FSName, dur_mins, dur_secs); + PrintInfo(0, MSG_220, FSName, dur_mins, dur_secs); } else { - PrintInfoDebug(0, MSG_222, FSName); + PrintInfo(0, MSG_222, FSName); } + uprintf("Formatting to %s (using VDS)", FSName); + UpdateProgressWithInfoInit(NULL, TRUE); VolumeName = GetLogicalName(DriveIndex, PartitionOffset, TRUE, TRUE); wVolumeName = utf8_to_wchar(VolumeName); @@ -585,10 +587,12 @@ static BOOL FormatNative(DWORD DriveIndex, uint64_t PartitionOffset, DWORD Clust size_t i; if ((strcmp(FSName, FileSystemLabel[FS_EXFAT]) == 0) && !((dur_mins == 0) && (dur_secs == 0))) { - PrintInfoDebug(0, MSG_220, FSName, dur_mins, dur_secs); + PrintInfo(0, MSG_220, FSName, dur_mins, dur_secs); } else { - PrintInfoDebug(0, MSG_222, FSName); + PrintInfo(0, MSG_222, FSName); } + uprintf("Formatting to %s (using IFS)", FSName); + VolumeName = GetLogicalName(DriveIndex, PartitionOffset, TRUE, TRUE); wVolumeName = utf8_to_wchar(VolumeName); if (wVolumeName == NULL) { diff --git a/src/iso.c b/src/iso.c index 20886bda..78f3907e 100644 --- a/src/iso.c +++ b/src/iso.c @@ -102,6 +102,7 @@ static const char* wininst_name[] = { "install.wim", "install.esd", "install.swm // If the disc was mastered properly, GRUB/EFI will take care of itself static const char* grub_dirname = "/boot/grub/i386-pc"; static const char* grub_cfg[] = { "grub.cfg", "loopback.cfg" }; +static const char* compatresources_dll = "compatresources.dll"; static const char* menu_cfg = "menu.cfg"; // NB: Do not alter the order of the array below without validating hardcoded indexes in check_iso_props static const char* syslinux_cfg[] = { "isolinux.cfg", "syslinux.cfg", "extlinux.conf", "txt.cfg" }; @@ -266,17 +267,22 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t file_length, const img_report.has_efi |= (2 << i); // start at 2 since "bootmgr.efi" is bit 0 } - // Check for "install.###" in "###/sources/" if (psz_dirname != NULL) { - if (safe_stricmp(&psz_dirname[max(0, ((int)safe_strlen(psz_dirname)) - ((int)strlen(sources_str)))], sources_str) == 0) { + if (safe_stricmp(&psz_dirname[max(0, ((int)safe_strlen(psz_dirname)) - + ((int)strlen(sources_str)))], sources_str) == 0) { + // Check for "install.###" in "###/sources/" for (i = 0; i < ARRAYSIZE(wininst_name); i++) { if (safe_stricmp(psz_basename, wininst_name[i]) == 0) { if (img_report.wininst_index < MAX_WININST) { - static_sprintf(img_report.wininst_path[img_report.wininst_index], "?:%s", psz_fullpath); + static_sprintf(img_report.wininst_path[img_report.wininst_index], + "?:%s", psz_fullpath); img_report.wininst_index++; } } } + // Check for "compatresources.dll" in "###/sources/" + if (safe_stricmp(psz_basename, compatresources_dll) == 0) + img_report.has_compatresources_dll = TRUE; } } @@ -1099,6 +1105,35 @@ out: img_report.has_grub2 = FALSE; } } + if (img_report.has_compatresources_dll) { + // So that we don't have to extract the XML index from boot/install.wim + // to find if we're dealing with Windows 11, we isolate the version from + // sources/compatresources.dll, which is much faster... + VS_FIXEDFILEINFO* ver_info = NULL; + DWORD ver_handle = 0, ver_size; + UINT value_len = 0; + // coverity[swapped_arguments] + if (GetTempFileNameU(temp_dir, APPLICATION_NAME, 0, path) != 0) { + size = (size_t)ExtractISOFile(src_iso, "sources/compatresources.dll", path, FILE_ATTRIBUTE_NORMAL); + ver_size = GetFileVersionInfoSizeU(path, &ver_handle); + if (ver_size != 0) { + buf = malloc(ver_size); + if ((buf != NULL) && GetFileVersionInfoU(path, ver_handle, ver_size, buf) && + VerQueryValueA(buf, "\\", (LPVOID)&ver_info, &value_len) && (value_len != 0)) { + if (ver_info->dwSignature == VS_FFI_SIGNATURE) { + img_report.win_version.major = HIWORD(ver_info->dwFileVersionMS); + img_report.win_version.minor = LOWORD(ver_info->dwFileVersionMS); + img_report.win_version.build = HIWORD(ver_info->dwFileVersionLS); + img_report.win_version.revision = LOWORD(ver_info->dwFileVersionLS); + if ((img_report.win_version.major == 10) && (img_report.win_version.build > 20000)) + img_report.win_version.major = 11; + } + } + free(buf); + } + DeleteFileU(path); + } + } StrArrayDestroy(&config_path); StrArrayDestroy(&isolinux_path); SendMessage(hMainDialog, UM_PROGRESS_EXIT, 0, 0); diff --git a/src/msapi_utf8.h b/src/msapi_utf8.h index 5fe22245..521f9d80 100644 --- a/src/msapi_utf8.h +++ b/src/msapi_utf8.h @@ -720,6 +720,32 @@ static __inline DWORD GetModuleFileNameExU(HANDLE hProcess, HMODULE hModule, cha return ret; } +static __inline DWORD GetFileVersionInfoSizeU(const char* lpFileName, LPDWORD lpdwHandle) +{ + DWORD ret = 0, err = ERROR_INVALID_DATA; + wconvert(lpFileName); + ret = GetFileVersionInfoSizeW(wlpFileName, lpdwHandle); + err = GetLastError(); + wfree(lpFileName); + SetLastError(err); + return ret; +} + +static __inline BOOL GetFileVersionInfoU(const char* lpFileName, DWORD dwHandle, DWORD dwLen, LPVOID lpData) +{ + BOOL ret = FALSE; + DWORD err = ERROR_INVALID_DATA; + wconvert(lpFileName); + if (dwHandle != 0) + SetLastError(ERROR_INVALID_PARAMETER); + else + ret = GetFileVersionInfoW(wlpFileName, dwHandle, dwLen, lpData); + err = GetLastError(); + wfree(lpFileName); + SetLastError(err); + return ret; +} + static __inline DWORD GetFullPathNameU(const char* lpFileName, DWORD nBufferLength, char* lpBuffer, char** lpFilePart) { DWORD ret = 0, err = ERROR_INVALID_DATA; diff --git a/src/rufus.c b/src/rufus.c index c42dc5df..2994e641 100755 --- a/src/rufus.c +++ b/src/rufus.c @@ -1055,6 +1055,15 @@ static void DisplayISOProps(void) int i; uprintf("ISO label: '%s'", img_report.label); + if (img_report.win_version.major != 0) { + if (img_report.win_version.minor == 0) + uprintf(" Detected: Windows %d ISO (Build %d.%d)", img_report.win_version.major, + img_report.win_version.build, img_report.win_version.revision); + else + uprintf(" Detected: Windows %d.%d ISO (Build %d.%d)", img_report.win_version.major, + img_report.win_version.minor, img_report.win_version.build, img_report.win_version.revision); + } + uprintf(" Size: %s (Projected)", SizeToHumanReadable(img_report.projected_size, FALSE, FALSE)); if (img_report.mismatch_size > 0) { uprintf(" ERROR: Detected that file on disk has been truncated by %s!", diff --git a/src/rufus.h b/src/rufus.h index fce4bc39..ac375197 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -333,6 +333,13 @@ enum checksum_type { #define SYMLINKS_RR 0x01 #define SYMLINKS_UDF 0x02 +typedef struct { + uint16_t major; + uint16_t minor; + uint16_t build; + uint16_t revision; +} winver_t; + typedef struct { char label[192]; // 3*64 to account for UTF-8 char usb_label[192]; // converted USB label for workaround @@ -367,10 +374,12 @@ typedef struct { BOOLEAN needs_syslinux_overwrite; BOOLEAN has_grub4dos; BOOLEAN has_grub2; + BOOLEAN has_compatresources_dll; BOOLEAN has_kolibrios; BOOLEAN uses_casper; BOOLEAN uses_minint; BOOLEAN compression_type; + winver_t win_version; // Windows ISO version uint16_t sl_version; // Syslinux/Isolinux version char sl_version_str[12]; char sl_version_ext[32]; diff --git a/src/rufus.rc b/src/rufus.rc index 7735b443..b0c07f5d 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -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.16.1830" +CAPTION "Rufus 3.16.1831" 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,16,1830,0 - PRODUCTVERSION 3,16,1830,0 + FILEVERSION 3,16,1831,0 + PRODUCTVERSION 3,16,1831,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.16.1830" + VALUE "FileVersion", "3.16.1831" 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.16.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.16.1830" + VALUE "ProductVersion", "3.16.1831" END END BLOCK "VarFileInfo"