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

Compare commits

..

No commits in common. "e495c691ea65ead3510a23ca8592f4c0f8a6aaa1" and "eeca1f279c495092bdcbe4207585a7b7e381a688" have entirely different histories.

29 changed files with 289 additions and 328 deletions

1
.gitattributes vendored
View file

@ -4,7 +4,6 @@
*.in eol=lf
*.m4 eol=lf
missing eol=lf
compile eol=lf
configure eol=lf
install-sh eol=lf
*.sln eol=crlf

View file

@ -48,7 +48,6 @@ jobs:
install: >-
mingw-w64-${{ matrix.env }}-toolchain
base-devel
autotools
git
upx

View file

@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2020-11-14.01; # UTC
scriptversion=2009-04-28.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@ -35,21 +35,25 @@ scriptversion=2020-11-14.01; # UTC
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
tab=' '
nl='
'
IFS=" $tab$nl"
IFS=" "" $nl"
# Set DOITPROG to "echo" to test this script.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
doit_exec=${doit:-exec}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
@ -64,16 +68,22 @@ mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
# Create dirs (including intermediate dirs) using mode 755.
# This is like GNU 'install' as of coreutils 8.32 (2020).
mkdir_umask=22
backupsuffix=
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
@ -87,7 +97,7 @@ dir_arg=
dst_arg=
copy_on_change=false
is_target_a_directory=possibly
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
@ -104,28 +114,18 @@ Options:
--version display version info and exit.
-c (ignored)
-C install only if different (preserve data modification time)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-p pass -p to $cpprog.
-s $stripprog installed files.
-S SUFFIX attempt to back up existing files, with suffix SUFFIX.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
By default, rm is invoked with -f; when overridden with RMPROG,
it's up to you to specify -f if you want it.
If -S is not specified, no backups are attempted.
Email bug reports to bug-automake@gnu.org.
Automake home page: https://www.gnu.org/software/automake/
"
while test $# -ne 0; do
@ -137,62 +137,42 @@ while test $# -ne 0; do
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-p) cpprog="$cpprog -p";;
shift;;
-s) stripcmd=$stripprog;;
-S) backupsuffix="$2"
shift;;
-t) dst_arg=$2
shift;;
-t)
is_target_a_directory=always
dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) is_target_a_directory=never;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
@ -206,10 +186,6 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
@ -218,26 +194,13 @@ if test $# -eq 0; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
@ -248,16 +211,16 @@ if test -z "$dir_arg"; then
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
u_plus_rw=
else
u_plus_rw='% 200'
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
u_plus_rw=
else
u_plus_rw=,u+rw
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
@ -265,9 +228,9 @@ fi
for src
do
# Protect names problematic for 'test' and other utilities.
# Protect names starting with `-'.
case $src in
-* | [=\(\)!]) src=./$src;;
-*) src=./$src;;
esac
if test -n "$dir_arg"; then
@ -275,10 +238,6 @@ do
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
# Don't chown directories that already exist.
if test $dstdir_status = 0; then
chowncmd=""
fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
@ -293,150 +252,185 @@ do
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename.
dst=$dst_arg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dstbase=`basename "$src"`
case $dst in
*/) dst=$dst$dstbase;;
*) dst=$dst/$dstbase;;
esac
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
dstdir=`dirname "$dst"`
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
case $dstdir in
*/) dstdirslash=$dstdir;;
*) dstdirslash=$dstdir/;;
esac
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
posix_mkdir=false
# The $RANDOM variable is not portable (e.g., dash). Use it
# here however when possible just to lower collision chance.
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
trap '
ret=$?
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
exit $ret
' 0
# Because "mkdir -p" follows existing symlinks and we likely work
# directly in world-writeable /tmp, make sure that the '$tmpdir'
# directory is successfully created first before we actually test
# 'mkdir -p'.
if (umask $mkdir_umask &&
$mkdirprog $mkdir_mode "$tmpdir" &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
test_tmpdir="$tmpdir/a"
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
mkdir_mode=
fi
trap '' 0;;
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# mkdir does not conform to POSIX,
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
/*) prefix='/';;
-*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
set -f
$posix_glob set -f
set fnord $dstdir
shift
set +f
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
@ -449,25 +443,14 @@ do
else
# Make a couple of temp file names in the proper directory.
dsttmp=${dstdirslash}_inst.$$_
rmtmp=${dstdirslash}_rm.$$_
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask &&
{ test -z "$stripcmd" || {
# Create $dsttmp read-write so that cp doesn't create it read-only,
# which would cause strip to fail.
if test -z "$doit"; then
: >"$dsttmp" # No need to fork-exec 'touch'.
else
$doit touch "$dsttmp"
fi
}
} &&
$doit_exec $cpprog "$src" "$dsttmp") &&
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
@ -482,24 +465,20 @@ do
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
set +f &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# If $backupsuffix is set, and the file being installed
# already exists, attempt a backup. Don't worry if it fails,
# e.g., if mv doesn't support -f.
if test -n "$backupsuffix" && test -f "$dst"; then
$doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
fi
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
@ -507,24 +486,24 @@ do
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
@ -533,9 +512,10 @@ do
done
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View file

@ -1064,10 +1064,9 @@ INT_PTR CALLBACK ChecksumCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM
safe_release_dc(GetDlgItem(hDlg, IDC_MD5), hDC);
if (image_path != NULL) {
for (i = (int)strlen(image_path); (i > 0) && (image_path[i] != '\\'); i--);
SetWindowTextU(hDlg, &image_path[i + 1]);
}
for (i=(int)safe_strlen(image_path); (i>0)&&(image_path[i]!='\\'); i--);
if (image_path != NULL) // VS code analysis has a false positive on this one
SetWindowTextU(hDlg, &image_path[i+1]);
// Set focus on the OK button
SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hDlg, IDOK), TRUE);
CenterDialog(hDlg, NULL);

View file

@ -655,7 +655,6 @@ 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);
scsi_card_name_copy[strlen(scsi_card_name_copy) - 1] = '&';
if (safe_strstr(buffer, scsi_card_name_copy) != NULL) {
props.is_CARD = TRUE;
@ -669,7 +668,7 @@ BOOL GetDevices(DWORD devnum)
if (!SetupDiGetDeviceInstanceIdA(dev_info, &dev_info_data, device_instance_id,
sizeof(device_instance_id), &size)) {
uprintf("SetupDiGetDeviceInstanceId failed: %s", WindowsErrorString());
strcpy(device_instance_id, "<N/A>");
static_strcpy(device_instance_id, "<N/A>");
}
memset(buffer, 0, sizeof(buffer));

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* DOS keyboard locale setup
* Copyright © 2011-2021 Pete Batard <pete@akeo.ie>
* Copyright © 2011-2020 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -982,7 +982,6 @@ BOOL SetDOSLocale(const char* path, BOOL bFreeDOS)
kb = "us";
kbdrv = bFreeDOS?fd_get_kbdrv(kb):ms_get_kbdrv(kb); // Always succeeds
}
assert(kbdrv >= 0);
uprintf("Will use DOS keyboard '%s' [%s]\n", kb, kb_to_hr(kb));
// Now get a codepage

View file

@ -301,8 +301,8 @@ errcode_t ext2fs_get_free_blocks2(ext2_filsys fs, blk64_t start, blk64_t finish,
if (!num)
num = 1;
c_ratio = 1 << ext2fs_get_bitmap_granularity(map);
b &= ~((blk64_t)c_ratio - 1);
finish &= ~((blk64_t)c_ratio - 1);
b &= ~(c_ratio - 1);
finish &= ~(c_ratio -1);
do {
if (b + num - 1 >= ext2fs_blocks_count(fs->super)) {
if (finish > start)

View file

@ -1438,7 +1438,7 @@ static errcode_t xattr_array_update(struct ext2_xattr_handle *h,
return 0;
}
if (old_idx >= 0 && h->ibody_count <= old_idx) {
if (h->ibody_count <= old_idx) {
block_free += EXT2_EXT_ATTR_LEN(name_len);
if (!h->attrs[old_idx].ea_ino)
block_free +=

View file

@ -357,8 +357,13 @@ ext2fs_file_write_inline_data(ext2_file_t file, const void *buf,
file->pos += count;
/* Update inode size */
if (count != 0 && EXT2_I_SIZE(&file->inode) < file->pos)
retval = ext2fs_file_set_size2(file, file->pos);
if (count != 0 && EXT2_I_SIZE(&file->inode) < file->pos) {
errcode_t rc;
rc = ext2fs_file_set_size2(file, file->pos);
if (retval == 0)
retval = rc;
}
if (written)
*written = count;

View file

@ -117,7 +117,7 @@ errcode_t ext2fs_make_generic_bitmap(errcode_t magic, ext2_filsys fs,
} else
bitmap->description = 0;
size = (((size_t)bitmap->real_end - bitmap->start) / 8) + 1;
size = (size_t) (((bitmap->real_end - bitmap->start) / 8) + 1);
/* Round up to allow for the BT x86 instruction */
size = (size + 7) & ~3;
retval = ext2fs_get_mem(size, &bitmap->bitmap);
@ -303,7 +303,7 @@ void ext2fs_clear_generic_bitmap(ext2fs_generic_bitmap bitmap)
}
memset(bitmap32->bitmap, 0,
(((size_t)bitmap32->real_end - bitmap32->start) / 8) + 1);
(size_t) (((bitmap32->real_end - bitmap32->start) / 8) + 1));
}
errcode_t ext2fs_fudge_generic_bitmap_end(ext2fs_inode_bitmap gen_bitmap,

View file

@ -87,11 +87,10 @@ void ext2fs_free_inode_cache(struct ext2_inode_cache *icache)
return;
if (icache->buffer)
ext2fs_free_mem(&icache->buffer);
if (icache->cache) {
for (i = 0; i < icache->cache_size; i++)
ext2fs_free_mem(&icache->cache[i].inode);
for (i = 0; i < icache->cache_size; i++)
ext2fs_free_mem(&icache->cache[i].inode);
if (icache->cache)
ext2fs_free_mem(&icache->cache);
}
icache->buffer_blk = 0;
ext2fs_free_mem(&icache);
}

