aboutsummaryrefslogtreecommitdiffstats
path: root/api/adapter.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-10-12 18:44:42 +0000
committerJason A. Donenfeld <Jason@zx2c4.com>2021-10-12 18:55:24 +0000
commitd8fe1419fb480ec5fc4dd0c4bc49f1d1a1a90663 (patch)
tree49461a6113fff49ecfb947a602d95ee91a373d2d /api/adapter.h
parentapi: rewrite based on SwDevice (diff)
downloadwintun-d8fe1419fb480ec5fc4dd0c4bc49f1d1a1a90663.tar.xz
wintun-d8fe1419fb480ec5fc4dd0c4bc49f1d1a1a90663.zip
driver: automatically close long-lived handle
There's only one handle that's likely to be open in a long lived way: the tun registration handle. So we can force that closed automatically when the device is about to close, if it's been improperly left open. Other handles will indeed hold up closing, but if those exist, they're a sign of a larger bug elsewhere that should be addressed. On the other hand, tun registration handles might legitimately be open during driver upgrades. This also saves us the trouble of dereferencing a freed FileObject as in the general case. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'api/adapter.h')
-rw-r--r--api/adapter.h15
1 files changed, 0 insertions, 15 deletions
diff --git a/api/adapter.h b/api/adapter.h
index ec84d70..567ee82 100644
--- a/api/adapter.h
+++ b/api/adapter.h
@@ -135,18 +135,3 @@ AdapterEnableInstance(_In_ HDEVINFO DevInfo, _In_ SP_DEVINFO_DATA *DevInfoData);
_Return_type_success_(return != FALSE)
BOOL
AdapterDisableInstance(_In_ HDEVINFO DevInfo, _In_ SP_DEVINFO_DATA *DevInfoData);
-
-/**
- * Force closes all device handles of the specified device instance.
- *
- * @param DevInfo Device info handle from SetupAPI.
- * @param DevInfoData Device info data specifying which device.
- *
- * @return If the function succeeds, the return value is TRUE. If the
- * function fails, the return value is FALSE. To get extended
- * error information, call GetLastError.
- */
-
-_Return_type_success_(return != FALSE)
-BOOL
-AdapterForceCloseHandles(_In_ HDEVINFO DevInfo, _In_ SP_DEVINFO_DATA *DevInfoData);