api: rename WintunGetAdapter to WintunOpenAdapter

"Create" and "Open" natural names for these.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-11-05 13:39:13 +01:00
parent e9e790605a
commit 1285b8f528
5 changed files with 22 additions and 22 deletions

View File

@ -179,7 +179,7 @@ Deletes a Wintun adapter.
**Parameters**
- *Adapter*: Adapter handle obtained with WintunGetAdapter or WintunCreateAdapter.
- *Adapter*: Adapter handle obtained with WintunOpenAdapter or WintunCreateAdapter.
- *ForceCloseSessions*: Force close adapter handles that may be in use by other processes. Only set this to TRUE with extreme care, as this is resource intensive and may put processes into an undefined or unpredictable state. Most users should set this to FALSE.
- *RebootRequired*: Optional pointer to a boolean flag to be set to TRUE in case SetupAPI suggests a reboot.
@ -226,11 +226,11 @@ Releases Wintun adapter resources.
**Parameters**
- *Adapter*: Adapter handle obtained with WintunGetAdapter or WintunCreateAdapter.
- *Adapter*: Adapter handle obtained with WintunOpenAdapter or WintunCreateAdapter.
#### WintunGetAdapter()
#### WintunOpenAdapter()
`WINTUN_ADAPTER_HANDLE WintunGetAdapter (const WCHAR * Pool, const WCHAR * Name)`
`WINTUN_ADAPTER_HANDLE WintunOpenAdapter (const WCHAR * Pool, const WCHAR * Name)`
Finds a Wintun adapter by its name.
@ -251,7 +251,7 @@ Returns a handle to the adapter device object.
**Parameters**
- *Adapter*: Adapter handle obtained with WintunGetAdapter or WintunCreateAdapter.
- *Adapter*: Adapter handle obtained with WintunOpenAdapter or WintunCreateAdapter.
**Returns**
@ -265,7 +265,7 @@ Returns the LUID of the adapter.
**Parameters**
- *Adapter*: Adapter handle obtained with WintunGetAdapter or WintunCreateAdapter
- *Adapter*: Adapter handle obtained with WintunOpenAdapter or WintunCreateAdapter
- *Luid*: Pointer to LUID to receive adapter LUID.
#### WintunGetAdapterName()
@ -276,7 +276,7 @@ Returns the name of the Wintun adapter.
**Parameters**
- *Adapter*: Adapter handle obtained with WintunGetAdapter or WintunCreateAdapter
- *Adapter*: Adapter handle obtained with WintunOpenAdapter or WintunCreateAdapter
- *Name*: Pointer to a string to receive adapter name
**Returns**
@ -291,7 +291,7 @@ Sets name of the Wintun adapter.
**Parameters**
- *Adapter*: Adapter handle obtained with WintunGetAdapter or WintunCreateAdapter
- *Adapter*: Adapter handle obtained with WintunOpenAdapter or WintunCreateAdapter
- *Name*: Adapter name. Zero-terminated string of up to MAX\_ADAPTER\_NAME-1 characters.
**Returns**
@ -326,7 +326,7 @@ Starts Wintun session.
**Parameters**
- *Adapter*: Adapter handle obtained with WintunGetAdapter or WintunCreateAdapter
- *Adapter*: Adapter handle obtained with WintunOpenAdapter or WintunCreateAdapter
- *Capacity*: Rings capacity. Must be between WINTUN\_MIN\_RING\_CAPACITY and WINTUN\_MAX\_RING\_CAPACITY (incl.) Must be a power of two.
**Returns**

View File

