[PATCH 2/5] mfplat: Give priority to local scheme handlers.

Nikolay Sivov nsivov at codeweavers.com
Tue Jun 11 07:40:02 CDT 2019


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/mfplat/main.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index b0db0db922..cf313d7a21 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -5093,12 +5093,34 @@ static HRESULT resolver_create_scheme_handler(const WCHAR *scheme, DWORD flags,
 {
     static const char schemehandlerspath[] = "Software\\Microsoft\\Windows Media Foundation\\SchemeHandlers";
     static const HKEY hkey_roots[2] = { HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE };
+    HRESULT hr = MF_E_UNSUPPORTED_SCHEME;
     unsigned int i;
-    HRESULT hr;
 
     TRACE("%s, %#x, %p.\n", debugstr_w(scheme), flags, handler);
 
-    /* FIXME: check local handlers first */
+    *handler = NULL;
+
+    if (!(flags & MF_RESOLUTION_DISABLE_LOCAL_PLUGINS))
+    {
+        struct local_handler *local_handler;
+
+        EnterCriticalSection(&local_handlers_section);
+
+        LIST_FOR_EACH_ENTRY(local_handler, &local_scheme_handlers, struct local_handler, entry)
+        {
+            if (!lstrcmpiW(scheme, local_handler->u.scheme))
+            {
+                if (SUCCEEDED(hr = IMFActivate_ActivateObject(local_handler->activate, &IID_IMFSchemeHandler,
+                        (void **)handler)))
+                    break;
+            }
+        }
+
+        LeaveCriticalSection(&local_handlers_section);
+
+        if (*handler)
+            return hr;
+    }
 
     for (i = 0; i < ARRAY_SIZE(hkey_roots); ++i)
     {
-- 
2.20.1




More information about the wine-devel mailing list