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

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


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Aug  1 07:49:33 2018 +0200| [725a46ed02f95d29852145e1c1b8398c2f85d964] | committer: Steve Lhomme

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

hopefully the location won't change in future Windows versions

(cherry picked from commit 81e6e779e183ffdeebbc8f72a3c81b241933ff7a)

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

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

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 49befa7601..02046d150d 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -36,7 +36,6 @@
 
 #include <assert.h>
 #include <math.h>
-#include <versionhelpers.h>
 
 #define COBJMACROS
 #include <initguid.h>
@@ -514,9 +513,18 @@ static int Open(vlc_object_t *object)
 {
     vout_display_t *vd = (vout_display_t *)object;
 
+#if !VLC_WINSTORE_APP
     /* Allow using D3D11 automatically starting from Windows 8.1 */
-    if (!vd->obj.force && !IsWindows8Point1OrGreater())
-        return VLC_EGENERIC;
+    if (!vd->obj.force)
+    {
+        bool isWin81OrGreater = false;
+        HMODULE hKernel32 = GetModuleHandle(TEXT("kernel32.dll"));
+        if (likely(hKernel32 != NULL))
+            isWin81OrGreater = GetProcAddress(hKernel32, "IsProcessCritical") != NULL;
+        if (!isWin81OrGreater)
+            return VLC_EGENERIC;
+    }
+#endif
 
 #if !VLC_WINSTORE_APP
     int ret = OpenHwnd(vd);



More information about the vlc-commits mailing list