@ -607,7 +607,7 @@ WintunFreeAdapter(_In_ WINTUN_ADAPTER *Adapter)
}
_Return_type_success_(return != NULL) WINTUN_ADAPTER *WINAPI
WintunGetAdapter(_In_z_ const WCHAR *Pool, _In_z_ const WCHAR *Name)
WintunOpenAdapter(_In_z_ const WCHAR *Pool, _In_z_ const WCHAR *Name)
{
if (!ElevateToSystem())
{

View File

@ -7,7 +7,7 @@ EXPORTS
WintunEndSession
WintunEnumAdapters
WintunFreeAdapter
WintunGetAdapter
WintunOpenAdapter
WintunOpenAdapterDeviceObject
WintunGetAdapterLUID
WintunGetAdapterName

View File

@ -50,7 +50,7 @@ typedef _Return_type_success_(return != NULL) WINTUN_ADAPTER_HANDLE(WINAPI *WINT
/**
* Deletes a Wintun adapter.
*
* @param Adapter Adapter handle obtained with WintunGetAdapter or WintunCreateAdapter.
* @param Adapter Adapter handle obtained with WintunOpenAdapter or WintunCreateAdapter.
*
* @param ForceCloseSessions Force close adapter handles that may be in use by other processes. Only set this to TRUE
* with extreme care, as this is resource intensive and may put processes into an undefined
@ -110,7 +110,7 @@ typedef _Return_type_success_(return != FALSE) BOOL(
/**
* Releases Wintun adapter resources.
*
* @param Adapter Adapter handle obtained with WintunGetAdapter or WintunCreateAdapter.
* @param Adapter Adapter handle obtained with WintunOpenAdapter or WintunCreateAdapter.
*/
typedef void(WINAPI *WINTUN_FREE_ADAPTER_FUNC)(_In_ WINTUN_ADAPTER_HANDLE Adapter);
@ -128,12 +128,12 @@ typedef void(WINAPI *WINTUN_FREE_ADAPTER_FUNC)(_In_ WINTUN_ADAPTER_HANDLE Adapte
* ERROR_ALREADY_EXISTS if adapter is found but not a Wintun-class or not a member of the pool
*/
typedef _Return_type_success_(return != NULL)
WINTUN_ADAPTER_HANDLE(WINAPI *WINTUN_GET_ADAPTER_FUNC)(_In_z_ const WCHAR *Pool, _In_z_ const WCHAR *Name);
WINTUN_ADAPTER_HANDLE(WINAPI *WINTUN_OPEN_ADAPTER_FUNC)(_In_z_ const WCHAR *Pool, _In_z_ const WCHAR *Name);
/**
* Returns a handle to the adapter device object.
*
* @param Adapter Adapter handle obtained with WintunGetAdapter or WintunCreateAdapter.
* @param Adapter Adapter handle obtained with WintunOpenAdapter or WintunCreateAdapter.
*
* @return If the function succeeds, the return value is adapter device object handle. Must be released with
* CloseHandle. If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error
@ -145,7 +145,7 @@ typedef _Return_type_success_(return != INVALID_HANDLE_VALUE)
/**
* Returns the LUID of the adapter.
*
* @param Adapter Adapter handle obtained with WintunGetAdapter or WintunCreateAdapter
* @param Adapter Adapter handle obtained with WintunOpenAdapter or WintunCreateAdapter
*
* @param Luid Pointer to LUID to receive adapter LUID.
*/
@ -154,7 +154,7 @@ typedef void(WINAPI *WINTUN_GET_ADAPTER_LUID_FUNC)(_In_ WINTUN_ADAPTER_HANDLE Ad
/**
* Returns the name of the Wintun adapter.
*
* @param Adapter Adapter handle obtained with WintunGetAdapter or WintunCreateAdapter
* @param Adapter Adapter handle obtained with WintunOpenAdapter or WintunCreateAdapter
*
* @param Name Pointer to a string to receive adapter name
*
@ -168,7 +168,7 @@ typedef _Return_type_success_(return != FALSE) BOOL(WINAPI *WINTUN_GET_ADAPTER_N
/**
* Sets name of the Wintun adapter.
*
* @param Adapter Adapter handle obtained with WintunGetAdapter or WintunCreateAdapter
* @param Adapter Adapter handle obtained with WintunOpenAdapter or WintunCreateAdapter
*
* @param Name Adapter name. Zero-terminated string of up to MAX_ADAPTER_NAME-1 characters.
*
@ -235,7 +235,7 @@ typedef void *WINTUN_SESSION_HANDLE;
/**
* Starts Wintun session.
*
* @param Adapter Adapter handle obtained with WintunGetAdapter or WintunCreateAdapter
* @param Adapter Adapter handle obtained with WintunOpenAdapter or WintunCreateAdapter
*
* @param Capacity Rings capacity. Must be between WINTUN_MIN_RING_CAPACITY and WINTUN_MAX_RING_CAPACITY (incl.)
* Must be a power of two.

View File

@ -17,7 +17,7 @@ static WINTUN_DELETE_ADAPTER_FUNC WintunDeleteAdapter;
static WINTUN_DELETE_POOL_DRIVER_FUNC WintunDeletePoolDriver;
static WINTUN_ENUM_ADAPTERS_FUNC WintunEnumAdapters;
static WINTUN_FREE_ADAPTER_FUNC WintunFreeAdapter;
static WINTUN_GET_ADAPTER_FUNC WintunGetAdapter;
static WINTUN_OPEN_ADAPTER_FUNC WintunOpenAdapter;
static WINTUN_OPEN_ADAPTER_DEVICE_OBJECT_FUNC WintunOpenAdapterDeviceObject;
static WINTUN_GET_ADAPTER_LUID_FUNC WintunGetAdapterLUID;
static WINTUN_GET_ADAPTER_NAME_FUNC WintunGetAdapterName;
@ -42,7 +42,7 @@ InitializeWintun(void)
#define X(Name, Type) ((Name = (Type)GetProcAddress(Wintun, #Name)) == NULL)
if (X(WintunCreateAdapter, WINTUN_CREATE_ADAPTER_FUNC) || X(WintunDeleteAdapter, WINTUN_DELETE_ADAPTER_FUNC) ||
X(WintunDeletePoolDriver, WINTUN_DELETE_POOL_DRIVER_FUNC) || X(WintunEnumAdapters, WINTUN_ENUM_ADAPTERS_FUNC) ||
X(WintunFreeAdapter, WINTUN_FREE_ADAPTER_FUNC) || X(WintunGetAdapter, WINTUN_GET_ADAPTER_FUNC) ||
X(WintunFreeAdapter, WINTUN_FREE_ADAPTER_FUNC) || X(WintunOpenAdapter, WINTUN_OPEN_ADAPTER_FUNC) ||
X(WintunOpenAdapterDeviceObject, WINTUN_OPEN_ADAPTER_DEVICE_OBJECT_FUNC) ||
X(WintunGetAdapterLUID, WINTUN_GET_ADAPTER_LUID_FUNC) ||
X(WintunGetAdapterName, WINTUN_GET_ADAPTER_NAME_FUNC) ||
@ -320,7 +320,7 @@ main(void)
}
GUID ExampleGuid = { 0xdeadbabe, 0xcafe, 0xbeef, { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef } };
WINTUN_ADAPTER_HANDLE Adapter = WintunGetAdapter(L"Example", L"Demo");
WINTUN_ADAPTER_HANDLE Adapter = WintunOpenAdapter(L"Example", L"Demo");
if (!Adapter)
{
Adapter = WintunCreateAdapter(L"Example", L"Demo", &ExampleGuid, NULL);