git/compat/win32
Matthias Aßhauer 4a9b204920 lazyload: use correct calling conventions
Christoph Reiter reported on the Git for Windows issue tracker[1], that
mingw_strftime() imports strftime() from ucrtbase.dll with the wrong
calling convention. It should be __cdecl instead of WINAPI, which we
always use in DECLARE_PROC_ADDR().

The MSYS2 project encountered cmake sefaults on x86 Windows caused by
the same issue in the cmake source. [2] There are no known git crashes
that where caused by this, yet, but we should try to prevent them.

We import two other non-WINAPI functions via DECLARE_PROC_ADDR(), too.

* NtSetSystemInformation() (NTAPI)
* GetUserNameExW()         (SEC_ENTRY)

NTAPI, SEC_ENTRY and WINAPI are all ususally defined as __stdcall,
but there are circumstances where they're defined differently.

Teach DECLARE_PROC_ADDR() about calling conventions and be explicit
about when we want to use which calling convention.

Import winnt.h for the definition of NTAPI and sspi.h for SEC_ENTRY
near their respective only users.

[1] https://github.com/git-for-windows/git/issues/3560
[2] https://github.com/msys2/MINGW-packages/issues/10152

Reported-By: Christoph Reiter <reiter.christoph@gmail.com>
Signed-off-by: Matthias Aßhauer <mha1993@live.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-01-09 10:34:53 -08:00
..
alloca.h mingw: activate alloca 2014-04-09 10:08:35 -07:00
dirent.c Win32: Unicode file name support (dirent) 2014-07-15 11:19:09 -07:00
dirent.h Win32: Unicode file name support (dirent) 2014-07-15 11:19:09 -07:00
git.manifest mingw: embed a manifest to trick UAC into Doing The Right Thing 2019-06-27 12:55:45 -07:00
lazyload.h lazyload: use correct calling conventions 2022-01-09 10:34:53 -08:00
path-utils.c Sync with 2.20.2 2019-12-06 16:31:12 +01:00
path-utils.h run-command: trigger PATH lookup properly on Cygwin 2020-03-27 11:06:17 -07:00
pthread.c win32: replace pthread_cond_*() with much simpler code 2018-11-14 15:14:22 +09:00
pthread.h pthread.h: manually align parameter lists 2019-10-11 14:59:35 +09:00
syslog.c win32: plug memory leak on realloc() failure in syslog() 2017-08-10 13:57:52 -07:00
syslog.h mingw: implement syslog 2010-11-04 16:53:49 -07:00
trace2_win32_process_info.c lazyload: use correct calling conventions 2022-01-09 10:34:53 -08:00