On Thu, 7 Apr 2022, Jeremy Drake via Mingw-w64-public wrote:
An alternative implementation of libdelayimp.a, which is a thin wrapper around OS APIs present in Windows 8 and newer, and which is required to be used in store apps that wish to delay load, in lieu of libdelayimp.a. Signed-off-by: Jeremy Drake <jeremyd2...@users.sourceforge.net> --- mingw-w64-crt/Makefile.am | 17 ++++++++ mingw-w64-crt/libsrc/dloadhelper.c | 63 ++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 mingw-w64-crt/libsrc/dloadhelper.c new file mode 100644 index 000000000..ce3a57914 --- /dev/null +++ b/mingw-w64-crt/libsrc/dloadhelper.c @@ -0,0 +1,63 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include <windows.h> +#include <delayloadhandler.h> + +/* XXX NTSTATUS is supposed to be a LONG, but there are a bunch of STATUS_ + * constants in winnt.h defined as ((DWORD)0x...), including + * STATUS_DLL_NOT_FOUND which we need, so using DWORD here to silence a warning + */ +typedef DWORD NTSTATUS; + +#define __ImageBase __MINGW_LSYMBOL(_image_base__) +extern IMAGE_DOS_HEADER __ImageBase;
Side note; we have these __ImageBase declarations copypasted across a bunch of files. It'd be nice to at least consolidate it into some shared mingw-w64-crt internal header... But this is clearly not a blocker for this patch.
The implementation looks fine to me, thanks! And duplicating the existing misc/delay-f.c in this library seems sensible to me, to let it go along with the implementation. (Also, as long as it's the exact same object file in two static libraries, it shouldn't end up in any conflicts.)
// Martin _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public