crt: Add emulation of _get_wpgmptr() function for pre-msvcr80 import libs Function _get_wpgmptr() is available in msvcr80+, UCRT and also in i386 and x64 msvcrt.dll since Windows Vista. It is not available in arm msvcrt.dll. Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 8a8bb10..b253201 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am
@@ -337,6 +337,7 @@ misc/_get_pgmptr.c \ misc/_get_timezone.c \ misc/_get_tzname.c \ + misc/_get_wpgmptr.c \ misc/_recalloc.c \ misc/_set_purecall_handler.c \ misc/imaxdiv.c \ @@ -888,6 +889,7 @@ misc/_get_pgmptr.c \ misc/_get_timezone.c \ misc/_get_tzname.c \ + misc/_get_wpgmptr.c \ misc/_initterm_e.c \ misc/_recalloc.c \ misc/_set_errno.c \
diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in index 270dfd3..2e696f9 100644 --- a/mingw-w64-crt/lib-common/msvcrt.def.in +++ b/mingw-w64-crt/lib-common/msvcrt.def.in
@@ -1438,7 +1438,7 @@ F_X86_ANY(_get_winmajor) F_X86_ANY(_get_winminor) F_X86_ANY(_get_winver) -F_X86_ANY(_get_wpgmptr) +; F_X86_ANY(_get_wpgmptr) ; i386 and x64 _get_wpgmptr replaced by emu, arm32 and arm64 provided by emu _gmtime32 F_I386(== gmtime) ; i386 _gmtime32 replaced by alias F_ARM_ANY(_gmtime32_s) ; i386 and x64 _gmtime32_s replaced by emu F_ARM_ANY(_gmtime64_s) ; i386 and x64 _gmtime64_s replaced by emu
diff --git a/mingw-w64-crt/misc/_get_wpgmptr.c b/mingw-w64-crt/misc/_get_wpgmptr.c new file mode 100644 index 0000000..bb13465 --- /dev/null +++ b/mingw-w64-crt/misc/_get_wpgmptr.c
@@ -0,0 +1,20 @@ +/** + * 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. + */ +#include <stdlib.h> +#include <errno.h> + +errno_t __cdecl _get_wpgmptr(wchar_t **value) +{ + if (!value) + { + errno = EINVAL; + return EINVAL; + } + + *value = _wpgmptr; + return 0; +} +errno_t (__cdecl *__MINGW_IMP_SYMBOL(_get_wpgmptr))(wchar_t **) = _get_wpgmptr;