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>
This commit is contained in:
parent
da3caadf48
commit
9514ef37b3
@ -29,5 +29,6 @@ typedef struct _SYSTEM_HANDLE_INFORMATION_EX
|
||||
} SYSTEM_HANDLE_INFORMATION_EX, *PSYSTEM_HANDLE_INFORMATION_EX;
|
||||
|
||||
extern NTSTATUS ZwQuerySystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass, PVOID SystemInformation, ULONG SystemInformationLength, ULONG *ReturnLength);
|
||||
extern NDIS_HANDLE NdisWdfGetAdapterContextFromAdapterHandle(PVOID DeviceExtension);
|
||||
|
||||
extern POBJECT_TYPE *IoDeviceObjectType;
|
||||
|
3
wintun.c
3
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user