View file

@ -278,7 +278,7 @@ static __inline BOOLEAN _IsMounted(IN HANDLE Handle)
{
IO_STATUS_BLOCK IoStatusBlock;
PF_INIT(NtFsControlFile, NtDll);
return (pfNtFsControlFile == NULL) ? FALSE :
return (pfNtFsControlFile == NULL) ? STATUS_DLL_NOT_FOUND :
(BOOLEAN)(pfNtFsControlFile(Handle, 0, 0, 0, &IoStatusBlock, FSCTL_IS_VOLUME_MOUNTED, 0, 0, 0, 0) == STATUS_SUCCESS);
}

View file

@ -1175,7 +1175,6 @@ static BOOL SetupWinPE(char drive_letter)
for (i=1; i<size-32; i++) {
for (j=0; j<ARRAYSIZE(patch_str_org); j++) {
if (safe_strnicmp(&buffer[i], patch_str_org[j], strlen(patch_str_org[j])-1) == 0) {
assert(index < 2);
uprintf(" 0x%08X: '%s' -> '%s'\n", i, &buffer[i], patch_str_rep[index][j]);
strcpy(&buffer[i], patch_str_rep[index][j]);
i += (DWORD)max(strlen(patch_str_org[j]), strlen(patch_str_rep[index][j])); // in case org is a substring of rep
@ -2094,7 +2093,6 @@ DWORD WINAPI FormatThread(void* param)
if ((hLogicalVolume != NULL) && (hLogicalVolume != INVALID_HANDLE_VALUE)) {
PrintInfoDebug(0, MSG_227);
if (!CloseHandle(hLogicalVolume)) {
hLogicalVolume = INVALID_HANDLE_VALUE;
uprintf("Could not close volume: %s", WindowsErrorString());
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_ACCESS_DENIED;
goto out;

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* extfs formatting
* Copyright © 2019-2021 Pete Batard <pete@akeo.ie>
* Copyright © 2019-2020 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -212,7 +212,6 @@ const char* GetExtFsLabel(DWORD DriveIndex, uint64_t PartitionOffset)
r = ext2fs_open(volume_name, EXT2_FLAG_SKIP_MMP, 0, 0, manager, &ext2fs);
free(volume_name);
if (r == 0) {
assert(ext2fs != NULL);
strncpy(label, ext2fs->super->s_volume_name, EXT2_LABEL_LEN);
label[EXT2_LABEL_LEN] = 0;
}

View file

@ -2,7 +2,7 @@
* Rufus: The Reliable USB Formatting Utility
* Large FAT32 formatting
* Copyright © 2007-2009 Tom Thornhill/Ridgecrop
* Copyright © 2011-2021 Pete Batard <pete@akeo.ie>
* Copyright © 2011-2020 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -414,7 +414,7 @@ BOOL FormatLargeFAT32(DWORD DriveIndex, uint64_t PartitionOffset, DWORD ClusterS
}
for (i = 0; i < (SystemAreaSize + BurstSize - 1); i += BurstSize) {
UpdateProgressWithInfo(OP_FORMAT, MSG_217, (uint64_t)i, (uint64_t)SystemAreaSize + BurstSize);
UpdateProgressWithInfo(OP_FORMAT, MSG_217, (uint64_t)i, (uint64_t)(SystemAreaSize + BurstSize));
CHECK_FOR_USER_CANCEL;
if (write_sectors(hLogicalVolume, BytesPerSect, i, BurstSize, pZeroSect) != (BytesPerSect * BurstSize)) {
die("Error clearing reserved sectors", ERROR_WRITE_FAULT);

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Extract icon from executable and set autorun.inf
* Copyright © 2012-2021 Pete Batard <pete@akeo.ie>
* Copyright © 2012-2019 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -26,7 +26,6 @@
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "rufus.h"
#include "missing.h"
@ -186,8 +185,7 @@ BOOL SetAutorun(const char* path)
uprintf("Created: %s", filename);
// .inf -> .ico
assert(strlen(filename) >= 2);
filename[strlen(filename) - 1] = 'o';
filename[strlen(filename) - 2] = 'c';
filename[strlen(filename)-1] = 'o';
filename[strlen(filename)-2] = 'c';
return ExtractAppIcon(filename, FALSE);
}

View file

@ -180,7 +180,7 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t file_length, const
// Check for archiso loader/entries/*.conf files
if (safe_stricmp(psz_dirname, "/loader/entries") == 0) {
len = safe_strlen(psz_basename);
len = strlen(psz_basename);
props->is_conf = ((len > 4) && (stricmp(&psz_basename[len - 5], ".conf") == 0));
}
@ -863,7 +863,7 @@ BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan)
size_t i, j, size, sl_index = 0;
uint16_t sl_version;
FILE* fd;
int k, r = 1;
int r = 1;
iso9660_t* p_iso = NULL;
iso9660_pvd_t pvd;
udf_t* p_udf = NULL;
@ -969,8 +969,8 @@ out:
if ((iso9660_ifs_read_pvd(p_iso, &pvd)) && (_stat64U(src_iso, &stat) == 0))
img_report.mismatch_size = (int64_t)(iso9660_get_pvd_space_size(&pvd)) * ISO_BLOCKSIZE - stat.st_size;
// Remove trailing spaces from the label
for (k=(int)safe_strlen(img_report.label)-1; ((k>0)&&(isspaceU(img_report.label[k]))); k--)
img_report.label[k] = 0;
for (j=safe_strlen(img_report.label)-1; ((j>0)&&(isspaceU(img_report.label[j]))); j--)
img_report.label[j] = 0;
// We use the fact that UDF_BLOCKSIZE and ISO_BLOCKSIZE are the same here
img_report.projected_size = total_blocks * ISO_BLOCKSIZE;
// We will link the existing isolinux.cfg from a syslinux.cfg we create

View file

@ -937,7 +937,7 @@ _iso9660_dir_to_statbuf (iso9660_dir_t *p_iso9660_dir,
if (su_length % 2)
su_length--;
if (su_length < sizeof (iso9660_xa_t))
if (su_length < 0 || su_length < sizeof (iso9660_xa_t))
return p_stat;
if (nope == b_xa) {

View file

@ -89,12 +89,12 @@ static __inline uint8_t popcnt8(uint8_t val)
static __inline uint8_t popcnt64(register uint64_t u)
{
u = (u & 0x5555555555555555ULL) + ((u >> 1) & 0x5555555555555555ULL);
u = (u & 0x3333333333333333ULL) + ((u >> 2) & 0x3333333333333333ULL);
u = (u & 0x0f0f0f0f0f0f0f0fULL) + ((u >> 4) & 0x0f0f0f0f0f0f0f0fULL);
u = (u & 0x00ff00ff00ff00ffULL) + ((u >> 8) & 0x00ff00ff00ff00ffULL);
u = (u & 0x0000ffff0000ffffULL) + ((u >> 16) & 0x0000ffff0000ffffULL);
u = (u & 0x00000000ffffffffULL) + ((u >> 32) & 0x00000000ffffffffULL);
u = (u & 0x5555555555555555) + ((u >> 1) & 0x5555555555555555);
u = (u & 0x3333333333333333) + ((u >> 2) & 0x3333333333333333);
u = (u & 0x0f0f0f0f0f0f0f0f) + ((u >> 4) & 0x0f0f0f0f0f0f0f0f);
u = (u & 0x00ff00ff00ff00ff) + ((u >> 8) & 0x00ff00ff00ff00ff);
u = (u & 0x0000ffff0000ffff) + ((u >> 16) & 0x0000ffff0000ffff);
u = (u & 0x00000000ffffffff) + ((u >> 32) & 0x00000000ffffffff);
return (uint8_t)u;
}

View file

@ -821,7 +821,7 @@ static __inline int SHDeleteDirectoryExU(HWND hwnd, const char* pszPath, FILEOP_
int ret;
// String needs to be double NULL terminated, so we just use the length of the UTF-8 string
// which is always expected to be larger than our UTF-16 one, and add 2 chars for good measure.
size_t wpszPath_len = (pszPath == NULL) ? 0 : strlen(pszPath) + 2;
size_t wpszPath_len = strlen(pszPath) + 2;
// coverity[returned_null]
walloc(pszPath, wpszPath_len);
SHFILEOPSTRUCTW shfo = { hwnd, FO_DELETE, wpszPath, NULL, fFlags, FALSE, NULL, NULL };

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Elementary Unicode compliant find/replace parser
* Copyright © 2012-2021 Pete Batard <pete@akeo.ie>
* Copyright © 2012-2020 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -796,20 +796,13 @@ char* set_token_data_file(const char* token, const char* data, const char* filen
}
out:
if (fd_in != NULL) {
fclose(fd_in);
fd_in = NULL;
}
if (fd_out != NULL) {
fclose(fd_out);
fd_out = NULL;
}
if (fd_in != NULL) fclose(fd_in);
if (fd_out != NULL) fclose(fd_out);
// If an insertion occurred, delete existing file and use the new one
if (ret != NULL) {
// We're in Windows text mode => Remove CRs if requested
if (wtmpname != NULL)
fd_in = _wfopen(wtmpname, L"rb");
fd_in = _wfopen(wtmpname, L"rb");
fd_out = _wfopen(wfilename, L"wb");
// Don't check fds
if ((fd_in != NULL) && (fd_out != NULL)) {
@ -1059,7 +1052,7 @@ out:
if (fd_out != NULL) fclose(fd_out);
// If an insertion occurred, delete existing file and use the new one
if (ret != NULL && wtmpname != NULL && wfilename != NULL) {
if (ret != NULL) {
// We're in Windows text mode => Remove CRs if requested
fd_in = _wfopen(wtmpname, L"rb");
fd_out = _wfopen(wfilename, L"wb");
@ -1236,7 +1229,7 @@ out:
if (fd_out != NULL) fclose(fd_out);
// If a replacement occurred, delete existing file and use the new one
if (ret != NULL && wtmpname != NULL && wfilename != NULL) {
if (ret != NULL) {
// We're in Windows text mode => Remove CRs if requested
fd_in = _wfopen(wtmpname, L"rb");
fd_out = _wfopen(wfilename, L"wb");

View file

@ -4,7 +4,7 @@
*
* Modified from Process Hacker:
* https://github.com/processhacker2/processhacker2/
* Copyright © 2017-2021 Pete Batard <pete@akeo.ie>
* Copyright © 2017-2020 Pete Batard <pete@akeo.ie>
* Copyright © 2017 dmex
* Copyright © 2009-2016 wj32
*
@ -506,9 +506,6 @@ static DWORD WINAPI SearchProcessThread(LPVOID param)
if (i >= handles->NumberOfHandles)
break;
if (handleInfo == NULL)
continue;
// Don't bother with processes we can't access
if (handleInfo->UniqueProcessId == last_access_denied_pid)
continue;
@ -612,7 +609,7 @@ static DWORD WINAPI SearchProcessThread(LPVOID param)
// The above may not work on Windows 7, so try QueryFullProcessImageName (Vista or later)
if (!bGotCmdLine) {
bGotCmdLine = (QueryFullProcessImageNameW(processHandle, 0, wexe_path, &size) != FALSE);
bGotCmdLine = QueryFullProcessImageNameW(processHandle, 0, wexe_path, &size);
if (bGotCmdLine)
wchar_to_utf8_no_alloc(wexe_path, cmdline, sizeof(cmdline));
}

View file

@ -751,6 +751,9 @@ static void EnableMBRBootOptions(BOOL enable, BOOL remove_checkboxes)
actual_enable_mbr = FALSE;
mbr_selected_by_user = FALSE;
}
if (boot_type == BT_NON_BOOTABLE) {
actual_enable_fix = FALSE;
}
}
if (remove_checkboxes) {
@ -1132,7 +1135,6 @@ static void DisplayISOProps(void)
PRINT_ISO_PROP(HAS_WINPE(img_report), " Uses: WinPE %s", (img_report.uses_minint) ? "(with /minint)" : "");
if (HAS_WININST(img_report)) {
inst_str[4] = '0' + img_report.wininst_index;
assert(strlen(img_report.wininst_path[0]) >= 3);
uprintf(" Uses: Install.%s%s (version %d.%d.%d%s)", &img_report.wininst_path[0][strlen(img_report.wininst_path[0]) - 3],
(img_report.wininst_index > 1) ? inst_str : "", (img_report.wininst_version >> 24) & 0xff,
(img_report.wininst_version >> 16) & 0xff, (img_report.wininst_version >> 8) & 0xff,
@ -2216,7 +2218,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
static SHChangeNotifyEntry NotifyEntry;
static DWORD_PTR thread_affinity[CHECKSUM_MAX + 1];
static HFONT hyperlink_font = NULL;
static wchar_t wtooltip[128];
LONG lPos;
BOOL set_selected_fs;
DRAWITEMSTRUCT* pDI;
@ -2233,6 +2234,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
char tmp[MAX_PATH], *log_buffer = NULL;
wchar_t* wbuffer = NULL;
loc_cmd* lcmd = NULL;
wchar_t wtooltip[128];
switch (message) {

View file

@ -132,7 +132,7 @@
#ifndef STRINGIFY
#define STRINGIFY(x) #x
#endif
#define PERCENTAGE(percent, value) ((1ULL * (percent) * (value)) / 100ULL)
#define PERCENTAGE(percent, value) ((1ULL * percent * value) / 100ULL)
#define IsChecked(CheckBox_ID) (IsDlgButtonChecked(hMainDialog, CheckBox_ID) == BST_CHECKED)
#define MB_IS_RTL (right_to_left_mode?MB_RTLREADING|MB_RIGHT:0)
#define CHECK_FOR_USER_CANCEL if (IS_ERROR(FormatStatus) && (SCODE_CODE(FormatStatus) == ERROR_CANCELLED)) goto out
@ -149,7 +149,7 @@
((char*)(dst))[safe_min(count, dst_max)-1] = 0;} while(0)
#define safe_strcpy(dst, dst_max, src) safe_strcp(dst, dst_max, src, safe_strlen(src)+1)
#define static_strcpy(dst, src) safe_strcpy(dst, sizeof(dst), src)
#define safe_strncat(dst, dst_max, src, count) strncat(dst, src, safe_min(count, (dst_max) - safe_strlen(dst) - 1))
#define safe_strncat(dst, dst_max, src, count) strncat(dst, src, safe_min(count, dst_max - safe_strlen(dst) - 1))
#define safe_strcat(dst, dst_max, src) safe_strncat(dst, dst_max, src, safe_strlen(src)+1)
#define static_strcat(dst, src) safe_strcat(dst, sizeof(dst), src)
#define safe_strcmp(str1, str2) strcmp(((str1==NULL)?"<NULL>":str1), ((str2==NULL)?"<NULL>":str2))
@ -178,7 +178,7 @@ extern void _uprintfs(const char *str);
#define vvuprintf(...) do { if (verbose > 1) _uprintf(__VA_ARGS__); } while(0)
#define suprintf(...) do { if (!bSilent) _uprintf(__VA_ARGS__); } while(0)
#define uuprintf(...) do { if (usb_debug) _uprintf(__VA_ARGS__); } while(0)
#define ubprintf(...) do { safe_sprintf(&ubuffer[ubuffer_pos], UBUFFER_SIZE - ubuffer_pos - 4, __VA_ARGS__); \
#define ubprintf(...) do { safe_sprintf(&ubuffer[ubuffer_pos], UBUFFER_SIZE - ubuffer_pos - 2, __VA_ARGS__); \
ubuffer_pos = strlen(ubuffer); ubuffer[ubuffer_pos++] = '\r'; ubuffer[ubuffer_pos++] = '\n'; \
ubuffer[ubuffer_pos] = 0; } while(0)
#define ubflush() do { if (ubuffer_pos) uprintf("%s", ubuffer); ubuffer_pos = 0; } while(0)
@ -389,7 +389,7 @@ typedef struct {
BOOLEAN has_kolibrios;
BOOLEAN uses_casper;
BOOLEAN uses_minint;
uint8_t compression_type;
BOOLEAN compression_type;
winver_t win_version; // Windows ISO version
uint16_t sl_version; // Syslinux/Isolinux version
char sl_version_str[12];

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 3.18.1856"
CAPTION "Rufus 3.18.1854"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -395,8 +395,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,18,1856,0
PRODUCTVERSION 3,18,1856,0
FILEVERSION 3,18,1854,0
PRODUCTVERSION 3,18,1854,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -414,13 +414,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.18.1856"
VALUE "FileVersion", "3.18.1854"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.18.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.18.1856"
VALUE "ProductVersion", "3.18.1854"
END
END
BLOCK "VarFileInfo"

View file

@ -662,7 +662,7 @@ const char *WindowsErrorString(void)
size = FormatMessageU(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
HRESULT_CODE(error_code), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
&err_string[presize], (DWORD)(sizeof(err_string)-strlen(err_string)), NULL);
&err_string[presize], sizeof(err_string)-(DWORD)strlen(err_string), NULL);
if (size == 0) {
format_error = GetLastError();
if ((format_error) && (format_error != ERROR_MR_MID_NOT_FOUND) && (format_error != ERROR_MUI_FILE_NOT_LOADED))

View file

@ -155,12 +155,9 @@ void BrowseForFolder(void) {
dialog_showing++;
hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC,
&IID_IFileOpenDialog, (LPVOID)&pfod);
if (FAILED(hr) || pfod == NULL) {
if (FAILED(hr)) {
uprintf("CoCreateInstance for FileOpenDialog failed: error %X\n", hr);
if (pfod != NULL) {
IFileOpenDialog_Release(pfod);
pfod = NULL; // Just in case
}
pfod = NULL; // Just in case
goto fallback;
}
hr = IFileOpenDialog_SetOptions(pfod, FOS_PICKFOLDERS);
@ -183,7 +180,7 @@ void BrowseForFolder(void) {
}
hr = SHCreateItemFromParsingName(wpath, NULL, &IID_IShellItem, (LPVOID)&si_path);
if (SUCCEEDED(hr) && pfod != NULL) {
if (SUCCEEDED(hr)) {
if (wpath != NULL) {
IFileOpenDialog_SetFolder(pfod, si_path);
}
@ -194,7 +191,7 @@ void BrowseForFolder(void) {
safe_free(wpath);
hr = IFileOpenDialog_Show(pfod, hMainDialog);
if (SUCCEEDED(hr) && pfod != NULL) {
if (SUCCEEDED(hr)) {
hr = IFileOpenDialog_GetResult(pfod, &psi);
if (SUCCEEDED(hr)) {
IShellItem_GetDisplayName(psi, SIGDN_FILESYSPATH, &wpath);
@ -280,10 +277,7 @@ char* FileDialog(BOOL save, char* path, const ext_t* ext, DWORD options)
if (FAILED(hr)) {
SetLastError(hr);
uprintf("CoCreateInstance for FileOpenDialog failed: %s\n", WindowsErrorString());
if (pfd != NULL) {
IFileDialog_Release(pfd);
pfd = NULL; // Just in case
}
pfd = NULL; // Just in case
goto fallback;
}
@ -795,8 +789,8 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
case IDC_MORE_INFO:
assert(notification_more_info->callback != NULL);
if (notification_more_info != NULL) {
assert(notification_more_info->callback != NULL);
if (notification_more_info->id == MORE_INFO_URL) {
ShellExecuteA(hDlg, "open", notification_more_info->url, NULL, NULL, SW_SHOWNORMAL);
} else {
@ -1619,7 +1613,7 @@ BOOL SetUpdateCheck(void)
}
// If the user hasn't set the interval in the dialog, set to default
if ( (ReadSetting32(SETTING_UPDATE_INTERVAL) == 0) ||
(ReadSetting32(SETTING_UPDATE_INTERVAL) == -1) )
((ReadSetting32(SETTING_UPDATE_INTERVAL) == -1) && enable_updates) )
WriteSetting32(SETTING_UPDATE_INTERVAL, 86400);
}
SetFidoCheck();
@ -2011,7 +2005,7 @@ static BOOL CALLBACK AlertPromptCallback(HWND hWnd, LPARAM lParam)
if (GetWindowTextU(hWnd, str, sizeof(str)) == 0)
return TRUE;
if (strcmp(str, button_str) == 0)
if (safe_strcmp(str, button_str) == 0)
*found = TRUE;
return TRUE;
}

View file

@ -194,7 +194,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int file_system)
}
/* Create ldlinux.sys file */
static_sprintf(path, "%c:\\%s.%s", drive_letter, ldlinux, ldlinux_ext[0]);
static_sprintf(path, "%C:\\%s.%s", drive_letter, ldlinux, ldlinux_ext[0]);
f_handle = CreateFileA(path, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, CREATE_ALWAYS,
@ -236,7 +236,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int file_system)
switch (file_system) {
case FS_NTFS:
static_sprintf(tmp, "%c:\\", drive_letter);
static_sprintf(tmp, "%C:\\", drive_letter);
vol_info.Handle = d_handle;
err = NtfsSectGetVolumeInfo(tmp, &vol_info);
if (err != ERROR_SUCCESS) {
@ -333,7 +333,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int file_system)
IGNORE_RETVAL(_chdirU(app_data_dir));
static_sprintf(path, "%s\\%s-%s", FILES_DIR, syslinux, embedded_sl_version_str[1]);
IGNORE_RETVAL(_chdir(path));
static_sprintf(path, "%c:\\%s.%s", drive_letter, ldlinux, ldlinux_ext[2]);
static_sprintf(path, "%C:\\%s.%s", drive_letter, ldlinux, ldlinux_ext[2]);
fd = fopen(&path[3], "rb");
if (fd == NULL) {
uprintf("Caution: No '%s' was provided. The target will be missing a required Syslinux file!", &path[3]);
@ -354,7 +354,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int file_system)
goto out;
}
/* Create mboot.c32 file */
static_sprintf(path, "%c:\\%s", drive_letter, mboot_c32);
static_sprintf(path, "%C:\\%s", drive_letter, mboot_c32);
f_handle = CreateFileA(path, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
@ -368,7 +368,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int file_system)
goto out;
}
safe_closehandle(f_handle);
static_sprintf(path, "%c:\\syslinux.cfg", drive_letter);
static_sprintf(path, "%C:\\syslinux.cfg", drive_letter);
fd = fopen(path, "w");
if (fd == NULL) {
uprintf("Could not create ReactOS 'syslinux.cfg'");

View file

@ -575,9 +575,8 @@ void SetSectionHeaders(HWND hDlg)
SendDlgItemMessageA(hDlg, section_control_ids[i], WM_SETFONT, (WPARAM)hf, TRUE);
hCtrl = GetDlgItem(hDlg, section_control_ids[i]);
memset(wtmp, 0, sizeof(wtmp));
GetWindowTextW(hCtrl, wtmp, ARRAYSIZE(wtmp) - 4);
GetWindowTextW(hCtrl, wtmp, ARRAYSIZE(wtmp) - 3);
wlen = wcslen(wtmp);
assert(wlen < ARRAYSIZE(wtmp - 2));
wtmp[wlen++] = L' ';
wtmp[wlen++] = L' ';
SetWindowTextW(hCtrl, wtmp);
@ -789,7 +788,8 @@ void ToggleImageOptions(void)
if (image_option_txt[0] == 0)
GetWindowTextU(GetDlgItem(hMainDialog, IDS_IMAGE_OPTION_TXT), image_option_txt, sizeof(image_option_txt));
if ((has_wintogo) != (image_options & IMOP_WINTOGO)) {
if ( ((has_wintogo) && !(image_options & IMOP_WINTOGO)) ||
((!has_wintogo) && (image_options & IMOP_WINTOGO)) ) {
image_options ^= IMOP_WINTOGO;
if (image_options & IMOP_WINTOGO) {
// Set the Windows To Go selection in the dropdown
@ -797,7 +797,8 @@ void ToggleImageOptions(void)
}
}
if ((has_persistence) != (image_options & IMOP_PERSISTENCE)) {
if (((has_persistence) && !(image_options & IMOP_PERSISTENCE)) ||
((!has_persistence) && (image_options & IMOP_PERSISTENCE))) {
image_options ^= IMOP_PERSISTENCE;
if (image_options & IMOP_PERSISTENCE) {
SetWindowTextU(GetDlgItem(hMainDialog, IDS_IMAGE_OPTION_TXT), lmprintf(MSG_123));
@ -1068,7 +1069,7 @@ void CreateAdditionalControls(HWND hDlg)
hAdvancedDeviceToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, TOOLBAR_STYLE,
0, 0, 0, 0, hMainDialog, (HMENU)IDC_ADVANCED_DEVICE_TOOLBAR, hMainInstance, NULL);
SendMessage(hAdvancedDeviceToolbar, CCM_SETVERSION, (WPARAM)6, 0);
memset(tbToolbarButtons, 0, sizeof(tbToolbarButtons));
memset(tbToolbarButtons, 0, sizeof(TBBUTTON));
tbToolbarButtons[0].idCommand = IDC_ADVANCED_DRIVE_PROPERTIES;
tbToolbarButtons[0].fsStyle = BTNS_SHOWTEXT | BTNS_AUTOSIZE;
tbToolbarButtons[0].fsState = TBSTATE_ENABLED;
@ -1090,7 +1091,7 @@ void CreateAdditionalControls(HWND hDlg)
hAdvancedFormatToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, TOOLBAR_STYLE,
0, 0, 0, 0, hMainDialog, (HMENU)IDC_ADVANCED_FORMAT_TOOLBAR, hMainInstance, NULL);
SendMessage(hAdvancedFormatToolbar, CCM_SETVERSION, (WPARAM)6, 0);
memset(tbToolbarButtons, 0, sizeof(tbToolbarButtons));
memset(tbToolbarButtons, 0, sizeof(TBBUTTON));
tbToolbarButtons[0].idCommand = IDC_ADVANCED_FORMAT_OPTIONS;
tbToolbarButtons[0].fsStyle = BTNS_SHOWTEXT | BTNS_AUTOSIZE;
tbToolbarButtons[0].fsState = TBSTATE_ENABLED;