Fixed Bug of not working on XP anymore... now only uses GetThreadId, if SDK supports it

This commit is contained in:
jkalmbach
2014-11-21 17:18:57 +01:00
parent c9e3721ff3
commit 1b711b2777
+5 -1
View File
@@ -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);
}