RegistryQueryString() may produce one or more "File not found" errors
when called from RegistryQueryStringWait() - which is expected while
waiting. Those errors were annoying and awkward to read in the log.
Furthermore, should RegistryQueryString() fail, it already displays
detailed Windows error message and the parent's logging was simplified
to prevent repetitions in the log.
Signed-off-by: Simon Rozman <simon@rozman.si>
The WintunCreateAdapter()+CreateAdapter() and WintunDeleteAdapter()+
DeleteAdapter() communicate using Unicode anonymous pipes now. This
allows the WintunCreateAdapter() to exactly determine the adapter
CreateAdapter() just created by its GUID rather than its name - avoiding
the possible ambiguity caused by same-adapter-name ordinal suffixes.
This also allows exact retrieval of the result code and pending reboot
flag from the rundll32 child process.
Furthermore, CreateAdapter() and DeleteAdapter() are now available in
_DEBUG for all platforms to allow testing. It took a #pragma comment(
linker, "/EXPORT") trick to stop compiler from decorating function names
and exporting as _CreateAdapter@16() and _DeleteAdapter@16() in x86.
Signed-off-by: Simon Rozman <simon@rozman.si>
SetupAPI fails to create a device in WoW64 processes. x86 (and arm)
wintun.dll pack the amd64 and arm64 wintun.dll now, and use rundll32 to
create a native process to do the job where required.
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>
When an internal function logs an error and its cause, it bloats the log
when the caller logs the cause again.
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>