1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

Compare commits

...

11 commits
v4.5 ... master

Author SHA1 Message Date
Dmytro Hissa
20881ceea6
[loc] fix the translation of 'cancel' for Ukrainian 2024-07-25 13:32:11 +01:00
Pete Batard
d5302c0bad
[misc] fix Coverity warnings
* Also use a new if_not_assert() construct where possible.
2024-07-19 13:46:42 +01:00
Pete Batard
78608c35fe
[wue] fix TimeZone option not being applied to the right parent
* Closes #2519.
* Also update MinGW's base WINVER to Windows 10.
2024-07-15 17:35:08 +01:00
Mohmed abdel-fattah
9b3c11122b
[misc] reinstate delay-loading of wininet and virtdisk DLLs
* Per #2272 and #1877, MinGW has issues when delay loading libraries, but
  it is possible to apply a workaround to alleviate them, by redefining
  DECLSPEC_IMPORT before including the corresponding headers.
* This is a bit more tricky to accomplish for virtdisk, as MinGW's windows.h
  header does include virtdisk.h on its own (rather than expect a formal
  include as MSVC does), so we have to prevent the virtdisk.h inclusion
  first, by defining a macro, and then apply our workaround.
* Per ea87573f-65ea-44a2-b4bb-ca96c0a136ab%40akeo.ie/#msg58793876
  we are hoping that this should be a temporary workaround and that the root
  cause of the issue will be fixed in binutils.
* Closes #2513.
2024-07-13 17:43:40 +01:00
Pete Batard
10d33c6658
[wue] add TimeZone to regional options replication
* Closes #2499.
2024-07-08 13:56:15 +01:00
Pete Batard
83b1e73062
[dev] add exception for Samsung uSD Card devices
* Closes #2506.
2024-07-08 13:22:37 +01:00
Pete Batard
6d29120b38
[wue] add 'Local' to the list of disallowed local account names
* Closes #2493.
* Also add 'KRBTGT' as it is mentioned at https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/manage/understand-default-user-accounts#default-local-accounts-in-active-directory
  along with 'Administrator' and 'Guest' and is probably disallowed too.
2024-07-08 13:13:21 +01:00
wallrik
7c6dbdc1ce
[msic] update Windows To Go docs link
* Old link is still fine, but we might as well point to the Windows 10 version.
* Closes #2511.
2024-07-08 11:01:47 +01:00
Mark Peek
6f764ab637
[dev] allow the use of FreeBSD bhyve virtual disks
* Closes #2504.
2024-07-08 10:59:48 +01:00
Pete Batard
bdff2dc45c
[core] work around Windows' moronic behaviour for mounted VHDs
* If you attempt to read past the end of a mounted VHD, not only will Windows happily
  return data that doesn't exist (instead of returning End of Disk), but it will also
  corrupt the existing data!
* So, to appease the capricious Windows gods, we now make sure that we never attempt
  to read (or write) past the boundaries of the source or target when writing images.
* This should address the last issue from #2468.
* Also set version to rufus-next and make some small improvement in winio.h.
2024-06-03 12:58:37 +01:00
Dayking Cheng
ae3c65e7f8
[loc] update Chinese Traditional translation to latest 2024-05-26 11:50:42 +01:00
40 changed files with 463 additions and 344 deletions

View file

@ -19,7 +19,7 @@ TARGET := $(word 1,$(subst -, ,$(TUPLE)))
DEF_SUFFIX := $(if $(TARGET:x86_64=),.def,.def64)
.PHONY: all
all: dwmapi-delaylib.lib version-delaylib.lib wintrust-delaylib.lib
all: dwmapi-delaylib.lib version-delaylib.lib virtdisk-delaylib.lib wininet-delaylib.lib wintrust-delaylib.lib
%.def64: %.def
$(AM_V_SED) "s/@.*//" $< >$@

View file

@ -367,7 +367,7 @@ uninstall-am:
.PHONY: all
all: dwmapi-delaylib.lib version-delaylib.lib wintrust-delaylib.lib
all: dwmapi-delaylib.lib version-delaylib.lib virtdisk-delaylib.lib wininet-delaylib.lib wintrust-delaylib.lib
%.def64: %.def
$(AM_V_SED) "s/@.*//" $< >$@

8
.mingw/virtdisk.def Normal file
View file

@ -0,0 +1,8 @@
EXPORTS
AttachVirtualDisk@24
CreateVirtualDisk@36
DetachVirtualDisk@12
GetVirtualDiskInformation@16
GetVirtualDiskPhysicalPath@12
GetVirtualDiskOperationProgress@12
OpenVirtualDisk@24

12
.mingw/wininet.def Normal file
View file

@ -0,0 +1,12 @@
EXPORTS
HttpQueryInfoA@20
HttpOpenRequestA@32
HttpSendRequestA@20
InternetCloseHandle@4
InternetConnectA@32
InternetCrackUrlA@16
InternetGetConnectedState@8
InternetGetLastResponseInfoA@12
InternetOpenA@20
InternetReadFile@16
InternetSetOptionA@16

View file

@ -133,12 +133,12 @@
<AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -162,12 +162,12 @@
<AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\arm</AdditionalLibraryDirectories>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -193,12 +193,12 @@
<AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\arm64</AdditionalLibraryDirectories>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -229,12 +229,12 @@
<AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -260,13 +260,13 @@
<StringPooling>true</StringPooling>
</ClCompile>
<Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalOptions>/BREPRO %(AdditionalOptions)</AdditionalOptions>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -292,13 +292,13 @@
<StringPooling>true</StringPooling>
</ClCompile>
<Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\arm</AdditionalLibraryDirectories>
<AdditionalOptions>/BREPRO %(AdditionalOptions)</AdditionalOptions>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -326,13 +326,13 @@
<StringPooling>true</StringPooling>
</ClCompile>
<Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\arm64</AdditionalLibraryDirectories>
<AdditionalOptions>/BREPRO %(AdditionalOptions)</AdditionalOptions>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -363,13 +363,13 @@
<StringPooling>true</StringPooling>
</ClCompile>
<Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
<AdditionalOptions>/BREPRO %(AdditionalOptions)</AdditionalOptions>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>

