From 0bda98f0ed06af23f1c05f140f10696ee2201f56 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Fri, 28 Apr 2023 17:33:00 +0100 Subject: [PATCH 1/2] [misc] update DB for newer GRUB core.img's MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * See pbatard/rufus-web@320b800592abc2b63650061476b16ccff6a3e133 * Also fix © sign not displaying properly in executable details page --- ChangeLog.txt | 4 ++-- README.md | 2 +- src/db.h | 7 +++---- src/rufus.rc | 12 ++++++------ 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 7d147c2a..cddb5766 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,11 +1,11 @@ o Version 4.0 (2023.04.26) - Fix persistence partition not working with Ubuntu 23.04 + Fix persistent partition not working with Ubuntu 23.04 Fix out of range pointer error with Ubuntu 23.04 when booting in BIOS mode Fix boot freeze with Ubuntu Studio when Secure Boot is enabled Fix incorrect architecture detection when checking for updates Fix a Windows Store application crash when processing GRUB bootloaders Fix a Windows Store application crash when enumerating processes that contain a % sign - Fix a Windows Store application crash when using the German localization + Fix a Windows Store application crash when using German localization Note that the major version was bumped on account of: - New versions of Rufus requiring Windows 8 or later - New versions of Rufus defaulting to a 64-bit executable diff --git a/README.md b/README.md index 60868c2a..c5514e46 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Features -------- * Format USB, flash card and virtual drives to FAT/FAT32/NTFS/UDF/exFAT/ReFS/ext2/ext3 -* Create DOS bootable USB drives, using [FreeDOS](https://www.freedos.org) or MS-DOS (Windows 8.1 or earlier) +* Create DOS bootable USB drives using [FreeDOS](https://www.freedos.org) * Create BIOS or UEFI bootable drives, including [UEFI bootable NTFS](https://github.com/pbatard/uefi-ntfs) * Create bootable drives from bootable ISOs (Windows, Linux, etc.) * Create bootable drives from bootable disk images, including compressed ones diff --git a/src/db.h b/src/db.h index dcdbe751..e1c2c273 100644 --- a/src/db.h +++ b/src/db.h @@ -1,7 +1,7 @@ /* * Rufus: The Reliable USB Formatting Utility * DB of the hash values we know for downloadable content (GRUB, Syslinux, etc.) - * Copyright © 2016-2020 Pete Batard + * Copyright © 2016-2023 Pete Batard * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +27,7 @@ static uint8_t sha256db[] = { 0x01, 0x21, 0x98, 0x20, 0xd9, 0x1c, 0x28, 0x7b, 0x35, 0x28, 0x06, 0xf1, 0xb6, 0xa8, 0x0d, 0x4a, 0x8a, 0xf4, 0x5c, 0xf5, 0x04, 0x83, 0xed, 0x6b, 0xe0, 0xc6, 0x0e, 0x7a, 0x66, 0x9c, 0x67, 0x87, // syslinux-6.04/pre2/ldlinux.bss + 0x0a, 0xd1, 0x3c, 0x2a, 0xb9, 0xd1, 0xcc, 0x66, 0x73, 0x70, 0xc4, 0x34, 0xf3, 0xe2, 0xa0, 0x54, 0x1c, 0xb8, 0x37, 0xdb, 0x72, 0x3e, 0x19, 0xae, 0x81, 0xc8, 0xee, 0x0b, 0xbe, 0x10, 0xdc, 0xe0, // grub-2.06-nonstandard/core.img 0x11, 0x0c, 0x50, 0x1b, 0xfa, 0x9e, 0x72, 0xa8, 0x8c, 0xdb, 0xb8, 0xba, 0x11, 0xe1, 0xf0, 0x76, 0x1a, 0xec, 0x28, 0xbf, 0x04, 0x44, 0x67, 0xff, 0x38, 0x2c, 0x06, 0x95, 0xd5, 0x1f, 0x8a, 0x83, // grub-2.04-nonstandard/core.img 0x12, 0xbd, 0x22, 0xd2, 0xb3, 0x69, 0x56, 0x0f, 0x89, 0xb8, 0x50, 0x7e, 0x7e, 0x74, 0xeb, 0xc5, 0xea, 0x44, 0x91, 0x48, 0x75, 0xf0, 0xa4, 0xcb, 0x1e, 0xa6, 0xfb, 0x4e, 0xc9, 0x89, 0x58, 0x17, // syslinux-6.03/pre6/ldlinux.sys 0x15, 0x5f, 0x36, 0x7b, 0xb1, 0x30, 0xfe, 0x05, 0x5c, 0x79, 0x9f, 0x88, 0xb3, 0xc0, 0xc1, 0xa0, 0x0a, 0x18, 0x05, 0x78, 0x22, 0x69, 0xcf, 0x7e, 0x54, 0xaa, 0x61, 0xbd, 0xe3, 0x8e, 0x05, 0x92, // syslinux-6.03/pre3/ldlinux.bss @@ -34,9 +35,7 @@ static uint8_t sha256db[] = { 0x1c, 0xc6, 0x32, 0x21, 0xfd, 0xf4, 0x46, 0xfc, 0xda, 0xc6, 0xc0, 0x56, 0x35, 0x79, 0x54, 0xc1, 0x5b, 0x61, 0x75, 0xca, 0x1b, 0xc2, 0xa4, 0x9f, 0x85, 0x52, 0xec, 0xca, 0x28, 0xac, 0x3e, 0x51, // syslinux-6.02/ldlinux.bss 0x22, 0x96, 0x82, 0xac, 0x61, 0xb8, 0x8b, 0x11, 0x25, 0xfc, 0xd7, 0xe6, 0x9f, 0x4e, 0x7f, 0x46, 0x7f, 0x68, 0xc5, 0x14, 0x9e, 0xb9, 0x37, 0x1a, 0x98, 0xd8, 0xf2, 0x78, 0x41, 0x40, 0xad, 0x88, // syslinux-5.00/ldlinux.sys 0x25, 0xd1, 0x38, 0xf3, 0x8b, 0x17, 0x35, 0x79, 0x3e, 0xee, 0x89, 0x19, 0xa3, 0xa0, 0xe5, 0xc9, 0x97, 0x9d, 0x2f, 0xac, 0xc0, 0xb5, 0x70, 0x74, 0x24, 0xe8, 0x04, 0x98, 0x1d, 0x25, 0xf9, 0xc9, // syslinux-6.03/pre10/ldlinux.sys - 0x28, 0xf8, 0x1d, 0xd8, 0x72, 0x0e, 0x6e, 0xfd, 0xc5, 0x30, 0x44, 0xf6, 0xf9, 0xa6, 0xc2, 0x8b, 0x6b, 0x89, 0x54, 0x23, 0xfb, 0x4c, 0xbc, 0x2d, 0xa2, 0xfb, 0xd6, 0x29, 0x70, 0xd6, 0xd1, 0xd6, // grub-2.06-nonstandard/core.img 0x29, 0xcd, 0xfc, 0x24, 0x0d, 0x08, 0xe4, 0xd6, 0x42, 0x0d, 0x1f, 0x05, 0x7a, 0x0e, 0xb0, 0xb1, 0x07, 0x88, 0x91, 0x65, 0xa8, 0xeb, 0x16, 0x3c, 0x31, 0x72, 0xaa, 0xfc, 0xee, 0x02, 0xac, 0xdd, // grub-2.06~rc1/core.img - 0x2b, 0x07, 0x20, 0x67, 0xf9, 0xcd, 0x6e, 0x8c, 0x62, 0xe7, 0x82, 0xdc, 0x4a, 0xe2, 0x3b, 0x19, 0x2d, 0xe6, 0x28, 0xe7, 0x67, 0x0c, 0x84, 0x68, 0xed, 0x38, 0x0d, 0x36, 0x4a, 0xa7, 0x0b, 0xf1, // grub-2.06/core.img 0x2b, 0x31, 0x7b, 0x12, 0xab, 0xff, 0x49, 0x66, 0x48, 0x78, 0xdf, 0xe0, 0xb5, 0x00, 0xb8, 0x50, 0x0f, 0x93, 0xf1, 0xd5, 0xe4, 0xd5, 0x28, 0x45, 0x95, 0xcc, 0x2c, 0x15, 0x6c, 0x74, 0x4f, 0x79, // grub-2.02~beta3/core.img 0x2d, 0x99, 0x55, 0x09, 0xd0, 0xd6, 0xcd, 0xf7, 0x6e, 0xd5, 0x9f, 0x46, 0x53, 0xf1, 0xcb, 0xe1, 0xc9, 0xe6, 0x24, 0xe1, 0xaf, 0xa8, 0xf7, 0x8e, 0xc2, 0x45, 0x5b, 0x24, 0x53, 0x4b, 0x87, 0x76, // syslinux-6.03/pre13/ldlinux.bss 0x2e, 0x3e, 0xf6, 0x65, 0x1e, 0x59, 0x85, 0x20, 0x26, 0xc5, 0x74, 0xde, 0x52, 0x65, 0xf6, 0x8e, 0x24, 0xf8, 0xe6, 0x27, 0xc5, 0x53, 0xce, 0x8d, 0x32, 0x7c, 0xa7, 0xe0, 0xb4, 0x96, 0x70, 0xa1, // grub4dos-0.4.5c/grldr @@ -73,7 +72,6 @@ static uint8_t sha256db[] = { 0x6a, 0xbc, 0xdc, 0x80, 0x3a, 0x30, 0x85, 0xea, 0x5f, 0x9d, 0xa1, 0xb4, 0x3e, 0xdb, 0x2e, 0xad, 0xa2, 0x75, 0x36, 0x0d, 0xb8, 0x11, 0xc9, 0xac, 0xf5, 0x9a, 0x55, 0x5f, 0x67, 0x7b, 0x2d, 0x8b, // syslinux-6.03/pre12/ldlinux.bss 0x73, 0xb6, 0x27, 0x67, 0xa1, 0x62, 0x00, 0xb9, 0xaf, 0x19, 0x3a, 0x7d, 0x5c, 0x94, 0xe9, 0xc2, 0x94, 0xc6, 0xdb, 0xb6, 0xd5, 0xb1, 0x7c, 0x15, 0x03, 0x8c, 0x9f, 0x31, 0x73, 0xc9, 0xa7, 0xbc, // syslinux-6.04/ldlinux.sys 0x75, 0x6f, 0x89, 0x25, 0x23, 0xc6, 0x8d, 0x27, 0x32, 0x28, 0x8b, 0x5a, 0xd4, 0x2d, 0x7d, 0xc7, 0x4e, 0xa7, 0xa7, 0x08, 0x9b, 0x04, 0x2b, 0x12, 0x5f, 0x5d, 0x74, 0x7f, 0xf3, 0x20, 0xa0, 0x77, // syslinux-4.07/vesamenu.c32 - 0x76, 0xd1, 0x2b, 0x17, 0xfd, 0x05, 0xd3, 0x10, 0xb0, 0x5d, 0x00, 0xa8, 0x38, 0x77, 0x06, 0xc5, 0xce, 0x35, 0xd4, 0xb0, 0x50, 0xf2, 0x23, 0x9d, 0x15, 0xd3, 0xc9, 0xac, 0x92, 0xc5, 0xdd, 0xbc, // grub-2.06-fedora-nonstandard/core.img 0x77, 0x9a, 0x5e, 0xbd, 0x69, 0xd3, 0x28, 0x5e, 0xb9, 0xed, 0x4a, 0xc7, 0xc0, 0x4d, 0x2d, 0x15, 0xcb, 0xa1, 0x8a, 0x1f, 0x97, 0xc7, 0xc4, 0xbe, 0x62, 0x48, 0x93, 0xa9, 0xe1, 0xb0, 0x89, 0x2e, // syslinux-6.03/pre9/ldlinux.sys 0x78, 0x64, 0x8e, 0xf0, 0xc5, 0x00, 0x41, 0x75, 0xb9, 0xa8, 0xea, 0x33, 0x30, 0x14, 0xea, 0x02, 0xc9, 0x17, 0xf8, 0x23, 0xe7, 0x7a, 0x3e, 0xc9, 0xac, 0xd9, 0xd2, 0x2b, 0x46, 0x02, 0xf3, 0x6d, // syslinux-6.03/pre13/ldlinux.sys 0x7d, 0xa9, 0xc5, 0x21, 0x76, 0xb8, 0xaf, 0x01, 0x64, 0xea, 0x39, 0x21, 0x22, 0x44, 0xb1, 0x0a, 0xa0, 0xc7, 0x97, 0xe7, 0x65, 0xbb, 0x6b, 0x92, 0x69, 0xb5, 0x8b, 0xc9, 0xe5, 0x0a, 0x9f, 0x18, // syslinux-5.01/ldlinux.bss @@ -90,6 +88,7 @@ static uint8_t sha256db[] = { 0xa9, 0x4a, 0x99, 0xe6, 0xde, 0x68, 0x81, 0x44, 0x49, 0x2b, 0x38, 0xdb, 0xee, 0x09, 0xde, 0x07, 0x30, 0xe3, 0x2e, 0x1c, 0xfd, 0x0a, 0xb2, 0x54, 0x99, 0x22, 0xff, 0xa8, 0x04, 0x01, 0xad, 0x49, // syslinux-6.03/pre2/ldlinux.bss 0xa9, 0x95, 0x68, 0x57, 0x9c, 0xd2, 0x51, 0xaf, 0xf1, 0x34, 0xfc, 0xaa, 0xa8, 0x09, 0x91, 0x60, 0x5e, 0x8f, 0xb1, 0x19, 0x74, 0x51, 0xf7, 0x51, 0xaa, 0x4d, 0x6c, 0x84, 0xbf, 0x65, 0xf4, 0xe3, // syslinux-6.03/pre15/ldlinux.sys 0xaa, 0x18, 0x1a, 0x4e, 0xb2, 0xab, 0xb0, 0xfb, 0xbc, 0x17, 0xc4, 0xc8, 0x5a, 0x17, 0xa0, 0x0b, 0x15, 0x52, 0x4d, 0x7f, 0x2b, 0x0b, 0xea, 0xd4, 0xf8, 0x74, 0x2e, 0x70, 0xa3, 0x3a, 0xfa, 0xf8, // grub-2.04/core.img + 0xad, 0x18, 0x82, 0x0e, 0xcd, 0xe8, 0x74, 0xc7, 0x19, 0x10, 0xbd, 0x24, 0xf3, 0x03, 0x55, 0x17, 0x61, 0x03, 0xd0, 0x21, 0x78, 0x9c, 0xc0, 0x0b, 0xd4, 0x13, 0xd8, 0x0f, 0x5b, 0x02, 0x59, 0xf4, // grub-2.06-fedora-nonstandard/core.img 0xb1, 0x97, 0x91, 0x33, 0xa4, 0x5e, 0x29, 0x4f, 0x54, 0xee, 0xd0, 0xbd, 0x92, 0xb7, 0xf2, 0xb9, 0xa3, 0xd2, 0x26, 0x45, 0xae, 0x28, 0x20, 0x0e, 0x4a, 0xd8, 0xfd, 0x98, 0xaf, 0x24, 0x1a, 0x07, // grub-2.05/core.img 0xb2, 0xf0, 0xde, 0x2e, 0x01, 0xa7, 0xe3, 0x4d, 0x96, 0xa9, 0x76, 0x36, 0x43, 0x05, 0xd3, 0x9f, 0xf8, 0x49, 0xd5, 0x0a, 0xd1, 0x3a, 0xd1, 0xf8, 0xa8, 0xb4, 0x41, 0x1d, 0x1d, 0x53, 0x4e, 0x88, // syslinux-5.10/ldlinux.bss 0xb3, 0xa8, 0xf2, 0x12, 0x89, 0x1c, 0xd2, 0x6e, 0x1a, 0xb4, 0x4a, 0xa8, 0x59, 0x8f, 0x6e, 0x64, 0xc6, 0x83, 0x19, 0x8d, 0x43, 0x00, 0x27, 0x54, 0xec, 0xbd, 0x8a, 0x78, 0xf2, 0xd0, 0xc0, 0x0b, // syslinux-6.03/pre8/ldlinux.sys diff --git a/src/rufus.rc b/src/rufus.rc index 9080947d..bb0d4f57 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 4.0.2035" +CAPTION "Rufus 4.0.2036" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -392,8 +392,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,0,2035,0 - PRODUCTVERSION 4,0,2035,0 + FILEVERSION 4,0,2036,0 + PRODUCTVERSION 4,0,2036,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -411,13 +411,13 @@ BEGIN VALUE "Comments", "https://rufus.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "4.0.2035" + VALUE "FileVersion", "4.0.2036" VALUE "InternalName", "Rufus" - VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)" + VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "OriginalFilename", "rufus-4.0.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "4.0.2035" + VALUE "ProductVersion", "4.0.2036" END END BLOCK "VarFileInfo" From 0df68b6af980b3cdbb128f46ca6faa1704db9581 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Fri, 28 Apr 2023 17:46:05 +0100 Subject: [PATCH 2/2] [misc] further Windows 7 specifics removals * Also remove some unused code in stdlg.c * Note that virtdisk appears to be a vulnerable library, so we go through delay loading yet again... --- .mingw/Makefile.am | 3 +- .mingw/Makefile.in | 2 +- .mingw/virtdisk.def | 5 ++ .vs/rufus.vcxproj | 32 ++++----- src/Makefile.am | 2 +- src/Makefile.in | 2 +- src/iso.c | 22 ++---- src/rufus.c | 10 +-- src/rufus.h | 6 +- src/rufus.rc | 10 +-- src/stdfn.c | 18 +++-- src/stdlg.c | 164 +------------------------------------------- src/ui.c | 7 +- 13 files changed, 46 insertions(+), 237 deletions(-) create mode 100644 .mingw/virtdisk.def diff --git a/.mingw/Makefile.am b/.mingw/Makefile.am index c5ad8d7c..32c0b48b 100644 --- a/.mingw/Makefile.am +++ b/.mingw/Makefile.am @@ -19,7 +19,7 @@ TARGET := $(word 1,$(subst -, ,$(TUPLE))) DEF_SUFFIX := $(if $(TARGET:x86_64=),.def,.def64) .PHONY: all -all: dwmapi-delaylib.lib wintrust-delaylib.lib +all: dwmapi-delaylib.lib virtdisk-delaylib.lib wintrust-delaylib.lib %.def64: %.def $(AM_V_SED) "s/@.*//" $< >$@ @@ -29,4 +29,3 @@ all: dwmapi-delaylib.lib wintrust-delaylib.lib clean: $(RM) -rf *.lib - \ No newline at end of file diff --git a/.mingw/Makefile.in b/.mingw/Makefile.in index 0af7e49c..fbdc2ce6 100644 --- a/.mingw/Makefile.in +++ b/.mingw/Makefile.in @@ -367,7 +367,7 @@ uninstall-am: .PHONY: all -all: dwmapi-delaylib.lib wintrust-delaylib.lib +all: dwmapi-delaylib.lib virtdisk-delaylib.lib wintrust-delaylib.lib %.def64: %.def $(AM_V_SED) "s/@.*//" $< >$@ diff --git a/.mingw/virtdisk.def b/.mingw/virtdisk.def new file mode 100644 index 00000000..5b727b9d --- /dev/null +++ b/.mingw/virtdisk.def @@ -0,0 +1,5 @@ +EXPORTS + AttachVirtualDisk@24 + GetVirtualDiskPhysicalPath@12 + DetachVirtualDisk@12 + OpenVirtualDisk@24 diff --git a/.vs/rufus.vcxproj b/.vs/rufus.vcxproj index d3af1c2e..effde61e 100644 --- a/.vs/rufus.vcxproj +++ b/.vs/rufus.vcxproj @@ -133,12 +133,12 @@ /utf-8 $(ExternalCompilerOptions) %(AdditionalOptions) - advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;%(AdditionalDependencies) + advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;virtdisk.lib;%(AdditionalDependencies) RequireAdministrator true Windows MachineX86 - advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;wintrust.dll;%(DelayLoadDLLs) + advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;wintrust.dll;virtdisk.dll;%(DelayLoadDLLs) _UNICODE;UNICODE;%(PreprocessorDefinitions) @@ -162,12 +162,12 @@ /utf-8 $(ExternalCompilerOptions) %(AdditionalOptions) - advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.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;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;virtdisk.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies) RequireAdministrator true Windows C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\arm - advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs) + advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;wintrust.dll;virtdisk.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs) _UNICODE;UNICODE;%(PreprocessorDefinitions) @@ -193,12 +193,12 @@ /utf-8 $(ExternalCompilerOptions) %(AdditionalOptions) - advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.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;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;virtdisk.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies) RequireAdministrator true Windows C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\arm64 - advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs) + advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;wintrust.dll;virtdisk.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs) _UNICODE;UNICODE;%(PreprocessorDefinitions) @@ -229,12 +229,12 @@ /utf-8 $(ExternalCompilerOptions) %(AdditionalOptions) - advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;%(AdditionalDependencies) + advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;virtdisk.lib;%(AdditionalDependencies) RequireAdministrator true Windows MachineX64 - advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;wintrust.dll;%(DelayLoadDLLs) + advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;wintrust.dll;virtdisk.dll;%(DelayLoadDLLs) _UNICODE;UNICODE;%(PreprocessorDefinitions) @@ -260,13 +260,13 @@ true - advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;%(AdditionalDependencies) + advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;virtdisk.lib;%(AdditionalDependencies) RequireAdministrator false Windows MachineX86 /BREPRO %(AdditionalOptions) - advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;wintrust.dll;%(DelayLoadDLLs) + advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;wintrust.dll;virtdisk.dll;%(DelayLoadDLLs) _UNICODE;UNICODE;%(PreprocessorDefinitions) @@ -292,13 +292,13 @@ true - advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.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;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;virtdisk.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies) RequireAdministrator false Windows C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\arm /BREPRO %(AdditionalOptions) - advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs) + advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;wintrust.dll;virtdisk.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs) _UNICODE;UNICODE;%(PreprocessorDefinitions) @@ -326,13 +326,13 @@ true - advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.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;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;virtdisk.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies) RequireAdministrator false Windows C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\arm64 /BREPRO %(AdditionalOptions) - advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs) + advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;wintrust.dll;virtdisk.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs) _UNICODE;UNICODE;%(PreprocessorDefinitions) @@ -363,13 +363,13 @@ true - advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;%(AdditionalDependencies) + advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;virtdisk.lib;%(AdditionalDependencies) RequireAdministrator false Windows MachineX64 /BREPRO %(AdditionalOptions) - advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;wintrust.dll;%(DelayLoadDLLs) + advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;wintrust.dll;virtdisk.dll;%(DelayLoadDLLs) _UNICODE;UNICODE;%(PreprocessorDefinitions) diff --git a/src/Makefile.am b/src/Makefile.am index 68f0c10e..b04205e3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,7 +2,7 @@ SUBDIRS = ../.mingw bled ext2fs ms-sys syslinux/libfat syslinux/libinstaller sys # As far as I can tell, the following libraries are *not* vulnerable to side-loading, so we link using their regular version: NONVULNERABLE_LIBS = -lsetupapi -lole32 -lgdi32 -lshlwapi -lcrypt32 -lcomdlg32 -lcomctl32 -luuid # The following libraries are vulnerable (or have an unknown vulnerability status), so we link using our delay-loaded replacement: -VULNERABLE_LIBS = -ldwmapi-delaylib -lwintrust-delaylib +VULNERABLE_LIBS = -ldwmapi-delaylib -lvirtdisk-delaylib -lwintrust-delaylib noinst_PROGRAMS = rufus diff --git a/src/Makefile.in b/src/Makefile.in index 2465d1af..493c4dbe 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -276,7 +276,7 @@ SUBDIRS = ../.mingw bled ext2fs ms-sys syslinux/libfat syslinux/libinstaller sys # As far as I can tell, the following libraries are *not* vulnerable to side-loading, so we link using their regular version: NONVULNERABLE_LIBS = -lsetupapi -lole32 -lgdi32 -lshlwapi -lcrypt32 -lcomdlg32 -lcomctl32 -luuid # The following libraries are vulnerable (or have an unknown vulnerability status), so we link using our delay-loaded replacement: -VULNERABLE_LIBS = -ldwmapi-delaylib -lwintrust-delaylib +VULNERABLE_LIBS = -ldwmapi-delaylib -lvirtdisk-delaylib -lwintrust-delaylib AM_V_WINDRES_0 = @echo " RC $@";$(WINDRES) AM_V_WINDRES_1 = $(WINDRES) AM_V_WINDRES_ = $(AM_V_WINDRES_$(AM_DEFAULT_VERBOSITY)) diff --git a/src/iso.c b/src/iso.c index 3ff9b49e..b667555b 100644 --- a/src/iso.c +++ b/src/iso.c @@ -1698,14 +1698,6 @@ out: return ret; } -// VirtDisk API Prototypes - Only available for Windows 8 or later -PF_TYPE_DECL(WINAPI, DWORD, OpenVirtualDisk, (PVIRTUAL_STORAGE_TYPE, PCWSTR, - VIRTUAL_DISK_ACCESS_MASK, OPEN_VIRTUAL_DISK_FLAG, POPEN_VIRTUAL_DISK_PARAMETERS, PHANDLE)); -PF_TYPE_DECL(WINAPI, DWORD, AttachVirtualDisk, (HANDLE, PSECURITY_DESCRIPTOR, - ATTACH_VIRTUAL_DISK_FLAG, ULONG, PATTACH_VIRTUAL_DISK_PARAMETERS, LPOVERLAPPED)); -PF_TYPE_DECL(WINAPI, DWORD, DetachVirtualDisk, (HANDLE, DETACH_VIRTUAL_DISK_FLAG, ULONG)); -PF_TYPE_DECL(WINAPI, DWORD, GetVirtualDiskPhysicalPath, (HANDLE, PULONG, PWSTR)); - static char physical_path[128] = ""; static HANDLE mounted_handle = INVALID_HANDLE_VALUE; @@ -1719,14 +1711,10 @@ char* MountISO(const char* path) wconvert(path); char* ret = NULL; - PF_INIT_OR_OUT(OpenVirtualDisk, VirtDisk); - PF_INIT_OR_OUT(AttachVirtualDisk, VirtDisk); - PF_INIT_OR_OUT(GetVirtualDiskPhysicalPath, VirtDisk); - if ((mounted_handle != NULL) && (mounted_handle != INVALID_HANDLE_VALUE)) UnMountISO(); - r = pfOpenVirtualDisk(&vtype, wpath, VIRTUAL_DISK_ACCESS_READ | VIRTUAL_DISK_ACCESS_GET_INFO, + r = OpenVirtualDisk(&vtype, wpath, VIRTUAL_DISK_ACCESS_READ | VIRTUAL_DISK_ACCESS_GET_INFO, OPEN_VIRTUAL_DISK_FLAG_NONE, NULL, &mounted_handle); if (r != ERROR_SUCCESS) { SetLastError(r); @@ -1735,7 +1723,7 @@ char* MountISO(const char* path) } vparams.Version = ATTACH_VIRTUAL_DISK_VERSION_1; - r = pfAttachVirtualDisk(mounted_handle, NULL, ATTACH_VIRTUAL_DISK_FLAG_READ_ONLY | + r = AttachVirtualDisk(mounted_handle, NULL, ATTACH_VIRTUAL_DISK_FLAG_READ_ONLY | ATTACH_VIRTUAL_DISK_FLAG_NO_DRIVE_LETTER, 0, &vparams, NULL); if (r != ERROR_SUCCESS) { SetLastError(r); @@ -1743,7 +1731,7 @@ char* MountISO(const char* path) goto out; } - r = pfGetVirtualDiskPhysicalPath(mounted_handle, &size, wtmp); + r = GetVirtualDiskPhysicalPath(mounted_handle, &size, wtmp); if (r != ERROR_SUCCESS) { SetLastError(r); uprintf("Could not obtain physical path for mounted ISO '%s': %s", path, WindowsErrorString()); @@ -1761,12 +1749,10 @@ out: void UnMountISO(void) { - PF_INIT_OR_OUT(DetachVirtualDisk, VirtDisk); - if ((mounted_handle == NULL) || (mounted_handle == INVALID_HANDLE_VALUE)) goto out; - pfDetachVirtualDisk(mounted_handle, DETACH_VIRTUAL_DISK_FLAG_NONE, 0); + DetachVirtualDisk(mounted_handle, DETACH_VIRTUAL_DISK_FLAG_NONE, 0); safe_closehandle(mounted_handle); out: physical_path[0] = 0; diff --git a/src/rufus.c b/src/rufus.c index 3db818b5..336cd1c9 100755 --- a/src/rufus.c +++ b/src/rufus.c @@ -3337,7 +3337,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine char *tmp, *locale_name = NULL, **argv = NULL; wchar_t **wenv, **wargv; PF_TYPE_DECL(CDECL, int, __wgetmainargs, (int*, wchar_t***, wchar_t***, int, int*)); - PF_TYPE_DECL(WINAPI, BOOL, SetDefaultDllDirectories, (DWORD)); HANDLE mutex = NULL, hogmutex = NULL, hFile = NULL; HWND hDlg = NULL; HDC hDC; @@ -3366,14 +3365,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine // 'somelib.dll;%(DelayLoadDLLs)' must be added to the 'Delay Loaded Dlls' option of // the linker properties in Visual Studio (which means this won't work with MinGW). // For all other DLLs, use SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32). - // Finally, we need to perform the whole gymkhana below, where we can't call on - // SetDefaultDllDirectories() directly, because Windows 7 doesn't have the API exposed. - // Also, no, Coverity, we never need to care about freeing kernel32 as a library. - // coverity[leaked_storage] - pfSetDefaultDllDirectories = (SetDefaultDllDirectories_t) - GetProcAddress(LoadLibraryW(L"kernel32.dll"), "SetDefaultDllDirectories"); - if (pfSetDefaultDllDirectories != NULL) - pfSetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32); + SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32); uprintf("*** " APPLICATION_NAME " init ***\n"); its_a_me_mario = GetUserNameA((char*)(uintptr_t)&u, &size) && (u == 7104878); diff --git a/src/rufus.h b/src/rufus.h index 78f966ec..cc260b3d 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -540,6 +540,7 @@ typedef struct { DWORD Major; DWORD Minor; DWORD BuildNumber; + DWORD Ubr; DWORD Edition; USHORT Arch; char VersionStr[128]; @@ -774,11 +775,6 @@ static __inline HMODULE GetLibraryHandle(char* szLibraryName) { goto out; } h = LoadLibraryExW(wszLibraryName, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32); - // Some Windows 7 platforms (most likely the ones missing KB2533623 per the - // official LoadLibraryEx doc) can return ERROR_INVALID_PARAMETER when using - // the Ex() version. If that's the case, fallback to using LoadLibraryW(). - if ((h == NULL) && (SCODE_CODE(GetLastError()) == ERROR_INVALID_PARAMETER)) - h = LoadLibraryW(wszLibraryName); if (h != NULL) OpenedLibrariesHandle[OpenedLibrariesHandleSize++] = h; else diff --git a/src/rufus.rc b/src/rufus.rc index bb0d4f57..a424cd0f 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 4.0.2036" +CAPTION "Rufus 4.0.2037" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -392,8 +392,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,0,2036,0 - PRODUCTVERSION 4,0,2036,0 + FILEVERSION 4,0,2037,0 + PRODUCTVERSION 4,0,2037,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -411,13 +411,13 @@ BEGIN VALUE "Comments", "https://rufus.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "4.0.2036" + VALUE "FileVersion", "4.0.2037" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "OriginalFilename", "rufus-4.0.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "4.0.2036" + VALUE "ProductVersion", "4.0.2037" END END BLOCK "VarFileInfo" diff --git a/src/stdfn.c b/src/stdfn.c index 5e38ee2b..04727917 100644 --- a/src/stdfn.c +++ b/src/stdfn.c @@ -441,17 +441,15 @@ void GetWindowsVersion(windows_version_t* windows_version) windows_version->Edition = (int)dwProductType; - // Add the build number (including UBR if available) for Windows 8.0 and later + // Add the build number (including UBR if available) windows_version->BuildNumber = vi.dwBuildNumber; - if (windows_version->Version >= WINDOWS_8) { - int nUbr = ReadRegistryKey32(REGKEY_HKLM, "Software\\Microsoft\\Windows NT\\CurrentVersion\\UBR"); - vptr = &windows_version->VersionStr[safe_strlen(windows_version->VersionStr)]; - vlen = sizeof(windows_version->VersionStr) - safe_strlen(windows_version->VersionStr) - 1; - if (nUbr > 0) - safe_sprintf(vptr, vlen, " (Build %lu.%d)", windows_version->BuildNumber, nUbr); - else - safe_sprintf(vptr, vlen, " (Build %lu)", windows_version->BuildNumber); - } + windows_version->Ubr = ReadRegistryKey32(REGKEY_HKLM, "Software\\Microsoft\\Windows NT\\CurrentVersion\\UBR"); + vptr = &windows_version->VersionStr[safe_strlen(windows_version->VersionStr)]; + vlen = sizeof(windows_version->VersionStr) - safe_strlen(windows_version->VersionStr) - 1; + if (windows_version->Ubr != 0) + safe_sprintf(vptr, vlen, " (Build %lu.%lu)", windows_version->BuildNumber, windows_version->Ubr); + else + safe_sprintf(vptr, vlen, " (Build %lu)", windows_version->BuildNumber); } /* diff --git a/src/stdlg.c b/src/stdlg.c index 443cdacb..1bb4e090 100644 --- a/src/stdlg.c +++ b/src/stdlg.c @@ -52,8 +52,7 @@ static char* szMessageText = NULL; static char* szMessageTitle = NULL; static char **szDialogItem; static int nDialogItems; -static HWND hBrowseEdit, hUpdatesDlg; -static WNDPROC pOrgBrowseWndproc; +static HWND hUpdatesDlg; static const SETTEXTEX friggin_microsoft_unicode_amateurs = { ST_DEFAULT, CP_UTF8 }; static BOOL notification_is_question; static const notification_info* notification_more_info; @@ -84,160 +83,6 @@ void SetDialogFocus(HWND hDlg, HWND hCtrl) SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)hCtrl, TRUE); } -/* - * We need a sub-callback to read the content of the edit box on exit and update - * our path, else if what the user typed does match the selection, it is discarded. - * Talk about a convoluted way of producing an intuitive folder selection dialog - */ -INT CALLBACK BrowseDlgCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch(message) { - case WM_DESTROY: - GetWindowTextU(hBrowseEdit, szFolderPath, sizeof(szFolderPath)); - break; - } - return (INT)CallWindowProc(pOrgBrowseWndproc, hDlg, message, wParam, lParam); -} - -/* - * Main BrowseInfo callback to set the initial directory and populate the edit control - */ -INT CALLBACK BrowseInfoCallback(HWND hDlg, UINT message, LPARAM lParam, LPARAM pData) -{ - char dir[MAX_PATH]; - wchar_t* wpath; - LPITEMIDLIST pidl; - - switch(message) { - case BFFM_INITIALIZED: - pOrgBrowseWndproc = (WNDPROC)SetWindowLongPtr(hDlg, GWLP_WNDPROC, (LONG_PTR)BrowseDlgCallback); - // Windows hides the full path in the edit box by default, which is bull. - // Get a handle to the edit control to fix that - hBrowseEdit = FindWindowExA(hDlg, NULL, "Edit", NULL); - SetWindowTextU(hBrowseEdit, szFolderPath); - SetDialogFocus(hDlg, hBrowseEdit); - // On Windows 7, MinGW only properly selects the specified folder when using a pidl - wpath = utf8_to_wchar(szFolderPath); - pidl = SHSimpleIDListFromPath(wpath); - safe_free(wpath); - // NB: see http://connect.microsoft.com/VisualStudio/feedback/details/518103/bffm-setselection-does-not-work-with-shbrowseforfolder-on-windows-7 - // for details as to why we send BFFM_SETSELECTION twice. - SendMessageW(hDlg, BFFM_SETSELECTION, (WPARAM)FALSE, (LPARAM)pidl); - Sleep(100); - PostMessageW(hDlg, BFFM_SETSELECTION, (WPARAM)FALSE, (LPARAM)pidl); - break; - case BFFM_SELCHANGED: - // Update the status - if (SHGetPathFromIDListU((LPITEMIDLIST)lParam, dir)) { - SendMessageLU(hDlg, BFFM_SETSTATUSTEXT, 0, dir); - SetWindowTextU(hBrowseEdit, dir); - } - break; - } - return 0; -} - -/* - * Browse for a folder and update the folder edit box - */ -void BrowseForFolder(void) { - - BROWSEINFOW bi; - LPITEMIDLIST pidl; - WCHAR *wpath; - size_t i; - HRESULT hr; - IShellItem *psi = NULL; - IShellItem *si_path = NULL; // Automatically freed - IFileOpenDialog *pfod = NULL; - WCHAR *fname; - char* tmp_path = NULL; - - dialog_showing++; - hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC, - &IID_IFileOpenDialog, (LPVOID)&pfod); - if (FAILED(hr) || pfod == NULL) { - uprintf("CoCreateInstance for FileOpenDialog failed: error %X\n", hr); - if (pfod != NULL) { - IFileOpenDialog_Release(pfod); - pfod = NULL; // Just in case - } - goto fallback; - } - hr = IFileOpenDialog_SetOptions(pfod, FOS_PICKFOLDERS); - if (FAILED(hr)) { - uprintf("Failed to set folder option for FileOpenDialog: error %X\n", hr); - goto fallback; - } - // Set the initial folder (if the path is invalid, will simply use last) - wpath = utf8_to_wchar(szFolderPath); - // The new IFileOpenDialog makes us split the path - fname = NULL; - if ((wpath != NULL) && (wcslen(wpath) >= 1)) { - for (i = wcslen(wpath) - 1; i != 0; i--) { - if (wpath[i] == L'\\') { - wpath[i] = 0; - fname = &wpath[i + 1]; - break; - } - } - } - - hr = SHCreateItemFromParsingName(wpath, NULL, &IID_IShellItem, (LPVOID)&si_path); - if (SUCCEEDED(hr) && pfod != NULL) { - if (wpath != NULL) { - IFileOpenDialog_SetFolder(pfod, si_path); - } - if (fname != NULL) { - IFileOpenDialog_SetFileName(pfod, fname); - } - } - safe_free(wpath); - - hr = IFileOpenDialog_Show(pfod, hMainDialog); - if (SUCCEEDED(hr) && pfod != NULL) { - hr = IFileOpenDialog_GetResult(pfod, &psi); - if (SUCCEEDED(hr)) { - IShellItem_GetDisplayName(psi, SIGDN_FILESYSPATH, &wpath); - tmp_path = wchar_to_utf8(wpath); - CoTaskMemFree(wpath); - if (tmp_path == NULL) { - uprintf("Could not convert path\n"); - } else { - static_strcpy(szFolderPath, tmp_path); - safe_free(tmp_path); - } - } else { - uprintf("Failed to set folder option for FileOpenDialog: error %X\n", hr); - } - } else if ((hr & 0xFFFF) != ERROR_CANCELLED) { - // If it's not a user cancel, assume the dialog didn't show and fallback - uprintf("Could not show FileOpenDialog: error %X\n", hr); - goto fallback; - } - IFileOpenDialog_Release(pfod); - dialog_showing--; - return; -fallback: - if (pfod != NULL) { - IFileOpenDialog_Release(pfod); - } - - memset(&bi, 0, sizeof(BROWSEINFOW)); - bi.hwndOwner = hMainDialog; - bi.lpszTitle = utf8_to_wchar(lmprintf(MSG_106)); - bi.lpfn = BrowseInfoCallback; - // BIF_NONEWFOLDERBUTTON = 0x00000200 is unknown on MinGW - bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS | - BIF_DONTGOBELOWDOMAIN | BIF_EDITBOX | 0x00000200; - pidl = SHBrowseForFolderW(&bi); - if (pidl != NULL) { - CoTaskMemFree(pidl); - } - safe_free(bi.lpszTitle); - dialog_showing--; -} - /* * Return the UTF8 path of a file selected through a load or save dialog * All string parameters are UTF-8 @@ -1626,7 +1471,6 @@ void SetFidoCheck(void) // - Powershell being installed // - Rufus running in AppStore mode or update check being enabled // - URL for the script being reachable - // - Windows version being Windows 8.0 or later if ((ReadRegistryKey32(REGKEY_HKLM, "Software\\Microsoft\\PowerShell\\1\\Install") <= 0) && (ReadRegistryKey32(REGKEY_HKLM, "Software\\Microsoft\\PowerShell\\3\\Install") <= 0)) { ubprintf("Notice: The ISO download feature has been deactivated because " @@ -1640,12 +1484,6 @@ void SetFidoCheck(void) return; } - if (WindowsVersion.Version < WINDOWS_8) { - ubprintf("Notice: The ISO download feature has been deactivated because " - "your version of Windows is too old."); - return; - } - CreateThread(NULL, 0, CheckForFidoThread, NULL, 0, NULL); } diff --git a/src/ui.c b/src/ui.c index 103adf13..09d158ce 100644 --- a/src/ui.c +++ b/src/ui.c @@ -1053,7 +1053,7 @@ void CreateAdditionalControls(HWND hDlg) hDll = GetLibraryHandle("ComDlg32"); hIconDown = (HICON)LoadImage(hDll, MAKEINTRESOURCE(577), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); hIconUp = (HICON)LoadImage(hDll, MAKEINTRESOURCE(578), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); - // Fallback to using Shell32 if we can't locate the icons we want in ComDlg32 + // Fallback to using Shell32 if we can't locate the icons we want in ComDlg32 (Windows 8) hDll = GetLibraryHandle("Shell32"); if (hIconUp == NULL) hIconUp = (HICON)LoadImage(hDll, MAKEINTRESOURCE(16749), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); @@ -1082,9 +1082,6 @@ void CreateAdditionalControls(HWND hDlg) GetWindowRect(GetDlgItem(hDlg, IDC_ADVANCED_DRIVE_PROPERTIES), &rc); MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); SendMessage(hAdvancedDeviceToolbar, TB_GETIDEALSIZE, (WPARAM)FALSE, (LPARAM)&sz); - // Yeah, so, like, TB_GETIDEALSIZE totally super doesn't work on Windows 7, for low zoom factor and when compiled with MSVC... - if (sz.cx < 16) - sz.cx = fw; SetWindowPos(hAdvancedDeviceToolbar, hTargetSystem, rc.left + toolbar_dx, rc.top, sz.cx, rc.bottom - rc.top, 0); SetAccessibleName(hAdvancedDeviceToolbar, lmprintf(MSG_119)); @@ -1104,8 +1101,6 @@ void CreateAdditionalControls(HWND hDlg) GetWindowRect(GetDlgItem(hDlg, IDC_ADVANCED_FORMAT_OPTIONS), &rc); MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); SendMessage(hAdvancedFormatToolbar, TB_GETIDEALSIZE, (WPARAM)FALSE, (LPARAM)&sz); - if (sz.cx < 16) - sz.cx = fw; SetWindowPos(hAdvancedFormatToolbar, hClusterSize, rc.left + toolbar_dx, rc.top, sz.cx, rc.bottom - rc.top, 0); SetAccessibleName(hAdvancedFormatToolbar, lmprintf(MSG_120));