From 1b711b27770a2d560ebcb460cf37dc47b5c6836e Mon Sep 17 00:00:00 2001 From: jkalmbach Date: Fri, 21 Nov 2014 17:18:57 +0100 Subject: [PATCH] Fixed Bug of not working on XP anymore... now only uses GetThreadId, if SDK supports it --- Main/StackWalker/StackWalker.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Main/StackWalker/StackWalker.cpp b/Main/StackWalker/StackWalker.cpp index ab2bb72..5075661 100644 --- a/Main/StackWalker/StackWalker.cpp +++ b/Main/StackWalker/StackWalker.cpp @@ -1032,9 +1032,13 @@ BOOL StackWalker::ShowCallstack(HANDLE hThread, const CONTEXT *context, PReadPro if (context == NULL) { // If no context is provided, capture the context - // if (hThread == GetCurrentThread()) // See: https://stackwalker.codeplex.com/discussions/446958 +#if _WIN32_WINNT <= 0x0501 + // If we need to support XP, we need to use the "old way", because "GetThreadId" is not available! + if (hThread == GetCurrentThread()) +#else if (GetThreadId(hThread) == GetCurrentThreadId()) +#endif { GET_CURRENT_CONTEXT_STACKWALKER_CODEPLEX(c, USED_CONTEXT_FLAGS); }