api: rename GetVersion to GetRunningDriverVersion
This makes our intentions a lot more clear, and in case we ever add other version functions, makes the forward path simpler. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
e2ffd0b3b3
commit
dc99f96da7
@ -103,7 +103,7 @@ WintunSendPacket(Session, Packet);
|
|||||||
|
|
||||||
Other `wintun.dll` functions are:
|
Other `wintun.dll` functions are:
|
||||||
|
|
||||||
- `WintunGetVersion()` returns driver and NDIS major and minor versions.
|
- `WintunGetRunningDriverVersion()` returns driver and NDIS major and minor versions.
|
||||||
- `WintunSetLogger()` sets global logging callback function.
|
- `WintunSetLogger()` sets global logging callback function.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
@ -1083,7 +1083,7 @@ static _Return_type_success_(return != FALSE) BOOL
|
|||||||
}
|
}
|
||||||
|
|
||||||
DWORD WINAPI
|
DWORD WINAPI
|
||||||
WintunGetVersion(void)
|
WintunGetRunningDriverVersion(void)
|
||||||
{
|
{
|
||||||
PRTL_PROCESS_MODULES Modules;
|
PRTL_PROCESS_MODULES Modules;
|
||||||
ULONG BufferSize = 128 * 1024;
|
ULONG BufferSize = 128 * 1024;
|
||||||
@ -1127,7 +1127,7 @@ static BOOL
|
|||||||
EnsureWintunUnloaded(void)
|
EnsureWintunUnloaded(void)
|
||||||
{
|
{
|
||||||
BOOL Loaded;
|
BOOL Loaded;
|
||||||
for (int i = 0; (Loaded = WintunGetVersion() != 0) != FALSE && i < 300; ++i)
|
for (int i = 0; (Loaded = WintunGetRunningDriverVersion() != 0) != FALSE && i < 300; ++i)
|
||||||
Sleep(50);
|
Sleep(50);
|
||||||
return !Loaded;
|
return !Loaded;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ EXPORTS
|
|||||||
WintunGetAdapterLUID
|
WintunGetAdapterLUID
|
||||||
WintunGetAdapterName
|
WintunGetAdapterName
|
||||||
WintunGetReadWaitEvent
|
WintunGetReadWaitEvent
|
||||||
WintunGetVersion
|
WintunGetRunningDriverVersion
|
||||||
WintunReceivePacket
|
WintunReceivePacket
|
||||||
WintunReceiveRelease
|
WintunReceiveRelease
|
||||||
WintunSendPacket
|
WintunSendPacket
|
||||||
|
@ -187,7 +187,7 @@ typedef _Return_type_success_(return != FALSE)
|
|||||||
* zero. To get extended error information, call GetLastError. Possible errors include the following:
|
* zero. To get extended error information, call GetLastError. Possible errors include the following:
|
||||||
* ERROR_FILE_NOT_FOUND Wintun not loaded
|
* ERROR_FILE_NOT_FOUND Wintun not loaded
|
||||||
*/
|
*/
|
||||||
typedef DWORD(WINAPI *WINTUN_GET_VERSION_FUNC)(void);
|
typedef DWORD(WINAPI *WINTUN_GET_RUNNING_DRIVER_VERSION_FUNC)(void);
|
||||||
|
|
||||||
typedef enum _WINTUN_LOGGER_LEVEL
|
typedef enum _WINTUN_LOGGER_LEVEL
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@ static WINTUN_OPEN_ADAPTER_DEVICE_OBJECT_FUNC WintunOpenAdapterDeviceObject;
|
|||||||
static WINTUN_GET_ADAPTER_LUID_FUNC WintunGetAdapterLUID;
|
static WINTUN_GET_ADAPTER_LUID_FUNC WintunGetAdapterLUID;
|
||||||
static WINTUN_GET_ADAPTER_NAME_FUNC WintunGetAdapterName;
|
static WINTUN_GET_ADAPTER_NAME_FUNC WintunGetAdapterName;
|
||||||
static WINTUN_SET_ADAPTER_NAME_FUNC WintunSetAdapterName;
|
static WINTUN_SET_ADAPTER_NAME_FUNC WintunSetAdapterName;
|
||||||
static WINTUN_GET_VERSION_FUNC WintunGetVersion;
|
static WINTUN_GET_RUNNING_DRIVER_VERSION_FUNC WintunGetRunningDriverVersion;
|
||||||
static WINTUN_SET_LOGGER_FUNC WintunSetLogger;
|
static WINTUN_SET_LOGGER_FUNC WintunSetLogger;
|
||||||
static WINTUN_START_SESSION_FUNC WintunStartSession;
|
static WINTUN_START_SESSION_FUNC WintunStartSession;
|
||||||
static WINTUN_END_SESSION_FUNC WintunEndSession;
|
static WINTUN_END_SESSION_FUNC WintunEndSession;
|
||||||
@ -279,7 +279,8 @@ InitializeWintun(void)
|
|||||||
X(WintunOpenAdapterDeviceObject, WINTUN_OPEN_ADAPTER_DEVICE_OBJECT_FUNC) ||
|
X(WintunOpenAdapterDeviceObject, WINTUN_OPEN_ADAPTER_DEVICE_OBJECT_FUNC) ||
|
||||||
X(WintunGetAdapterLUID, WINTUN_GET_ADAPTER_LUID_FUNC) ||
|
X(WintunGetAdapterLUID, WINTUN_GET_ADAPTER_LUID_FUNC) ||
|
||||||
X(WintunGetAdapterName, WINTUN_GET_ADAPTER_NAME_FUNC) ||
|
X(WintunGetAdapterName, WINTUN_GET_ADAPTER_NAME_FUNC) ||
|
||||||
X(WintunSetAdapterName, WINTUN_SET_ADAPTER_NAME_FUNC) || X(WintunGetVersion, WINTUN_GET_VERSION_FUNC) ||
|
X(WintunSetAdapterName, WINTUN_SET_ADAPTER_NAME_FUNC) ||
|
||||||
|
X(WintunGetRunningDriverVersion, WINTUN_GET_RUNNING_DRIVER_VERSION_FUNC) ||
|
||||||
X(WintunSetLogger, WINTUN_SET_LOGGER_FUNC) || X(WintunStartSession, WINTUN_START_SESSION_FUNC) ||
|
X(WintunSetLogger, WINTUN_SET_LOGGER_FUNC) || X(WintunStartSession, WINTUN_START_SESSION_FUNC) ||
|
||||||
X(WintunEndSession, WINTUN_END_SESSION_FUNC) || X(WintunGetReadWaitEvent, WINTUN_GET_READ_WAIT_EVENT_FUNC) ||
|
X(WintunEndSession, WINTUN_END_SESSION_FUNC) || X(WintunGetReadWaitEvent, WINTUN_GET_READ_WAIT_EVENT_FUNC) ||
|
||||||
X(WintunReceivePacket, WINTUN_RECEIVE_PACKET_FUNC) || X(WintunReceiveRelease, WINTUN_RECEIVE_RELEASE_FUNC) ||
|
X(WintunReceivePacket, WINTUN_RECEIVE_PACKET_FUNC) || X(WintunReceiveRelease, WINTUN_RECEIVE_RELEASE_FUNC) ||
|
||||||
@ -331,7 +332,7 @@ main(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD Version = WintunGetVersion();
|
DWORD Version = WintunGetRunningDriverVersion();
|
||||||
Log(WINTUN_LOG_INFO, L"Wintun v%u.%u loaded", (Version >> 16) & 0xff, (Version >> 0) & 0xff);
|
Log(WINTUN_LOG_INFO, L"Wintun v%u.%u loaded", (Version >> 16) & 0xff, (Version >> 0) & 0xff);
|
||||||
|
|
||||||
MIB_UNICASTIPADDRESS_ROW AddressRow;
|
MIB_UNICASTIPADDRESS_ROW AddressRow;
|
||||||
|
Loading…
Reference in New Issue
Block a user