shithub: openh264

Download patch

ref: 9e00bf89aa22edafb1f1c6a0f9c8e9f6464a846b
parent: 4f33b38ac16bfb7420f495da08754e6bba397410
author: Martin Storsjö <martin@martin.st>
date: Fri Jan 16 06:07:14 EST 2015

Use VerifyVersionInfo instead of GetVersionEx

The GetVersionEx function has been deprecated since Windows 8.1.
VerifyVersionInfo exists at least since Windows 2000.

This fixes warnings about use of deprecated functions in MSVC.

--- a/codec/console/dec/src/d3d9_utils.cpp
+++ b/codec/console/dec/src/d3d9_utils.cpp
@@ -605,23 +605,17 @@
   OSVERSIONINFOEX osvi;
   ZeroMemory (&osvi, sizeof (OSVERSIONINFOEX));
   osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
+  osvi.dwPlatformId = VER_PLATFORM_WIN32_NT;
+  osvi.dwMajorVersion = 6; // Vista
+  DWORDLONG condmask = VerSetConditionMask (VerSetConditionMask (0, VER_MAJORVERSION, VER_GREATER_EQUAL),
+                       VER_PLATFORMID, VER_EQUAL);
 
-  if (!GetVersionEx ((OSVERSIONINFO*) &osvi)) {
-    osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
-    if (! GetVersionEx ((OSVERSIONINFO*) &osvi))
-      return iType;
-  }
-
-  switch (osvi.dwPlatformId) {
-  case VER_PLATFORM_WIN32_NT:
-    if (osvi.dwMajorVersion >= 6)
-      iType = OS_VISTA_UPPER;
-    else if (osvi.dwMajorVersion == 5)
+  if (VerifyVersionInfo (&osvi, VER_MAJORVERSION | VER_PLATFORMID, condmask)) {
+    iType = OS_VISTA_UPPER;
+  } else {
+    osvi.dwMajorVersion = 5; // XP/2000
+    if (VerifyVersionInfo (&osvi, VER_MAJORVERSION | VER_PLATFORMID, condmask))
       iType = OS_XP;
-    break;
-
-  default:
-    break;
   }
 #endif