diff options
author | Simon Rozman <simon@rozman.si> | 2020-07-07 15:42:39 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-10-30 16:50:58 +0100 |
commit | d3a63116bae420db751bb2243f72baaa3b61c441 (patch) | |
tree | f6efa29387261a51750861e98acc66d9b85974be /api/api.h | |
parent | api: port nci package from wireguard-go (diff) | |
download | wintun-d3a63116bae420db751bb2243f72baaa3b61c441.tar.xz wintun-d3a63116bae420db751bb2243f72baaa3b61c441.zip |
api: port GetInterface member from wireguard-go
Mind that this also fixes the order of adapter detection checks. A fast
test to eliminate non-Wintun adapters from iteration to speed things up
rendered the method incapable of detecting a non-Wintun adapter with the
name we are looking for.
ERROR_OBJECT_NOT_FOUND was replaced with ERROR_FILE_NOT_FOUND.
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'api/api.h')
-rw-r--r-- | api/api.h | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -36,3 +36,21 @@ NciInit(); void NciCleanup(); + +#define MAX_POOL 256 +#define MAX_INSTANCE_ID MAX_PATH /* TODO: Is MAX_PATH always enough? */ + +typedef struct _WINTUN_ADAPTER +{ + GUID CfgInstanceID; + WCHAR DevInstanceID[MAX_INSTANCE_ID]; + DWORD LuidIndex; + DWORD IfType; + WCHAR Pool[MAX_POOL]; +} WINTUN_ADAPTER; + +VOID WINAPI +WintunFreeAdapter(_In_ WINTUN_ADAPTER *Adapter); + +_Return_type_success_(return == 0) DWORD WINAPI + WintunGetAdapter(_In_z_count_c_(MAX_POOL) LPCWSTR Pool, _In_z_ LPCWSTR IfName, _Out_ WINTUN_ADAPTER **Adapter); |