aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-11-02 18:34:49 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2020-11-02 23:33:20 +0100
commitddacb5491aadb2a013a80cb5d45e23fec85c5d68 (patch)
treecb44d0e87b74c24e6f774faa4898722d68711754
parentapi: consistancy in exported interface (diff)
downloadwintun-ddacb5491aadb2a013a80cb5d45e23fec85c5d68.tar.xz
wintun-ddacb5491aadb2a013a80cb5d45e23fec85c5d68.zip
api: pass around NET_LUID instead of LUID
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--api/adapter.c7
-rw-r--r--api/wintun.h3
2 files changed, 6 insertions, 4 deletions
diff --git a/api/adapter.c b/api/adapter.c
index 973316e..5953e9b 100644
--- a/api/adapter.c
+++ b/api/adapter.c
@@ -774,10 +774,11 @@ WintunGetAdapterGUID(_In_ const WINTUN_ADAPTER *Adapter, _Out_ GUID *Guid)
}
void WINAPI
-WintunGetAdapterLUID(_In_ const WINTUN_ADAPTER *Adapter, _Out_ LUID *Luid)
+WintunGetAdapterLUID(_In_ const WINTUN_ADAPTER *Adapter, _Out_ NET_LUID *Luid)
{
- *(LONGLONG *)Luid = (((LONGLONG)Adapter->LuidIndex & ((1 << 24) - 1)) << 24) |
- (((LONGLONG)Adapter->IfType & ((1 << 16) - 1)) << 48);
+ Luid->Info.Reserved = 0;
+ Luid->Info.NetLuidIndex = Adapter->LuidIndex;
+ Luid->Info.IfType = Adapter->IfType;
}
WINTUN_STATUS WINAPI
diff --git a/api/wintun.h b/api/wintun.h
index 5176c2c..09d53b2 100644
--- a/api/wintun.h
+++ b/api/wintun.h
@@ -7,6 +7,7 @@
#include <Windows.h>
#include <IPExport.h>
+#include <ifdef.h>
#ifdef __cplusplus
extern "C" {
@@ -157,7 +158,7 @@ typedef void(WINAPI *WINTUN_GET_ADAPTER_GUID_FUNC)(_In_ WINTUN_ADAPTER_HANDLE Ad
*
* @param Luid Pointer to LUID to receive adapter LUID.
*/
-typedef void(WINAPI *WINTUN_GET_ADAPTER_LUID_FUNC)(_In_ WINTUN_ADAPTER_HANDLE Adapter, _Out_ LUID *Luid);
+typedef void(WINAPI *WINTUN_GET_ADAPTER_LUID_FUNC)(_In_ WINTUN_ADAPTER_HANDLE Adapter, _Out_ NET_LUID *Luid);
/**
* Returns the name of the Wintun adapter.