else() # Probably MinGW = GCC
set(PLATFORM_LIBS "")
endif()
- set(PLATFORM_LIBS ws2_32.lib shlwapi.lib ${PLATFORM_LIBS})
+ set(PLATFORM_LIBS ws2_32.lib version.lib shlwapi.lib ${PLATFORM_LIBS})
# Zlib stuff
set(ZLIB_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../../zlib/zlib-1.2.5"
#include <windows.h>
#include <wincrypt.h>
#include <algorithm>
+ #include <shlwapi.h>
#endif
#if !defined(_WIN32)
#include <unistd.h>
std::string get_sysinfo()
{
#ifdef _WIN32
- OSVERSIONINFO osvi;
+
std::ostringstream oss;
- std::string tmp;
- ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&osvi);
- tmp = osvi.szCSDVersion;
- std::replace(tmp.begin(), tmp.end(), ' ', '_');
-
- oss << "Windows/" << osvi.dwMajorVersion << "."
- << osvi.dwMinorVersion;
- if (osvi.szCSDVersion[0])
- oss << "-" << tmp;
- oss << " ";
+ LPSTR filePath = new char[MAX_PATH];
+ UINT blockSize;
+ VS_FIXEDFILEINFO *fixedFileInfo;
+
+ GetSystemDirectoryA(filePath, MAX_PATH);
+ PathAppendA(filePath, "kernel32.dll");
+
+ DWORD dwVersionSize = GetFileVersionInfoSizeA(filePath, NULL);
+ LPBYTE lpVersionInfo = new BYTE[dwVersionSize];
+
+ GetFileVersionInfoA(filePath, 0, dwVersionSize, lpVersionInfo);
+ VerQueryValueA(lpVersionInfo, "\\", (LPVOID *)&fixedFileInfo, &blockSize);
+
+ oss << "Windows/"
+ << HIWORD(fixedFileInfo->dwProductVersionMS) << '.' // Major
+ << LOWORD(fixedFileInfo->dwProductVersionMS) << '.' // Minor
+ << HIWORD(fixedFileInfo->dwProductVersionLS) << ' '; // Build
+
#ifdef _WIN64
oss << "x86_64";
#else
oss << "x86";
#endif
+ delete[] lpVersionInfo;
+ delete[] filePath;
+
return oss.str();
#else
struct utsname osinfo;