]> 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:49:19 +0000 (15:49 +0200)
commit87b43ded380af06129ea59744d27684e36635c74
tree91a97e8e979b6744c54a363e80208c0cb19c3885
parent7ee347f74beb0758c1cb70813f773fcde99b270e
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>
(cherry picked from commit f3f09541dcff3f0b307067bdf5dcaabc530db4c7)
config-msvc.h
src/tapctl/tap.c