aboutsummaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-11-05 15:25:52 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2020-11-05 16:58:43 +0100
commit9f3d4667915357b8e7c2dbce87d94e389f8305de (patch)
treef06c600ccc9cff4ce449446f44867580e059c3c2 /api
parentexample: raise to 4MiB (diff)
downloadwintun-9f3d4667915357b8e7c2dbce87d94e389f8305de.tar.xz
wintun-9f3d4667915357b8e7c2dbce87d94e389f8305de.zip
api: remove WintunOpenAdapterDeviceObject
Discourage use of kernel interface, which gives us more flexibility if we ever want to change it. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'api')
-rw-r--r--api/adapter.c2
-rw-r--r--api/adapter.h18
-rw-r--r--api/exports.def1
-rw-r--r--api/session.c2
-rw-r--r--api/wintun.h12
5 files changed, 14 insertions, 21 deletions
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
@@ -35,12 +35,6 @@ 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
*/
_Return_type_success_(return != NULL) WINTUN_ADAPTER *WINAPI WintunCreateAdapter(
@@ -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
@@ -132,18 +132,6 @@ 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.
*
* @param Adapter Adapter handle obtained with WintunOpenAdapter or WintunCreateAdapter