]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Load wintun.dll from the application directory only
authorDimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Wed, 8 Dec 2021 08:21:06 +0000 (09:21 +0100)
committerDaniel Lenski <dlenski@gmail.com>
Thu, 9 Dec 2021 01:36:23 +0000 (17:36 -0800)
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

index 84111e761d67dc87004675e309142bf7c2be1132..7667cab90edee03e2b36df3783921f61f599a4bd 100644 (file)
--- 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;