When we install the Wintun driver to the store, we get exact oem<nn>.inf
filename of the driver in the store we just installed. Since the
installation should be only temporarily, we should uninstall only the
driver we installed.
This also eliminates the need for iterating driver store speeding up
things.
The code we removed was inherited from the installer.dll, where it made
perfect sense to remove all installed Wintun drivers in the update
process.
Suggested-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Simon Rozman <simon@rozman.si>
The SDK header for deployment containing datatype and function
declarations for use by C/C++ clients.
As we shall not distribute MSVC wintun.lib files, making clients need to
use GetProcAddress(), this file contains function type declarations
rather then __declspec(dllimport) function declarations.
Signed-off-by: Simon Rozman <simon@rozman.si>
1. Add driver to the store: SetupCopyOEMInfW()
2. Create the adapter using explicit path to .inf file: DI_ENUMSINGLEINF
3. Delete all Wintun drivers from the store.
This is a subject of further research:
- It appears those adapters survive a reboot. So, Windows must store the
driver somewhere on the disk and the driver removal is not completed.
If the driver removal is not completed until there are existing
adapters, this is excellent, as it will provide a self-cleanup.
- Test multiple adapters with different driver versions. Which driver
wins?
- Are other Wintun adapters interrupted when adding a new one?
- Test Windows 7 behaviour.
Signed-off-by: Simon Rozman <simon@rozman.si>
While Doxygen correctly locates the function documentation when it is
written directly preceding the function body, Microsoft Visual Studio
IDE does not. The former requires the documentation to precede the
function declaration.
Signed-off-by: Simon Rozman <simon@rozman.si>
Gather adapter management in adapter.h/.c (formerly devmgmt.h/.c) and
unify HwID tests.
Use "Namespace" namespace in all functions from namespace.h/.c.
Fix char strings in LOG_...
Signed-off-by: Simon Rozman <simon@rozman.si>
With installer.dll the installer did the decision whether to install or
upgrade the driver according to installer.dll version and hash stored in
registry by MSM.
With wintun.dll we need to know, which version of Wintun driver we are
packing in the resources to decide about driver upgrade. The most
accurate source of the driver version is the DriverVer directive in
[Version] section of the driver's .inf file.
Signed-off-by: Simon Rozman <simon@rozman.si>