Commit Graph

26 Commits

Author SHA1 Message Date
Simon Rozman
d675646ab8 api: upgrade
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-07-28 20:25:27 +02:00
Simon Rozman
7dffa4be72 vs: move shared configuration to wintun.props and upgrade
Remember to rename wintun.vcxproj.user file in your local working folder
to wintun.props.user manually.

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-07-28 20:22:18 +02:00
Jason A. Donenfeld
899e085a91 api: build with WDK
Makes builds more reproducable, as we can do our next release using the
EWDK, an all-in-one ISO of build tools from Microsoft.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-07-23 20:20:43 +02:00
Jason A. Donenfeld
747ba7121d api: clean up NetSetup2 GUIDs
Recent versions of Windows fail to tidy up, causing issues when reusing
GUIDs. Check to see if a GUID might be orphaned, and forcibly clear out
the registry state if so.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-05-05 11:17:39 +02:00
Simon Rozman
bc5cde8916 api: upgrade logging
Log runtime information to quickly check whether the values are sane
when analyzing error logs sent in by users.

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-02-16 04:19:21 +01:00
Jason A. Donenfeld
2628412d71 global: bump copyright
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-01-30 16:45:26 +01:00
Jason A. Donenfeld
5d1efa847f api: use a logging alloc function
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-11-04 13:21:43 +01:00
Simon Rozman
f657e6fd27 api: use GetLastError() to report failures like standard Win32
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-11-04 13:21:42 +01:00
Simon Rozman
60ad907b99 api: check buffer overflows in runtime
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-31 19:11:57 +01:00
Jason A. Donenfeld
937eb44727 api: get rid of pch and make headers sane
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-10-31 19:11:51 +01:00
Simon Rozman
1b3af95be3 api: selectively use temporary variable to prepare output
Suggested-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-31 19:11:49 +01:00
Simon Rozman
4a575d210a api: fallback to hard-coded version
Windows 7 doesn't have DriverMajorVersion and DriverMinorVersion
registry values yet.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-31 10:41:46 +01:00
Simon Rozman
bf4eabb4ca api: switch to private heap
We must not use the process heap, as it is changeable. Client may change
it causing our HeapFree() to use wrong heap.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:51:01 +01:00
Simon Rozman
84c066fa79 api: revise logging
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>
2020-10-30 16:51:01 +01:00
Simon Rozman
ac6db7788a api: move documentation to .h and discontinue on static functions
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>
2020-10-30 16:51:00 +01:00
Simon Rozman
1f87c307f6 api: log out-of-memory errors too
It's not likely the write to log will succeed in low memory condition
thou.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:51:00 +01:00
Simon Rozman
2a77f20277 api: remove dead code
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:51:00 +01:00
Simon Rozman
16a9737578 api: internal reorganization
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>
2020-10-30 16:51:00 +01:00
Simon Rozman
78b7a01eb3 api: simplify logger macros names
WINTUN_LOGGER_... => LOGGER_... => LOG_...

Those macros are internal, so they don/t need to start with WINTUN_...

Replacing the noun LOGGER_... with the verb LOG_... makes the code more
natural to read now.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:51:00 +01:00
Simon Rozman
f316c13b3e api: introduce logging
And other unifications with installer before merging.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:50:59 +01:00
Simon Rozman
640605a8d9 api: update documentation
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:50:59 +01:00
Simon Rozman
28c135b8e1 api: tighten maximum registry key path length
Maximum registry key path length is not 260 (MAX_PATH), but 255 (256
incl. zero terminator).

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:50:59 +01:00
Simon Rozman
08e2993d23 api: cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:50:59 +01:00
Simon Rozman
0a986ce9fc api: add pre-compiled header support
...for super-fast compilation.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:50:58 +01:00
Simon Rozman
a283add85b api: rename WINSTATUS to WINTUN_STATUS
...to reduce name collision probability.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:50:58 +01:00
Simon Rozman
7e3740018d api: finish porting from wireguard-go
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:50:58 +01:00