22
configure vendored
View file

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for rufus 4.5.
# Generated by GNU Autoconf 2.71 for rufus 4.6.
#
# Report bugs to <https://github.com/pbatard/rufus/issues>.
#
@ -611,8 +611,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='rufus'
PACKAGE_TARNAME='rufus'
PACKAGE_VERSION='4.5'
PACKAGE_STRING='rufus 4.5'
PACKAGE_VERSION='4.6'
PACKAGE_STRING='rufus 4.6'
PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues'
PACKAGE_URL='https://rufus.ie'
@ -1269,7 +1269,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 4.5 to adapt to many kinds of systems.
\`configure' configures rufus 4.6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1336,7 +1336,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of rufus 4.5:";;
short | recursive ) echo "Configuration of rufus 4.6:";;
esac
cat <<\_ACEOF
@ -1428,7 +1428,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
rufus configure 4.5
rufus configure 4.6
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
@ -1504,7 +1504,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 4.5, which was
It was created by rufus $as_me 4.6, 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='4.5'
VERSION='4.6'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@ -4638,7 +4638,7 @@ esac
printf "%s\n" "#define _GNU_SOURCE /**/" >>confdefs.h
AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x601 -D_WIN32_WINNT=0x601 -D_WIN32_IE=0x800"
AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x0A00 -D_WIN32_WINNT=0x0A00 -D_WIN32_IE=0x0A00"
# "-Wl,--nxcompat" to enable DEP (Data Execution Prevention)
# "-Wl,--dynamicbase" to enable ASLR (Address Space Layout Randomization)
AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined -Wl,--nxcompat -Wl,--no-insert-timestamp -Wl,--dynamicbase"
@ -5309,7 +5309,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 4.5, which was
This file was extended by rufus $as_me 4.6, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -5365,7 +5365,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 4.5
rufus config.status 4.6
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"

View file

@ -1,4 +1,4 @@
AC_INIT([rufus], [4.5], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.ie])
AC_INIT([rufus], [4.6], [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])
@ -18,7 +18,7 @@ AC_CHECK_TOOL(WINDRES, windres, :)
AC_C_INLINE
AC_DEFINE([_GNU_SOURCE], [], [Use GNU extensions])
AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x601 -D_WIN32_WINNT=0x601 -D_WIN32_IE=0x800"
AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x0A00 -D_WIN32_WINNT=0x0A00 -D_WIN32_IE=0x0A00"
# "-Wl,--nxcompat" to enable DEP (Data Execution Prevention)
# "-Wl,--dynamicbase" to enable ASLR (Address Space Layout Randomization)
AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined -Wl,--nxcompat -Wl,--no-insert-timestamp -Wl,--dynamicbase"

View file

@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: 4.5\n"
"Report-Msgid-Bugs-To: pete@akeo.ie\n"
"POT-Creation-Date: 2024-05-14 13:59+0300\n"
"PO-Revision-Date: 2024-05-15 21:15+0300\n"
"POT-Creation-Date: 2024-07-23 23:38+0300\n"
"PO-Revision-Date: 2024-07-23 23:42+0300\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: uk_UA\n"
@ -207,7 +207,7 @@ msgid ""
"To continue with this operation, click OK. To quit click CANCEL."
msgstr ""
"УВАГА: ВСІ ДАНІ НА ДИСКУ '%s' БУДУТЬ ЗНИЩЕНІ.\n"
"Для того, щоб продовжити, натисніть ОК. Для виходу натисніть Відмінити."
"Для того, щоб продовжити, натисніть ОК. Для виходу натисніть Скасувати."
#. • MSG_004
msgid "Rufus update policy"
@ -219,7 +219,7 @@ msgstr "Чи хочете ви, щоб Rufus перевіряв оновленн
#. • MSG_007
msgid "Cancel"
msgstr "Відмінити"
msgstr "Скасувати"
#. • MSG_010
msgid "Bad blocks found"
@ -365,7 +365,7 @@ msgstr "Додаток"
#. • MSG_038
msgid "Abort"
msgstr "Відмінити"
msgstr "Скасувати"
#. • MSG_039
msgid "Launch"
@ -768,7 +768,7 @@ msgstr ""
"\n"
"Так як нові версії Syslinux несумісні одна з одною, необхідно, щоб додаткові файли ('ldlinux.sys' та 'ldlinux.bss') були завантажені з інтернету:\n"
"- Виберіть 'Так', щоб завантажити файли з інтернету\n"
"- Виберіть 'Ні', щоб відмінити операцію\n"
"- Виберіть 'Ні', щоб скасувати операцію\n"
"\n"
"Примітка: Файли будуть завантажені в поточний каталог додатку і будуть використовуватися повторно за необхідності."
@ -795,7 +795,7 @@ msgstr ""
"Різні версії завантажувача Grub можуть бути несумісними одна з одною та увімкнення їх усіх не являється можливим. Rufus намагатиметься знайти потрібну версію настановного файла завантажувача Grub ('core.img'), що відповідає версії завантажувача вашого образу:\n"
"- Виберіть 'Так', щоб скачати завантажувальний файл з інтернету\n"
"- Виберіть 'Ні', щоб використовувати версію за замовчуванням із Rufus\n"
"- Виберіть 'Відмінити', щоб відмінити операцію\n"
"- Виберіть 'Скасувати', щоб скасувати операцію\n"
"\n"
"Примітка: Файл буде завантажено в поточний каталог додатку та буде використаний повторно наступного разу. Якщо потрібна версія настановного файла не буде знайдена в інтернеті, то буде використовуватися версія за замовчуванням."

View file

@ -1,9 +1,9 @@
msgid ""
msgstr ""
"Project-Id-Version: 3.22\n"
"Project-Id-Version: 4.5\n"
"Report-Msgid-Bugs-To: pete@akeo.ie\n"
"POT-Creation-Date: 2023-03-09 10:01+0000\n"
"PO-Revision-Date: 2023-03-09 10:01+0000\n"
"POT-Creation-Date: 2024-05-25 18:11+0800\n"
"PO-Revision-Date: 2024-05-25 20:05+0800\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: zh_TW\n"
@ -13,7 +13,7 @@ msgstr ""
"X-Poedit-SourceCharset: UTF-8\n"
"X-Rufus-LanguageName: Chinese Traditional (正體中文)\n"
"X-Rufus-LCID: 0x0404, 0x0c04, 0x1404, 0x7c04\n"
"X-Generator: Poedit 3.2.2\n"
"X-Generator: Poedit 3.4.4\n"
#. • IDD_DIALOG → IDS_DRIVE_PROPERTIES_TXT
msgid "Drive Properties"
@ -54,13 +54,11 @@ msgstr "顯示 USB 外接硬碟"
msgid "Add fixes for old BIOSes (extra partition, align, etc.)"
msgstr "相容性模式"
#. • IDD_DIALOG → IDC_RUFUS_MBR
#. • IDD_DIALOG → IDC_UEFI_MEDIA_VALIDATION
#.
#. 'MBR': See http://en.wikipedia.org/wiki/Master_boot_record
#. Rufus can install it's own custom MBR (the Rufus MBR), which also allows users to
#. specify a custom disk ID for the BIOS. The tooltip for this control is MSG_167.
msgid "Use Rufus MBR with BIOS ID"
msgstr "使用 Rufus MBR 並設定 BIOS ID 為"
#. It is acceptable to drop the "runtime" if you are running out of space
msgid "Enable runtime UEFI media validation"
msgstr "啟用執行階段 UEFI 媒體驗證"
#. • IDD_DIALOG → IDS_FORMAT_OPTIONS_TXT
msgid "Format Options"
@ -391,7 +389,7 @@ msgstr "檔案下載"
#. • MSG_045
msgid "USB Storage Device (Generic)"
msgstr "USB 裝置"
msgstr "USB 儲存裝置"
#. • MSG_046
msgid "%s (Disk %d) [%s]"
@ -417,7 +415,7 @@ msgstr "完成。"
#. • MSG_051
msgid "Undetermined error while formatting."
msgstr "格式化發生不明錯誤。"
msgstr "格式化發生不明錯誤。"
#. • MSG_052
msgid "Cannot use the selected file system for this media."
@ -489,7 +487,7 @@ msgstr "無法分割磁碟。"
#. • MSG_069
msgid "Could not copy files to target drive."
msgstr "無法複製檔案到裝置。"
msgstr "無法複製檔案到目標磁碟。"
#. • MSG_070
msgid "Cancelled by user."
@ -575,7 +573,7 @@ msgstr ""
"開機選單可能因此無法正常運作。\n"
"\n"
"Rufus 可下載新版本來修正問題:\n"
"- 選 '是' 將連網路並下載檔案\n"
"- 選 '是' 將連線到網路並下載檔案\n"
"- 選 '否' 保留原始 ISO 內容\n"
"如果你不知道該如何抉擇,建議選擇 '是'。\n"
"\n"
@ -866,7 +864,7 @@ msgid ""
"You have just created a media that uses the UEFI:NTFS bootloader. Please remember that, to boot this media, YOU MUST DISABLE SECURE BOOT.\n"
"For details on why this is necessary, see the 'More Information' button below."
msgstr ""
"你已建立使用 UEFI:NTFS bootloader 的裝置。如要使用此裝置開機,請記得關閉安全開機。\n"
"你已建立使用 UEFI:NTFS 開機引導程式的裝置。如要使用此裝置開機,請記得關閉安全開機。\n"
"更多資訊請點選底下 '進階說明' 按鈕。"
#. • MSG_130
@ -967,17 +965,17 @@ msgstr "下載 ISO 映像檔"
#. • MSG_150
msgid "Type of computer you plan to use this bootable drive with. It is your responsibility to determine whether your target is of BIOS or UEFI type before you start creating the drive, as it may fail to boot otherwise."
msgstr "你使用此開機磁碟的電腦類型。在建立開機磁碟之前你必須確定該電腦使用 BIOS 或是 UEFI匹配錯誤將可能無法開機。"
msgstr "你使用此開機磁碟的電腦類型。在建立開機磁碟之前你必須確定該電腦使用 BIOS 或是 UEFI沒正確對應可能無法開機。"
#. • MSG_151
#.
#. You shouldn't translate 'Legacy Mode' as this is an option that usually appears in English in the UEFI settings.
msgid "'UEFI-CSM' means that the device will only boot in BIOS emulation mode (also known as 'Legacy Mode') under UEFI, and not in native UEFI mode."
msgstr "'UEFI-CSM'代表裝置只能在 UEFI 下的模擬 BIOS 模式 (或稱'Legacy Mode') 開機,而非原生 UEFI 模式。"
msgstr "'UEFI-CSM' 代表裝置只能在 UEFI 下的模擬 BIOS 模式 (或稱 'Legacy Mode') 開機,而非原生 UEFI 模式。"
#. • MSG_152
msgid "'non CSM' means that the device will only boot in native UEFI mode, and not in BIOS emulation mode (also known as 'Legacy Mode')."
msgstr "'無 CSM'代表裝置只能在原生 UEFI 模式下啟動,而非模擬 BIOS 模式 (或稱' Legacy Mode ')。"
msgstr "'無 CSM' 代表裝置只能在原生 UEFI 模式下啟動,而非模擬 BIOS 模式 (或稱 'Legacy Mode')。"
#. • MSG_153
msgid "Test pattern: 0x%02X"
@ -1040,16 +1038,8 @@ msgid "Check this box to allow the display of international labels and set a dev
msgstr "允許顯示多國語言標籤及裝置圖示 (建立 autorun.inf)"
#. • MSG_167
msgid "Install an MBR that allows boot selection and can masquerade the BIOS USB drive ID"
msgstr "於裝置上建立 Rufus 客製化的 MBR可支援開機選單及偽裝 BIOS 中的 USB ID"
#. • MSG_168
msgid ""
"Try to masquerade first bootable USB drive (usually 0x80) as a different disk.\n"
"This should only be necessary if you install Windows XP and have more than one disk."
msgstr ""
"偽裝第一個可開機的 USB 磁碟為其他序列的磁碟。\n"
"主要適用情境: 於多磁碟系統安裝 Windows XP。"
msgid "Install a UEFI bootloader, that will perform MD5Sum file validation of the media"
msgstr "安裝 UEFI 開機引導程式,該程式將對媒體進行 MD5 雜湊值驗證"
#. • MSG_169
msgid ""
@ -1057,7 +1047,7 @@ msgid ""
"This can improve boot detection for older BIOSes."
msgstr ""
"建立隱藏磁區分割並嘗試對齊資料分割界限。\n"
"可幫助老舊 BIOS 偵測到開機。"
"可幫助老舊 BIOS 偵測到開機。"
#. • MSG_170
msgid "Enable the listing of USB Hard Drive enclosures. USE AT YOUR OWN RISKS!!!"
@ -1419,7 +1409,7 @@ msgstr "線上更新: 檢查更新版本中..."
#. • MSG_244
msgid "Updates: Unable to connect to the internet"
msgstr "線上更新: 無法存取網路"
msgstr "線上更新: 無法連線到網路"
#. • MSG_245
msgid "Updates: Unable to access version data"
@ -1513,7 +1503,7 @@ msgstr "VMWare 磁碟偵測"
#. • MSG_266
msgid "Dual UEFI/BIOS mode"
msgstr "Dual UEFI/BIOS 模式"
msgstr "UEFI/BIOS 模式"
#. • MSG_267
msgid "Applying Windows image: %s"
@ -1848,11 +1838,87 @@ msgstr "關閉 BitLocker 自動設備加密"
msgid "Persistent log"
msgstr "持久化日誌"
#. • MSG_337
msgid ""
"An additional file ('diskcopy.dll') must be downloaded from Microsoft to install MS-DOS:\n"
"- Select 'Yes' to connect to the Internet and download it\n"
"- Select 'No' to cancel the operation\n"
"\n"
"Note: The file will be downloaded in the application's directory and will be reused automatically if present."
msgstr ""
"必須從微軟下載額外的 'diskcopy.dll' 檔案,才能安裝 MS-DOS:\n"
"- 選 '是' 將連線到網路並進行下載\n"
"- 選 '否' 將取消操作\n"
"\n"
"註: 該檔案將被下載到 Rufus 所在的資料夾中,如果已存在將會自動使用。"
#. • MSG_338
msgid "Revoked UEFI bootloader detected"
msgstr "偵測到被撤銷的 UEFI 開機引導程式"
#. • MSG_339
msgid ""
"Rufus detected that the ISO you have selected contains a UEFI bootloader that has been revoked and that will produce %s, when Secure Boot is enabled on a fully up to date UEFI system.\n"
"\n"
"- If you obtained this ISO image from a non reputable source, you should consider the possibility that it might contain UEFI malware and avoid booting from it.\n"
"- If you obtained it from a trusted source, you should try to locate a more up to date version, that will not produce this warning."
msgstr ""
"Rufus 偵測到選取的 ISO 包含一個被撤銷的 UEFI 開機引導程式,當你在完全更新的 UEFI 系統上啟用安全開機時,將產生 %s。\n"
"\n"
"- 如果你從無法信任的來源取得這個 ISO 映像,應該考慮到它可能包含 UEFI 惡意程式,並避免以此進行開機。\n"
"- 如果你從可以信任的來源取得,應該嘗試找到一個更新的版本,才不會出現這個警告。"
#. • MSG_340
msgid "a \"Security Violation\" screen"
msgstr "一個 \"安全違規\" 畫面"
#. • MSG_341
msgid "a Windows Recovery Screen (BSOD) with '%s'"
msgstr "一個有著 '%s' 的 Windows 復原畫面 (BSOD)"
#. • MSG_342
msgid "Compressed VHDX Image"
msgstr "壓縮後的 VHDX 映像"
#. • MSG_343
msgid "Uncompressed VHD Image"
msgstr "未壓縮的 VHD 映像"
#. • MSG_344
msgid "Full Flash Update Image"
msgstr "完整寫入更新映像"
#. • MSG_345
msgid ""
"Some additional data must be downloaded from Microsoft to use this functionality:\n"
"- Select 'Yes' to connect to the Internet and download it\n"
"- Select 'No' to cancel the operation"
msgstr ""
"必須從微軟下載一些額外的資料才能使用此功能:\n"
"- 選 '是' 將連線到網路並進行下載\n"
"- 選 '否' 將取消操作"
#. • MSG_346
msgid "Restrict Windows to S-Mode (INCOMPATIBLE with online account bypass)"
msgstr "將 Windows 限制為 S-模式 (不相容繞過線上帳號)。"
#. • MSG_347
msgid "Expert Mode"
msgstr "專家模式"
#. • MSG_348
msgid "Extracting archive files: %s"
msgstr "正在擷取封存檔案: %s"
#. • MSG_349
msgid "Use Rufus MBR"
msgstr "使用 Rufus MBR"
#. • MSG_900
#.
#. The following messages are for the Windows Store listing only and are not used by the application
msgid "Rufus is a utility that helps format and create bootable USB flash drives, such as USB keys/pendrives, memory sticks, etc."
msgstr "Rufus 是個能格式化並製作可開機 USB 快閃磁碟機USB 隨身碟、Memory Stick 等等)的工具。"
msgstr "Rufus 是個能格式化並製作可開機 USB 快閃磁碟 (如 USB 隨身碟等) 的工具。"
#. • MSG_901
msgid "Official site: %s"
@ -1860,7 +1926,7 @@ msgstr "官方網站: %s"
#. • MSG_902
msgid "Source Code: %s"
msgstr "始碼: %s"
msgstr "始碼: %s"
#. • MSG_903
msgid "ChangeLog: %s"
@ -1891,19 +1957,19 @@ msgstr "將隨身碟、記憶卡或虛擬光碟機格式化為 FAT/FAT32/NTFS/UD
#. • MSG_911
msgid "Create FreeDOS bootable USB drives"
msgstr "建立 FreeDOS 可隨身碟"
msgstr "建立 FreeDOS 可開機隨身碟"
#. • MSG_912
msgid "Create bootable drives from bootable ISOs (Windows, Linux, etc.)"
msgstr "從可啟動 ISO 檔案 (Windows 和 Linux 等) 建立可啟動隨身碟"
msgstr "從可開機 ISO 檔案 (Windows 和 Linux 等) 建立可開機隨身碟"
#. • MSG_913
msgid "Create bootable drives from bootable disk images, including compressed ones"
msgstr "從可啟動硬碟映像檔 (包括壓縮映像檔) 建立可啟動隨身碟"
msgstr "從可開機硬碟映像檔 (包括壓縮映像檔) 建立可開機隨身碟"
#. • MSG_914
msgid "Create BIOS or UEFI bootable drives, including UEFI bootable NTFS"
msgstr "建立 BIOS 或 UEFI 可啟動隨身碟,包括 UEFI 可啟動的 NTFS 隨身碟"
msgstr "建立 BIOS 或 UEFI 可開機隨身碟,包括 UEFI 下的可開機 NTFS 隨身碟"
#. • MSG_915
msgid "Create 'Windows To Go' drives"
@ -1919,15 +1985,17 @@ msgstr "建立持續性 Linux 磁區"
#. • MSG_918
msgid "Create VHD/DD images of the selected drive"
msgstr "為選的磁碟機建立 VHD/DD 映像檔"
msgstr "為選的磁碟機建立 VHD/DD 映像檔"
#. • MSG_919
msgid "Compute MD5, SHA-1, SHA-256 and SHA-512 checksums of the selected image"
msgstr "計算被選映像的 MD5、SHA-1、SHA-256 和 SHA-512 檢查碼"
msgstr "計算被選映像的 MD5、SHA-1、SHA-256 和 SHA-512 檢查碼"
#. • MSG_920
msgid "Perform bad blocks checks, including detection of \"fake\" flash drives"
msgstr "執行壞軌檢查包括對”假“USB 快閃磁碟機的偵測"
msgstr ""
"執行壞軌檢查包括對”假“USB 快閃磁碟\n"
"的偵測"
#. • MSG_921
msgid "Download official Microsoft Windows retail ISOs"

View file

@ -7,7 +7,7 @@
# • v4.5 "ar-SA" "Arabic (العربية)"
# • v3.22 "bg-BG" "Bulgarian (Български)"
# • v4.5 "zh-CN" "Chinese Simplified (简体中文)"
# • v3.22 "zh-TW" "Chinese Traditional (正體中文)"
# • v4.5 "zh-TW" "Chinese Traditional (正體中文)"
# • v4.5 "hr-HR" "Croatian (Hrvatski)"
# • v4.5 "cs-CZ" "Czech (Čeština)"
# • v4.5 "da-DK" "Danish (Dansk)"
@ -1904,7 +1904,7 @@ t MSG_922 "下载 UEFI Shell 镜像"
#########################################################################
l "zh-TW" "Chinese Traditional (正體中文)" 0x0404, 0x0c04, 0x1404, 0x7c04
v 3.22
v 4.5
b "en-US"
g IDD_ABOUTBOX
@ -1922,7 +1922,7 @@ t IDS_PARTITION_TYPE_TXT "資料分割配置"
t IDS_TARGET_SYSTEM_TXT "目標系統"
t IDC_LIST_USB_HDD "顯示 USB 外接硬碟"
t IDC_OLD_BIOS_FIXES "相容性模式"
t IDC_UEFI_MEDIA_VALIDATION "启用运行时 UEFI 媒体验证"
t IDC_UEFI_MEDIA_VALIDATION "啟用執行階段 UEFI 媒體驗證"
t IDS_FORMAT_OPTIONS_TXT "選項"
t IDS_FILE_SYSTEM_TXT "檔案系統"
t IDS_CLUSTER_SIZE_TXT "配置單元大小"
@ -2005,13 +2005,13 @@ t MSG_041 "作業被使用者中斷"
t MSG_042 "錯誤"
t MSG_043 "錯誤: %s"
t MSG_044 "檔案下載"
t MSG_045 "USB 裝置"
t MSG_045 "USB 儲存裝置"
t MSG_046 "%s (磁碟 %d) [%s]"
t MSG_047 "多個磁碟分割區"
t MSG_048 "Rufus - 正在清空緩衝區"
t MSG_049 "Rufus - 取消"
t MSG_050 "完成。"
t MSG_051 "格式化發生不明錯誤。"
t MSG_051 "格式化發生不明錯誤。"
t MSG_052 "此裝置無法使用選取之檔案系統。"
t MSG_053 "裝置存取遭拒。"
t MSG_054 "裝置唯讀模式無法寫入。"
@ -2029,7 +2029,7 @@ t MSG_065 "寫入錯誤。"
t MSG_066 "安裝失敗"
t MSG_067 "無法開啟裝置,可能被其他程序占用。請重新插拔一次試試。"
t MSG_068 "無法分割磁碟。"
t MSG_069 "無法複製檔案到裝置。"
t MSG_069 "無法複製檔案到目標磁碟。"
t MSG_070 "工作遭使用者中斷。"
t MSG_071 "無法啟動執行緒。"
t MSG_072 "損毀磁區檢查工作未完成。"
@ -2044,7 +2044,7 @@ t MSG_080 "Rufus 偵測到 Windows 正在排清緩衝區至 USB 裝置。\n\n此
t MSG_081 "不支援的映像檔"
t MSG_082 "此映像檔無法開機,或是使用 Rufus 不支援的開機、壓縮方式..."
t MSG_083 "取代 %s?"
t MSG_084 "此 ISO 映像檔似乎使用過時版本的 '%s'。\n開機選單可能因此無法正常運作。\n\nRufus 可下載新版本來修正問題:\n- 選 '是' 將連網路並下載檔案\n- 選 '否' 保留原始 ISO 內容\n如果你不知道該如何抉擇建議選擇 '是'。\n\n注意: 檔案會下載至目前資料夾,如果已存在 '%s' 檔案將直接使用。"
t MSG_084 "此 ISO 映像檔似乎使用過時版本的 '%s'。\n開機選單可能因此無法正常運作。\n\nRufus 可下載新版本來修正問題:\n- 選 '是' 將連線到網路並下載檔案\n- 選 '否' 保留原始 ISO 內容\n如果你不知道該如何抉擇建議選擇 '是'。\n\n注意: 檔案會下載至目前資料夾,如果已存在 '%s' 檔案將直接使用。"
t MSG_085 "下載中 %s"
t MSG_086 "未選取任何映像檔"
t MSG_087 "給 %s NAND"
@ -2088,7 +2088,7 @@ t MSG_125 "設定 live USB 的固定磁區大小。大小設定為 0 則移除
t MSG_126 "設定磁區大小單位。"
t MSG_127 "不要再顯示此訊息"
t MSG_128 "重要通知關於 %s"
t MSG_129 "你已建立使用 UEFI:NTFS bootloader 的裝置。如要使用此裝置開機,請記得關閉安全開機。\n更多資訊請點選底下 '進階說明' 按鈕。"
t MSG_129 "你已建立使用 UEFI:NTFS 開機引導程式的裝置。如要使用此裝置開機,請記得關閉安全開機。\n更多資訊請點選底下 '進階說明' 按鈕。"
t MSG_130 "Windows 映像檔選擇"
t MSG_131 "此 ISO 包含多個 Windows 映像\n請選擇要安裝的映像:"
t MSG_132 "另一個程式或程序正在使用此裝置,要繼續格式化?"
@ -2108,9 +2108,9 @@ t MSG_145 "需要 PowerShell 3.0 或更新版本才能執行。"
t MSG_146 "您要連上網並下載?"
t MSG_148 "執行下載程序中..."
t MSG_149 "下載 ISO 映像檔"
t MSG_150 "你使用此開機磁碟的電腦類型。在建立開機磁碟之前你必須確定該電腦使用 BIOS 或是 UEFI匹配錯誤將可能無法開機。"
t MSG_151 "'UEFI-CSM'代表裝置只能在 UEFI 下的模擬 BIOS 模式 (或稱'Legacy Mode') 開機,而非原生 UEFI 模式。"
t MSG_152 "'無 CSM'代表裝置只能在原生 UEFI 模式下啟動,而非模擬 BIOS 模式 (或稱' Legacy Mode ')。"
t MSG_150 "你使用此開機磁碟的電腦類型。在建立開機磁碟之前你必須確定該電腦使用 BIOS 或是 UEFI沒正確對應可能無法開機。"
t MSG_151 "'UEFI-CSM' 代表裝置只能在 UEFI 下的模擬 BIOS 模式 (或稱 'Legacy Mode') 開機,而非原生 UEFI 模式。"
t MSG_152 "'無 CSM' 代表裝置只能在原生 UEFI 模式下啟動,而非模擬 BIOS 模式 (或稱 'Legacy Mode')。"
t MSG_153 "測試模式: 0x%02X"
t MSG_154 "測試模式: 0x%02X, 0x%02X"
t MSG_155 "測試模式: 0x%02X, 0x%02X, 0x%02X"
@ -2125,9 +2125,8 @@ t MSG_163 "用來建立磁區的方式"
t MSG_164 "開機方法"
t MSG_165 "選取或下載映像檔..."
t MSG_166 "允許顯示多國語言標籤及裝置圖示 (建立 autorun.inf)"
t MSG_167 "於裝置上建立 Rufus 客製化的 MBR可支援開機選單及偽裝 BIOS 中的 USB ID"
t MSG_168 "偽裝第一個可開機的 USB 磁碟為其他序列的磁碟。\n主要適用情境: 於多磁碟系統安裝 Windows XP。"
t MSG_169 "建立隱藏磁區分割並嘗試對齊資料分割界限。\n可幫助老舊 BIOS 偵測到開機片。"
t MSG_167 "安裝 UEFI 開機引導程式,該程式將對媒體進行 MD5 雜湊值驗證"
t MSG_169 "建立隱藏磁區分割並嘗試對齊資料分割界限。\n可幫助老舊 BIOS 偵測到開機碟。"
t MSG_170 "顯示連接到電腦的 USB 外接硬碟。請謹慎使用,後果自負!!!"
t MSG_171 "立即開始格式化作業。\n注意: 裝置上所有的資料將被清除!"
t MSG_172 "下載簽章無效"
@ -2201,7 +2200,7 @@ t MSG_240 "無法驗證已下載的更新簽章。這代表你的系統可能未
t MSG_241 "下載中: %s"
t MSG_242 "檔案下載失敗。"
t MSG_243 "線上更新: 檢查更新版本中..."
t MSG_244 "線上更新: 無法存取網路"
t MSG_244 "線上更新: 無法連線到網路"
t MSG_245 "線上更新: 無法確認軟體版本"
t MSG_246 "線上更新: 有更新版本!"
t MSG_247 "線上更新: 已是最新版"
@ -2223,7 +2222,7 @@ t MSG_262 "ISO 支援"
t MSG_263 "正規位元單位"
t MSG_264 "刪除目錄 '%s'"
t MSG_265 "VMWare 磁碟偵測"
t MSG_266 "Dual UEFI/BIOS 模式"
t MSG_266 "UEFI/BIOS 模式"
t MSG_267 "套用 Windows 映像檔: %s"
t MSG_268 "建置 Windows 映像檔中..."
t MSG_269 "保留時間戳記"
@ -2292,23 +2291,36 @@ t MSG_333 "使用此使用者名建立一個本機帳戶:"
t MSG_334 "使用目前用戶的區域設定"
t MSG_335 "關閉 BitLocker 自動設備加密"
t MSG_336 "持久化日誌"
t MSG_900 "Rufus 是個能格式化並製作可開機 USB 快閃磁碟機USB 隨身碟、Memory Stick 等等)的工具。"
t MSG_337 "必須從微軟下載額外的 'diskcopy.dll' 檔案,才能安裝 MS-DOS:\n- 選 '是' 將連線到網路並進行下載\n- 選 '否' 將取消操作\n\n註: 該檔案將被下載到 Rufus 所在的資料夾中,如果已存在將會自動使用。"
t MSG_338 "偵測到被撤銷的 UEFI 開機引導程式"
t MSG_339 "Rufus 偵測到選取的 ISO 包含一個被撤銷的 UEFI 開機引導程式,當你在完全更新的 UEFI 系統上啟用安全開機時,將產生 %s。\n\n- 如果你從無法信任的來源取得這個 ISO 映像,應該考慮到它可能包含 UEFI 惡意程式,並避免以此進行開機。\n- 如果你從可以信任的來源取得,應該嘗試找到一個更新的版本,才不會出現這個警告。"
t MSG_340 "一個 \"安全違規\" 畫面"
t MSG_341 "一個有著 '%s' 的 Windows 復原畫面 (BSOD)"
t MSG_342 "壓縮後的 VHDX 映像"
t MSG_343 "未壓縮的 VHD 映像"
t MSG_344 "完整寫入更新映像"
t MSG_345 "必須從微軟下載一些額外的資料才能使用此功能:\n- 選 '是' 將連線到網路並進行下載\n- 選 '否' 將取消操作"
t MSG_346 "將 Windows 限制為 S-模式 (不相容繞過線上帳號)。"
t MSG_347 "專家模式"
t MSG_348 "正在擷取封存檔案: %s"
t MSG_349 "使用 Rufus MBR"
t MSG_900 "Rufus 是個能格式化並製作可開機 USB 快閃磁碟 (如 USB 隨身碟等) 的工具。"
t MSG_901 "官方網站: %s"
t MSG_902 "源始碼: %s"
t MSG_902 "始碼: %s"
t MSG_903 "更新日誌: %s"
t MSG_904 "本應用採用 GNU 通用公共許可證 (GPL) 第三版。\n具體許可證見 https://www.gnu.org/licenses/gpl-3.0.zh-tw.html。"
t MSG_905 "啟動"
t MSG_910 "將隨身碟、記憶卡或虛擬光碟機格式化為 FAT/FAT32/NTFS/UDF/exFAT/ReFS/ext2/ext3 格式"
t MSG_911 "建立 FreeDOS 可啟隨身碟"
t MSG_912 "從可啟動 ISO 檔案 (Windows 和 Linux 等) 建立可啟動隨身碟"
t MSG_913 "從可啟動硬碟映像檔 (包括壓縮映像檔) 建立可啟動隨身碟"
t MSG_914 "建立 BIOS 或 UEFI 可啟動隨身碟,包括 UEFI 可啟動的 NTFS 隨身碟"
t MSG_911 "建立 FreeDOS 可開機隨身碟"
t MSG_912 "從可開機 ISO 檔案 (Windows 和 Linux 等) 建立可開機隨身碟"
t MSG_913 "從可開機硬碟映像檔 (包括壓縮映像檔) 建立可開機隨身碟"
t MSG_914 "建立 BIOS 或 UEFI 可開機隨身碟,包括 UEFI 下的可開機 NTFS 隨身碟"
t MSG_915 "建立 'Windows To Go' 隨身碟"
t MSG_916 "為沒有 TPM 或安全開機功能的電腦建立 Windows 11 安裝隨身碟"
t MSG_917 "建立持續性 Linux 磁區"
t MSG_918 "為選的磁碟機建立 VHD/DD 映像檔"
t MSG_919 "計算被選映像的 MD5、SHA-1、SHA-256 和 SHA-512 檢查碼"
t MSG_920 "執行壞軌檢查包括對”假“USB 快閃磁碟的偵測"
t MSG_918 "為選的磁碟機建立 VHD/DD 映像檔"
t MSG_919 "計算被選映像的 MD5、SHA-1、SHA-256 和 SHA-512 檢查碼"
t MSG_920 "執行壞軌檢查包括對”假“USB 快閃磁碟\n的偵測"
t MSG_921 "下載微軟官方 Windows 映像檔"
t MSG_922 "下載 UEFI Shell 映像檔"
@ -15315,11 +15327,11 @@ t IDC_CHECK_NOW "Перевірити зараз"
t MSG_001 "Виявлено інший екземпляр Rufus"
t MSG_002 "Запущено інший додаток Rufus.\nЗакрийте перший додаток перед тим, як запустити ще один."
t MSG_003 "УВАГА: ВСІ ДАНІ НА ДИСКУ '%s' БУДУТЬ ЗНИЩЕНІ.\nДля того, щоб продовжити, натисніть ОК. Для виходу натисніть Відмінити."
t MSG_003 "УВАГА: ВСІ ДАНІ НА ДИСКУ '%s' БУДУТЬ ЗНИЩЕНІ.\nДля того, щоб продовжити, натисніть ОК. Для виходу натисніть Скасувати."
t MSG_004 "Політика оновлення Rufus"
t MSG_005 "Чи хочете ви, щоб Rufus перевіряв оновлення автоматично?"
t MSG_006 "Закрити"
t MSG_007 "Відмінити"
t MSG_007 "Скасувати"
t MSG_008 "Так"
t MSG_009 "Ні"
t MSG_010 "Знайдено пошкоджені блоки"
@ -15350,7 +15362,7 @@ t MSG_034 "%d прохід"
t MSG_035 "%d проходів %s"
t MSG_036 "ISO-образ"
t MSG_037 "Додаток"
t MSG_038 "Відмінити"
t MSG_038 "Скасувати"
t MSG_039 "Запустити"
t MSG_040 "Завантажити"
t MSG_041 "Операція скасована користувачем"
@ -15426,9 +15438,9 @@ t MSG_110 "MS-DOS не може завантажитися при викорис
t MSG_111 "Несумісний розмір кластера"
t MSG_112 "Форматування великих UDF-томів займає багато часу. На швидкості USB 2.0 приблизна тривалість форматування складе %d:%02d, протягом якої індикатор прогресу буде заморожено. Будь ласка, будьте терплячі!"
t MSG_113 "Великий UDF-том"
t MSG_114 "Даний образ використовує Syslinux %s%s, проте даний додаток включає в себе тільки настановні файли для Syslinux %s%s.\n\nТак як нові версії Syslinux несумісні одна з одною, необхідно, щоб додаткові файли ('ldlinux.sys' та 'ldlinux.bss') були завантажені з інтернету:\n- Виберіть 'Так', щоб завантажити файли з інтернету\n- Виберіть 'Ні', щоб відмінити операцію\n\nПримітка: Файли будуть завантажені в поточний каталог додатку і будуть використовуватися повторно за необхідності."
t MSG_114 "Даний образ використовує Syslinux %s%s, проте даний додаток включає в себе тільки настановні файли для Syslinux %s%s.\n\nТак як нові версії Syslinux несумісні одна з одною, необхідно, щоб додаткові файли ('ldlinux.sys' та 'ldlinux.bss') були завантажені з інтернету:\n- Виберіть 'Так', щоб завантажити файли з інтернету\n- Виберіть 'Ні', щоб скасувати операцію\n\nПримітка: Файли будуть завантажені в поточний каталог додатку і будуть використовуватися повторно за необхідності."
t MSG_115 "Необхідно завантажити"
t MSG_116 "Даний образ використовує завантажувач Grub %s, але додаток включає тільки настановні файли для завантажувача Grub %s.\n\nРізні версії завантажувача Grub можуть бути несумісними одна з одною та увімкнення їх усіх не являється можливим. Rufus намагатиметься знайти потрібну версію настановного файла завантажувача Grub ('core.img'), що відповідає версії завантажувача вашого образу:\n- Виберіть 'Так', щоб скачати завантажувальний файл з інтернету\n- Виберіть 'Ні', щоб використовувати версію за замовчуванням із Rufus\n- Виберіть 'Відмінити', щоб відмінити операцію\n\nПримітка: Файл буде завантажено в поточний каталог додатку та буде використаний повторно наступного разу. Якщо потрібна версія настановного файла не буде знайдена в інтернеті, то буде використовуватися версія за замовчуванням."
t MSG_116 "Даний образ використовує завантажувач Grub %s, але додаток включає тільки настановні файли для завантажувача Grub %s.\n\nРізні версії завантажувача Grub можуть бути несумісними одна з одною та увімкнення їх усіх не являється можливим. Rufus намагатиметься знайти потрібну версію настановного файла завантажувача Grub ('core.img'), що відповідає версії завантажувача вашого образу:\n- Виберіть 'Так', щоб скачати завантажувальний файл з інтернету\n- Виберіть 'Ні', щоб використовувати версію за замовчуванням із Rufus\n- Виберіть 'Скасувати', щоб скасувати операцію\n\nПримітка: Файл буде завантажено в поточний каталог додатку та буде використаний повторно наступного разу. Якщо потрібна версія настановного файла не буде знайдена в інтернеті, то буде використовуватися версія за замовчуванням."
t MSG_117 "Стандартне встановлення Windows"
t MSG_119 "розширені властивості диска"
t MSG_120 "розширені властивості форматування"

View file

@ -4,8 +4,8 @@ NONVULNERABLE_LIBS = -lsetupapi -lole32 -lgdi32 -lshlwapi -lcrypt32 -lcomctl32 -
# The following libraries are vulnerable (or have an unknown vulnerability status), so we link using our delay-loaded replacement:
# Ideally there would also be virtdisk and wininet as delaylib's below, but the MinGW folks haven't quite sorted out delay-loading
# for x86_32 so as soon as you try to call APIs from these, the application will crash!
# See https://github.com/pbatard/rufus/issues/1877#issuecomment-1109683039 as well as https://github.com/pbatard/rufus/issues/2272
VULNERABLE_LIBS = -ldwmapi-delaylib -lversion-delaylib -lwintrust-delaylib
# See https://github.com/pbatard/rufus/issues/2272
VULNERABLE_LIBS = -ldwmapi-delaylib -lversion-delaylib -lvirtdisk-delaylib -lwininet-delaylib -lwintrust-delaylib
noinst_PROGRAMS = rufus

View file

@ -279,8 +279,8 @@ NONVULNERABLE_LIBS = -lsetupapi -lole32 -lgdi32 -lshlwapi -lcrypt32 -lcomctl32 -
# The following libraries are vulnerable (or have an unknown vulnerability status), so we link using our delay-loaded replacement:
# Ideally there would also be virtdisk and wininet as delaylib's below, but the MinGW folks haven't quite sorted out delay-loading
# for x86_32 so as soon as you try to call APIs from these, the application will crash!
# See https://github.com/pbatard/rufus/issues/1877#issuecomment-1109683039 as well as https://github.com/pbatard/rufus/issues/2272
VULNERABLE_LIBS = -ldwmapi-delaylib -lversion-delaylib -lwintrust-delaylib
# See https://github.com/pbatard/rufus/issues/2272
VULNERABLE_LIBS = -ldwmapi-delaylib -lversion-delaylib -lvirtdisk-delaylib -lwininet-delaylib -lwintrust-delaylib
AM_V_WINDRES_0 = @echo " RC $@";$(WINDRES)
AM_V_WINDRES_1 = $(WINDRES)
AM_V_WINDRES_ = $(AM_V_WINDRES_$(AM_DEFAULT_VERBOSITY))

View file

@ -426,6 +426,11 @@ static unsigned int test_rw(HANDLE hDrive, blk64_t last_block, size_t block_size
cancel_ops = -1;
return 0;
}
if ((first_block * block_size > 1 * PB) || (last_block * block_size > 1 * PB)) {
uprintf("%sDisk is too large\n", bb_prefix);
cancel_ops = -1;
return 0;
}
buffer = allocate_buffer(2 * blocks_at_once * block_size);
if (!buffer) {
@ -543,8 +548,12 @@ static unsigned int test_rw(HANDLE hDrive, blk64_t last_block, size_t block_size
for (i=0; i < got; i++) {
if (memcmp(read_buffer + i * block_size,
buffer + i * block_size,
block_size))
block_size)) {
if_not_assert(currently_testing * block_size < 1 * PB)
goto out;
// coverity[overflow_const]
bb_count += bb_output(currently_testing+i-got, CORRUPTION_ERROR);
}
}
if (v_flag > 1)
print_status();

View file

@ -38,6 +38,7 @@ static void crc32init_le(uint32_t *crc32table_le)
crc32table_le[0] = 0;
for (i = 1 << (CRC_LE_BITS - 1); i; i >>= 1) {
// coverity[overflow_const]
crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY_LE : 0);
for (j = 0; j < 1 << CRC_LE_BITS; j += 2 * i)
crc32table_le[i + j] = crc ^ crc32table_le[j];
@ -81,6 +82,7 @@ static void crc32init_be(uint32_t *crc32table_be)
uint32_t crc = 0x80000000;
for (i = 1; i < 1 << CRC_BE_BITS; i <<= 1) {
// coverity[overflow_const]
crc = (crc << 1) ^ ((crc & 0x80000000) ? CRCPOLY_BE : 0);
for (j = 0; j < i; j++)
crc32table_be[i + j] = crc ^ crc32table_be[j];

View file

@ -280,6 +280,7 @@ static unsigned fill_bitbuffer(STATE_PARAM unsigned bitbuffer, unsigned *current
bytebuffer_offset++;
*current += 8;
}
// coverity[return_overflow]
return bitbuffer;
}
@ -661,7 +662,7 @@ static NOINLINE int inflate_codes(STATE_PARAM_ONLY)
/* called once from inflate_block */
static void inflate_stored_setup(STATE_PARAM int my_n, int my_b, int my_k)
static void inflate_stored_setup(STATE_PARAM unsigned my_n, unsigned my_b, unsigned my_k)
{
inflate_stored_n = my_n;
inflate_stored_b = my_b;
@ -1043,7 +1044,15 @@ inflate_unzip_internal(STATE_PARAM transformer_state_t *xstate)
n = (nwrote <0)?nwrote:-1;
goto ret;
}
IF_DESKTOP(n += nwrote;)
#if ENABLE_DESKTOP
long long int v = n + nwrote;
if (v < n) {
bb_simple_error_msg("overflow");
n = -1;
goto ret;
}
n = v;
#endif
if (r == 0) break;
}
@ -1054,6 +1063,7 @@ inflate_unzip_internal(STATE_PARAM transformer_state_t *xstate)
bytebuffer_offset--;
bytebuffer[bytebuffer_offset] = gunzip_bb & 0xff;
gunzip_bb >>= 8;
// coverity[overflow_const]
gunzip_bk -= 8;
}
ret:

View file

@ -23,6 +23,7 @@
#include "platform.h"
#include "msapi_utf8.h"
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>

View file

@ -18,6 +18,7 @@
/* #define XZ_DEC_ARMTHUMB */
/* #define XZ_DEC_SPARC */
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>

View file

@ -109,6 +109,7 @@ static noinline_for_stack size_t XZ_FUNC bcj_x86(
if ((buf[i] & 0xFE) != 0xE8)
continue;
// coverity[overflow_const]
prev_pos = i - prev_pos;
if (prev_pos > 3) {
prev_mask = 0;

View file

@ -622,7 +622,7 @@ static void XZ_FUNC lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l,
uint32_t pos_state)
{
uint16_t *probs;
uint32_t limit;
uint32_t limit, v;
if (!rc_bit(&s->rc, &l->choice)) {
probs = l->low[pos_state];
@ -641,7 +641,9 @@ static void XZ_FUNC lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l,
}
}
s->lzma.len += rc_bittree(&s->rc, probs, limit) - limit;
v = s->lzma.len + rc_bittree(&s->rc, probs, limit) - limit;
assert(v >= s->lzma.len);
s->lzma.len = (v < s->lzma.len) ? 0 : v;
}
/* Decode a match. The distance will be stored in s->lzma.rep0. */
@ -660,6 +662,7 @@ static void XZ_FUNC lzma_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
lzma_len(s, &s->lzma.match_len_dec, pos_state);
probs = s->lzma.dist_slot[lzma_get_dist_state(s->lzma.len)];
// coverity[overflow_const]
dist_slot = rc_bittree(&s->rc, probs, DIST_SLOTS) - DIST_SLOTS;
if (dist_slot < DIST_MODEL_START) {

View file

@ -137,7 +137,8 @@ BOOL CyclePort(int index)
DWORD size;
USB_CYCLE_PORT_PARAMS cycle_port;
assert(index < MAX_DRIVES);
if_not_assert(index < MAX_DRIVES)
return -1;
// Wait at least 10 secs between resets
if (GetTickCount64() < LastReset + 10000ULL) {
uprintf("You must wait at least 10 seconds before trying to reset a device");
@ -190,7 +191,8 @@ int CycleDevice(int index)
SP_DEVINFO_DATA dev_info_data;
SP_PROPCHANGE_PARAMS propchange_params;
assert(index < MAX_DRIVES);
if_not_assert(index < MAX_DRIVES)
return ERROR_INVALID_DRIVE;
if ((index < 0) || (safe_strlen(rufus_drive[index].id) < 8))
return ERROR_INVALID_PARAMETER;
@ -287,6 +289,7 @@ static __inline BOOL IsVHD(const char* buffer)
"Arsenal_________Virtual_",
"KernSafeVirtual_________",
"Msft____Virtual_Disk____",
"BHYVE__________SATA_DISK",
"VMware__VMware_Virtual_S" // Enabled through a cheat mode, as this lists primary disks on VMWare instances
};
@ -415,9 +418,9 @@ BOOL GetOpticalMedia(IMG_SAVE* img_save)
/* For debugging user reports of HDDs vs UFDs */
//#define FORCED_DEVICE
#ifdef FORCED_DEVICE
#define FORCED_VID 0x23A9
#define FORCED_PID 0xEF18
#define FORCED_NAME "SCSI DISK USB Device"
#define FORCED_VID 0x04E8
#define FORCED_PID 0x61ED
#define FORCED_NAME "Samsung uSD Card Reader USB Device"
#endif
void ClearDrives(void)
@ -582,8 +585,10 @@ BOOL GetDevices(DWORD devnum)
// Better safe than sorry. And yeah, we could have used arrays of
// arrays to avoid this, but it's more readable this way.
assert((uasp_start > 0) && (uasp_start < ARRAYSIZE(usbstor_name)));
assert((card_start > 0) && (card_start < ARRAYSIZE(genstor_name)));
if_not_assert((uasp_start > 0) && (uasp_start < ARRAYSIZE(usbstor_name)))
goto out;
if_not_assert((card_start > 0) && (card_start < ARRAYSIZE(genstor_name)))
goto out;
devid_list = NULL;
if (full_list_size != 0) {
@ -670,7 +675,8 @@ BOOL GetDevices(DWORD devnum)
}
// Also test for "_SD&" instead of "_SD_" and so on to allow for devices like
// "SCSI\DiskRicoh_Storage_SD&REV_3.0" to be detected.
assert(strlen(scsi_card_name_copy) > 1);
if_not_assert(strlen(scsi_card_name_copy) > 1)
continue;
scsi_card_name_copy[strlen(scsi_card_name_copy) - 1] = '&';
if (safe_strstr(buffer, scsi_card_name_copy) != NULL) {
props.is_CARD = TRUE;
@ -998,7 +1004,8 @@ BOOL GetDevices(DWORD devnum)
rufus_drive[num_drives].display_name = safe_strdup(display_name);
rufus_drive[num_drives].label = safe_strdup(label);
rufus_drive[num_drives].size = drive_size;
assert(rufus_drive[num_drives].size != 0);
if_not_assert(rufus_drive[num_drives].size != 0)
break;
if (hub_path != NULL) {
rufus_drive[num_drives].hub = safe_strdup(hub_path);
rufus_drive[num_drives].port = props.port;

View file

@ -280,9 +280,12 @@ char* GetLogicalName(DWORD DriveIndex, uint64_t PartitionOffset, BOOL bKeepTrail
// Sanity checks
len = safe_strlen(volume_name);
assert(len > 4);
assert(safe_strnicmp(volume_name, volume_start, 4) == 0);
assert(volume_name[len - 1] == '\\');
if_not_assert(len > 4)
continue;
if_not_assert(safe_strnicmp(volume_name, volume_start, 4) == 0)
continue;
if_not_assert(volume_name[len - 1] == '\\')
continue;
drive_type = GetDriveTypeA(volume_name);
if ((drive_type != DRIVE_REMOVABLE) && (drive_type != DRIVE_FIXED))
@ -1817,7 +1820,8 @@ const char* GetFsName(HANDLE hPhysical, LARGE_INTEGER StartingOffset)
}
}
assert(rev < ARRAYSIZE(ext_names));
ret = ext_names[rev];
if (rev < ARRAYSIZE(ext_names))
ret = ext_names[rev];
goto out;
}

View file

@ -45,6 +45,7 @@ static void TEA_transform(__u32 buf[4], __u32 const in[])
int n = 16;
do {
// coverity[overflow_const]
sum += DELTA;
b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b);
b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d);

View file

@ -11,6 +11,7 @@
*/
#include "config.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
#if HAVE_UNISTD_H
@ -374,7 +375,9 @@ ipg_retry:
* adjust inode count to reflect the adjusted inodes_per_group
*/
if ((__u64)super->s_inodes_per_group * fs->group_desc_count > ~0U) {
ipg--;
assert(ipg != 0);
if (ipg != 0)
ipg--;
goto ipg_retry;
}
super->s_inodes_count = super->s_inodes_per_group *

View file

@ -117,8 +117,7 @@ static BOOLEAN __stdcall FormatExCallback(FILE_SYSTEM_CALLBACK_COMMAND Command,
if (IS_ERROR(ErrorStatus))
return FALSE;
assert((actual_fs_type >= 0) && (actual_fs_type < FS_MAX));
if ((actual_fs_type < 0) || (actual_fs_type >= FS_MAX))
if_not_assert((actual_fs_type >= 0) && (actual_fs_type < FS_MAX))
return FALSE;
switch(Command) {
@ -1108,6 +1107,10 @@ static int sector_write(int fd, const void* _buf, unsigned int count)
if (sec_size == 0)
sec_size = 512;
if_not_assert(sec_size <= 64 * KB)
return -1;
if_not_assert(count <= 1 * GB)
return -1;
// If we are on a sector boundary and count is multiple of the
// sector size, just issue a regular write
@ -1116,6 +1119,8 @@ static int sector_write(int fd, const void* _buf, unsigned int count)
// If we have an existing partial sector, fill and write it
if (sec_buf_pos > 0) {
if_not_assert(sec_size >= sec_buf_pos)
return -1;
fill_size = min(sec_size - sec_buf_pos, count);
memcpy(&sec_buf[sec_buf_pos], buf, fill_size);
sec_buf_pos += fill_size;
@ -1133,10 +1138,18 @@ static int sector_write(int fd, const void* _buf, unsigned int count)
written = _write(fd, &buf[fill_size], sec_num * sec_size);
if (written < 0)
return written;
else if (written != sec_num * sec_size)
return fill_size + written;
if (written != sec_num * sec_size) {
// Detect overflows
// coverity[overflow]
int v = fill_size + written;
if_not_assert(v >= fill_size)
return -1;
else
return v;
}
sec_buf_pos = count - fill_size - written;
assert(sec_buf_pos < sec_size);
if_not_assert(sec_buf_pos < sec_size)
return -1;
// Keep leftover bytes, if any, in the sector buffer
if (sec_buf_pos != 0)
@ -1150,8 +1163,8 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, BOOL bZeroDrive)
BOOL s, ret = FALSE;
LARGE_INTEGER li;
HANDLE hSourceImage = INVALID_HANDLE_VALUE;
DWORD i, read_size[NUM_BUFFERS], write_size, comp_size, buf_size;
uint64_t wb, target_size = bZeroDrive ? SelectedDrive.DiskSize : img_report.image_size;
DWORD i, read_size[NUM_BUFFERS] = { 0 }, write_size, comp_size, buf_size;
uint64_t wb, target_size = bZeroDrive ? SelectedDrive.DiskSize : MIN((uint64_t)SelectedDrive.DiskSize, img_report.image_size);
uint64_t cur_value, last_value = 0;
int64_t bled_ret;
uint8_t* buffer = NULL;
@ -1180,7 +1193,8 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, BOOL bZeroDrive)
uprintf("Could not allocate disk zeroing buffer");
goto out;
}
assert((uintptr_t)buffer % SelectedDrive.SectorSize == 0);
if_not_assert((uintptr_t)buffer % SelectedDrive.SectorSize == 0)
goto out;
// Clear buffer
memset(buffer, fast_zeroing ? 0xff : 0x00, buf_size);
@ -1192,7 +1206,8 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, BOOL bZeroDrive)
uprintf("Could not allocate disk comparison buffer");
goto out;
}
assert((uintptr_t)cmp_buffer % SelectedDrive.SectorSize == 0);
if_not_assert((uintptr_t)cmp_buffer % SelectedDrive.SectorSize == 0)
goto out;
}
read_size[0] = buf_size;
@ -1290,7 +1305,8 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, BOOL bZeroDrive)
uprintf("Could not allocate disk write buffer");
goto out;
}
assert((uintptr_t)sec_buf % SelectedDrive.SectorSize == 0);
if_not_assert((uintptr_t)sec_buf% SelectedDrive.SectorSize == 0)
goto out;
sec_buf_pos = 0;
bled_init(256 * KB, uprintf, NULL, sector_write, update_progress, NULL, &ErrorStatus);
bled_ret = bled_uncompress_with_handles(hSourceImage, hPhysicalDrive, img_report.compression_type);
@ -1312,7 +1328,8 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, BOOL bZeroDrive)
goto out;
}
} else {
assert(img_report.compression_type != IMG_COMPRESSION_FFU);
if_not_assert(img_report.compression_type != IMG_COMPRESSION_FFU)
goto out;
// VHD/VHDX require mounting the image first
if (img_report.compression_type == IMG_COMPRESSION_VHD ||
img_report.compression_type == IMG_COMPRESSION_VHDX) {
@ -1338,10 +1355,11 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, BOOL bZeroDrive)
uprintf("Could not allocate disk write buffer");
goto out;
}
assert((uintptr_t)buffer % SelectedDrive.SectorSize == 0);
if_not_assert((uintptr_t)buffer% SelectedDrive.SectorSize == 0)
goto out;
// Start the initial read
ReadFileAsync(hSourceImage, &buffer[read_bufnum * buf_size], buf_size);
ReadFileAsync(hSourceImage, &buffer[read_bufnum * buf_size], (DWORD)MIN(buf_size, target_size));
read_size[proc_bufnum] = 1; // To avoid early loop exit
for (wb = 0; read_size[proc_bufnum] != 0; wb += read_size[proc_bufnum]) {
@ -1362,21 +1380,26 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, BOOL bZeroDrive)
goto out;
}
// 2. Update the read size
// 2a) Don't overflow our projected size (mostly for VHDs)
if (wb + read_size[read_bufnum] > target_size)
read_size[read_bufnum] = (DWORD)(target_size - wb);
// 2b) WriteFile fails unless the size is a multiple of sector size
if (read_size[read_bufnum] % SelectedDrive.SectorSize != 0)
read_size[read_bufnum] = ((read_size[read_bufnum] + SelectedDrive.SectorSize - 1) /
SelectedDrive.SectorSize) * SelectedDrive.SectorSize;
// 2. WriteFile fails unless the size is a multiple of sector size
if (read_size[read_bufnum] % SelectedDrive.SectorSize != 0) {
if_not_assert(HI_ALIGN_X_TO_Y(read_size[read_bufnum], SelectedDrive.SectorSize) <= buf_size)
goto out;
read_size[read_bufnum] = HI_ALIGN_X_TO_Y(read_size[read_bufnum], SelectedDrive.SectorSize);
}
// 3. Switch to the next reading buffer
proc_bufnum = read_bufnum;
read_bufnum = (read_bufnum + 1) % NUM_BUFFERS;
// 3. Launch the next asynchronous read operation
ReadFileAsync(hSourceImage, &buffer[read_bufnum * buf_size], buf_size);
// It is VERY IMPORTANT here that we don't attempt to read past the source
// or target sizes, as mounted VHDs will SCREW YOU if you attempt to do so
// and will even start returning ERRONEOUS DATA for sectors before the end
// of the disk... So we make sure to adjust the size not to ever overflow.
// Also we need to make sure we add read_size[proc_bufnum] to wb since we
// have already read the data and are about to write it.
ReadFileAsync(hSourceImage, &buffer[read_bufnum * buf_size], (DWORD)MIN(buf_size, target_size - (wb + read_size[proc_bufnum])));
// 4. Synchronously write the current data buffer
for (i = 1; i <= WRITE_RETRIES; i++) {
@ -1656,7 +1679,8 @@ DWORD WINAPI FormatThread(void* param)
if (img_report.compression_type == IMG_COMPRESSION_FFU) {
char cmd[MAX_PATH + 128], *physical = NULL;
// Should have been filtered out beforehand
assert(has_ffu_support);
if_not_assert(has_ffu_support)
goto out;
safe_unlockclose(hPhysicalDrive);
physical = GetPhysicalName(SelectedDrive.DeviceNumber);
static_sprintf(cmd, "dism /Apply-Ffu /ApplyDrive:%s /ImageFile:\"%s\"", physical, image_path);
@ -1844,8 +1868,7 @@ DWORD WINAPI FormatThread(void* param)
// All good
} else if (target_type == TT_UEFI) {
// For once, no need to do anything - just check our sanity
assert((boot_type == BT_IMAGE) && IS_EFI_BOOTABLE(img_report) && (fs_type <= FS_NTFS));
if ( (boot_type != BT_IMAGE) || !IS_EFI_BOOTABLE(img_report) || (fs_type > FS_NTFS) ) {
if_not_assert((boot_type == BT_IMAGE) && IS_EFI_BOOTABLE(img_report) && (fs_type <= FS_NTFS)) {
ErrorStatus = RUFUS_ERROR(ERROR_INSTALL_FAILURE);
goto out;
}
@ -1920,7 +1943,8 @@ DWORD WINAPI FormatThread(void* param)
ErrorStatus = RUFUS_ERROR(APPERR(ERROR_CANT_PATCH));
}
} else {
assert(!img_report.is_windows_img);
if_not_assert(!img_report.is_windows_img)
goto out;
if (!ExtractISO(image_path, drive_name, FALSE)) {
if (!IS_ERROR(ErrorStatus))
ErrorStatus = RUFUS_ERROR(APPERR(ERROR_ISO_EXTRACT));

View file

@ -91,6 +91,7 @@ static str_score_t str_adjust[] = {
{ "Gadget", -10 },
{ "Flash", -10 },
{ "SD-CARD", -10 },
{ "uSD Card", -10 },
{ "HDD", +20 },
{ "SATA", +20 },
{ "SCSI", +20 },

View file

@ -1571,8 +1571,8 @@ uint32_t ReadISOFileToBuffer(const char* iso, const char* iso_file, uint8_t** bu
goto out;
}
file_length = udf_get_file_length(p_udf_file);
if (file_length > UINT32_MAX) {
uprintf("Only files smaller than 4 GB are supported");
if (file_length > 1 * GB) {
uprintf("Only files smaller than 1 GB are supported");
goto out;
}
nblocks = (uint32_t)((file_length + UDF_BLOCKSIZE - 1) / UDF_BLOCKSIZE);
@ -1604,10 +1604,11 @@ try_iso:
goto out;
}
file_length = p_statbuf->total_size;
if (file_length > UINT32_MAX) {
uprintf("Only files smaller than 4 GB are supported");
if (file_length > 1 * GB) {
uprintf("Only files smaller than 1 GB are supported");
goto out;
}
// coverity[cast_overflow]
nblocks = (uint32_t)((file_length + ISO_BLOCKSIZE - 1) / ISO_BLOCKSIZE);
*buf = malloc(nblocks * ISO_BLOCKSIZE + 1);
if (*buf == NULL) {

139
src/net.c
View file

@ -24,6 +24,12 @@
#endif
#include <windows.h>
// Temporary workaround for MinGW32 delay-loading
// See https://github.com/pbatard/rufus/pull/2513
#if defined(__MINGW32__)
#undef DECLSPEC_IMPORT
#define DECLSPEC_IMPORT __attribute__((visibility("hidden")))
#endif
#include <wininet.h>
#include <netlistmgr.h>
#include <stdio.h>
@ -113,14 +119,6 @@ static HINTERNET GetInternetSession(const char* user_agent, BOOL bRetry)
HINTERNET hSession = NULL;
HRESULT hr = S_FALSE;
INetworkListManager* pNetworkListManager;
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));
hr = CoCreateInstance(&CLSID_NetworkListManager, NULL, CLSCTX_ALL,
@ -131,8 +129,8 @@ static HINTERNET GetInternetSession(const char* user_agent, BOOL bRetry)
// 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;
if (hr == HRESULT_FROM_WIN32(ERROR_SERVICE_DEPENDENCY_FAIL)) {
InternetConnection = InternetGetConnectedState(&dwFlags, 0) ? VARIANT_TRUE : VARIANT_FALSE;
break;
}
if (hr == S_OK || !bRetry)
@ -147,16 +145,16 @@ static HINTERNET GetInternetSession(const char* user_agent, BOOL bRetry)
static_sprintf(default_agent, APPLICATION_NAME "/%d.%d.%d (Windows NT %lu.%lu%s)",
rufus_version[0], rufus_version[1], rufus_version[2],
WindowsVersion.Major, WindowsVersion.Minor, is_WOW64() ? "; WOW64" : "");
hSession = pfInternetOpenA((user_agent == NULL) ? default_agent : user_agent,
hSession = InternetOpenA((user_agent == NULL) ? default_agent : user_agent,
INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
// Set the timeouts
pfInternetSetOptionA(hSession, INTERNET_OPTION_CONNECT_TIMEOUT, (LPVOID)&dwTimeout, sizeof(dwTimeout));
pfInternetSetOptionA(hSession, INTERNET_OPTION_SEND_TIMEOUT, (LPVOID)&dwTimeout, sizeof(dwTimeout));
pfInternetSetOptionA(hSession, INTERNET_OPTION_RECEIVE_TIMEOUT, (LPVOID)&dwTimeout, sizeof(dwTimeout));
InternetSetOptionA(hSession, INTERNET_OPTION_CONNECT_TIMEOUT, (LPVOID)&dwTimeout, sizeof(dwTimeout));
InternetSetOptionA(hSession, INTERNET_OPTION_SEND_TIMEOUT, (LPVOID)&dwTimeout, sizeof(dwTimeout));
InternetSetOptionA(hSession, INTERNET_OPTION_RECEIVE_TIMEOUT, (LPVOID)&dwTimeout, sizeof(dwTimeout));
// Enable gzip and deflate decoding schemes
pfInternetSetOptionA(hSession, INTERNET_OPTION_HTTP_DECODING, (LPVOID)&decodingSupport, sizeof(decodingSupport));
InternetSetOptionA(hSession, INTERNET_OPTION_HTTP_DECODING, (LPVOID)&decodingSupport, sizeof(decodingSupport));
// Enable HTTP/2 protocol support
pfInternetSetOptionA(hSession, INTERNET_OPTION_ENABLE_HTTP_PROTOCOL, (LPVOID)&dwProtocolSupport, sizeof(dwProtocolSupport));
InternetSetOptionA(hSession, INTERNET_OPTION_ENABLE_HTTP_PROTOCOL, (LPVOID)&dwProtocolSupport, sizeof(dwProtocolSupport));
out:
return hSession;
@ -187,23 +185,6 @@ uint64_t DownloadToFileOrBufferEx(const char* url, const char* file, const char*
hostname, sizeof(hostname), 0, NULL, 1, urlpath, sizeof(urlpath), NULL, 1};
uint64_t size = 0, total_size = 0;
// Can't link with wininet.lib because of sideloading issues
// And we can't delay-load wininet.dll with MinGW either because the application simply exits on startup...
PF_TYPE_DECL(WINAPI, BOOL, InternetCrackUrlA, (LPCSTR, DWORD, DWORD, LPURL_COMPONENTSA));
PF_TYPE_DECL(WINAPI, HINTERNET, InternetConnectA, (HINTERNET, LPCSTR, INTERNET_PORT, LPCSTR, LPCSTR, DWORD, DWORD, DWORD_PTR));
PF_TYPE_DECL(WINAPI, BOOL, InternetReadFile, (HINTERNET, LPVOID, DWORD, LPDWORD));
PF_TYPE_DECL(WINAPI, BOOL, InternetCloseHandle, (HINTERNET));
PF_TYPE_DECL(WINAPI, HINTERNET, HttpOpenRequestA, (HINTERNET, LPCSTR, LPCSTR, LPCSTR, LPCSTR, LPCSTR*, DWORD, DWORD_PTR));
PF_TYPE_DECL(WINAPI, BOOL, HttpSendRequestA, (HINTERNET, LPCSTR, DWORD, LPVOID, DWORD));
PF_TYPE_DECL(WINAPI, BOOL, HttpQueryInfoA, (HINTERNET, DWORD, LPVOID, LPDWORD, LPDWORD));
PF_INIT_OR_OUT(InternetCrackUrlA, WinInet);
PF_INIT_OR_OUT(InternetConnectA, WinInet);
PF_INIT_OR_OUT(InternetReadFile, WinInet);
PF_INIT_OR_OUT(InternetCloseHandle, WinInet);
PF_INIT_OR_OUT(HttpOpenRequestA, WinInet);
PF_INIT_OR_OUT(HttpSendRequestA, WinInet);
PF_INIT_OR_OUT(HttpQueryInfoA, WinInet);
ErrorStatus = 0;
DownloadStatus = 404;
if (hProgressDialog != NULL)
@ -220,7 +201,7 @@ uint64_t DownloadToFileOrBufferEx(const char* url, const char* file, const char*
uprintf("Downloading %s", url);
}
if ( (!pfInternetCrackUrlA(url, (DWORD)safe_strlen(url), 0, &UrlParts))
if ( (!InternetCrackUrlA(url, (DWORD)safe_strlen(url), 0, &UrlParts))
|| (UrlParts.lpszHostName == NULL) || (UrlParts.lpszUrlPath == NULL)) {
uprintf("Unable to decode URL: %s", WindowsErrorString());
goto out;
@ -233,13 +214,13 @@ uint64_t DownloadToFileOrBufferEx(const char* url, const char* file, const char*
goto out;
}
hConnection = pfInternetConnectA(hSession, UrlParts.lpszHostName, UrlParts.nPort, NULL, NULL, INTERNET_SERVICE_HTTP, 0, (DWORD_PTR)NULL);
hConnection = InternetConnectA(hSession, UrlParts.lpszHostName, UrlParts.nPort, NULL, NULL, INTERNET_SERVICE_HTTP, 0, (DWORD_PTR)NULL);
if (hConnection == NULL) {
uprintf("Could not connect to server %s:%d: %s", UrlParts.lpszHostName, UrlParts.nPort, WindowsErrorString());
goto out;
}
hRequest = pfHttpOpenRequestA(hConnection, "GET", UrlParts.lpszUrlPath, NULL, NULL, accept_types,
hRequest = HttpOpenRequestA(hConnection, "GET", UrlParts.lpszUrlPath, NULL, NULL, accept_types,
INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP | INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS |
INTERNET_FLAG_NO_COOKIES | INTERNET_FLAG_NO_UI | INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_HYPERLINK |
((UrlParts.nScheme==INTERNET_SCHEME_HTTPS)?INTERNET_FLAG_SECURE:0), (DWORD_PTR)NULL);
@ -248,14 +229,14 @@ uint64_t DownloadToFileOrBufferEx(const char* url, const char* file, const char*
goto out;
}
if (!pfHttpSendRequestA(hRequest, request_headers, -1L, NULL, 0)) {
if (!HttpSendRequestA(hRequest, request_headers, -1L, NULL, 0)) {
uprintf("Unable to send request: %s", WindowsErrorString());
goto out;
}
// Get the file size
dwSize = sizeof(DownloadStatus);
pfHttpQueryInfoA(hRequest, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, (LPVOID)&DownloadStatus, &dwSize, NULL);
HttpQueryInfoA(hRequest, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, (LPVOID)&DownloadStatus, &dwSize, NULL);
if (DownloadStatus != 200) {
error_code = ERROR_INTERNET_ITEM_NOT_FOUND;
SetLastError(RUFUS_ERROR(error_code));
@ -263,7 +244,7 @@ uint64_t DownloadToFileOrBufferEx(const char* url, const char* file, const char*
goto out;
}
dwSize = sizeof(strsize);
if (!pfHttpQueryInfoA(hRequest, HTTP_QUERY_CONTENT_LENGTH, (LPVOID)strsize, &dwSize, NULL)) {
if (!HttpQueryInfoA(hRequest, HTTP_QUERY_CONTENT_LENGTH, (LPVOID)strsize, &dwSize, NULL)) {
uprintf("Unable to retrieve file length: %s", WindowsErrorString());
goto out;
}
@ -302,7 +283,7 @@ uint64_t DownloadToFileOrBufferEx(const char* url, const char* file, const char*
// User may have cancelled the download
if (IS_ERROR(ErrorStatus))
goto out;
if (!pfInternetReadFile(hRequest, buf, sizeof(buf), &dwDownloaded) || (dwDownloaded == 0))
if (!InternetReadFile(hRequest, buf, sizeof(buf), &dwDownloaded) || (dwDownloaded == 0))
break;
if (hProgressDialog != NULL)
UpdateProgressWithInfo(OP_NOOP, MSG_241, size, total_size);
@ -347,11 +328,11 @@ out:
safe_free(*buffer);
}
if (hRequest)
pfInternetCloseHandle(hRequest);
InternetCloseHandle(hRequest);
if (hConnection)
pfInternetCloseHandle(hConnection);
InternetCloseHandle(hConnection);
if (hSession)
pfInternetCloseHandle(hSession);
InternetCloseHandle(hSession);
SetLastError(error_code);
return r ? size : 0;
@ -476,23 +457,6 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
SYSTEMTIME ServerTime, LocalTime;
FILETIME FileTime;
int64_t local_time = 0, reg_time, server_time, update_interval;
// Can't link with wininet.lib because of sideloading issues
PF_TYPE_DECL(WINAPI, BOOL, InternetCrackUrlA, (LPCSTR, DWORD, DWORD, LPURL_COMPONENTSA));
PF_TYPE_DECL(WINAPI, HINTERNET, InternetConnectA, (HINTERNET, LPCSTR, INTERNET_PORT, LPCSTR, LPCSTR, DWORD, DWORD, DWORD_PTR));
PF_TYPE_DECL(WINAPI, BOOL, InternetReadFile, (HINTERNET, LPVOID, DWORD, LPDWORD));
PF_TYPE_DECL(WINAPI, BOOL, InternetCloseHandle, (HINTERNET));
PF_TYPE_DECL(WINAPI, HINTERNET, HttpOpenRequestA, (HINTERNET, LPCSTR, LPCSTR, LPCSTR, LPCSTR, LPCSTR*, DWORD, DWORD_PTR));
PF_TYPE_DECL(WINAPI, BOOL, HttpSendRequestA, (HINTERNET, LPCSTR, DWORD, LPVOID, DWORD));
PF_TYPE_DECL(WINAPI, BOOL, HttpQueryInfoA, (HINTERNET, DWORD, LPVOID, LPDWORD, LPDWORD));
PF_INIT_OR_OUT(InternetCrackUrlA, WinInet);
PF_INIT_OR_OUT(InternetConnectA, WinInet);
PF_INIT_OR_OUT(InternetReadFile, WinInet);
PF_INIT_OR_OUT(InternetCloseHandle, WinInet);
PF_INIT_OR_OUT(HttpOpenRequestA, WinInet);
PF_INIT_OR_OUT(HttpSendRequestA, WinInet);
PF_INIT_OR_OUT(HttpQueryInfoA, WinInet);
verbose = ReadSetting32(SETTING_VERBOSE_UPDATES);
// Without this the FileDialog will produce error 0x8001010E when compiled for Vista or later
IGNORE_RETVAL(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE));
@ -530,7 +494,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
PrintInfoDebug(3000, MSG_243);
status++; // 1
if (!pfInternetCrackUrlA(server_url, (DWORD)safe_strlen(server_url), 0, &UrlParts))
if (!InternetCrackUrlA(server_url, (DWORD)safe_strlen(server_url), 0, &UrlParts))
goto out;
hostname[sizeof(hostname)-1] = 0;
@ -540,7 +504,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
hSession = GetInternetSession(NULL, FALSE);
if (hSession == NULL)
goto out;
hConnection = pfInternetConnectA(hSession, UrlParts.lpszHostName, UrlParts.nPort,
hConnection = InternetConnectA(hSession, UrlParts.lpszHostName, UrlParts.nPort,
NULL, NULL, INTERNET_SERVICE_HTTP, 0, (DWORD_PTR)NULL);
if (hConnection == NULL)
goto out;
@ -582,11 +546,11 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
UrlParts.dwUrlPathLength = sizeof(urlpath);
for (i=0; i<ARRAYSIZE(verpos); i++) {
vvuprintf("Trying %s", UrlParts.lpszUrlPath);
hRequest = pfHttpOpenRequestA(hConnection, "GET", UrlParts.lpszUrlPath, NULL, NULL, accept_types,
hRequest = HttpOpenRequestA(hConnection, "GET", UrlParts.lpszUrlPath, NULL, NULL, accept_types,
INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP|INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS|
INTERNET_FLAG_NO_COOKIES|INTERNET_FLAG_NO_UI|INTERNET_FLAG_NO_CACHE_WRITE|INTERNET_FLAG_HYPERLINK|
((UrlParts.nScheme == INTERNET_SCHEME_HTTPS)?INTERNET_FLAG_SECURE:0), (DWORD_PTR)NULL);
if ((hRequest == NULL) || (!pfHttpSendRequestA(hRequest, request_headers, -1L, NULL, 0))) {
if ((hRequest == NULL) || (!HttpSendRequestA(hRequest, request_headers, -1L, NULL, 0))) {
uprintf("Unable to send request: %s", WindowsErrorString());
goto out;
}
@ -594,10 +558,10 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
// Ensure that we get a text file
dwSize = sizeof(dwStatus);
dwStatus = 404;
pfHttpQueryInfoA(hRequest, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, (LPVOID)&dwStatus, &dwSize, NULL);
HttpQueryInfoA(hRequest, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, (LPVOID)&dwStatus, &dwSize, NULL);
if (dwStatus == 200)
break;
pfInternetCloseHandle(hRequest);
InternetCloseHandle(hRequest);
hRequest = NULL;
safe_strcpy(&urlpath[verpos[i]], 5, ".ver");
}
@ -614,7 +578,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
// On the other hand, if local clock is set way back in the past, we will never check.
dwSize = sizeof(ServerTime);
// If we can't get a date we can trust, don't bother...
if ( (!pfHttpQueryInfoA(hRequest, HTTP_QUERY_DATE|HTTP_QUERY_FLAG_SYSTEMTIME, (LPVOID)&ServerTime, &dwSize, NULL))
if ( (!HttpQueryInfoA(hRequest, HTTP_QUERY_DATE|HTTP_QUERY_FLAG_SYSTEMTIME, (LPVOID)&ServerTime, &dwSize, NULL))
|| (!SystemTimeToFileTime(&ServerTime, &FileTime)) )
goto out;
server_time = ((((int64_t)FileTime.dwHighDateTime) << 32) + FileTime.dwLowDateTime) / 10000000;
@ -631,7 +595,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
}
dwSize = sizeof(dwTotalSize);
if (!pfHttpQueryInfoA(hRequest, HTTP_QUERY_CONTENT_LENGTH|HTTP_QUERY_FLAG_NUMBER, (LPVOID)&dwTotalSize, &dwSize, NULL))
if (!HttpQueryInfoA(hRequest, HTTP_QUERY_CONTENT_LENGTH|HTTP_QUERY_FLAG_NUMBER, (LPVOID)&dwTotalSize, &dwSize, NULL))
goto out;
// Make sure the file is NUL terminated
@ -639,7 +603,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
if (buf == NULL)
goto out;
// This is a version file - we should be able to gulp it down in one go
if (!pfInternetReadFile(hRequest, buf, dwTotalSize, &dwDownloaded) || (dwDownloaded != dwTotalSize))
if (!InternetReadFile(hRequest, buf, dwTotalSize, &dwDownloaded) || (dwDownloaded != dwTotalSize))
goto out;
vuprintf("Successfully downloaded version file (%d bytes)", dwTotalSize);
@ -670,11 +634,11 @@ out:
safe_free(buf);
safe_free(sig);
if (hRequest)
pfInternetCloseHandle(hRequest);
InternetCloseHandle(hRequest);
if (hConnection)
pfInternetCloseHandle(hConnection);
InternetCloseHandle(hConnection);
if (hSession)
pfInternetCloseHandle(hSession);
InternetCloseHandle(hSession);
switch (status) {
case 1:
PrintInfoDebug(3000, MSG_244);
@ -933,26 +897,13 @@ BOOL IsDownloadable(const char* url)
URL_COMPONENTSA UrlParts = { sizeof(URL_COMPONENTSA), NULL, 1, (INTERNET_SCHEME)0,
hostname, sizeof(hostname), 0, NULL, 1, urlpath, sizeof(urlpath), NULL, 1 };
PF_TYPE_DECL(WINAPI, BOOL, InternetCrackUrlA, (LPCSTR, DWORD, DWORD, LPURL_COMPONENTSA));
PF_TYPE_DECL(WINAPI, HINTERNET, InternetConnectA, (HINTERNET, LPCSTR, INTERNET_PORT, LPCSTR, LPCSTR, DWORD, DWORD, DWORD_PTR));
PF_TYPE_DECL(WINAPI, BOOL, InternetCloseHandle, (HINTERNET));
PF_TYPE_DECL(WINAPI, HINTERNET, HttpOpenRequestA, (HINTERNET, LPCSTR, LPCSTR, LPCSTR, LPCSTR, LPCSTR*, DWORD, DWORD_PTR));
PF_TYPE_DECL(WINAPI, BOOL, HttpSendRequestA, (HINTERNET, LPCSTR, DWORD, LPVOID, DWORD));
PF_TYPE_DECL(WINAPI, BOOL, HttpQueryInfoA, (HINTERNET, DWORD, LPVOID, LPDWORD, LPDWORD));
PF_INIT_OR_OUT(InternetCrackUrlA, WinInet);
PF_INIT_OR_OUT(InternetConnectA, WinInet);
PF_INIT_OR_OUT(InternetCloseHandle, WinInet);
PF_INIT_OR_OUT(HttpOpenRequestA, WinInet);
PF_INIT_OR_OUT(HttpSendRequestA, WinInet);
PF_INIT_OR_OUT(HttpQueryInfoA, WinInet);
if (url == NULL)
return FALSE;
ErrorStatus = 0;
DownloadStatus = 404;
if ((!pfInternetCrackUrlA(url, (DWORD)safe_strlen(url), 0, &UrlParts))
if ((!InternetCrackUrlA(url, (DWORD)safe_strlen(url), 0, &UrlParts))
|| (UrlParts.lpszHostName == NULL) || (UrlParts.lpszUrlPath == NULL))
goto out;
hostname[sizeof(hostname) - 1] = 0;
@ -962,35 +913,35 @@ BOOL IsDownloadable(const char* url)
if (hSession == NULL)
goto out;
hConnection = pfInternetConnectA(hSession, UrlParts.lpszHostName, UrlParts.nPort, NULL, NULL, INTERNET_SERVICE_HTTP, 0, (DWORD_PTR)NULL);
hConnection = InternetConnectA(hSession, UrlParts.lpszHostName, UrlParts.nPort, NULL, NULL, INTERNET_SERVICE_HTTP, 0, (DWORD_PTR)NULL);
if (hConnection == NULL)
goto out;
hRequest = pfHttpOpenRequestA(hConnection, "GET", UrlParts.lpszUrlPath, NULL, NULL, accept_types,
hRequest = HttpOpenRequestA(hConnection, "GET", UrlParts.lpszUrlPath, NULL, NULL, accept_types,
INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP | INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS |
INTERNET_FLAG_NO_COOKIES | INTERNET_FLAG_NO_UI | INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_HYPERLINK |
((UrlParts.nScheme == INTERNET_SCHEME_HTTPS) ? INTERNET_FLAG_SECURE : 0), (DWORD_PTR)NULL);
if (hRequest == NULL)
goto out;
if (!pfHttpSendRequestA(hRequest, request_headers, -1L, NULL, 0))
if (!HttpSendRequestA(hRequest, request_headers, -1L, NULL, 0))
goto out;
// Get the file size
dwSize = sizeof(DownloadStatus);
pfHttpQueryInfoA(hRequest, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, (LPVOID)&DownloadStatus, &dwSize, NULL);
HttpQueryInfoA(hRequest, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, (LPVOID)&DownloadStatus, &dwSize, NULL);
if (DownloadStatus != 200)
goto out;
dwSize = sizeof(dwTotalSize);
pfHttpQueryInfoA(hRequest, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, (LPVOID)&dwTotalSize, &dwSize, NULL);
HttpQueryInfoA(hRequest, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, (LPVOID)&dwTotalSize, &dwSize, NULL);
out:
if (hRequest)
pfInternetCloseHandle(hRequest);
InternetCloseHandle(hRequest);
if (hConnection)
pfInternetCloseHandle(hConnection);
InternetCloseHandle(hConnection);
if (hSession)
pfInternetCloseHandle(hSession);
InternetCloseHandle(hSession);
return (dwTotalSize > 0);
}

View file

@ -407,7 +407,8 @@ static PWSTR GetProcessCommandLine(HANDLE hProcess)
ucmdline = (UNICODE_STRING*)(pp + cmd_offset);
// In the absolute, someone could craft a process with dodgy attributes to try to cause an overflow
ucmdline->Length = min(ucmdline->Length, 512);
// coverity[cast_overflow]
ucmdline->Length = min(ucmdline->Length, (USHORT)512);
wcmdline = (PWSTR)calloc(ucmdline->Length + 1, sizeof(WCHAR));
if (!ReadProcessMemory(hProcess, ucmdline->Buffer, wcmdline, ucmdline->Length, NULL)) {
safe_free(wcmdline);
@ -493,8 +494,7 @@ static DWORD WINAPI SearchProcessThread(LPVOID param)
// Work on our own copy of the handle names so we don't have to hold the
// mutex for string comparison. Update only if the version has changed.
if (blocking_process.nVersion[0] != blocking_process.nVersion[1]) {
assert(blocking_process.wHandleName != NULL && blocking_process.nHandles != 0);
if (blocking_process.wHandleName == NULL || blocking_process.nHandles == 0) {
if_not_assert(blocking_process.wHandleName != NULL && blocking_process.nHandles != 0) {
ReleaseMutex(hLock);
goto out;
}
@ -895,7 +895,7 @@ static BOOL IsProcessRunning(uint64_t pid)
PF_INIT_OR_OUT(NtClose, NtDll);
status = PhOpenProcess(&hProcess, PROCESS_QUERY_LIMITED_INFORMATION, (HANDLE)pid);
status = PhOpenProcess(&hProcess, PROCESS_QUERY_LIMITED_INFORMATION, (HANDLE)(uintptr_t)pid);
if (!NT_SUCCESS(status) || (hProcess == NULL))
return FALSE;
if (GetExitCodeProcess(hProcess, &dwExitCode))
@ -930,8 +930,7 @@ BYTE GetProcessSearch(uint32_t timeout, uint8_t access_mask, BOOL bIgnoreStalePr
return 0;
}
assert(blocking_process.hLock != NULL);
if (blocking_process.hLock == NULL)
if_not_assert(blocking_process.hLock != NULL)
return 0;
retry:

View file

@ -37,11 +37,9 @@ static __inline BOOL DeleteRegistryKey(HKEY key_root, const char* key_name)
HKEY hSoftware = NULL;
LONG s;
assert(key_root == REGKEY_HKCU);
if (key_root != REGKEY_HKCU)
if_not_assert(key_root == REGKEY_HKCU)
return FALSE;
assert(key_name != NULL);
if (key_name == NULL)
if_not_assert(key_name != NULL)
return FALSE;
if (RegOpenKeyExA(key_root, "SOFTWARE", 0, KEY_READ|KEY_CREATE_SUB_KEY, &hSoftware) != ERROR_SUCCESS)
@ -135,15 +133,12 @@ static __inline BOOL _SetRegistryKey(HKEY key_root, const char* key_name, DWORD
HKEY hRoot = NULL, hApp = NULL;
DWORD dwDisp, dwType = reg_type;
assert(key_name != NULL);
if (key_name == NULL)
if_not_assert(key_name != NULL)
return FALSE;
assert(key_root == REGKEY_HKCU);
if (key_root != REGKEY_HKCU)
if_not_assert(key_root == REGKEY_HKCU)
return FALSE;
// Validate that we are always dealing with a short key
assert(strchr(key_name, '\\') == NULL);
if (strchr(key_name, '\\') != NULL)
if_not_assert(strchr(key_name, '\\') == NULL)
return FALSE;
if (RegOpenKeyExA(key_root, NULL, 0, KEY_READ|KEY_CREATE_SUB_KEY, &hRoot) != ERROR_SUCCESS) {

View file

@ -1131,7 +1131,8 @@ static void DisplayISOProps(void)
// Insert the image name into the Boot selection dropdown and (re)populate the Image option dropdown
static void UpdateImage(BOOL update_image_option_only)
{
assert(image_index != 0);
if_not_assert(image_index != 0)
return;
if (!update_image_option_only) {
if (ComboBox_GetItemData(hBootType, image_index) == BT_IMAGE)
@ -1429,8 +1430,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param)
}
if (boot_type == BT_IMAGE) {
assert(image_path != NULL);
if (image_path == NULL)
if_not_assert(image_path != NULL)
goto out;
if ((size_check) && (img_report.projected_size > (uint64_t)SelectedDrive.DiskSize)) {
// This ISO image is too big for the selected target

View file

@ -15,6 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <windows.h>
#include <malloc.h>
#include <inttypes.h>
@ -36,6 +37,7 @@
#define MB 1048576LL
#define GB 1073741824LL
#define TB 1099511627776LL
#define PB 1125899906842624LL
/*
* Features not ready for prime time and that may *DESTROY* your data - USE AT YOUR OWN RISKS!
@ -186,6 +188,7 @@ static __inline void static_repchr(char* p, char s, char r) {
}
#define to_unix_path(str) static_repchr(str, '\\', '/')
#define to_windows_path(str) static_repchr(str, '/', '\\')
#define if_not_assert(cond) assert(cond); if (!(cond))
extern void uprintf(const char *format, ...);
extern void uprintfs(const char *str);
@ -627,7 +630,7 @@ typedef struct {
#define UNATTEND_WINPE_SETUP_MASK (UNATTEND_SECUREBOOT_TPM_MINRAM)
#define UNATTEND_SPECIALIZE_DEPLOYMENT_MASK (UNATTEND_NO_ONLINE_ACCOUNT)
#define UNATTEND_OOBE_SHELL_SETUP_MASK (UNATTEND_NO_DATA_COLLECTION | UNATTEND_SET_USER)
#define UNATTEND_OOBE_SHELL_SETUP_MASK (UNATTEND_NO_DATA_COLLECTION | UNATTEND_SET_USER | UNATTEND_DUPLICATE_LOCALE)
#define UNATTEND_OOBE_INTERNATIONAL_MASK (UNATTEND_DUPLICATE_LOCALE)
#define UNATTEND_OOBE_MASK (UNATTEND_OOBE_SHELL_SETUP_MASK | UNATTEND_OOBE_INTERNATIONAL_MASK | UNATTEND_DISABLE_BITLOCKER)
#define UNATTEND_OFFLINE_SERVICING_MASK (UNATTEND_OFFLINE_INTERNAL_DRIVES | UNATTEND_FORCE_S_MODE)

View file

@ -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.5.2180"
CAPTION "Rufus 4.6.2191"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -397,8 +397,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,5,2180,0
PRODUCTVERSION 4,5,2180,0
FILEVERSION 4,6,2191,0
PRODUCTVERSION 4,6,2191,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -416,13 +416,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "4.5.2180"
VALUE "FileVersion", "4.6.2191"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "<22> 2011-2024 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-4.5.exe"
VALUE "OriginalFilename", "rufus-4.6.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "4.5.2180"
VALUE "ProductVersion", "4.6.2191"
END
END
BLOCK "VarFileInfo"

View file

@ -80,8 +80,7 @@ BOOL htab_create(uint32_t nel, htab_table* htab)
if (htab == NULL) {
return FALSE;
}
assert(htab->table == NULL);
if (htab->table != NULL) {
if_not_assert(htab->table == NULL) {
uprintf("Warning: htab_create() was called with a non empty table");
return FALSE;
}
@ -197,8 +196,7 @@ uint32_t htab_hash(char* str, htab_table* htab)
// Not found => New entry
// If the table is full return an error
assert(htab->filled < htab->size);
if (htab->filled >= htab->size) {
if_not_assert(htab->filled < htab->size) {
uprintf("Hash table is full (%d entries)", htab->size);
return 0;
}
@ -1199,7 +1197,8 @@ BOOL MountRegistryHive(const HKEY key, const char* pszHiveName, const char* pszH
LSTATUS status;
HANDLE token = INVALID_HANDLE_VALUE;
assert((key == HKEY_LOCAL_MACHINE) || (key == HKEY_USERS));
if_not_assert((key == HKEY_LOCAL_MACHINE) || (key == HKEY_USERS))
return FALSE;
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &token)) {
uprintf("Could not get current process token: %s", WindowsErrorString());
@ -1230,7 +1229,8 @@ BOOL UnmountRegistryHive(const HKEY key, const char* pszHiveName)
{
LSTATUS status;
assert((key == HKEY_LOCAL_MACHINE) || (key == HKEY_USERS));
if_not_assert((key == HKEY_LOCAL_MACHINE) || (key == HKEY_USERS))
return FALSE;
status = RegUnLoadKeyA(key, pszHiveName);
if (status != ERROR_SUCCESS) {

View file

@ -857,7 +857,8 @@ uint32_t ResolveDllAddress(dll_resolver_t* resolver)
// NB: SymLoadModuleEx() does not load a PDB unless the file has an explicit '.pdb' extension
base_address = pfSymLoadModuleEx(hRufus, NULL, path, NULL, DEFAULT_BASE_ADDRESS, 0, NULL, 0);
assert(base_address == DEFAULT_BASE_ADDRESS);
if_not_assert(base_address == DEFAULT_BASE_ADDRESS)
goto out;
// On Windows 11 ARM64 the following call will return *TWO* different addresses for the same
// call, because most Windows DLL's are ARM64X, which means that they are an unholy union of
// both X64 and ARM64 code in the same binary...

View file

@ -588,7 +588,8 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP
return (INT_PTR)TRUE;
case IDC_MORE_INFO:
if (notification_more_info != NULL) {
assert(notification_more_info->callback != NULL);
if_not_assert(notification_more_info->callback != NULL)
return (INT_PTR)FALSE;
if (notification_more_info->id == MORE_INFO_URL) {
ShellExecuteA(hDlg, "open", notification_more_info->url, NULL, NULL, SW_SHOWNORMAL);
} else {

View file

@ -575,7 +575,8 @@ void SetSectionHeaders(HWND hDlg)
memset(wtmp, 0, sizeof(wtmp));
GetWindowTextW(hCtrl, wtmp, ARRAYSIZE(wtmp) - 4);
wlen = wcslen(wtmp);
assert(wlen < ARRAYSIZE(wtmp) - 2);
if_not_assert(wlen < ARRAYSIZE(wtmp) - 2)
break;
wtmp[wlen++] = L' ';
wtmp[wlen++] = L' ';
SetWindowTextW(hCtrl, wtmp);

View file

@ -17,7 +17,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// MinGW includes virdisk.h in windows.h, but we we don't want that
// because we must apply a delay-loading workaround, and that workaround
// has to apply between the winnt.h include and the virdisk.h include.
// So we define _INC_VIRTDISK, to prevent the virdisk.h include in
// windows.h, and then take care of the workaround (and virtdisk.h
// include) in vhd.h.
#define _INC_VIRTDISK
#include <windows.h>
#undef _INC_VIRTDISK
#include <windowsx.h>
#include <stdlib.h>
#include <io.h>
@ -68,9 +76,10 @@ static uint8_t wim_flags = 0;
static uint32_t progress_report_mask;
static uint64_t progress_offset = 0, progress_total = 100;
static wchar_t wmount_path[MAX_PATH] = { 0 }, wmount_track[MAX_PATH] = { 0 };
static char sevenzip_path[MAX_PATH];
static BOOL count_files;
static char sevenzip_path[MAX_PATH], physical_path[128] = "";
static int progress_op = OP_FILE_COPY, progress_msg = MSG_267;
static BOOL count_files;
static HANDLE mounted_handle = INVALID_HANDLE_VALUE;
static BOOL Get7ZipPath(void)
{
@ -897,23 +906,6 @@ BOOL WimApplyImage(const char* image, int index, const char* dst)
return dw;
}
// VirtDisk API Prototypes since we can't use delay-loading because of MinGW
// See https://github.com/pbatard/rufus/issues/2272#issuecomment-1615976013
PF_TYPE_DECL(WINAPI, DWORD, CreateVirtualDisk, (PVIRTUAL_STORAGE_TYPE, PCWSTR,
VIRTUAL_DISK_ACCESS_MASK, PSECURITY_DESCRIPTOR, CREATE_VIRTUAL_DISK_FLAG, ULONG,
PCREATE_VIRTUAL_DISK_PARAMETERS, LPOVERLAPPED, PHANDLE));
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));
PF_TYPE_DECL(WINAPI, DWORD, GetVirtualDiskOperationProgress, (HANDLE, LPOVERLAPPED, PVIRTUAL_DISK_PROGRESS));
PF_TYPE_DECL(WINAPI, DWORD, GetVirtualDiskInformation, (HANDLE, PULONG, PGET_VIRTUAL_DISK_INFO, PULONG));
static char physical_path[128] = "";
static HANDLE mounted_handle = INVALID_HANDLE_VALUE;
// Mount an ISO or a VHD/VHDX image and provide its size
// Returns the physical path of the mounted image or NULL on error.
char* VhdMountImageAndGetSize(const char* path, uint64_t* disk_size)
@ -927,12 +919,6 @@ char* VhdMountImageAndGetSize(const char* path, uint64_t* disk_size)
wconvert(path);
char *ret = NULL, *ext = NULL;
PF_INIT_OR_OUT(OpenVirtualDisk, VirtDisk);
PF_INIT_OR_OUT(AttachVirtualDisk, VirtDisk);
PF_INIT_OR_OUT(GetVirtualDiskPhysicalPath, VirtDisk);
if (disk_size != NULL)
PF_INIT_OR_OUT(GetVirtualDiskInformation, VirtDisk);
if (wpath == NULL)
return NULL;
@ -946,7 +932,7 @@ char* VhdMountImageAndGetSize(const char* path, uint64_t* disk_size)
else if (safe_stricmp(ext, ".vhd") == 0)
vtype.DeviceId = VIRTUAL_STORAGE_TYPE_DEVICE_VHD;
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);
@ -955,7 +941,7 @@ char* VhdMountImageAndGetSize(const char* path, uint64_t* disk_size)
}
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);
@ -963,7 +949,7 @@ char* VhdMountImageAndGetSize(const char* path, uint64_t* disk_size)
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 image '%s': %s", path, WindowsErrorString());
@ -975,7 +961,7 @@ char* VhdMountImageAndGetSize(const char* path, uint64_t* disk_size)
*disk_size = 0;
disk_info.Version = GET_VIRTUAL_DISK_INFO_SIZE;
size = sizeof(disk_info);
r = pfGetVirtualDiskInformation(mounted_handle, &size, &disk_info, NULL);
r = GetVirtualDiskInformation(mounted_handle, &size, &disk_info, NULL);
if (r != ERROR_SUCCESS) {
SetLastError(r);
uprintf("Could not obtain virtual size of mounted image '%s': %s", path, WindowsErrorString());
@ -995,12 +981,10 @@ out:
void VhdUnmountImage(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;
@ -1022,11 +1006,9 @@ static DWORD WINAPI VhdSaveImageThread(void* param)
OVERLAPPED overlapped = { 0 };
DWORD r = ERROR_NOT_FOUND, flags;
PF_INIT_OR_OUT(CreateVirtualDisk, VirtDisk);
PF_INIT_OR_OUT(GetVirtualDiskOperationProgress, VirtDisk);
assert(img_save->Type == VIRTUAL_STORAGE_TYPE_DEVICE_VHD ||
img_save->Type == VIRTUAL_STORAGE_TYPE_DEVICE_VHDX);
if_not_assert(img_save->Type == VIRTUAL_STORAGE_TYPE_DEVICE_VHD ||
img_save->Type == VIRTUAL_STORAGE_TYPE_DEVICE_VHDX)
return ERROR_INVALID_PARAMETER;
UpdateProgressWithInfoInit(NULL, FALSE);
@ -1052,7 +1034,7 @@ static DWORD WINAPI VhdSaveImageThread(void* param)
// CreateVirtualDisk() does not have an overwrite flag...
DeleteFileW(wDst);
r = pfCreateVirtualDisk(&vtype, wDst, VIRTUAL_DISK_ACCESS_NONE, NULL,
r = CreateVirtualDisk(&vtype, wDst, VIRTUAL_DISK_ACCESS_NONE, NULL,
flags, 0, (PCREATE_VIRTUAL_DISK_PARAMETERS)&vparams, &overlapped, &handle);
if (r != ERROR_SUCCESS && r != ERROR_IO_PENDING) {
SetLastError(r);
@ -1066,7 +1048,7 @@ static DWORD WINAPI VhdSaveImageThread(void* param)
CancelIoEx(handle, &overlapped);
goto out;
}
if (pfGetVirtualDiskOperationProgress(handle, &overlapped, &vprogress) == ERROR_SUCCESS) {
if (GetVirtualDiskOperationProgress(handle, &overlapped, &vprogress) == ERROR_SUCCESS) {
if (vprogress.OperationStatus == ERROR_IO_PENDING)
UpdateProgressWithInfo(OP_FORMAT, MSG_261, vprogress.CurrentValue, vprogress.CompletionValue);
}

View file

@ -19,6 +19,12 @@
#include <stdint.h>
#include <windows.h>
// Temporary workaround for MinGW32 delay-loading
// See https://github.com/pbatard/rufus/pull/2513
#if defined(__MINGW32__)
#undef DECLSPEC_IMPORT
#define DECLSPEC_IMPORT __attribute__((visibility("hidden")))
#endif
#include <virtdisk.h>
#pragma once
@ -54,10 +60,6 @@
#define MBR_SIZE 512 // Might need to review this once we see bootable 4k systems
// TODO: Remove this once MinGW has been updated
#ifndef VIRTUAL_STORAGE_TYPE_DEVICE_VHDX
#define VIRTUAL_STORAGE_TYPE_DEVICE_VHDX 3
#endif
#define VIRTUAL_STORAGE_TYPE_DEVICE_FFU 99
#define CREATE_VIRTUAL_DISK_VERSION_2 2
#define CREATE_VIRTUAL_DISK_FLAG_CREATE_BACKING_STORAGE 8

View file

@ -102,11 +102,13 @@ static __inline BOOL ReadFileAsync(HANDLE h, LPVOID lpBuffer, DWORD nNumberOfByt
ASYNC_FD* fd = (ASYNC_FD*)h;
fd->Overlapped.bOffsetUpdated = FALSE;
if (!ReadFile(fd->hFile, lpBuffer, nNumberOfBytesToRead, NULL,
(OVERLAPPED*)&fd->Overlapped))
// TODO: Is it possible to get ERROR_HANDLE_EOF here?
(OVERLAPPED*)&fd->Overlapped)) {
// Is it possible to get ERROR_HANDLE_EOF here?
assert(GetLastError() != ERROR_HANDLE_EOF);
fd->iStatus = (GetLastError() == ERROR_IO_PENDING) ? -1 : 0;
else
} else {
fd->iStatus = 1;
}
return (fd->iStatus != 0);
}
@ -165,11 +167,11 @@ static __inline BOOL GetSizeAsync(HANDLE h, LPDWORD lpNumberOfBytes)
SetLastError(ERROR_NO_MORE_ITEMS);
return FALSE;
}
fd->Overlapped.bOffsetUpdated = TRUE;
if (!GetOverlappedResultEx(fd->hFile, (OVERLAPPED*)&fd->Overlapped,
lpNumberOfBytes, WRITE_TIMEOUT, (fd->iStatus < 0)))
// When reading from VHD/VHDX we get SECTOR_NOT_FOUND rather than EOF for the end of the drive
return (GetLastError() == ERROR_HANDLE_EOF || GetLastError() == ERROR_SECTOR_NOT_FOUND);
fd->Overlapped.Offset += *lpNumberOfBytes;
fd->Overlapped.bOffsetUpdated = TRUE;
return TRUE;
}

View file

@ -31,6 +31,7 @@
#include "resource.h"
#include "registry.h"
#include "msapi_utf8.h"
#include "timezoneapi.h"
#include "localization.h"
/* Memory leaks detection - define _CRTDBG_MAP_ALLOC as preprocessor macro */
@ -60,10 +61,13 @@ extern StrArray modified_files;
/// <returns>The path of a newly created answer file on success or NULL on error.</returns>
char* CreateUnattendXml(int arch, int flags)
{
const static char* xml_arch_names[5] = { "x86", "amd64", "arm", "arm64" };
const static char* unallowed_account_names[] = { "Administrator", "Guest", "KRBTGT", "Local" };
static char path[MAX_PATH];
char* tzstr;
FILE* fd;
TIME_ZONE_INFORMATION tz_info;
int i, order;
const char* xml_arch_names[5] = { "x86", "amd64", "arm", "arm64" };
unattend_xml_flags = flags;
if (arch < ARCH_X86_32 || arch > ARCH_ARM_64 || flags == 0) {
uprintf("Note: No Windows User Experience options selected");
@ -149,11 +153,20 @@ char* CreateUnattendXml(int arch, int flags)
fprintf(fd, " <ProtectYourPC>3</ProtectYourPC>\n");
fprintf(fd, " </OOBE>\n");
}
if (flags & UNATTEND_SET_USER) {
if ((unattend_username[0] == 0) || (stricmp(unattend_username, "Administrator") == 0) ||
(stricmp(unattend_username, "Guest") == 0)) {
uprintf("WARNING: '%s' is not allowed as local account name - Option ignored", unattend_username);
if (flags & UNATTEND_DUPLICATE_LOCALE) {
if ((GetTimeZoneInformation(&tz_info) == TIME_ZONE_ID_INVALID) ||
((tzstr = wchar_to_utf8(tz_info.StandardName)) == NULL)) {
uprintf("WARNING: Could not retrieve current timezone: %s", WindowsErrorString());
} else {
fprintf(fd, " <TimeZone>%s</TimeZone>\n", tzstr);
free(tzstr);
}
}
if (flags & UNATTEND_SET_USER) {
for (i = 0; (i < ARRAYSIZE(unallowed_account_names)) && (stricmp(unattend_username, unallowed_account_names[i]) != 0); i++);
if (i < ARRAYSIZE(unallowed_account_names)) {
uprintf("WARNING: '%s' is not allowed as local account name - Option ignored", unattend_username);
} else if (unattend_username[0] != 0) {
uprintf("• Use '%s' for local account name", unattend_username);
// If we create a local account in unattend.xml, then we can get Windows 11
// 22H2 to skip MSA even if the network is connected during installation.
@ -631,7 +644,7 @@ out:
/// <summary>
/// Setup a Windows To Go drive according to the official Microsoft instructions detailed at:
/// https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-8.1-and-8/jj721578(v=ws.11).
/// https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/deployment/windows-to-go/deploy-windows-to-go
/// Note that as opposed to the technet guide above we use bcdedit rather than 'unattend.xml'
/// to disable the recovery environment.
/// </summary>
@ -892,7 +905,8 @@ BOOL ApplyWindowsCustomization(char drive_letter, int flags)
// If we have a windowsPE section, copy the answer files to the root of boot.wim as
// Autounattend.xml. This also results in that file being automatically copied over
// to %WINDIR%\Panther\unattend.xml for later passes processing.
assert(mount_path != NULL);
if_not_assert(mount_path != NULL)
goto out;
static_sprintf(path, "%s\\Autounattend.xml", mount_path);
if (!CopyFileU(unattend_xml_path, path, TRUE)) {
uprintf("Could not create boot.wim 'Autounattend.xml': %s", WindowsErrorString());