diff options
author | Simon Rozman <simon@rozman.si> | 2019-06-21 10:58:37 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-07-03 08:50:30 +0000 |
commit | c394368e889329268c463219dd2cc7d793c7a272 (patch) | |
tree | 0ea8bca48cc517ce7afb4f3515c54d214de963ca | |
parent | Use ULONG instead of ptrdiff_t for length measurement (diff) | |
download | wintun-c394368e889329268c463219dd2cc7d793c7a272.tar.xz wintun-c394368e889329268c463219dd2cc7d793c7a272.zip |
Declare NDIS 6.70 compliant
After confirming with Microsoft Documentation that Wintun is already
NDIS 6.70 compliant, we declare it so.
Furthermore, determine NDIS version bounds from NDISxxx_MINIPORT
automatically.
https://docs.microsoft.com/en-us/windows-hardware/drivers/network/introduction-to-ndis-6-40
https://docs.microsoft.com/en-us/windows-hardware/drivers/network/introduction-to-ndis-6-50
https://docs.microsoft.com/en-us/windows-hardware/drivers/network/introduction-to-ndis-6-60
https://docs.microsoft.com/en-us/windows-hardware/drivers/network/introduction-to-ndis-6-70
Signed-off-by: Simon Rozman <simon@rozman.si>
-rw-r--r-- | wintun.c | 9 | ||||
-rw-r--r-- | wintun.vcxproj | 4 |
2 files changed, 8 insertions, 5 deletions
@@ -18,6 +18,9 @@ #pragma warning(disable : 4204) // nonstandard extension used: non-constant aggregate initializer #pragma warning(disable : 4221) // nonstandard extension used: <member>: cannot be initialized using address of automatic variable <variable> +#define NDIS_MINIPORT_VERSION_MIN ((NDIS_MINIPORT_MINIMUM_MAJOR_VERSION << 16) | NDIS_MINIPORT_MINIMUM_MINOR_VERSION) +#define NDIS_MINIPORT_VERSION_MAX ((NDIS_MINIPORT_MAJOR_VERSION << 16) | NDIS_MINIPORT_MINOR_VERSION ) + #define TUN_DEVICE_NAME L"WINTUN%u" #define TUN_VENDOR_NAME "Wintun Tunnel" @@ -1536,10 +1539,10 @@ NTSTATUS DriverEntry(DRIVER_OBJECT *DriverObject, UNICODE_STRING *RegistryPath) NTSTATUS status; NdisVersion = NdisGetVersion(); - if (NdisVersion < NDIS_RUNTIME_VERSION_620) + if (NdisVersion < NDIS_MINIPORT_VERSION_MIN) return NDIS_STATUS_UNSUPPORTED_REVISION; - if (NdisVersion > NDIS_RUNTIME_VERSION_630) - NdisVersion = NDIS_RUNTIME_VERSION_630; + if (NdisVersion > NDIS_MINIPORT_VERSION_MAX) + NdisVersion = NDIS_MINIPORT_VERSION_MAX; NDIS_MINIPORT_DRIVER_CHARACTERISTICS miniport = { .Header = { diff --git a/wintun.vcxproj b/wintun.vcxproj index ad386d5..be3d03f 100644 --- a/wintun.vcxproj +++ b/wintun.vcxproj @@ -124,12 +124,12 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" /> <ItemDefinitionGroup> <ClCompile> - <PreprocessorDefinitions>WINTUN_VERSION_MAJ=$(WintunVersionMaj);WINTUN_VERSION_MIN=$(WintunVersionMin);WINTUN_VERSION_STR="$(WintunVersionStr)";NDIS_MINIPORT_DRIVER=1;NDIS620_MINIPORT=1;NDIS630_MINIPORT=1;NDIS_WDM=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WINTUN_VERSION_MAJ=$(WintunVersionMaj);WINTUN_VERSION_MIN=$(WintunVersionMin);WINTUN_VERSION_STR="$(WintunVersionStr)";NDIS_MINIPORT_DRIVER=1;NDIS620_MINIPORT=1;NDIS670_MINIPORT=1;NDIS_WDM=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> <WarningLevel>Level4</WarningLevel> <EnablePREfast>true</EnablePREfast> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>WINTUN_VERSION_MAJ=$(WintunVersionMaj);WINTUN_VERSION_MIN=$(WintunVersionMin);WINTUN_VERSION_STR="$(WintunVersionStr)";NDIS_MINIPORT_DRIVER=1;NDIS620_MINIPORT=1;NDIS630_MINIPORT=1;NDIS_WDM=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WINTUN_VERSION_MAJ=$(WintunVersionMaj);WINTUN_VERSION_MIN=$(WintunVersionMin);WINTUN_VERSION_STR="$(WintunVersionStr)";NDIS_MINIPORT_DRIVER=1;NDIS620_MINIPORT=1;NDIS670_MINIPORT=1;NDIS_WDM=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> <Link> <AdditionalDependencies>ndis.lib;wdmsec.lib;%(AdditionalDependencies)</AdditionalDependencies> |