[FFmpeg-devel] [PATCH 2/2] compat/w32dlfcn: remove support for pre-KB2533623 Win7 systems

Ramiro Polla ramiro.polla at gmail.com
Tue Jul 30 17:09:15 EEST 2024


The KB2533623 security update has been released 13 years ago and
Windows 7 has reached end of extended support 4 years ago.
---
 compat/w32dlfcn.h | 52 -----------------------------------------------
 1 file changed, 52 deletions(-)

diff --git a/compat/w32dlfcn.h b/compat/w32dlfcn.h
index 8ae718f4bd..856ad74cc1 100644
--- a/compat/w32dlfcn.h
+++ b/compat/w32dlfcn.h
@@ -68,58 +68,6 @@ static inline HMODULE win32_dlopen(const char *name)
     HMODULE module = NULL;
     if (utf8towchar(name, &name_w))
         name_w = NULL;
-#if _WIN32_WINNT < 0x0602
-    // On Win7 and earlier we check if KB2533623 is available
-    if (!GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "SetDefaultDllDirectories")) {
-        wchar_t *path = NULL, *new_path;
-        DWORD pathlen, pathsize, namelen;
-        if (!name_w)
-            goto exit;
-        namelen = wcslen(name_w);
-        // Try local directory first
-        path = get_module_filename(NULL);
-        if (!path)
-            goto exit;
-        new_path = wcsrchr(path, '\\');
-        if (!new_path)
-            goto exit;
-        pathlen = new_path - path;
-        pathsize = pathlen + namelen + 2;
-        new_path = av_realloc_array(path, pathsize, sizeof *path);
-        if (!new_path)
-            goto exit;
-        path = new_path;
-        wcscpy(path + pathlen + 1, name_w);
-        module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
-        if (module == NULL) {
-            // Next try System32 directory
-            pathlen = GetSystemDirectoryW(path, pathsize);
-            if (!pathlen)
-                goto exit;
-            // Buffer is not enough in two cases:
-            // 1. system directory + \ + module name
-            // 2. system directory even without the module name.
-            if (pathlen + namelen + 2 > pathsize) {
-                pathsize = pathlen + namelen + 2;
-                new_path = av_realloc_array(path, pathsize, sizeof *path);
-                if (!new_path)
-                    goto exit;
-                path = new_path;
-                // Query again to handle the case #2.
-                pathlen = GetSystemDirectoryW(path, pathsize);
-                if (!pathlen)
-                    goto exit;
-            }
-            path[pathlen] = L'\\';
-            wcscpy(path + pathlen + 1, name_w);
-            module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
-        }
-exit:
-        av_free(path);
-        av_free(name_w);
-        return module;
-    }
-#endif
 #if HAVE_WINRT
     if (!name_w)
         return NULL;
-- 
2.30.2



More information about the ffmpeg-devel mailing list