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>
{
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;