]> git.ipfire.org Git - thirdparty/openvpn.git/commit
In tap.c use DiInstallDevice to install the driver on a new adapter
authorSelva Nair <selva.nair@gmail.com>
Thu, 3 Sep 2020 23:56:44 +0000 (19:56 -0400)
committerGert Doering <gert@greenie.muc.de>
Fri, 4 Sep 2020 13:44:57 +0000 (15:44 +0200)
commitf3f09541dcff3f0b307067bdf5dcaabc530db4c7
tree469f70166e8000d58c5e37807572acb4e0c4ac94
parent6ffe64e34004967a96514cc55abb22215fbe5640
In tap.c use DiInstallDevice to install the driver on a new adapter

As reported in Trac 1321, additional adapter installation
by tapctl.exe fails to fully setup the device node (some registry
keys missing, error in setapi.dev.log etc.).
Although the exact cause of this failure is unclear,
letting the Plug and Play subsystem handle the installation
by calling DiInstallDevice() avoids it.

We let the system automatically choose the best driver
by passing NULL for driverinfo to DiInstallDevice().
This also eliminates the need for enumerating all drivers
in the Net class and selecting a matching one.

Somehow mingw-w64 fails to find DiInstallDriver() in
newdev.lib although the header does define it. Use LoadLibrary()
to locate it at run time (available in Vista and above).

Built using mingw and tested both the msi installer (code shared
with libopenvpnmscia.dll) and tapctl.exe on Windows 10 64 bit.

Fixes: Trac #1321
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <1599177404-29996-1-git-send-email-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20880.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
config-msvc.h
src/tapctl/tap.c