2020-07-29 10:10:42 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0
|
|
|
|
*
|
|
|
|
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-10-17 15:11:34 +02:00
|
|
|
#include "wintun.h"
|
2020-10-31 11:55:26 +01:00
|
|
|
#include <IPExport.h>
|
2020-10-15 11:32:06 +02:00
|
|
|
#include <SetupAPI.h>
|
2020-10-31 11:55:26 +01:00
|
|
|
#include <Windows.h>
|
2020-07-29 10:10:42 +02:00
|
|
|
|
|
|
|
#define MAX_INSTANCE_ID MAX_PATH /* TODO: Is MAX_PATH always enough? */
|
2020-10-30 09:53:09 +01:00
|
|
|
#define WINTUN_HWID L"Wintun"
|
2020-07-29 10:10:42 +02:00
|
|
|
|
2020-10-15 11:32:06 +02:00
|
|
|
void
|
2020-10-30 06:03:21 +01:00
|
|
|
AdapterInit(void);
|
2020-10-15 11:32:06 +02:00
|
|
|
|
2020-10-17 15:11:34 +02:00
|
|
|
/**
|
|
|
|
* Wintun adapter descriptor.
|
|
|
|
*/
|
2020-07-29 10:10:42 +02:00
|
|
|
typedef struct _WINTUN_ADAPTER
|
|
|
|
{
|
|
|
|
GUID CfgInstanceID;
|
|
|
|
WCHAR DevInstanceID[MAX_INSTANCE_ID];
|
|
|
|
DWORD LuidIndex;
|
|
|
|
DWORD IfType;
|
2020-10-31 08:53:32 +01:00
|
|
|
WCHAR Pool[WINTUN_MAX_POOL];
|
2020-07-29 10:10:42 +02:00
|
|
|
} WINTUN_ADAPTER;
|
|
|
|
|
2020-10-15 12:52:01 +02:00
|
|
|
/**
|
2020-10-17 15:11:34 +02:00
|
|
|
* @copydoc WINTUN_FREE_ADAPTER_FUNC
|
2020-10-15 12:52:01 +02:00
|
|
|
*/
|
2020-07-29 10:10:42 +02:00
|
|
|
void WINAPI
|
|
|
|
WintunFreeAdapter(_In_ WINTUN_ADAPTER *Adapter);
|
|
|
|
|
2020-10-24 08:28:17 +02:00
|
|
|
/**
|
2020-11-03 12:31:49 +01:00
|
|
|
* @copydoc WINTUN_OPEN_ADAPTER_DEVICE_OBJECT_FUNC
|
2020-10-24 08:28:17 +02:00
|
|
|
*/
|
|
|
|
WINTUN_STATUS WINAPI
|
2020-11-03 12:31:49 +01:00
|
|
|
WintunOpenAdapterDeviceObject(_In_ const WINTUN_ADAPTER *Adapter, _Out_ HANDLE *Handle);
|
2020-10-24 08:28:17 +02:00
|
|
|
|
2020-10-15 12:52:01 +02:00
|
|
|
/**
|
2020-10-17 15:11:34 +02:00
|
|
|
* @copydoc WINTUN_CREATE_ADAPTER_FUNC
|
2020-10-15 12:52:01 +02:00
|
|
|
*/
|
2020-07-29 10:10:42 +02:00
|
|
|
WINTUN_STATUS WINAPI
|
|
|
|
WintunCreateAdapter(
|
2020-10-31 18:13:36 +01:00
|
|
|
_In_z_ const WCHAR *Pool,
|
|
|
|
_In_z_ const WCHAR *Name,
|
2020-07-29 10:10:42 +02:00
|
|
|
_In_opt_ const GUID *RequestedGUID,
|
|
|
|
_Out_ WINTUN_ADAPTER **Adapter,
|
2020-10-31 15:40:01 +01:00
|
|
|
_Out_opt_ BOOL *RebootRequired);
|
2020-07-29 10:10:42 +02:00
|
|
|
|
2020-10-15 12:52:01 +02:00
|
|
|
/**
|
2020-10-17 15:11:34 +02:00
|
|
|
* @copydoc WINTUN_DELETE_ADAPTER_FUNC
|
2020-10-15 12:52:01 +02:00
|
|
|
*/
|
2020-07-29 10:10:42 +02:00
|
|
|
WINTUN_STATUS WINAPI
|
2020-10-31 15:40:01 +01:00
|
|
|
WintunDeleteAdapter(_In_ const WINTUN_ADAPTER *Adapter, _In_ BOOL ForceCloseSessions, _Out_opt_ BOOL *RebootRequired);
|
2020-11-02 16:28:51 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-03 12:27:42 +01:00
|
|
|
* @copydoc WINTUN_DELETE_POOL_DRIVER_FUNC
|
2020-11-02 16:28:51 +01:00
|
|
|
*/
|
|
|
|
WINTUN_STATUS WINAPI
|
2020-11-03 12:45:38 +01:00
|
|
|
WintunDeletePoolDriver(_In_z_ const WCHAR Pool[WINTUN_MAX_POOL], _Out_opt_ BOOL *RebootRequired);
|