api: use 'open' name since caller must close handle

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-11-03 12:31:49 +01:00
parent 7dede73406
commit 2af7fbd64a
7 changed files with 9 additions and 9 deletions

View File

@ -34,7 +34,7 @@ Manage the network adapters using following functions:
- `WintunEnumAdapters()` enumerates all existing adapters. - `WintunEnumAdapters()` enumerates all existing adapters.
- `WintunGetAdapter()` gets existing adapter handle. - `WintunGetAdapter()` gets existing adapter handle.
- `WintunFreeAdapter()` frees adapter handle. - `WintunFreeAdapter()` frees adapter handle.
- `WintunGetAdapterDeviceObject()` opens adapter device object. - `WintunOpenAdapterDeviceObject()` opens adapter device object.
- `WintunGetAdapterGUID()` gets adapter GUID. - `WintunGetAdapterGUID()` gets adapter GUID.
- `WintunGetAdapterLUID()` gets adapter LUID. - `WintunGetAdapterLUID()` gets adapter LUID.
- `WintunGetAdapterName()` gets adapter name. - `WintunGetAdapterName()` gets adapter name.

View File

@ -781,7 +781,7 @@ WintunGetAdapterLUID(_In_ const WINTUN_ADAPTER *Adapter, _Out_ NET_LUID *Luid)
} }
WINTUN_STATUS WINAPI WINTUN_STATUS WINAPI
WintunGetAdapterDeviceObject(_In_ const WINTUN_ADAPTER *Adapter, _Out_ HANDLE *Handle) WintunOpenAdapterDeviceObject(_In_ const WINTUN_ADAPTER *Adapter, _Out_ HANDLE *Handle)
{ {
return GetDeviceObject(Adapter->DevInstanceID, Handle); return GetDeviceObject(Adapter->DevInstanceID, Handle);
} }

View File

@ -35,10 +35,10 @@ void WINAPI
WintunFreeAdapter(_In_ WINTUN_ADAPTER *Adapter); WintunFreeAdapter(_In_ WINTUN_ADAPTER *Adapter);
/** /**
* @copydoc WINTUN_GET_ADAPTER_DEVICE_OBJECT_FUNC * @copydoc WINTUN_OPEN_ADAPTER_DEVICE_OBJECT_FUNC
*/ */
WINTUN_STATUS WINAPI WINTUN_STATUS WINAPI
WintunGetAdapterDeviceObject(_In_ const WINTUN_ADAPTER *Adapter, _Out_ HANDLE *Handle); WintunOpenAdapterDeviceObject(_In_ const WINTUN_ADAPTER *Adapter, _Out_ HANDLE *Handle);
/** /**
* @copydoc WINTUN_CREATE_ADAPTER_FUNC * @copydoc WINTUN_CREATE_ADAPTER_FUNC

View File

@ -8,7 +8,7 @@ EXPORTS
WintunEnumAdapters WintunEnumAdapters
WintunFreeAdapter WintunFreeAdapter
WintunGetAdapter WintunGetAdapter
WintunGetAdapterDeviceObject WintunOpenAdapterDeviceObject
WintunGetAdapterGUID WintunGetAdapterGUID
WintunGetAdapterLUID WintunGetAdapterLUID
WintunGetAdapterName WintunGetAdapterName

View File

@ -110,7 +110,7 @@ WintunStartSession(
goto cleanupSendTailMoved; goto cleanupSendTailMoved;
} }
Result = WintunGetAdapterDeviceObject(Adapter, &s->Handle); Result = WintunOpenAdapterDeviceObject(Adapter, &s->Handle);
if (Result != ERROR_SUCCESS) if (Result != ERROR_SUCCESS)
{ {
LOG(WINTUN_LOG_ERR, L"Failed to open adapter device object"); LOG(WINTUN_LOG_ERR, L"Failed to open adapter device object");

View File

@ -147,7 +147,7 @@ typedef WINTUN_STATUS(WINAPI *WINTUN_GET_ADAPTER_FUNC)(
* @return ERROR_SUCCESS on success; Win32 error code otherwise. * @return ERROR_SUCCESS on success; Win32 error code otherwise.
*/ */
typedef WINTUN_STATUS( typedef WINTUN_STATUS(
WINAPI *WINTUN_GET_ADAPTER_DEVICE_OBJECT_FUNC)(_In_ WINTUN_ADAPTER_HANDLE Adapter, _Out_ HANDLE *Handle); WINAPI *WINTUN_OPEN_ADAPTER_DEVICE_OBJECT_FUNC)(_In_ WINTUN_ADAPTER_HANDLE Adapter, _Out_ HANDLE *Handle);
/** /**
* Returns the GUID of the adapter. * Returns the GUID of the adapter.

View File

@ -18,7 +18,7 @@ static WINTUN_DELETE_POOL_DRIVER_FUNC WintunDeletePoolDriver;
static WINTUN_ENUM_ADAPTERS_FUNC WintunEnumAdapters; static WINTUN_ENUM_ADAPTERS_FUNC WintunEnumAdapters;
static WINTUN_FREE_ADAPTER_FUNC WintunFreeAdapter; static WINTUN_FREE_ADAPTER_FUNC WintunFreeAdapter;
static WINTUN_GET_ADAPTER_FUNC WintunGetAdapter; static WINTUN_GET_ADAPTER_FUNC WintunGetAdapter;
static WINTUN_GET_ADAPTER_DEVICE_OBJECT_FUNC WintunGetAdapterDeviceObject; static WINTUN_OPEN_ADAPTER_DEVICE_OBJECT_FUNC WintunOpenAdapterDeviceObject;
static WINTUN_GET_ADAPTER_GUID_FUNC WintunGetAdapterGUID; static WINTUN_GET_ADAPTER_GUID_FUNC WintunGetAdapterGUID;
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;
@ -261,7 +261,7 @@ InitializeWintun(void)
X(WintunDeletePoolDriver, WINTUN_DELETE_POOL_DRIVER_FUNC) || X(WintunDeletePoolDriver, WINTUN_DELETE_POOL_DRIVER_FUNC) ||
X(WintunEnumAdapters, WINTUN_ENUM_ADAPTERS_FUNC) || X(WintunFreeAdapter, WINTUN_FREE_ADAPTER_FUNC) || X(WintunEnumAdapters, WINTUN_ENUM_ADAPTERS_FUNC) || X(WintunFreeAdapter, WINTUN_FREE_ADAPTER_FUNC) ||
X(WintunGetAdapter, WINTUN_GET_ADAPTER_FUNC) || X(WintunGetAdapter, WINTUN_GET_ADAPTER_FUNC) ||
X(WintunGetAdapterDeviceObject, WINTUN_GET_ADAPTER_DEVICE_OBJECT_FUNC) || X(WintunOpenAdapterDeviceObject, WINTUN_OPEN_ADAPTER_DEVICE_OBJECT_FUNC) ||
X(WintunGetAdapterGUID, WINTUN_GET_ADAPTER_GUID_FUNC) || X(WintunGetAdapterGUID, WINTUN_GET_ADAPTER_GUID_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) ||