Commit 4fb1b1c7 authored by rswindell's avatar rswindell
Browse files

Work-around the Windows 8.1 GetVersionEx() stupidity (it lies and claims the OS

Windows 8.0, a.k.a. NT v6.2 instead of Windows 8.1, a.k.a. NT v6.3) by using
a LAN manager API function. Ugh.
parent 164cbe5b
......@@ -48,7 +48,10 @@
#include <sys/ioctl.h> /* ioctl() */
#include <sys/utsname.h> /* uname() */
#include <signal.h>
#endif /* __unix__ */
#elif defined(_WIN32)
#include <Windows.h>
#include <LM.h> /* NetWkstaGetInfo() */
#endif
#include "genwrap.h" /* Verify prototypes */
#include "xpendian.h" /* BYTE_SWAP */
......@@ -404,10 +407,23 @@ char* DLLCALL os_version(char *str)
break;
}
sprintf(str,"Windows %sVersion %u.%u (Build %u) %s"
/* Work-around Microsoft Windows 8.1 stupidity where GetVersionEx() lies about the current OS version */
if(winver.dwMajorVersion == 6 && winver.dwMinorVersion == 2) {
WKSTA_INFO_100* wksta_info;
if(NetWkstaGetInfo(NULL, 100, (LPBYTE*)&wksta_info) == NERR_Success) {
winver.dwMajorVersion = wksta_info->wki100_ver_major;
winver.dwMinorVersion = wksta_info->wki100_ver_minor;
winver.dwBuildNumber = 0;
}
}
sprintf(str,"Windows %sVersion %u.%u"
,winflavor
,winver.dwMajorVersion, winver.dwMinorVersion
,winver.dwBuildNumber,winver.szCSDVersion);
,winver.dwMajorVersion, winver.dwMinorVersion);
if(winver.dwBuildNumber)
sprintf(str+strlen(str), " (Build %u)", winver.dwBuildNumber);
if(winver.szCSDVersion[0])
sprintf(str+strlen(str), " %s", winver.szCSDVersion);
#elif defined(__unix__)
......
......@@ -10,6 +10,9 @@
<PreprocessorDefinitions>HAS_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalDependencies>netapi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment