mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[mingw] use delay loading for DLLs that are subject to side loading
* This reverts much of commitsf6ac559f4dand1947266837so that we call the Windows APIs directly again, while ensuring that, by the time we load the DLLs, sideloading mitigation has already been applied by the application. * This is a continuation of #1877, and should help prevent re-introducing side-loading issues when we link against new libraries, as well as allow us to drop some of the manual DLL hooking we've been doing to prevent it, to clean up the code. * Note that this is a bit more complex than what the stackoverflow post suggests, because we need to create delayloaded libs for both 32-bit and 64-bit, which use a different calling convention and therefore need to use different .def files. So there's a lot of gymkhana involved, with Makefiles and whatnot, to get us there. * Also simplify the use of CM_Get_DevNode_Registry_PropertyA() in dev.c since recent versions of MinGW now have support for it. * Also fix 2 small issues in net.c (potential overflow) and format.c (memory leak).
This commit is contained in:
parent
3528ca773d
commit
e7b66e7e4c
27 changed files with 597 additions and 68 deletions
110
configure
vendored
110
configure
vendored
|
|
@ -626,6 +626,7 @@ AM_LDFLAGS
|
|||
AM_CFLAGS
|
||||
VISIBILITY_CFLAGS
|
||||
WINDRES
|
||||
DLLTOOL
|
||||
RM
|
||||
SED
|
||||
RANLIB
|
||||
|
|
@ -4283,6 +4284,108 @@ printf "%s\n" "no" >&6; }
|
|||
fi
|
||||
|
||||
|
||||
if test -n "$ac_tool_prefix"; then
|
||||
# Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
|
||||
set dummy ${ac_tool_prefix}dlltool; ac_word=$2
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
printf %s "checking for $ac_word... " >&6; }
|
||||
if test ${ac_cv_prog_DLLTOOL+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
if test -n "$DLLTOOL"; then
|
||||
ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
case $as_dir in #(((
|
||||
'') as_dir=./ ;;
|
||||
*/) ;;
|
||||
*) as_dir=$as_dir/ ;;
|
||||
esac
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
|
||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
fi
|
||||
fi
|
||||
DLLTOOL=$ac_cv_prog_DLLTOOL
|
||||
if test -n "$DLLTOOL"; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
|
||||
printf "%s\n" "$DLLTOOL" >&6; }
|
||||
else
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
if test -z "$ac_cv_prog_DLLTOOL"; then
|
||||
ac_ct_DLLTOOL=$DLLTOOL
|
||||
# Extract the first word of "dlltool", so it can be a program name with args.
|
||||
set dummy dlltool; ac_word=$2
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
printf %s "checking for $ac_word... " >&6; }
|
||||
if test ${ac_cv_prog_ac_ct_DLLTOOL+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
if test -n "$ac_ct_DLLTOOL"; then
|
||||
ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
case $as_dir in #(((
|
||||
'') as_dir=./ ;;
|
||||
*/) ;;
|
||||
*) as_dir=$as_dir/ ;;
|
||||
esac
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_ac_ct_DLLTOOL="dlltool"
|
||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
fi
|
||||
fi
|
||||
ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
|
||||
if test -n "$ac_ct_DLLTOOL"; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
|
||||
printf "%s\n" "$ac_ct_DLLTOOL" >&6; }
|
||||
else
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
|
||||
if test "x$ac_ct_DLLTOOL" = x; then
|
||||
DLLTOOL=":"
|
||||
else
|
||||
case $cross_compiling:$ac_tool_warned in
|
||||
yes:)
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
|
||||
printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
|
||||
ac_tool_warned=yes ;;
|
||||
esac
|
||||
DLLTOOL=$ac_ct_DLLTOOL
|
||||
fi
|
||||
else
|
||||
DLLTOOL="$ac_cv_prog_DLLTOOL"
|
||||
fi
|
||||
|
||||
if test -n "$ac_tool_prefix"; then
|
||||
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
|
||||
set dummy ${ac_tool_prefix}strip; ac_word=$2
|
||||
|
|
@ -4371,7 +4474,7 @@ printf "%s\n" "no" >&6; }
|
|||
fi
|
||||
|
||||
if test "x$ac_ct_STRIP" = x; then
|
||||
STRIP="strip"
|
||||
STRIP=":"
|
||||
else
|
||||
case $cross_compiling:$ac_tool_warned in
|
||||
yes:)
|
||||
|
|
@ -4473,7 +4576,7 @@ printf "%s\n" "no" >&6; }
|
|||
fi
|
||||
|
||||
if test "x$ac_ct_WINDRES" = x; then
|
||||
WINDRES="windres"
|
||||
WINDRES=":"
|
||||
else
|
||||
case $cross_compiling:$ac_tool_warned in
|
||||
yes:)
|
||||
|
|
@ -4632,6 +4735,8 @@ AM_CFLAGS="$AM_CFLAGS -DUNICODE -D_UNICODE -UNDEBUG -DCOBJMACROS -D__USE_MINGW_A
|
|||
|
||||
ac_config_files="$ac_config_files Makefile"
|
||||
|
||||
ac_config_files="$ac_config_files .mingw/Makefile"
|
||||
|
||||
ac_config_files="$ac_config_files src/Makefile"
|
||||
|
||||
ac_config_files="$ac_config_files src/bled/Makefile"
|
||||
|
|
@ -5375,6 +5480,7 @@ for ac_config_target in $ac_config_targets
|
|||
do
|
||||
case $ac_config_target in
|
||||
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
|
||||
".mingw/Makefile") CONFIG_FILES="$CONFIG_FILES .mingw/Makefile" ;;
|
||||
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
|
||||
"src/bled/Makefile") CONFIG_FILES="$CONFIG_FILES src/bled/Makefile" ;;
|
||||
"src/ext2fs/Makefile") CONFIG_FILES="$CONFIG_FILES src/ext2fs/Makefile" ;;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue