From 338974bb29bb13edba64add3a06242e08bddcd07 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Thu, 2 Nov 2023 20:33:02 +0300
Subject: [PATCH] SDL_test_memory.c: fix build against older windows SDKs.
---
src/test/SDL_test_memory.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/test/SDL_test_memory.c b/src/test/SDL_test_memory.c
index 526686ad8266..2ca790fb312a 100644
--- a/src/test/SDL_test_memory.c
+++ b/src/test/SDL_test_memory.c
@@ -43,6 +43,10 @@ typedef BOOL (__stdcall *dbghelp_SymGetLineFromAddr_fn)(HANDLE hProcess, DWORD q
#endif
static dbghelp_SymGetLineFromAddr_fn dbghelp_SymGetLineFromAddr;
+/* older SDKs might not have this: */
+__declspec(dllimport) USHORT WINAPI RtlCaptureStackBackTrace(ULONG FramesToSkip, ULONG FramesToCapture, PVOID* BackTrace, PULONG BackTraceHash);
+#define CaptureStackBackTrace RtlCaptureStackBackTrace
+
#endif
/* This is a simple tracking allocator to demonstrate the use of SDL's
@@ -179,7 +183,7 @@ static void SDL_TrackAllocation(void *mem, size_t size)
line.LineNumber = 0;
}
- SDL_snprintf(entry->stack_names[i], sizeof(entry->stack_names[i]), "%s+0x%llx %s:%u", pSymbol->Name, (unsigned long long)dwDisplacement, line.FileName, (Uint32)line.LineNumber);
+ SDL_snprintf(entry->stack_names[i], sizeof(entry->stack_names[i]), "%s+0x%I64x %s:%u", pSymbol->Name, dwDisplacement, line.FileName, (Uint32)line.LineNumber);
}
}
}