diff --git a/README.md b/README.md index 1a4276e..06f4847 100644 --- a/README.md +++ b/README.md @@ -243,20 +243,6 @@ Deletes all Wintun adapters in a pool and if there are no more adapters in any o If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError. -#### WintunOpenAdapterDeviceObject() - -`HANDLE WintunOpenAdapterDeviceObject (WINTUN_ADAPTER_HANDLE Adapter)` - -Returns a handle to the adapter device object. - -**Parameters** - -- *Adapter*: Adapter handle obtained with WintunOpenAdapter or WintunCreateAdapter. - -**Returns** - -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 information, call GetLastError. - #### WintunGetAdapterLuid() `void WintunGetAdapterLuid (WINTUN_ADAPTER_HANDLE Adapter, NET_LUID * Luid)` diff --git a/api/adapter.c b/api/adapter.c index 58ab18d..8a0c772 100644 --- a/api/adapter.c +++ b/api/adapter.c @@ -824,7 +824,7 @@ WintunGetAdapterLUID(_In_ const WINTUN_ADAPTER *Adapter, _Out_ NET_LUID *Luid) } _Return_type_success_(return != INVALID_HANDLE_VALUE) HANDLE WINAPI - WintunOpenAdapterDeviceObject(_In_ const WINTUN_ADAPTER *Adapter) + AdapterOpenDeviceObject(_In_ const WINTUN_ADAPTER *Adapter) { return OpenDeviceObject(Adapter->DevInstanceID); } diff --git a/api/adapter.h b/api/adapter.h index 3f4532a..f98415a 100644 --- a/api/adapter.h +++ b/api/adapter.h @@ -34,12 +34,6 @@ typedef struct _WINTUN_ADAPTER void WINAPI WintunFreeAdapter(_In_ WINTUN_ADAPTER *Adapter); -/** - * @copydoc WINTUN_OPEN_ADAPTER_DEVICE_OBJECT_FUNC - */ -_Return_type_success_(return != INVALID_HANDLE_VALUE) HANDLE WINAPI - WintunOpenAdapterDeviceObject(_In_ const WINTUN_ADAPTER *Adapter); - /** * @copydoc WINTUN_CREATE_ADAPTER_FUNC */ @@ -62,3 +56,15 @@ _Return_type_success_(return != FALSE) BOOL WINAPI WintunDeleteAdapter( */ _Return_type_success_(return != FALSE) BOOL WINAPI WintunDeletePoolDriver(_In_z_ const WCHAR *Pool, _Out_opt_ BOOL *RebootRequired); + +/** + * Returns a handle to the adapter device object. + * + * @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 + * information, call GetLastError. + */ +_Return_type_success_(return != INVALID_HANDLE_VALUE) HANDLE WINAPI + AdapterOpenDeviceObject(_In_ const WINTUN_ADAPTER *Adapter); \ No newline at end of file diff --git a/api/exports.def b/api/exports.def index 8773431..3539ad8 100644 --- a/api/exports.def +++ b/api/exports.def @@ -8,7 +8,6 @@ EXPORTS WintunEnumAdapters WintunFreeAdapter WintunOpenAdapter - WintunOpenAdapterDeviceObject WintunGetAdapterLUID WintunGetAdapterName WintunGetReadWaitEvent diff --git a/api/session.c b/api/session.c index e854bde..c48d5cb 100644 --- a/api/session.c +++ b/api/session.c @@ -109,7 +109,7 @@ _Return_type_success_(return != NULL) TUN_SESSION *WINAPI goto cleanupSendTailMoved; } - Session->Handle = WintunOpenAdapterDeviceObject(Adapter); + Session->Handle = AdapterOpenDeviceObject(Adapter); if (Session->Handle == INVALID_HANDLE_VALUE) { LastError = LOG(WINTUN_LOG_ERR, L"Failed to open adapter device object"); diff --git a/api/wintun.h b/api/wintun.h index 79742d8..b5d4d02 100644 --- a/api/wintun.h +++ b/api/wintun.h @@ -131,18 +131,6 @@ typedef void(WINAPI *WINTUN_FREE_ADAPTER_FUNC)(_In_ WINTUN_ADAPTER_HANDLE Adapte typedef _Return_type_success_(return != FALSE) BOOL(WINAPI *WINTUN_DELETE_POOL_DRIVER_FUNC)(_In_z_ const WCHAR *Pool, _Out_opt_ BOOL *RebootRequired); -/** - * Returns a handle to the adapter device object. - * - * @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 - * information, call GetLastError. - */ -typedef _Return_type_success_(return != INVALID_HANDLE_VALUE) - HANDLE(WINAPI *WINTUN_OPEN_ADAPTER_DEVICE_OBJECT_FUNC)(_In_ WINTUN_ADAPTER_HANDLE Adapter); - /** * Returns the LUID of the adapter. * diff --git a/example/example.c b/example/example.c index 1b77cb0..b429e7b 100644 --- a/example/example.c +++ b/example/example.c @@ -18,7 +18,6 @@ static WINTUN_DELETE_POOL_DRIVER_FUNC WintunDeletePoolDriver; static WINTUN_ENUM_ADAPTERS_FUNC WintunEnumAdapters; static WINTUN_FREE_ADAPTER_FUNC WintunFreeAdapter; 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; static WINTUN_SET_ADAPTER_NAME_FUNC WintunSetAdapterName; @@ -43,7 +42,6 @@ InitializeWintun(void) 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(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) || X(WintunSetAdapterName, WINTUN_SET_ADAPTER_NAME_FUNC) ||