diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 91600e51..b9010753 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -49,7 +49,9 @@ jobs: msbuild-architecture: x64 - name: Build with Coverity - run: cov-build.exe --dir cov-int msbuild ${{ env.SOLUTION_FILE_PATH }} /m /p:Configuration=${{ env.BUILD_CONFIGURATION }},Platform=${{ env.TARGET_PLATFORM }} + run: | + cov-configure --msvc + cov-build.exe --dir cov-int msbuild ${{ env.SOLUTION_FILE_PATH }} /m /p:Configuration=${{ env.BUILD_CONFIGURATION }},Platform=${{ env.TARGET_PLATFORM }} - name: Publish Coverity artifacts uses: actions/upload-artifact@v2 diff --git a/.github/workflows/vs2022.yml b/.github/workflows/vs2022.yml index 488bc216..df98e554 100644 --- a/.github/workflows/vs2022.yml +++ b/.github/workflows/vs2022.yml @@ -80,5 +80,5 @@ jobs: uses: actions/upload-artifact@v2 if: ${{ github.event_name == 'push' }} with: - name: VS2019 + name: VS2022 path: ./*.exe diff --git a/.vs/rufus.vcxproj b/.vs/rufus.vcxproj index e835f758..792d4688 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;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;%(AdditionalDependencies) + advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;%(AdditionalDependencies) RequireAdministrator true Windows MachineX86 - advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;setupapi.dll;shell32.dll;shlwapi.dll;wintrust.dll;%(DelayLoadDLLs) + advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;setupapi.dll;shell32.dll;shlwapi.dll;%(DelayLoadDLLs) _UNICODE;UNICODE;RUFUS_LOC;%(PreprocessorDefinitions) @@ -158,12 +158,12 @@ /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;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;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;setupapi.dll;shell32.dll;shlwapi.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs) _UNICODE;UNICODE;RUFUS_LOC;%(PreprocessorDefinitions) @@ -185,12 +185,12 @@ /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;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;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;setupapi.dll;shell32.dll;shlwapi.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs) _UNICODE;UNICODE;RUFUS_LOC;%(PreprocessorDefinitions) @@ -217,12 +217,12 @@ /utf-8 $(ExternalCompilerOptions) %(AdditionalOptions) - advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;wintrust.lib;%(AdditionalDependencies) + advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;%(AdditionalDependencies) RequireAdministrator true Windows MachineX64 - advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;setupapi.dll;shell32.dll;shlwapi.dll;wintrust.dll;%(DelayLoadDLLs) + advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;setupapi.dll;shell32.dll;shlwapi.dll;%(DelayLoadDLLs) _UNICODE;UNICODE;RUFUS_LOC;%(PreprocessorDefinitions) @@ -244,12 +244,13 @@ true - 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) + advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;%(AdditionalDependencies) RequireAdministrator false Windows MachineX86 /BREPRO %(AdditionalOptions) + advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;setupapi.dll;shell32.dll;shlwapi.dll;%(DelayLoadDLLs) _UNICODE;UNICODE;RUFUS_LOC;%(PreprocessorDefinitions) @@ -271,12 +272,13 @@ true - 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) + advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.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;setupapi.dll;shell32.dll;shlwapi.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs) _UNICODE;UNICODE;RUFUS_LOC;%(PreprocessorDefinitions) @@ -300,12 +302,13 @@ true - 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) + advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.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;setupapi.dll;shell32.dll;shlwapi.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs) _UNICODE;UNICODE;RUFUS_LOC;%(PreprocessorDefinitions) @@ -332,12 +335,13 @@ true - 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) + advapi32.lib;comctl32.lib;comdlg32.lib;crypt32.lib;gdi32.lib;ole32.lib;setupapi.lib;shell32.lib;shlwapi.lib;%(AdditionalDependencies) RequireAdministrator false Windows MachineX64 /BREPRO %(AdditionalOptions) + advapi32.dll;comctl32.dll;comdlg32.dll;crypt32.dll;gdi32.dll;ole32.dll;setupapi.dll;shell32.dll;shlwapi.dll;%(DelayLoadDLLs) _UNICODE;UNICODE;RUFUS_LOC;%(PreprocessorDefinitions) diff --git a/ChangeLog.txt b/ChangeLog.txt index 046d7878..624746bc 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,12 @@ +o Version 3.18 (2022.03.11) + Fix DLL sideloading vulnerabilities + Fix ISO → ESP creation when running on Windows 11 + Fix an issue when detecting network connectivity when the DHCP service is disabled + Update FreeDOS to version 1.3 + Add bypass of Windows 11 restrictions for in-place upgrades + Add Miracle Linux 8 to the list of Red Hat exceptions + Other internal fixes and improvements + o Version 3.17 (2021.10.23) [BUGFIX RELEASE] Fix MBR not being properly cleared Fix commandline hogger not being deleted on exit diff --git a/configure b/configure index 3ea2c16d..ba858bb7 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for rufus 3.18. +# Generated by GNU Autoconf 2.71 for rufus 3.19. # # Report bugs to . # @@ -611,8 +611,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='rufus' PACKAGE_TARNAME='rufus' -PACKAGE_VERSION='3.18' -PACKAGE_STRING='rufus 3.18' +PACKAGE_VERSION='3.19' +PACKAGE_STRING='rufus 3.19' PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues' PACKAGE_URL='https://rufus.ie' @@ -1268,7 +1268,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures rufus 3.18 to adapt to many kinds of systems. +\`configure' configures rufus 3.19 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1335,7 +1335,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of rufus 3.18:";; + short | recursive ) echo "Configuration of rufus 3.19:";; esac cat <<\_ACEOF @@ -1427,7 +1427,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -rufus configure 3.18 +rufus configure 3.19 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -1503,7 +1503,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by rufus $as_me 3.18, which was +It was created by rufus $as_me 3.19, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -2767,7 +2767,7 @@ fi # Define the identity of the package. PACKAGE='rufus' - VERSION='3.18' + VERSION='3.19' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -5205,7 +5205,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by rufus $as_me 3.18, which was +This file was extended by rufus $as_me 3.19, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5261,7 +5261,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -rufus config.status 3.18 +rufus config.status 3.19 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 298d635b..32f061de 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([rufus], [3.18], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.ie]) +AC_INIT([rufus], [3.19], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.ie]) AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies]) AC_CONFIG_SRCDIR([src/rufus.c]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/res/appstore/packme.cmd b/res/appstore/packme.cmd index fd0c5ff8..0a57c945 100644 --- a/res/appstore/packme.cmd +++ b/res/appstore/packme.cmd @@ -25,7 +25,6 @@ del /q *.map >NUL 2>&1 set WDK_PATH=C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64 set ZIP_PATH=C:\Program Files\7-Zip set SIGNATURE_SHA1=3dbc3a2a0e9ce8803b422cfdbc60acd33164965d -set MSBUILD_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin set MANIFEST=AppxManifest.xml set ARCHS=x86 x64 arm arm64 set DEFAULT_SCALE=200 diff --git a/res/freedos/COMMAND.COM b/res/freedos/COMMAND.COM index 4a301682..f56ace7e 100644 Binary files a/res/freedos/COMMAND.COM and b/res/freedos/COMMAND.COM differ diff --git a/res/freedos/DISPLAY.EXE b/res/freedos/DISPLAY.EXE index 9a0d98c9..0b6b388d 100644 Binary files a/res/freedos/DISPLAY.EXE and b/res/freedos/DISPLAY.EXE differ diff --git a/res/freedos/KERNEL.SYS b/res/freedos/KERNEL.SYS index 9ce38b19..6b524a99 100644 Binary files a/res/freedos/KERNEL.SYS and b/res/freedos/KERNEL.SYS differ diff --git a/res/freedos/readme.txt b/res/freedos/readme.txt index 44048d09..4064bc18 100644 --- a/res/freedos/readme.txt +++ b/res/freedos/readme.txt @@ -1,21 +1,11 @@ -o KERNEL.SYS was taken from KERNL386.SYS in FreeDOS Kernel 2042: - http://ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/base/kernel.zip +All of the executables found in this repository where extracted from: +https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.3/official/FD13-FullUSB.zip + +o COMMAND.COM was extracted from packages\base\freecom.zip +o DISPLAY.EXE was extracted from packages\base\display.zip +o The EGA[#].CPX files were extracted from packages\base\cpidos.zip +o KERNEL.SYS was taken from packages\base\kernel.zip (KERNL386.SYS) It was modified to have FORCELBA enabled (byte offset 0x0D set to 0x01) - -o COMMAND.COM was extracted from FreeCom 0.84 pre 2: - http://ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/base/command.zip - -o The EGA files were extracted from CPI (Code Page Information) Package 3.0: - http://ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/base/cpidos.zip - -o DISPLAY.EXE was extracted from Display 0.13b: - http://ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/base/display.zip - -o KEYB.EXE was extracted from Keyb 2.01: - http://ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/base/keyb.zip - -o The keyboard layouts (KEYB___.SYS) were extracted from Keyb Layouts 3.1: - http://ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/base/keyb_lay.zip - -o MODE.COM was extracted from Mode 2015-11-25: - http://ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/base/mode.zip +o KEYB.EXE was extracted from packages\base\keyb.zip +o The KEYB###.SYS keyboard layouts were extracted from packages\base\keyb_lay.zip +o MODE.COM was extracted from packages\base\mode.zip diff --git a/res/loc/po/ja-JP.po b/res/loc/po/ja-JP.po index 056c3358..9256e8b2 100644 --- a/res/loc/po/ja-JP.po +++ b/res/loc/po/ja-JP.po @@ -1166,13 +1166,13 @@ msgstr "互換性のないドライブが検出されました。" #. #. Used in MSG_235 msgid "Write pass" -msgstr "書き込みをパスしました。" +msgstr "書き込み中" #. • MSG_192 #. #. Used in MSG_235 msgid "Read pass" -msgstr "読み出しをパスしました。" +msgstr "読み出し中" #. • MSG_193 msgid "Downloaded %s" @@ -1385,7 +1385,7 @@ msgstr "Syslinux %s をインストール中..." #. Bad blocks status. Example: "Bad Blocks: Write pass 1/2 - 12.34% (0/0/1 errors)" #. See MSG_191 & MSG_192 for "Write pass"/"Read pass" translation. msgid "Bad Blocks: %s %d/%d - %0.2f%% (%d/%d/%d errors)" -msgstr "不良ブロック: %s %d/%d - %0.2f%% (エラー: %d/%d/%d)" +msgstr "不良ブロック: %s %d/%d パス - %0.2f%% (エラー: %d/%d/%d)" #. • MSG_236 msgid "Bad Blocks: Testing with random pattern" diff --git a/res/loc/rufus.loc b/res/loc/rufus.loc index 4fe4bd63..992776a1 100644 --- a/res/loc/rufus.loc +++ b/res/loc/rufus.loc @@ -6778,8 +6778,8 @@ t MSG_187 "選択したブート設定には無効なイメージです。" t MSG_188 "現在選択中のイメージとブート設定が一致しません。別のイメージを使うか、他のブート設定を使用してください。" t MSG_189 "この ISO は選択中のファイル システムと互換性がありません。" t MSG_190 "互換性のないドライブが検出されました。" -t MSG_191 "書き込みをパスしました。" -t MSG_192 "読み出しをパスしました。" +t MSG_191 "書き込み中" +t MSG_192 "読み出し中" t MSG_193 "%s をダウンロードしました。" t MSG_194 "%s はダウンロードできませんでした。" t MSG_195 "内蔵している %s ファイルを使用します。" @@ -6820,7 +6820,7 @@ t MSG_231 "ISO ファイルをコピー中: %s" t MSG_232 "Win7 EFI ブート セットアップ中 (%s)..." t MSG_233 "最終処理中です。もう間もなく終わります..." t MSG_234 "Syslinux %s をインストール中..." -t MSG_235 "不良ブロック: %s %d/%d - %0.2f%% (エラー: %d/%d/%d)" +t MSG_235 "不良ブロック: %s %d/%d パス - %0.2f%% (エラー: %d/%d/%d)" t MSG_236 "不良ブロック: ランダムパターンでテスト" t MSG_237 "不良ブロック: パターン 0x%02X でテスト" t MSG_238 "パーティション分割中 (%s)..." diff --git a/src/Makefile.am b/src/Makefile.am index 1b08f20b..61a3ed58 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -17,4 +17,4 @@ rufus_CFLAGS = -I$(srcdir)/ms-sys/inc -I$(srcdir)/syslinux/libfat -I$(srcdir)/sy rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows # Note: Do not link with -lversion as this will results in DLL sideloading issue. See https://github.com/pbatard/rufus/pull/1838 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 -lcomdlg32 -lcomctl32 -luuid -lpsapi diff --git a/src/Makefile.in b/src/Makefile.in index 5bc99641..42fe058a 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -283,7 +283,7 @@ rufus_CFLAGS = -I$(srcdir)/ms-sys/inc -I$(srcdir)/syslinux/libfat -I$(srcdir)/sy rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows # Note: Do not link with -lversion as this will results in DLL sideloading issue. See https://github.com/pbatard/rufus/pull/1838 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 -lcomdlg32 -lcomctl32 -luuid -lpsapi all: all-recursive diff --git a/src/dos.c b/src/dos.c index 245890fe..010c8692 100644 --- a/src/dos.c +++ b/src/dos.c @@ -65,7 +65,6 @@ typedef struct _TIME_FIELDS { short Minute; short Second; short Milliseconds; - short Weekday; } TIME_FIELDS, *PTIME_FIELDS; #define ARGUMENT_PRESENT(ArgumentPointer) \ diff --git a/src/drive.c b/src/drive.c index f1079b96..778c67d7 100644 --- a/src/drive.c +++ b/src/drive.c @@ -29,8 +29,8 @@ #include #if !defined(__MINGW32__) #include -#endif #include +#endif #include "rufus.h" #include "missing.h" @@ -1487,6 +1487,43 @@ BOOL AnalyzePBR(HANDLE hLogicalVolume) return TRUE; } +/* + * This call returns the offset of the first ESP partition found + * on the relevant drive, or 0ULL if no ESP was found. + */ +uint64_t GetEspOffset(DWORD DriveIndex) +{ + uint64_t ret = 0ULL; + BOOL r; + HANDLE hPhysical; + DWORD size, i; + BYTE layout[4096] = { 0 }; + PDRIVE_LAYOUT_INFORMATION_EX DriveLayout = (PDRIVE_LAYOUT_INFORMATION_EX)(void*)layout; + + hPhysical = GetPhysicalHandle(DriveIndex, FALSE, TRUE, TRUE); + if (hPhysical == INVALID_HANDLE_VALUE) + return FALSE; + + r = DeviceIoControl(hPhysical, IOCTL_DISK_GET_DRIVE_LAYOUT_EX, + NULL, 0, layout, sizeof(layout), &size, NULL); + if (!r || size <= 0) { + uprintf("Could not get layout for drive 0x%02x: %s", DriveIndex, WindowsErrorString()); + goto out; + } + + for (i = 0; i < DriveLayout->PartitionCount; i++) { + if (((DriveLayout->PartitionStyle == PARTITION_STYLE_MBR) && (DriveLayout->PartitionEntry[i].Mbr.PartitionType == 0xef)) || + ((DriveLayout->PartitionStyle == PARTITION_STYLE_GPT) && CompareGUID(&DriveLayout->PartitionEntry[i].Gpt.PartitionType, &PARTITION_GENERIC_ESP))) { + ret = DriveLayout->PartitionEntry[i].StartingOffset.QuadPart; + break; + } + } + +out: + safe_closehandle(hPhysical); + return ret; +} + static BOOL StoreEspInfo(GUID* guid) { uint8_t j; @@ -1531,12 +1568,23 @@ static BOOL ClearEspInfo(uint8_t index) BOOL ToggleEsp(DWORD DriveIndex, uint64_t PartitionOffset) { char *volume_name, mount_point[] = DEFAULT_ESP_MOUNT_POINT; - BOOL r, ret = FALSE, found = FALSE; + int i, j, esp_index = -1; + BOOL r, ret = FALSE, delete_data = FALSE; HANDLE hPhysical; - DWORD size, i, j, esp_index = 0; - BYTE layout[4096] = { 0 }; - GUID* guid; + DWORD dl_size, size, offset; + BYTE layout[4096] = { 0 }, buf[512]; + GUID *guid = NULL, *stored_guid = NULL, mbr_guid; PDRIVE_LAYOUT_INFORMATION_EX DriveLayout = (PDRIVE_LAYOUT_INFORMATION_EX)(void*)layout; + typedef struct { + const uint8_t mbr_type; + const uint8_t magic[8]; + } fat_mbr_type; + const fat_mbr_type fat_mbr_types[] = { + { 0x0b, { 'F', 'A', 'T', ' ', ' ', ' ', ' ', ' ' } }, + { 0x01, { 'F', 'A', 'T', '1', '2', ' ', ' ', ' ' } }, + { 0x0e, { 'F', 'A', 'T', '1', '6', ' ', ' ', ' ' } }, + { 0x0c, { 'F', 'A', 'T', '3', '2', ' ', ' ', ' ' } }, + }; if ((PartitionOffset == 0) && (nWindowsVersion < WINDOWS_10)) { uprintf("ESP toggling is only available for Windows 10 or later"); @@ -1547,86 +1595,113 @@ BOOL ToggleEsp(DWORD DriveIndex, uint64_t PartitionOffset) if (hPhysical == INVALID_HANDLE_VALUE) return FALSE; - r = DeviceIoControl(hPhysical, IOCTL_DISK_GET_DRIVE_LAYOUT_EX, - NULL, 0, layout, sizeof(layout), &size, NULL); - if (!r || size <= 0) { + r = DeviceIoControl(hPhysical, IOCTL_DISK_GET_DRIVE_LAYOUT_EX, NULL, 0, layout, sizeof(layout), &dl_size, NULL); + if (!r || dl_size <= 0) { uprintf("Could not get layout for drive 0x%02x: %s", DriveIndex, WindowsErrorString()); goto out; } - // TODO: Handle MBR - if (DriveLayout->PartitionStyle != PARTITION_STYLE_GPT) { - uprintf("ESP toggling is only available for GPT drives"); - goto out; - } if (PartitionOffset == 0) { // See if the current drive contains an ESP - for (i = 0, j = 0; i < DriveLayout->PartitionCount; i++) { - if (CompareGUID(&DriveLayout->PartitionEntry[i].Gpt.PartitionType, &PARTITION_GENERIC_ESP)) { + for (i = 0; i < (int)DriveLayout->PartitionCount; i++) { + if (((DriveLayout->PartitionStyle == PARTITION_STYLE_MBR) && (DriveLayout->PartitionEntry[i].Mbr.PartitionType == 0xef)) || + ((DriveLayout->PartitionStyle == PARTITION_STYLE_GPT) && CompareGUID(&DriveLayout->PartitionEntry[i].Gpt.PartitionType, &PARTITION_GENERIC_ESP))) { esp_index = i; - j++; + break; } } - if (j > 1) { - uprintf("ESP toggling is not available for drives with more than one ESP"); - goto out; - } - if (j == 1) { + if (esp_index >= 0) { // ESP -> Basic Data - i = esp_index; - uprintf("ESP name: '%S'", DriveLayout->PartitionEntry[i].Gpt.Name); - if (!StoreEspInfo(&DriveLayout->PartitionEntry[i].Gpt.PartitionId)) { + if (DriveLayout->PartitionStyle == PARTITION_STYLE_GPT) { + uprintf("ESP name: '%S'", DriveLayout->PartitionEntry[esp_index].Gpt.Name); + guid = &DriveLayout->PartitionEntry[esp_index].Gpt.PartitionId; + } else { + // For MBR we create a GUID from the disk signature and the offset + mbr_guid.Data1 = DriveLayout->Mbr.Signature; + mbr_guid.Data2 = 0; mbr_guid.Data3 = 0; + *((uint64_t*)&mbr_guid.Data4) = DriveLayout->PartitionEntry[i].StartingOffset.QuadPart; + guid = &mbr_guid; + } + if (!StoreEspInfo(guid)) { uprintf("ESP toggling data could not be stored"); goto out; } - DriveLayout->PartitionEntry[i].Gpt.PartitionType = PARTITION_MICROSOFT_DATA; - } else { - // Basic Data -> ESP - for (j = 1; j <= MAX_ESP_TOGGLE; j++) { - guid = GetEspGuid((uint8_t)j); - if (guid != NULL) { - for (i = 0; i < DriveLayout->PartitionCount; i++) { - if (CompareGUID(guid, &DriveLayout->PartitionEntry[i].Gpt.PartitionId)) { - found = TRUE; - break; + if (DriveLayout->PartitionStyle == PARTITION_STYLE_GPT) { + DriveLayout->PartitionEntry[esp_index].Gpt.PartitionType = PARTITION_MICROSOFT_DATA; + } else if (DriveLayout->PartitionStyle == PARTITION_STYLE_MBR) { + // Default to FAT32 (non LBA) if we can't determine anything better + DriveLayout->PartitionEntry[esp_index].Mbr.PartitionType = 0x0b; + // Now detect if we're dealing with FAT12/16/32 + if (SetFilePointerEx(hPhysical, DriveLayout->PartitionEntry[esp_index].StartingOffset, NULL, FILE_BEGIN) && + ReadFile(hPhysical, buf, 512, &size, NULL) && size == 512) { + for (offset = 0x36; offset <= 0x52; offset += 0x1c) { + for (i = 0; i < ARRAYSIZE(fat_mbr_types); i++) { + if (memcmp(&buf[offset], fat_mbr_types[i].magic, 8) == 0) { + DriveLayout->PartitionEntry[esp_index].Mbr.PartitionType = fat_mbr_types[i].mbr_type; + break; + } + } + } + } + } + } else { + // Basic Data -> ESP + for (i = 1; i <= MAX_ESP_TOGGLE && esp_index < 0; i++) { + stored_guid = GetEspGuid((uint8_t)i); + if (stored_guid != NULL) { + for (j = 0; j < (int)DriveLayout->PartitionCount && esp_index < 0; j++) { + if (DriveLayout->PartitionStyle == PARTITION_STYLE_GPT) { + guid = &DriveLayout->PartitionEntry[j].Gpt.PartitionId; + } else if (DriveLayout->PartitionStyle == PARTITION_STYLE_MBR) { + mbr_guid.Data1 = DriveLayout->Mbr.Signature; + mbr_guid.Data2 = 0; mbr_guid.Data3 = 0; + *((uint64_t*)&mbr_guid.Data4) = DriveLayout->PartitionEntry[j].StartingOffset.QuadPart; + guid = &mbr_guid; + } + if (CompareGUID(stored_guid, guid)) { + esp_index = j; + delete_data = TRUE; + if (DriveLayout->PartitionStyle == PARTITION_STYLE_GPT) + DriveLayout->PartitionEntry[esp_index].Gpt.PartitionType = PARTITION_GENERIC_ESP; + else if (DriveLayout->PartitionStyle == PARTITION_STYLE_MBR) + DriveLayout->PartitionEntry[esp_index].Mbr.PartitionType = 0xef; } } - if (found) - break; } } - if (j > MAX_ESP_TOGGLE) - goto out; - DriveLayout->PartitionEntry[i].Gpt.PartitionType = PARTITION_GENERIC_ESP; } } else { - for (i = 0, j = 0; i < DriveLayout->PartitionCount; i++) { + for (i = 0; i < (int)DriveLayout->PartitionCount; i++) { if (DriveLayout->PartitionEntry[i].StartingOffset.QuadPart == PartitionOffset) { - DriveLayout->PartitionEntry[i].Gpt.PartitionType = PARTITION_GENERIC_ESP; + esp_index = i; + if (DriveLayout->PartitionStyle == PARTITION_STYLE_GPT) + DriveLayout->PartitionEntry[esp_index].Gpt.PartitionType = PARTITION_GENERIC_ESP; + else if (DriveLayout->PartitionStyle == PARTITION_STYLE_MBR) + DriveLayout->PartitionEntry[esp_index].Mbr.PartitionType = 0xef; break; } } } - if (i >= DriveLayout->PartitionCount) { + if (esp_index < 0) { uprintf("No partition to toggle"); goto out; } - DriveLayout->PartitionEntry[i].RewritePartition = TRUE; // Just in case - r = DeviceIoControl(hPhysical, IOCTL_DISK_SET_DRIVE_LAYOUT_EX, (BYTE*)DriveLayout, size, NULL, 0, &size, NULL); + DriveLayout->PartitionEntry[esp_index].RewritePartition = TRUE; // Just in case + r = DeviceIoControl(hPhysical, IOCTL_DISK_SET_DRIVE_LAYOUT_EX, (BYTE*)DriveLayout, dl_size, NULL, 0, &dl_size, NULL); if (!r) { uprintf("Could not set drive layout: %s", WindowsErrorString()); goto out; } RefreshDriveLayout(hPhysical); if (PartitionOffset == 0) { - if (CompareGUID(&DriveLayout->PartitionEntry[i].Gpt.PartitionType, &PARTITION_GENERIC_ESP)) { + if (delete_data) { // We successfully reverted ESP from Basic Data -> Delete stored ESP info ClearEspInfo((uint8_t)j); } else if (!IsDriveLetterInUse(*mount_point)) { // We successfully switched ESP to Basic Data -> Try to mount it - volume_name = GetLogicalName(DriveIndex, DriveLayout->PartitionEntry[i].StartingOffset.QuadPart, TRUE, FALSE); + volume_name = GetLogicalName(DriveIndex, DriveLayout->PartitionEntry[esp_index].StartingOffset.QuadPart, TRUE, FALSE); IGNORE_RETVAL(MountVolume(mount_point, volume_name)); free(volume_name); } @@ -1639,7 +1714,8 @@ out: } // This is a crude attempt at detecting file systems through their superblock magic. -// Note that we only attempt to detect the file systems that Rufus can actually format. +// Note that we only attempt to detect the file systems that Rufus can format as +// well as a couple other maintsream ones. const char* GetFsName(HANDLE hPhysical, LARGE_INTEGER StartingOffset) { typedef struct { @@ -1651,11 +1727,11 @@ const char* GetFsName(HANDLE hPhysical, LARGE_INTEGER StartingOffset) { "NTFS", { 'N', 'T', 'F', 'S', ' ', ' ', ' ', ' ' } }, { "ReFS", { 'R', 'e', 'F', 'S', 0, 0, 0, 0 } } }; - const win_fs_type fat_fs_types[] = { - { "FAT", { 'F', 'A', 'T', ' ', ' ', ' ', ' ', ' ' } }, - { "FAT12", { 'F', 'A', 'T', '1', '2', ' ', ' ', ' ' } }, - { "FAT16", { 'F', 'A', 'T', '1', '6', ' ', ' ', ' ' } }, - { "FAT32", { 'F', 'A', 'T', '3', '2', ' ', ' ', ' ' } }, + const win_fs_type fat_fs_types[] = { + { "FAT", { 'F', 'A', 'T', ' ', ' ', ' ', ' ', ' ' } }, + { "FAT12", { 'F', 'A', 'T', '1', '2', ' ', ' ', ' ' } }, + { "FAT16", { 'F', 'A', 'T', '1', '6', ' ', ' ', ' ' } }, + { "FAT32", { 'F', 'A', 'T', '3', '2', ' ', ' ', ' ' } }, }; const uint32_t ext_feature[3][3] = { // feature_compat @@ -1713,7 +1789,7 @@ const char* GetFsName(HANDLE hPhysical, LARGE_INTEGER StartingOffset) goto out; } // Switch to offset 1024 - memset(buf, sector_size, 0); + memset(buf, 0, sector_size); StartingOffset.QuadPart += 0x0400ULL; if (!SetFilePointerEx(hPhysical, StartingOffset, NULL, FILE_BEGIN)) goto out; @@ -1748,7 +1824,7 @@ const char* GetFsName(HANDLE hPhysical, LARGE_INTEGER StartingOffset) // 4. Try to detect UDF through by looking for a "BEA01\0" string at offset 0xC001 // NB: This is not thorough UDF detection but good enough for our purpose. // For the full specs see: http://www.osta.org/specs/pdf/udf260.pdf - memset(buf, sector_size, 0); + memset(buf, 0, sector_size); StartingOffset.QuadPart += 0x8000ULL - 0x0400ULL; if (!SetFilePointerEx(hPhysical, StartingOffset, NULL, FILE_BEGIN)) goto out; diff --git a/src/drive.h b/src/drive.h index bb17929c..1a6be225 100644 --- a/src/drive.h +++ b/src/drive.h @@ -94,7 +94,12 @@ typedef struct _FILE_FS_DEVICE_INFORMATION { ULONG Characteristics; } FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION; #else -/* MinGW is currently missing all the VDS COM stuff */ +/* + * MinGW is currently missing most of the VDS COM stuff. + * Oh, and MinGW's vds.h is screwed up unless you define the following: + */ +#define VDS_LUN_INFORMATION void +#define __vdslun_h__ #include typedef interface IVdsServiceLoader IVdsServiceLoader; typedef interface IVdsService IVdsService; @@ -413,4 +418,5 @@ BOOL CyclePort(int index); int CycleDevice(int index); BOOL RefreshLayout(DWORD DriveIndex); BOOL GetOpticalMedia(IMG_SAVE* img_save); +uint64_t GetEspOffset(DWORD DriveIndex); BOOL ToggleEsp(DWORD DriveIndex, uint64_t PartitionOffset); diff --git a/src/format.c b/src/format.c index d77e2e75..fde30967 100644 --- a/src/format.c +++ b/src/format.c @@ -31,7 +31,9 @@ #include #include #include +#if !defined(__MINGW32__) #include +#endif #include "rufus.h" #include "missing.h" @@ -1870,6 +1872,8 @@ DWORD WINAPI FormatThread(void* param) char drive_letters[27], fs_name[32], label[64]; char logfile[MAX_PATH], *userdir; char efi_dst[] = "?:\\efi\\boot\\bootx64.efi"; + char appraiserres_dll_src[] = "?:\\sources\\appraiserres.dll"; + char appraiserres_dll_dst[] = "?:\\sources\\appraiserres.bak"; char kolibri_dst[] = "?:\\MTLD_F32"; char grub4dos_dst[] = "?:\\grldr"; @@ -2060,23 +2064,6 @@ DWORD WINAPI FormatThread(void* param) // Write an image file if ((boot_type == BT_IMAGE) && write_as_image) { WriteDrive(hPhysicalDrive, FALSE); - - // Trying to mount accessible partitions after writing an image leads to the - // creation of the infamous 'System Volume Information' folder on ESPs, which - // in turn leads to checksum errors for Ubuntu's boot/grub/efi.img (that maps - // to the Ubuntu ESP). So we only call the code below for Ventoy's vtsi images. - if (img_report.compression_type == BLED_COMPRESSION_VTSI) { - // If the image contains a partition we might be able to access, try to re-mount it - safe_unlockclose(hPhysicalDrive); - safe_unlockclose(hLogicalVolume); - Sleep(200); - WaitForLogical(DriveIndex, 0); - if (GetDrivePartitionData(SelectedDrive.DeviceNumber, fs_name, sizeof(fs_name), TRUE)) { - volume_name = GetLogicalName(DriveIndex, 0, TRUE, TRUE); - if ((volume_name != NULL) && (MountVolume(drive_name, volume_name))) - uprintf("Remounted %s as %c:", volume_name, toupper(drive_name[0])); - } - } goto out; } @@ -2358,6 +2345,18 @@ DWORD WINAPI FormatThread(void* param) FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH); } if (ComboBox_GetCurItemData(hImageOption) == IMOP_WIN_EXTENDED) { + // Create a backup of sources\appraiserres.dll and then create an empty file to + // allow in-place upgrades without TPM/SB. Note that we need to create an empty, + // appraiserres.dll otherwise setup.exe extracts its own. + appraiserres_dll_src[0] = drive_name[0]; + appraiserres_dll_dst[0] = drive_name[0]; + uprintf("Renaming: '%s' → '%s'", appraiserres_dll_src, appraiserres_dll_dst); + if (!MoveFileExU(appraiserres_dll_src, appraiserres_dll_dst, MOVEFILE_REPLACE_EXISTING)) + uprintf(" Rename failed: %s", WindowsErrorString()); + else + CloseHandle(CreateFileU(appraiserres_dll_src, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, + NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)); + // Now patch for boot-time TPM/SB checks. if (!RemoveWindows11Restrictions(drive_name[0])) FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_PATCH); } @@ -2387,13 +2386,27 @@ out: AltUnmountVolume(volume_name, TRUE); else safe_free(volume_name); - if ((boot_type == BT_IMAGE) && write_as_image) { - PrintInfo(0, MSG_320, lmprintf(MSG_307)); - VdsRescan(VDS_RESCAN_REFRESH, 0, TRUE); - } safe_free(buffer); safe_unlockclose(hLogicalVolume); safe_unlockclose(hPhysicalDrive); // This can take a while + if ((boot_type == BT_IMAGE) && write_as_image) { + PrintInfo(0, MSG_320, lmprintf(MSG_307)); + Sleep(200); + VdsRescan(VDS_RESCAN_REFRESH, 0, TRUE); + // Trying to mount accessible partitions after writing an image leads to the + // creation of the infamous 'System Volume Information' folder on ESPs, which + // in turn leads to checksum errors for Ubuntu's boot/grub/efi.img (that maps + // to the Ubuntu ESP). So we only call the code below if there are no ESPs or + // if we're running a Ventoy image. + if ((GetEspOffset(DriveIndex) == 0) || (img_report.compression_type == BLED_COMPRESSION_VTSI)) { + WaitForLogical(DriveIndex, 0); + if (GetDrivePartitionData(SelectedDrive.DeviceNumber, fs_name, sizeof(fs_name), TRUE)) { + volume_name = GetLogicalName(DriveIndex, 0, TRUE, TRUE); + if ((volume_name != NULL) && (MountVolume(drive_name, volume_name))) + uprintf("Remounted %s as %c:", volume_name, toupper(drive_name[0])); + } + } + } if (IS_ERROR(FormatStatus)) { volume_name = GetLogicalName(DriveIndex, partition_offset[PI_MAIN], TRUE, TRUE); if (volume_name != NULL) { diff --git a/src/iso.c b/src/iso.c index c987dc82..93a60566 100644 --- a/src/iso.c +++ b/src/iso.c @@ -1557,6 +1557,7 @@ BOOL DumpFatDir(const char* path, int32_t cluster) } do { + // coverity[-taint_source] dirpos.cluster = libfat_dumpdir(lf_fs, &dirpos, &diritem); if (dirpos.cluster >= 0) { name = wchar_to_utf8(diritem.name); diff --git a/src/mbr_types.h b/src/mbr_types.h index 652a0ef4..caa43738 100644 --- a/src/mbr_types.h +++ b/src/mbr_types.h @@ -165,7 +165,7 @@ mbr_type_t mbr_type[] = { { 0xec, "SkyFS" }, { 0xed, "GPT Hybrid MBR" }, { 0xee, "GPT Protective MBR" }, - { 0xef, "EFI FAT" }, + { 0xef, "EFI System Partition" }, { 0xf0, "PA-RISC Boot" }, { 0xf1, "SpeedStor" }, { 0xf2, "DOS secondary" }, diff --git a/src/net.c b/src/net.c index ee7a71a4..508a62ea 100644 --- a/src/net.c +++ b/src/net.c @@ -57,6 +57,10 @@ static DWORD error_code, fido_len = 0; static BOOL force_update_check = FALSE; static const char* request_headers = "Accept-Encoding: gzip, deflate"; +#if defined(__MINGW32__) +#define INetworkListManager_get_IsConnectedToInternet INetworkListManager_IsConnectedToInternet +#endif + /* * FormatMessage does not handle internet errors * https://docs.microsoft.com/en-us/windows/desktop/wininet/wininet-errors @@ -267,16 +271,18 @@ static HINTERNET GetInternetSession(BOOL bRetry) int i; char agent[64]; BOOL decodingSupport = TRUE; - DWORD dwTimeout = NET_SESSION_TIMEOUT, dwProtocolSupport = HTTP_PROTOCOL_FLAG_HTTP2; + VARIANT_BOOL InternetConnection = VARIANT_FALSE; + DWORD dwFlags, dwTimeout = NET_SESSION_TIMEOUT, dwProtocolSupport = HTTP_PROTOCOL_FLAG_HTTP2; HINTERNET hSession = NULL; HRESULT hr = S_FALSE; INetworkListManager* pNetworkListManager; - NLM_CONNECTIVITY Connectivity = NLM_CONNECTIVITY_DISCONNECTED; PF_TYPE_DECL(WINAPI, HINTERNET, InternetOpenA, (LPCSTR, DWORD, LPCSTR, LPCSTR, DWORD)); PF_TYPE_DECL(WINAPI, BOOL, InternetSetOptionA, (HINTERNET, DWORD, LPVOID, DWORD)); + PF_TYPE_DECL(WINAPI, BOOL, InternetGetConnectedState, (LPDWORD, DWORD)); PF_INIT_OR_OUT(InternetOpenA, WinInet); PF_INIT_OR_OUT(InternetSetOptionA, WinInet); + PF_INIT(InternetGetConnectedState, WinInet); // Create a NetworkListManager Instance to check the network connection IGNORE_RETVAL(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE)); @@ -284,13 +290,20 @@ static HINTERNET GetInternetSession(BOOL bRetry) &IID_INetworkListManager, (LPVOID*)&pNetworkListManager); if (hr == S_OK) { for (i = 0; i <= WRITE_RETRIES; i++) { - hr = INetworkListManager_GetConnectivity(pNetworkListManager, &Connectivity); + hr = INetworkListManager_get_IsConnectedToInternet(pNetworkListManager, &InternetConnection); + // INetworkListManager may fail with ERROR_SERVICE_DEPENDENCY_FAIL if the DHCP service + // is not running, in which case we must fall back to using InternetGetConnectedState(). + // See https://github.com/pbatard/rufus/issues/1801. + if ((hr == HRESULT_FROM_WIN32(ERROR_SERVICE_DEPENDENCY_FAIL)) && (pfInternetGetConnectedState != NULL)) { + InternetConnection = pfInternetGetConnectedState(&dwFlags, 0) ? VARIANT_TRUE : VARIANT_FALSE; + break; + } if (hr == S_OK || !bRetry) break; Sleep(1000); } } - if (Connectivity == NLM_CONNECTIVITY_DISCONNECTED) { + if (InternetConnection == VARIANT_FALSE) { SetLastError(ERROR_INTERNET_DISCONNECTED); goto out; } diff --git a/src/pki.c b/src/pki.c index 251d6cb1..2764d2fa 100644 --- a/src/pki.c +++ b/src/pki.c @@ -1,7 +1,7 @@ /* * Rufus: The Reliable USB Formatting Utility * PKI functions (code signing, etc.) - * Copyright © 2015-2016 Pete Batard + * Copyright © 2015-2022 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 @@ -572,9 +572,11 @@ out: // From https://msdn.microsoft.com/en-us/library/windows/desktop/aa382384.aspx LONG ValidateSignature(HWND hDlg, const char* path) { - LONG r; + LONG r = TRUST_E_SYSTEM_ERROR; WINTRUST_DATA trust_data = { 0 }; WINTRUST_FILE_INFO trust_file = { 0 }; + PF_TYPE_DECL(WINAPI, long, WinVerifyTrustEx, (HWND, GUID*, WINTRUST_DATA*)); + PF_INIT(WinVerifyTrustEx, WinTrust); GUID guid_generic_verify = // WINTRUST_ACTION_GENERIC_VERIFY_V2 { 0xaac56b, 0xcd44, 0x11d0,{ 0x8c, 0xc2, 0x0, 0xc0, 0x4f, 0xc2, 0x95, 0xee } }; char *signature_name; @@ -625,7 +627,8 @@ LONG ValidateSignature(HWND hDlg, const char* path) trust_data.dwUnionChoice = WTD_CHOICE_FILE; trust_data.pFile = &trust_file; - r = WinVerifyTrustEx(INVALID_HANDLE_VALUE, &guid_generic_verify, &trust_data); + if (pfWinVerifyTrustEx != NULL) + r = pfWinVerifyTrustEx(INVALID_HANDLE_VALUE, &guid_generic_verify, &trust_data); safe_free(trust_file.pcwszFilePath); switch (r) { case ERROR_SUCCESS: diff --git a/src/rufus.c b/src/rufus.c index ff72eb2b..a03266b0 100755 --- a/src/rufus.c +++ b/src/rufus.c @@ -1168,7 +1168,8 @@ static void UpdateImage(BOOL update_image_option_only) ComboBox_ResetContent(hImageOption); if (!img_report.is_windows_img) { // Straight install.wim/install.esd only have Windows To Go option - if (img_report.win_version.major == 11) { + // Can't remove restrictions if running on Windows 7 or when running the appstore version + if (nWindowsVersion >= WINDOWS_8 && !appstore_version && img_report.win_version.major == 11) { IGNORE_RETVAL(ComboBox_SetItemData(hImageOption, ComboBox_AddStringU(hImageOption, lmprintf(MSG_322)), IMOP_WIN_STANDARD)); IGNORE_RETVAL(ComboBox_SetItemData(hImageOption, ComboBox_AddStringU(hImageOption, lmprintf(MSG_323)), IMOP_WIN_EXTENDED)); } else { @@ -1267,6 +1268,7 @@ DWORD WINAPI ImageScanThread(LPVOID param) "^OL-8.*", // Oracle Linux 8.x "^RHEL-8.*", // Red Hat 8.x "^Rocky-8.*", // Rocky Linux 8.x + "^MIRACLE-LINUX-8-.*", // MIRACLE LINUX 8.x }; int i, len; uint8_t arch; diff --git a/src/rufus.rc b/src/rufus.rc index 7c87f66c..a87ec5fb 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.18.1867" +CAPTION "Rufus 3.19.1878" 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,18,1867,0 - PRODUCTVERSION 3,18,1867,0 + FILEVERSION 3,19,1878,0 + PRODUCTVERSION 3,19,1878,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.18.1867" + VALUE "FileVersion", "3.19.1878" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2022 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" - VALUE "OriginalFilename", "rufus-3.18.exe" + VALUE "OriginalFilename", "rufus-3.19.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.18.1867" + VALUE "ProductVersion", "3.19.1878" END END BLOCK "VarFileInfo"