aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-11-02 17:42:52 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2020-11-02 23:33:20 +0100
commitf0f18ea4fb26bff98312f35183612c944d7ccd26 (patch)
tree809590214685dca9f4044d006de881daf7888231
parentapi: return correct error when there's a duplicate (diff)
downloadwintun-f0f18ea4fb26bff98312f35183612c944d7ccd26.tar.xz
wintun-f0f18ea4fb26bff98312f35183612c944d7ccd26.zip
api: consistancy in exported interface
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--api/logger.c2
-rw-r--r--api/wintun.h16
2 files changed, 10 insertions, 8 deletions
diff --git a/api/logger.c b/api/logger.c
index 303608a..c954f6c 100644
--- a/api/logger.c
+++ b/api/logger.c
@@ -19,6 +19,8 @@ WINTUN_LOGGER_CALLBACK_FUNC Logger = NopLogger;
void CALLBACK
WintunSetLogger(_In_ WINTUN_LOGGER_CALLBACK_FUNC NewLogger)
{
+ if (!NewLogger)
+ NewLogger = NopLogger;
Logger = NewLogger;
}
diff --git a/api/wintun.h b/api/wintun.h
index 7c72ead..5176c2c 100644
--- a/api/wintun.h
+++ b/api/wintun.h
@@ -173,13 +173,6 @@ typedef WINTUN_STATUS(WINAPI *WINTUN_GET_ADAPTER_NAME_FUNC)(
_Out_cap_c_(MAX_ADAPTER_NAME) WCHAR *Name);
/**
- * Determines the version of the Wintun driver currently loaded.
- *
- * @return The version number on success, or 0 if failure or Wintun not loaded.
- */
-typedef DWORDLONG(WINAPI *WINTUN_GET_VERSION_FUNC)(void);
-
-/**
* Sets name of the Wintun adapter.
*
* @param Adapter Adapter handle obtained with WintunGetAdapter or WintunCreateAdapter
@@ -191,6 +184,13 @@ typedef DWORDLONG(WINAPI *WINTUN_GET_VERSION_FUNC)(void);
typedef WINTUN_STATUS(
WINAPI *WINTUN_SET_ADAPTER_NAME_FUNC)(_In_ WINTUN_ADAPTER_HANDLE Adapter, _In_z_ const WCHAR *Name);
+/**
+ * Determines the version of the Wintun driver currently loaded.
+ *
+ * @return The version number on success, or 0 if failure or Wintun not loaded.
+ */
+typedef DWORDLONG(WINAPI *WINTUN_GET_VERSION_FUNC)(void);
+
typedef enum _WINTUN_LOGGER_LEVEL
{
WINTUN_LOG_INFO = 0,
@@ -214,7 +214,7 @@ typedef BOOL(CALLBACK *WINTUN_LOGGER_CALLBACK_FUNC)(_In_ WINTUN_LOGGER_LEVEL Lev
*
* @param NewLogger Pointer to callback function to use as a new global logger. NewLogger may be called from various
* threads concurrently. Should the logging require serialization, you must handle serialization in
- * NewLogger.
+ * NewLogger. Set to NULL to disable.
*/
typedef void(WINAPI *WINTUN_SET_LOGGER_FUNC)(_In_ WINTUN_LOGGER_CALLBACK_FUNC NewLogger);