Skip to content

Commit cf33163

Browse files
author
Matthieu Longo
committed
Use _WIN32_WINNT in addition to _MSC_VER
1 parent 5300a5a commit cf33163

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

Main/StackWalker/StackWalker.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
#include <stdlib.h>
8686
#include <tchar.h>
8787
#include <windows.h>
88+
#include <SDKDDKVer.h>
8889
#pragma comment(lib, "version.lib") // for "VerQueryValue"
8990
#pragma warning(disable : 4826)
9091

@@ -1439,19 +1440,7 @@ void StackWalker::OnSymInit(LPCSTR szSearchPath, DWORD symOptions, LPCSTR szUser
14391440
buffer[STACKWALK_MAX_NAMELEN - 1] = 0;
14401441
OnOutput(buffer);
14411442
}
1442-
#elif (_MSC_VER < 1800)
1443-
OSVERSIONINFOEXA ver;
1444-
ZeroMemory(&ver, sizeof(OSVERSIONINFOEXA));
1445-
ver.dwOSVersionInfoSize = sizeof(ver);
1446-
if (GetVersionExA((OSVERSIONINFOA*)&ver) != FALSE)
1447-
{
1448-
_snprintf_s(buffer, maxLen, "OS-Version: %d.%d.%d (%s) 0x%x-0x%x\n", ver.dwMajorVersion,
1449-
ver.dwMinorVersion, ver.dwBuildNumber, ver.szCSDVersion, ver.wSuiteMask,
1450-
ver.wProductType);
1451-
buffer[STACKWALK_MAX_NAMELEN - 1] = 0;
1452-
OnOutput(buffer);
1453-
}
1454-
#else
1443+
#elif (_MSC_VER >= 1800) && (_WIN32_WINNT > _WIN32_WINNT_VISTA)
14551444
OSVERSIONINFOEXW osInfo;
14561445
// Get a handle on RtlGetVersion
14571446
HMODULE h_NtDll = GetModuleHandleW(L"ntdll.dll");
@@ -1475,6 +1464,18 @@ void StackWalker::OnSymInit(LPCSTR szSearchPath, DWORD symOptions, LPCSTR szUser
14751464
osInfo.wSuiteMask, osInfo.wProductType);
14761465
}
14771466
OnOutput(buffer);
1467+
#else
1468+
OSVERSIONINFOEXA ver;
1469+
ZeroMemory(&ver, sizeof(OSVERSIONINFOEXA));
1470+
ver.dwOSVersionInfoSize = sizeof(ver);
1471+
if (GetVersionExA((OSVERSIONINFOA*)&ver) != FALSE)
1472+
{
1473+
_snprintf_s(buffer, maxLen, "OS-Version: %d.%d.%d (%s) 0x%x-0x%x\n", ver.dwMajorVersion,
1474+
ver.dwMinorVersion, ver.dwBuildNumber, ver.szCSDVersion, ver.wSuiteMask,
1475+
ver.wProductType);
1476+
buffer[STACKWALK_MAX_NAMELEN - 1] = 0;
1477+
OnOutput(buffer);
1478+
}
14781479
#endif
14791480
}
14801481

0 commit comments

Comments
 (0)