From 17d12f83add7de3bab8ef855e157add594d0dcce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Fri, 17 Apr 2026 03:35:11 +0200 Subject: [PATCH] osdep/io: expand relative path only if it contains directory separator For anything else, respact default load library search logic. --- osdep/io.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/osdep/io.c b/osdep/io.c index 0ae6abb281..9401a46805 100644 --- a/osdep/io.c +++ b/osdep/io.c @@ -753,15 +753,18 @@ void *mp_dlopen(const char *filename, int flag) HMODULE lib = NULL; void *ta_ctx = talloc_new(NULL); wchar_t *wfilename = mp_from_utf8(ta_ctx, filename); + wchar_t *path = wfilename; - DWORD len = GetFullPathNameW(wfilename, 0, NULL, NULL); - if (!len) - goto err; + if (strchr(filename, '/') || strchr(filename, '\\')) { + DWORD len = GetFullPathNameW(wfilename, 0, NULL, NULL); + if (!len) + goto err; - wchar_t *path = talloc_array(ta_ctx, wchar_t, len); - len = GetFullPathNameW(wfilename, len, path, NULL); - if (!len) - goto err; + path = talloc_array(ta_ctx, wchar_t, len); + len = GetFullPathNameW(wfilename, len, path, NULL); + if (!len) + goto err; + } lib = LoadLibraryW(path);