api: consistancy in exported interface

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-11-02 17:42:52 +01:00
parent 351349b4c4
commit f0f18ea4fb
2 changed files with 10 additions and 8 deletions

View File

@ -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;
}

View File

@ -172,13 +172,6 @@ typedef WINTUN_STATUS(WINAPI *WINTUN_GET_ADAPTER_NAME_FUNC)(
_In_ WINTUN_ADAPTER_HANDLE Adapter,
_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.
*
@ -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);