[vlc-commits] direct3d9: make the OS detection not dependent on the app manifest

Steve Lhomme git at videolan.org
Tue Aug 7 09:13:07 CEST 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Aug  1 07:56:11 2018 +0200| [eec002ae4d675fd4ebd2e94780f49dbd8ca5bac9] | committer: Steve Lhomme

direct3d9: make the OS detection not dependent on the app manifest

(cherry picked from commit 6f6803c954a8e6b4856f281dde2e0a8a93eea4e9)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=eec002ae4d675fd4ebd2e94780f49dbd8ca5bac9
---

 modules/video_output/win32/direct3d9.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index f3d7773f00..a97fd59e47 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -56,7 +56,6 @@
 #include "builtin_shaders.h"
 
 #include <assert.h>
-#include <versionhelpers.h>
 
 /*****************************************************************************
  * Module descriptor
@@ -252,9 +251,18 @@ static int Open(vlc_object_t *object)
     if ( !vd->obj.force && vd->source.mastering.max_luminance != 0)
         return VLC_EGENERIC; /* let a module who can handle it do it */
 
+#if !VLC_WINSTORE_APP
     /* do not use D3D9 on XP unless forced */
-    if(!object->obj.force && !IsWindowsVistaOrGreater())
-        return VLC_EGENERIC;
+    if (!vd->obj.force)
+    {
+        bool isVistaOrGreater = false;
+        HMODULE hKernel32 = GetModuleHandle(TEXT("kernel32.dll"));
+        if (likely(hKernel32 != NULL))
+            isVistaOrGreater = GetProcAddress(hKernel32, "EnumResourceLanguagesExW") != NULL;
+        if (!isVistaOrGreater)
+            return VLC_EGENERIC;
+    }
+#endif
 
     /* Allocate structure */
     vd->sys = sys = calloc(1, sizeof(vout_display_sys_t));



More information about the vlc-commits mailing list