"Unrecognized version of Windows [major=%d,minor=%d]",
(int)info.dwMajorVersion,(int)info.dwMinorVersion);
}
- #ifdef VER_NT_SERVER
- if (info.wProductType == VER_NT_SERVER ||
- info.wProductType == VER_NT_DOMAIN_CONTROLLER) {
- strlcat(uname_result, " [server]", sizeof(uname_result));
- }
- #endif /* defined(VER_NT_SERVER) */
+ /* Now append extra information to the name.
+ *
+ * Microsoft's API documentation says that on Windows 8.1 and later,
+ * GetVersionEx returns Windows 8 (6.2) for applications without an
+ * app compatibility manifest (including tor's default build).
+ *
+ * But in our testing, we have seen the actual Windows version on
+ * Windows Server 2012 R2, even without a manifest. */
+ if (info.dwMajorVersion > 6 ||
+ (info.dwMajorVersion == 6 && info.dwMinorVersion >= 2)) {
+ /* When GetVersionEx() returns Windows 8, the actual OS may be any
+ * later version. */
+ strlcat(uname_result, " [or later]", sizeof(uname_result));
+ }
+ /* When we don't know if the OS is a client or server version, we use
+ * the client version, and this qualifier. */
+ if (!is_server && !is_client) {
+ strlcat(uname_result, " [client or server]", sizeof(uname_result));
+ }
-#else
+#else /* !(defined(_WIN32)) */
/* LCOV_EXCL_START -- can't provoke uname failure */
strlcpy(uname_result, "Unknown platform", sizeof(uname_result));
/* LCOV_EXCL_STOP */