summaryrefslogtreecommitdiff
path: root/compat/win32/trace2_win32_process_info.c
diff options
context:
space:
mode:
authorMatthias Aßhauer <mha1993@live.de>2022-01-08 16:02:30 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-01-09 18:34:53 (GMT)
commit4a9b204920152c668228a9d43a63be39b0c32f45 (patch)
tree72622ac8970e285d3eb6ebe1350e25741a604f5a /compat/win32/trace2_win32_process_info.c
parente9d7761bb94f20acc98824275e317fa82436c25d (diff)
downloadgit-4a9b204920152c668228a9d43a63be39b0c32f45.zip
git-4a9b204920152c668228a9d43a63be39b0c32f45.tar.gz
git-4a9b204920152c668228a9d43a63be39b0c32f45.tar.bz2
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>
Diffstat (limited to 'compat/win32/trace2_win32_process_info.c')
-rw-r--r--compat/win32/trace2_win32_process_info.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/compat/win32/trace2_win32_process_info.c b/compat/win32/trace2_win32_process_info.c
index 8ccbd1c..a53fd92 100644
--- a/compat/win32/trace2_win32_process_info.c
+++ b/compat/win32/trace2_win32_process_info.c
@@ -143,8 +143,8 @@ static void get_is_being_debugged(void)
*/
static void get_peak_memory_info(void)
{
- DECLARE_PROC_ADDR(psapi.dll, BOOL, GetProcessMemoryInfo, HANDLE,
- PPROCESS_MEMORY_COUNTERS, DWORD);
+ DECLARE_PROC_ADDR(psapi.dll, BOOL, WINAPI, GetProcessMemoryInfo,
+ HANDLE, PPROCESS_MEMORY_COUNTERS, DWORD);
if (INIT_PROC_ADDR(GetProcessMemoryInfo)) {
PROCESS_MEMORY_COUNTERS pmc;