aboutsummaryrefslogtreecommitdiffstats
path: root/wintun.c
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2019-06-20 11:24:03 +0200
committerSimon Rozman <simon@rozman.si>2019-06-20 11:54:58 +0200
commit9514ef37b398dd82006a7253ac2db3f2bfef1e68 (patch)
treef96cb9e9bb68bbb49809b4196b027c673904e34d /wintun.c
parentAccept IRP_MJ_WRITE when paused but silently drop the packets (diff)
downloadwintun-9514ef37b398dd82006a7253ac2db3f2bfef1e68.tar.xz
wintun-9514ef37b398dd82006a7253ac2db3f2bfef1e68.zip
Save some valuable lessons learned on Windows internals
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to '')
-rw-r--r--wintun.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/wintun.c b/wintun.c
index f4ba4b4..3a8657c 100644
--- a/wintun.c
+++ b/wintun.c
@@ -66,6 +66,7 @@ typedef struct _TUN_CTX {
* atomic and then releasing. It's similar to setting the atomic and then calling rcu_barrier(). */
EX_SPIN_LOCK TransitionLock;
+ /* This is actually a pointer to NDIS_MINIPORT_BLOCK struct. */
NDIS_HANDLE MiniportAdapterHandle;
NDIS_STATISTICS_INFO Statistics;
@@ -1023,6 +1024,8 @@ static NDIS_STATUS TunInitializeEx(NDIS_HANDLE MiniportAdapterHandle, NDIS_HANDL
goto cleanup_NdisDeregisterDeviceEx;
}
+ /* Jason reverse engineered and found NdisWdfGetAdapterContextFromAdapterHandle.
+ * Switch from device object's "Reserved" to this when we drop support for Windows 8.1. */
DEVICE_OBJECT *functional_device;
NdisMGetDeviceProperty(MiniportAdapterHandle, NULL, &functional_device, NULL, NULL, NULL);