From 59d3e370270e16f80bdad39d2739df1973a1ad82 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com> Date: Wed, 8 Dec 2021 09:21:06 +0100 Subject: [PATCH] Load wintun.dll from the application directory only Do not attempt to load it from the System32 directory. Different versions of `wintun.dll` or `wintun.sys` float around in system directories. In my case, a `C:\Windows\System32\wintun.sys` had been left behind for some reason, and was being loaded at startup, taking precedence over the `wintun.dll` bundled with OpenConnect. Unfortunately, different versions are not compatible, at least not entirely, while OpenConnect is being tested with the bundled `wintun.dll` only. To avoid this DLL hell, we shall load exclusively the bundled version of `wintun.dll` from the application directory, and disregard any `wintun.dll` or `wintun.sys` installed in system directories by other software. Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com> --- wintun.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wintun.c b/wintun.c index 84111e76..7667cab9 100644 --- a/wintun.c +++ b/wintun.c @@ -69,8 +69,7 @@ static int init_wintun(struct openconnect_info *vpninfo) { if (!vpninfo->wintun) { vpninfo->wintun = LoadLibraryExW(L"wintun.dll", NULL, - LOAD_LIBRARY_SEARCH_APPLICATION_DIR | - LOAD_LIBRARY_SEARCH_SYSTEM32); + LOAD_LIBRARY_SEARCH_APPLICATION_DIR); if (!vpninfo->wintun) { vpn_progress(vpninfo, PRG_DEBUG, _("Could not load wintun.dll\n")); return -ENOENT; -- 2.50.1