20 changed files with 4 additions and 4526 deletions
@ -1,385 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ItemGroup Label="ProjectConfigurations"> |
||||
<ProjectConfiguration Include="Win8 Debug|Win32"> |
||||
<Configuration>Win8 Debug</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Win8 Release|Win32"> |
||||
<Configuration>Win8 Release</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Win7 Debug|Win32"> |
||||
<Configuration>Win7 Debug</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Win7 Release|Win32"> |
||||
<Configuration>Win7 Release</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Vista Debug|Win32"> |
||||
<Configuration>Vista Debug</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Vista Release|Win32"> |
||||
<Configuration>Vista Release</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Win8 Debug|x64"> |
||||
<Configuration>Win8 Debug</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Win8 Release|x64"> |
||||
<Configuration>Win8 Release</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Win7 Debug|x64"> |
||||
<Configuration>Win7 Debug</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Win7 Release|x64"> |
||||
<Configuration>Win7 Release</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Vista Debug|x64"> |
||||
<Configuration>Vista Debug</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Vista Release|x64"> |
||||
<Configuration>Vista Release</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
</ItemGroup> |
||||
<PropertyGroup Label="Globals"> |
||||
<ProjectGuid>{689210B1-467C-4850-BB7D-2E10D5B4A3DA}</ProjectGuid> |
||||
<TemplateGuid>{1bc93793-694f-48fe-9372-81e2b05556fd}</TemplateGuid> |
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> |
||||
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion> |
||||
<Configuration>Win8 Debug</Configuration> |
||||
<Platform Condition="'$(Platform)' == ''">Win32</Platform> |
||||
</PropertyGroup> |
||||
<PropertyGroup Label="Globals"> |
||||
<RootNamespace>TapDriver</RootNamespace> |
||||
<VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VisualStudioVersion)' == '11.0'">$(VCTargetsPath11)</VCTargetsPath> |
||||
</PropertyGroup> |
||||
<PropertyGroup Label="PropertySheets"> |
||||
<PlatformToolset>WindowsKernelModeDriver8.0</PlatformToolset> |
||||
<ConfigurationType>Driver</ConfigurationType> |
||||
<DriverType>KMDF</DriverType> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'" Label="Configuration"> |
||||
<TargetVersion>Windows8</TargetVersion> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'" Label="Configuration"> |
||||
<TargetVersion>Windows8</TargetVersion> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'" Label="Configuration"> |
||||
<TargetVersion>Windows7</TargetVersion> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Release|Win32'" Label="Configuration"> |
||||
<TargetVersion>Windows7</TargetVersion> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Vista Debug|Win32'" Label="Configuration"> |
||||
<TargetVersion>Vista</TargetVersion> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Vista Release|Win32'" Label="Configuration"> |
||||
<TargetVersion>Vista</TargetVersion> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'" Label="Configuration"> |
||||
<TargetVersion>Windows8</TargetVersion> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'" Label="Configuration"> |
||||
<TargetVersion>Windows8</TargetVersion> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'" Label="Configuration"> |
||||
<TargetVersion>Windows7</TargetVersion> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Release|x64'" Label="Configuration"> |
||||
<TargetVersion>Windows7</TargetVersion> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Vista Debug|x64'" Label="Configuration"> |
||||
<TargetVersion>Vista</TargetVersion> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Vista Release|x64'" Label="Configuration"> |
||||
<TargetVersion>Vista</TargetVersion> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||
<ImportGroup Label="ExtensionSettings"> |
||||
</ImportGroup> |
||||
<ImportGroup Label="PropertySheets"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
</ImportGroup> |
||||
<PropertyGroup Label="UserMacros" /> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Vista Debug|Win32'"> |
||||
<TargetName>zttap200</TargetName> |
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir> |
||||
<IntDir>$(Platform)\$(ConfigurationName)\</IntDir> |
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer> |
||||
</PropertyGroup> |
||||
<PropertyGroup> |
||||
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'"> |
||||
<TargetName>zttap200</TargetName> |
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir> |
||||
<IntDir>$(Platform)\$(ConfigurationName)\</IntDir> |
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Vista Release|Win32'"> |
||||
<TargetName>zttap200</TargetName> |
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir> |
||||
<IntDir>$(Platform)\$(ConfigurationName)\</IntDir> |
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'"> |
||||
<TargetName>zttap200</TargetName> |
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir> |
||||
<IntDir>$(Platform)\$(ConfigurationName)\</IntDir> |
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Release|Win32'"> |
||||
<TargetName>zttap200</TargetName> |
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir> |
||||
<IntDir>$(Platform)\$(ConfigurationName)\</IntDir> |
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'"> |
||||
<TargetName>zttap200</TargetName> |
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir> |
||||
<IntDir>$(Platform)\$(ConfigurationName)\</IntDir> |
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Vista Debug|x64'"> |
||||
<TargetName>zttap200</TargetName> |
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir> |
||||
<TimeStampServer> |
||||
</TimeStampServer> |
||||
<DiagnosticMode>true</DiagnosticMode> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'"> |
||||
<TargetName>zttap200</TargetName> |
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir> |
||||
<TimeStampServer> |
||||
</TimeStampServer> |
||||
<DiagnosticMode>true</DiagnosticMode> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Vista Release|x64'"> |
||||
<TargetName>zttap200</TargetName> |
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir> |
||||
<TimeStampServer> |
||||
</TimeStampServer> |
||||
<DiagnosticMode>true</DiagnosticMode> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'"> |
||||
<TargetName>zttap200</TargetName> |
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir> |
||||
<TimeStampServer> |
||||
</TimeStampServer> |
||||
<DiagnosticMode>true</DiagnosticMode> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Release|x64'"> |
||||
<TargetName>zttap200</TargetName> |
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir> |
||||
<TimeStampServer> |
||||
</TimeStampServer> |
||||
<DiagnosticMode>true</DiagnosticMode> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'"> |
||||
<TargetName>zttap200</TargetName> |
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir> |
||||
<TimeStampServer> |
||||
</TimeStampServer> |
||||
<DiagnosticMode>true</DiagnosticMode> |
||||
</PropertyGroup> |
||||
<ItemDefinitionGroup> |
||||
<ClCompile> |
||||
<WppEnabled>false</WppEnabled> |
||||
<WppScanConfigurationData Condition="'%(ClCompile. ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData> |
||||
<WppKernelMode>true</WppKernelMode> |
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'">Level2</WarningLevel> |
||||
<TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'">false</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'">None</DebugInformationFormat> |
||||
<DebugInformationFormat Condition="'$(Configuration)|$(Platform)'=='Win7 Release|Win32'">None</DebugInformationFormat> |
||||
<DebugInformationFormat Condition="'$(Configuration)|$(Platform)'=='Vista Release|Win32'">None</DebugInformationFormat> |
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Vista Debug|Win32'">Level2</WarningLevel> |
||||
<TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Vista Debug|Win32'">false</TreatWarningAsError> |
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'">Level2</WarningLevel> |
||||
<TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'">false</TreatWarningAsError> |
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Vista Release|Win32'">Level2</WarningLevel> |
||||
<TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Vista Release|Win32'">false</TreatWarningAsError> |
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'">Level2</WarningLevel> |
||||
<TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'">false</TreatWarningAsError> |
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Win7 Release|Win32'">Level2</WarningLevel> |
||||
<TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Win7 Release|Win32'">false</TreatWarningAsError> |
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Vista Debug|x64'">Level2</WarningLevel> |
||||
<TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Vista Debug|x64'">false</TreatWarningAsError> |
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'">Level2</WarningLevel> |
||||
<TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'">false</TreatWarningAsError> |
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Vista Release|x64'">Level2</WarningLevel> |
||||
<TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Vista Release|x64'">false</TreatWarningAsError> |
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'">Level2</WarningLevel> |
||||
<TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'">false</TreatWarningAsError> |
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Win7 Release|x64'">Level2</WarningLevel> |
||||
<TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Win7 Release|x64'">false</TreatWarningAsError> |
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'">Level2</WarningLevel> |
||||
<TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'">false</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'">None</DebugInformationFormat> |
||||
<DebugInformationFormat Condition="'$(Configuration)|$(Platform)'=='Win7 Release|x64'">None</DebugInformationFormat> |
||||
<DebugInformationFormat Condition="'$(Configuration)|$(Platform)'=='Vista Release|x64'">None</DebugInformationFormat> |
||||
</ClCompile> |
||||
<Link> |
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'">C:\WinDDK\7600.16385.1\lib\wnet\i386\ndis.lib;C:\WinDDK\7600.16385.1\lib\wnet\i386\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies> |
||||
</Link> |
||||
<Link> |
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Vista Debug|Win32'">C:\WinDDK\7600.16385.1\lib\wnet\i386\ndis.lib;C:\WinDDK\7600.16385.1\lib\wnet\i386\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies> |
||||
</Link> |
||||
<Link> |
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'">C:\WinDDK\7600.16385.1\lib\wnet\i386\ndis.lib;C:\WinDDK\7600.16385.1\lib\wnet\i386\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies> |
||||
</Link> |
||||
<Link> |
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Vista Release|Win32'">C:\WinDDK\7600.16385.1\lib\wnet\i386\ndis.lib;C:\WinDDK\7600.16385.1\lib\wnet\i386\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies> |
||||
</Link> |
||||
<Link> |
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'">C:\WinDDK\7600.16385.1\lib\wnet\i386\ndis.lib;C:\WinDDK\7600.16385.1\lib\wnet\i386\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies> |
||||
</Link> |
||||
<Link> |
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Win7 Release|Win32'">C:\WinDDK\7600.16385.1\lib\wnet\i386\ndis.lib;C:\WinDDK\7600.16385.1\lib\wnet\i386\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies> |
||||
</Link> |
||||
<Link> |
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Vista Debug|x64'">C:\WinDDK\7600.16385.1\lib\wnet\amd64\ndis.lib;C:\WinDDK\7600.16385.1\lib\wnet\amd64\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies> |
||||
</Link> |
||||
<Link> |
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'">C:\WinDDK\7600.16385.1\lib\wnet\amd64\ndis.lib;C:\WinDDK\7600.16385.1\lib\wnet\amd64\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies> |
||||
</Link> |
||||
<Link> |
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Vista Release|x64'">C:\WinDDK\7600.16385.1\lib\wnet\amd64\ndis.lib;C:\WinDDK\7600.16385.1\lib\wnet\amd64\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies> |
||||
</Link> |
||||
<Link> |
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'">C:\WinDDK\7600.16385.1\lib\wnet\amd64\ndis.lib;C:\WinDDK\7600.16385.1\lib\wnet\amd64\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies> |
||||
</Link> |
||||
<Link> |
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Win7 Release|x64'">C:\WinDDK\7600.16385.1\lib\wnet\amd64\ndis.lib;C:\WinDDK\7600.16385.1\lib\wnet\amd64\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies> |
||||
</Link> |
||||
<Link> |
||||
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'">C:\WinDDK\7600.16385.1\lib\wnet\amd64\ndis.lib;C:\WinDDK\7600.16385.1\lib\wnet\amd64\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies> |
||||
</Link> |
||||
<DriverSign> |
||||
<FileDigestAlgorithm Condition="'$(Configuration)|$(Platform)'=='Vista Debug|x64'">SHA1</FileDigestAlgorithm> |
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Vista Debug|x64'">/t "http://timestamp.digicert.com/" /d "ZeroTier One Virtual Network Port" /sha1 5809bb3255b4f32dd93619c1cf26a7df6c282a89</AdditionalOptions> |
||||
</DriverSign> |
||||
<DriverSign> |
||||
<FileDigestAlgorithm Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'">SHA1</FileDigestAlgorithm> |
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'">/t "http://timestamp.digicert.com/" /d "ZeroTier One Virtual Network Port" /sha1 5809bb3255b4f32dd93619c1cf26a7df6c282a89</AdditionalOptions> |
||||
</DriverSign> |
||||
<DriverSign> |
||||
<FileDigestAlgorithm Condition="'$(Configuration)|$(Platform)'=='Vista Release|x64'">SHA1</FileDigestAlgorithm> |
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Vista Release|x64'">/t "http://timestamp.digicert.com/" /d "ZeroTier One Virtual Network Port" /sha1 5809bb3255b4f32dd93619c1cf26a7df6c282a89</AdditionalOptions> |
||||
</DriverSign> |
||||
<DriverSign> |
||||
<FileDigestAlgorithm Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'">SHA1</FileDigestAlgorithm> |
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'">/t "http://timestamp.digicert.com/" /d "ZeroTier One Virtual Network Port" /sha1 5809bb3255b4f32dd93619c1cf26a7df6c282a89</AdditionalOptions> |
||||
</DriverSign> |
||||
<DriverSign> |
||||
<FileDigestAlgorithm Condition="'$(Configuration)|$(Platform)'=='Win7 Release|x64'">SHA1</FileDigestAlgorithm> |
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Win7 Release|x64'">/t "http://timestamp.digicert.com/" /d "ZeroTier One Virtual Network Port" /sha1 5809bb3255b4f32dd93619c1cf26a7df6c282a89</AdditionalOptions> |
||||
</DriverSign> |
||||
<DriverSign> |
||||
<FileDigestAlgorithm Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'">SHA1</FileDigestAlgorithm> |
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'">/t "http://timestamp.digicert.com/" /d "ZeroTier One Virtual Network Port" /sha1 5809bb3255b4f32dd93619c1cf26a7df6c282a89</AdditionalOptions> |
||||
</DriverSign> |
||||
</ItemDefinitionGroup> |
||||
<ItemGroup> |
||||
<Inf Include="zttap200.inf" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<FilesToPackage Include="$(TargetPath)" /> |
||||
<FilesToPackage Include="@(Inf->'%(CopyOutput)')" Condition="'@(Inf)'!=''" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ClCompile Include="error.c"> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Debug|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Release|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Release|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Debug|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Release|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Release|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'">true</ExcludedFromBuild> |
||||
</ClCompile> |
||||
<ClCompile Include="instance.c"> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Debug|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Release|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Release|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Debug|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Release|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Release|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'">true</ExcludedFromBuild> |
||||
</ClCompile> |
||||
<ClCompile Include="macinfo.c"> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Debug|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Release|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Release|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Debug|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Release|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Release|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'">true</ExcludedFromBuild> |
||||
</ClCompile> |
||||
<ClCompile Include="mem.c"> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Debug|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Release|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Release|Win32'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Debug|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Release|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Release|x64'">true</ExcludedFromBuild> |
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'">true</ExcludedFromBuild> |
||||
</ClCompile> |
||||
<ClCompile Include="tapdrvr.c" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ClInclude Include="config.h" /> |
||||
<ClInclude Include="constants.h" /> |
||||
<ClInclude Include="endian.h" /> |
||||
<ClInclude Include="error.h" /> |
||||
<ClInclude Include="lock.h" /> |
||||
<ClInclude Include="macinfo.h" /> |
||||
<ClInclude Include="proto.h" /> |
||||
<ClInclude Include="prototypes.h" /> |
||||
<ClInclude Include="tap-windows.h" /> |
||||
<ClInclude Include="types.h" /> |
||||
</ItemGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||
<ImportGroup Label="ExtensionTargets"> |
||||
</ImportGroup> |
||||
</Project> |
||||
@ -1,75 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ItemGroup> |
||||
<Filter Include="Source Files"> |
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> |
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> |
||||
</Filter> |
||||
<Filter Include="Header Files"> |
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> |
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> |
||||
</Filter> |
||||
<Filter Include="Resource Files"> |
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> |
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> |
||||
</Filter> |
||||
<Filter Include="Driver Files"> |
||||
<UniqueIdentifier>{8E41214B-6785-4CFE-B992-037D68949A14}</UniqueIdentifier> |
||||
<Extensions>inf;inv;inx;mof;mc;</Extensions> |
||||
</Filter> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ClCompile Include="error.c"> |
||||
<Filter>Source Files</Filter> |
||||
</ClCompile> |
||||
<ClCompile Include="instance.c"> |
||||
<Filter>Source Files</Filter> |
||||
</ClCompile> |
||||
<ClCompile Include="macinfo.c"> |
||||
<Filter>Source Files</Filter> |
||||
</ClCompile> |
||||
<ClCompile Include="mem.c"> |
||||
<Filter>Source Files</Filter> |
||||
</ClCompile> |
||||
<ClCompile Include="tapdrvr.c"> |
||||
<Filter>Source Files</Filter> |
||||
</ClCompile> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ClInclude Include="constants.h"> |
||||
<Filter>Header Files</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="endian.h"> |
||||
<Filter>Header Files</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="error.h"> |
||||
<Filter>Header Files</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="lock.h"> |
||||
<Filter>Header Files</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="macinfo.h"> |
||||
<Filter>Header Files</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="proto.h"> |
||||
<Filter>Header Files</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="prototypes.h"> |
||||
<Filter>Header Files</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="tap-windows.h"> |
||||
<Filter>Header Files</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="types.h"> |
||||
<Filter>Header Files</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="config.h"> |
||||
<Filter>Header Files</Filter> |
||||
</ClInclude> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Inf Include="zttap200.inf"> |
||||
<Filter>Driver Files</Filter> |
||||
</Inf> |
||||
</ItemGroup> |
||||
</Project> |
||||
@ -1,12 +0,0 @@
|
||||
#define PRODUCT_NAME "ZeroTier One Virtual Network Port" |
||||
#define PRODUCT_VERSION "2.0.0" |
||||
#define PRODUCT_VERSION_RESOURCE 2,0,0,1 |
||||
#define PRODUCT_TAP_WIN_COMPONENT_ID "zttap200" |
||||
#define PRODUCT_TAP_WIN_MAJOR 2 |
||||
#define PRODUCT_TAP_WIN_MINOR 0 |
||||
#define PRODUCT_TAP_WIN_PROVIDER "ZeroTier Networks" |
||||
#define PRODUCT_TAP_WIN_DEVICE_DESCRIPTION PRODUCT_NAME |
||||
#define PRODUCT_TAP_WIN_RELDATE "01/22/2014" |
||||
|
||||
#define TAP_DRIVER_MAJOR_VERSION PRODUCT_TAP_WIN_MAJOR |
||||
#define TAP_DRIVER_MINOR_VERSION PRODUCT_TAP_WIN_MINOR |
||||
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* TAP-Windows -- A kernel driver to provide virtual tap |
||||
* device functionality on Windows. |
||||
* |
||||
* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. |
||||
* |
||||
* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., |
||||
* and is released under the GPL version 2 (see below). |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License version 2 |
||||
* as published by the Free Software Foundation. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program (see the file COPYING included with this |
||||
* distribution); if not, write to the Free Software Foundation, Inc., |
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||
*/ |
||||
|
||||
//====================================================================
|
||||
// Product and Version public settings
|
||||
//====================================================================
|
||||
|
||||
#define PRODUCT_STRING PRODUCT_TAP_DEVICE_DESCRIPTION |
||||
|
||||
#define TAP_NDIS_MAJOR_VERSION 5 |
||||
#define TAP_NDIS_MINOR_VERSION 0 |
||||
|
||||
//===========================================================
|
||||
// Driver constants
|
||||
//===========================================================
|
||||
|
||||
#define ETHERNET_HEADER_SIZE (sizeof (ETH_HEADER)) |
||||
#define ETHERNET_MTU 2800 // ZeroTier One MTU
|
||||
#define ETHERNET_PACKET_SIZE (ETHERNET_MTU + ETHERNET_HEADER_SIZE) |
||||
#define DEFAULT_PACKET_LOOKAHEAD (ETHERNET_PACKET_SIZE) |
||||
|
||||
#define NIC_MAX_MCAST_LIST 128 // Max length of multicast address list
|
||||
|
||||
#define MINIMUM_MTU 576 // USE TCP Minimum MTU
|
||||
#define MAXIMUM_MTU 65536 // IP maximum MTU
|
||||
|
||||
#define PACKET_QUEUE_SIZE 64 // tap -> userspace queue size
|
||||
#define IRP_QUEUE_SIZE 16 // max number of simultaneous i/o operations from userspace
|
||||
|
||||
#define TAP_LITTLE_ENDIAN // affects ntohs, htonl, etc. functions
|
||||
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* TAP-Windows -- A kernel driver to provide virtual tap |
||||
* device functionality on Windows. |
||||
* |
||||
* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. |
||||
* |
||||
* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., |
||||
* and is released under the GPL version 2 (see below). |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License version 2 |
||||
* as published by the Free Software Foundation. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program (see the file COPYING included with this |
||||
* distribution); if not, write to the Free Software Foundation, Inc., |
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||
*/ |
||||
|
||||
#ifdef TAP_LITTLE_ENDIAN |
||||
#define ntohs(x) RtlUshortByteSwap(x) |
||||
#define htons(x) RtlUshortByteSwap(x) |
||||
#define ntohl(x) RtlUlongByteSwap(x) |
||||
#define htonl(x) RtlUlongByteSwap(x) |
||||
#else |
||||
#define ntohs(x) ((USHORT)(x)) |
||||
#define htons(x) ((USHORT)(x)) |
||||
#define ntohl(x) ((ULONG)(x)) |
||||
#define htonl(x) ((ULONG)(x)) |
||||
#endif |
||||
@ -1,387 +0,0 @@
|
||||
/*
|
||||
* TAP-Windows -- A kernel driver to provide virtual tap |
||||
* device functionality on Windows. |
||||
* |
||||
* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. |
||||
* |
||||
* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., |
||||
* and is released under the GPL version 2 (see below). |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License version 2 |
||||
* as published by the Free Software Foundation. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program (see the file COPYING included with this |
||||
* distribution); if not, write to the Free Software Foundation, Inc., |
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||
*/ |
||||
|
||||
//-----------------
|
||||
// DEBUGGING OUTPUT
|
||||
//-----------------
|
||||
|
||||
const char *g_LastErrorFilename; |
||||
int g_LastErrorLineNumber; |
||||
|
||||
#if DBG |
||||
|
||||
DebugOutput g_Debug; |
||||
|
||||
BOOLEAN |
||||
NewlineExists (const char *str, int len) |
||||
{ |
||||
while (len-- > 0) |
||||
{ |
||||
const char c = *str++; |
||||
if (c == '\n') |
||||
return TRUE; |
||||
else if (c == '\0') |
||||
break; |
||||
} |
||||
return FALSE; |
||||
} |
||||
|
||||
VOID |
||||
MyDebugInit (unsigned int bufsiz) |
||||
{ |
||||
NdisZeroMemory (&g_Debug, sizeof (g_Debug)); |
||||
g_Debug.text = (char *) MemAlloc (bufsiz, FALSE); |
||||
if (g_Debug.text) |
||||
g_Debug.capacity = bufsiz; |
||||
} |
||||
|
||||
VOID |
||||
MyDebugFree () |
||||
{ |
||||
if (g_Debug.text) |
||||
MemFree (g_Debug.text, g_Debug.capacity); |
||||
NdisZeroMemory (&g_Debug, sizeof (g_Debug)); |
||||
} |
||||
|
||||
VOID |
||||
MyDebugPrint (const unsigned char* format, ...) |
||||
{ |
||||
if (g_Debug.text && g_Debug.capacity > 0 && CAN_WE_PRINT) |
||||
{ |
||||
BOOLEAN owned; |
||||
ACQUIRE_MUTEX_ADAPTIVE (&g_Debug.lock, owned); |
||||
if (owned) |
||||
{ |
||||
const int remaining = (int)g_Debug.capacity - (int)g_Debug.out; |
||||
|
||||
if (remaining > 0) |
||||
{ |
||||
va_list args; |
||||
NTSTATUS status; |
||||
char *end; |
||||
|
||||
#ifdef DBG_PRINT |
||||
va_start (args, format); |
||||
vDbgPrintEx (DPFLTR_IHVNETWORK_ID, DPFLTR_INFO_LEVEL, format, args); |
||||
va_end (args); |
||||
#endif |
||||
va_start (args, format); |
||||
status = RtlStringCchVPrintfExA (g_Debug.text + g_Debug.out, |
||||
remaining, |
||||
&end, |
||||
NULL, |
||||
STRSAFE_NO_TRUNCATION | STRSAFE_IGNORE_NULLS, |
||||
format, |
||||
args); |
||||
va_end (args); |
||||
va_start (args, format); |
||||
vDbgPrintEx(DPFLTR_IHVDRIVER_ID , 1, format, args); |
||||
va_end (args); |
||||
if (status == STATUS_SUCCESS) |
||||
g_Debug.out = (unsigned int) (end - g_Debug.text); |
||||
else |
||||
g_Debug.error = TRUE; |
||||
} |
||||
else |
||||
g_Debug.error = TRUE; |
||||
|
||||
RELEASE_MUTEX (&g_Debug.lock); |
||||
} |
||||
else |
||||
g_Debug.error = TRUE; |
||||
} |
||||
} |
||||
|
||||
BOOLEAN |
||||
GetDebugLine (char *buf, const int len) |
||||
{ |
||||
static const char *truncated = "[OUTPUT TRUNCATED]\n"; |
||||
BOOLEAN ret = FALSE; |
||||
|
||||
NdisZeroMemory (buf, len); |
||||
|
||||
if (g_Debug.text && g_Debug.capacity > 0) |
||||
{ |
||||
BOOLEAN owned; |
||||
ACQUIRE_MUTEX_ADAPTIVE (&g_Debug.lock, owned); |
||||
if (owned) |
||||
{ |
||||
int i = 0; |
||||
|
||||
if (g_Debug.error || NewlineExists (g_Debug.text + g_Debug.in, (int)g_Debug.out - (int)g_Debug.in)) |
||||
{ |
||||
while (i < (len - 1) && g_Debug.in < g_Debug.out) |
||||
{ |
||||
const char c = g_Debug.text[g_Debug.in++]; |
||||
if (c == '\n') |
||||
break; |
||||
buf[i++] = c; |
||||
} |
||||
if (i < len) |
||||
buf[i] = '\0'; |
||||
} |
||||
|
||||
if (!i) |
||||
{ |
||||
if (g_Debug.in == g_Debug.out) |
||||
{ |
||||
g_Debug.in = g_Debug.out = 0; |
||||
if (g_Debug.error) |
||||
{ |
||||
const unsigned int tlen = strlen (truncated); |
||||
if (tlen < g_Debug.capacity) |
||||
{ |
||||
NdisMoveMemory (g_Debug.text, truncated, tlen+1); |
||||
g_Debug.out = tlen; |
||||
} |
||||
g_Debug.error = FALSE; |
||||
} |
||||
} |
||||
} |
||||
else |
||||
ret = TRUE; |
||||
|
||||
RELEASE_MUTEX (&g_Debug.lock); |
||||
}
|
||||
} |
||||
return ret; |
||||
} |
||||
|
||||
VOID |
||||
MyAssert (const unsigned char *file, int line) |
||||
{ |
||||
DEBUGP (("MYASSERT failed %s/%d\n", file, line)); |
||||
KeBugCheckEx (0x0F00BABA, |
||||
(ULONG_PTR) line, |
||||
(ULONG_PTR) 0, |
||||
(ULONG_PTR) 0, |
||||
(ULONG_PTR) 0); |
||||
} |
||||
|
||||
VOID |
||||
PrMac (const MACADDR mac) |
||||
{ |
||||
DEBUGP (("%x:%x:%x:%x:%x:%x", |
||||
mac[0], mac[1], mac[2], |
||||
mac[3], mac[4], mac[5])); |
||||
} |
||||
|
||||
VOID |
||||
PrIP (IPADDR ip_addr) |
||||
{ |
||||
const unsigned char *ip = (const unsigned char *) &ip_addr; |
||||
|
||||
DEBUGP (("%d.%d.%d.%d", |
||||
ip[0], ip[1], ip[2], ip[3])); |
||||
} |
||||
|
||||
const char * |
||||
PrIPProto (int proto) |
||||
{ |
||||
switch (proto) |
||||
{ |
||||
case IPPROTO_UDP: |
||||
return "UDP"; |
||||
case IPPROTO_TCP: |
||||
return "TCP"; |
||||
case IPPROTO_ICMP: |
||||
return "ICMP"; |
||||
case IPPROTO_IGMP: |
||||
return "IGMP"; |
||||
default: |
||||
return "???"; |
||||
} |
||||
} |
||||
|
||||
VOID |
||||
DumpARP (const char *prefix, const ARP_PACKET *arp) |
||||
{ |
||||
DEBUGP (("%s ARP src=", prefix)); |
||||
PrMac (arp->m_MAC_Source); |
||||
DEBUGP ((" dest=")); |
||||
PrMac (arp->m_MAC_Destination); |
||||
DEBUGP ((" OP=0x%04x", |
||||
(int)ntohs(arp->m_ARP_Operation))); |
||||
DEBUGP ((" M=0x%04x(%d)", |
||||
(int)ntohs(arp->m_MAC_AddressType), |
||||
(int)arp->m_MAC_AddressSize)); |
||||
DEBUGP ((" P=0x%04x(%d)", |
||||
(int)ntohs(arp->m_PROTO_AddressType), |
||||
(int)arp->m_PROTO_AddressSize)); |
||||
|
||||
DEBUGP ((" MacSrc=")); |
||||
PrMac (arp->m_ARP_MAC_Source); |
||||
DEBUGP ((" MacDest=")); |
||||
PrMac (arp->m_ARP_MAC_Destination); |
||||
|
||||
DEBUGP ((" IPSrc=")); |
||||
PrIP (arp->m_ARP_IP_Source); |
||||
DEBUGP ((" IPDest=")); |
||||
PrIP (arp->m_ARP_IP_Destination); |
||||
|
||||
DEBUGP (("\n")); |
||||
} |
||||
|
||||
struct ethpayload { |
||||
ETH_HEADER eth; |
||||
UCHAR payload[DEFAULT_PACKET_LOOKAHEAD]; |
||||
}; |
||||
|
||||
VOID |
||||
DumpPacket2 (const char *prefix, |
||||
const ETH_HEADER *eth, |
||||
const unsigned char *data, |
||||
unsigned int len) |
||||
{ |
||||
struct ethpayload *ep = (struct ethpayload *) MemAlloc (sizeof (struct ethpayload), TRUE); |
||||
if (ep) |
||||
{ |
||||
if (len > DEFAULT_PACKET_LOOKAHEAD) |
||||
len = DEFAULT_PACKET_LOOKAHEAD; |
||||
ep->eth = *eth; |
||||
NdisMoveMemory (ep->payload, data, len); |
||||
DumpPacket (prefix, (unsigned char *) ep, sizeof (ETH_HEADER) + len); |
||||
MemFree (ep, sizeof (struct ethpayload)); |
||||
} |
||||
} |
||||
|
||||
VOID |
||||
DumpPacket (const char *prefix, |
||||
const unsigned char *data, |
||||
unsigned int len) |
||||
{ |
||||
const ETH_HEADER *eth = (const ETH_HEADER *) data; |
||||
const IPHDR *ip = (const IPHDR *) (data + sizeof (ETH_HEADER)); |
||||
|
||||
if (len < sizeof (ETH_HEADER)) |
||||
{ |
||||
DEBUGP (("%s TRUNCATED PACKET LEN=%d\n", prefix, len)); |
||||
return; |
||||
} |
||||
|
||||
// ARP Packet?
|
||||
if (len >= sizeof (ARP_PACKET) && eth->proto == htons (ETH_P_ARP)) |
||||
{ |
||||
DumpARP (prefix, (const ARP_PACKET *) data); |
||||
return; |
||||
} |
||||
|
||||
// IPv4 packet?
|
||||
if (len >= (sizeof (IPHDR) + sizeof (ETH_HEADER)) |
||||
&& eth->proto == htons (ETH_P_IP) |
||||
&& IPH_GET_VER (ip->version_len) == 4) |
||||
{ |
||||
const int hlen = IPH_GET_LEN (ip->version_len); |
||||
const int blen = len - sizeof (ETH_HEADER); |
||||
BOOLEAN did = FALSE; |
||||
|
||||
DEBUGP (("%s IPv4 %s[%d]", prefix, PrIPProto (ip->protocol), len)); |
||||
|
||||
if (!(ntohs (ip->tot_len) == blen && hlen <= blen)) |
||||
{ |
||||
DEBUGP ((" XXX")); |
||||
return; |
||||
} |
||||
|
||||
// TCP packet?
|
||||
if (ip->protocol == IPPROTO_TCP |
||||
&& blen - hlen >= (sizeof (TCPHDR))) |
||||
{ |
||||
const TCPHDR *tcp = (TCPHDR *) (data + sizeof (ETH_HEADER) + hlen); |
||||
DEBUGP ((" ")); |
||||
PrIP (ip->saddr); |
||||
DEBUGP ((":%d", ntohs (tcp->source))); |
||||
DEBUGP ((" -> ")); |
||||
PrIP (ip->daddr); |
||||
DEBUGP ((":%d", ntohs (tcp->dest))); |
||||
did = TRUE; |
||||
} |
||||
|
||||
// UDP packet?
|
||||
else if ((ntohs (ip->frag_off) & IP_OFFMASK) == 0 |
||||
&& ip->protocol == IPPROTO_UDP |
||||
&& blen - hlen >= (sizeof (UDPHDR))) |
||||
{ |
||||
const UDPHDR *udp = (UDPHDR *) (data + sizeof (ETH_HEADER) + hlen); |
||||
|
||||
#if 0 |
||||
// DHCP packet?
|
||||
if ((udp->dest == htons (BOOTPC_PORT) || udp->dest == htons (BOOTPS_PORT)) |
||||
&& blen - hlen >= (sizeof (UDPHDR) + sizeof (DHCP))) |
||||
{ |
||||
const DHCP *dhcp = (DHCP *) (data |
||||
+ hlen |
||||
+ sizeof (ETH_HEADER) |
||||
+ sizeof (UDPHDR)); |
||||
|
||||
int optlen = len |
||||
- sizeof (ETH_HEADER) |
||||
- hlen |
||||
- sizeof (UDPHDR) |
||||
- sizeof (DHCP); |
||||
|
||||
if (optlen < 0) |
||||
optlen = 0; |
||||
|
||||
DumpDHCP (eth, ip, udp, dhcp, optlen); |
||||
did = TRUE; |
||||
} |
||||
#endif |
||||
|
||||
if (!did) |
||||
{ |
||||
DEBUGP ((" ")); |
||||
PrIP (ip->saddr); |
||||
DEBUGP ((":%d", ntohs (udp->source))); |
||||
DEBUGP ((" -> ")); |
||||
PrIP (ip->daddr); |
||||
DEBUGP ((":%d", ntohs (udp->dest))); |
||||
did = TRUE; |
||||
} |
||||
} |
||||
|
||||
if (!did) |
||||
{ |
||||
DEBUGP ((" ipproto=%d ", ip->protocol)); |
||||
PrIP (ip->saddr); |
||||
DEBUGP ((" -> ")); |
||||
PrIP (ip->daddr); |
||||
} |
||||
|
||||
DEBUGP (("\n")); |
||||
return; |
||||
} |
||||
|
||||
{ |
||||
DEBUGP (("%s ??? src=", prefix)); |
||||
PrMac (eth->src); |
||||
DEBUGP ((" dest=")); |
||||
PrMac (eth->dest); |
||||
DEBUGP ((" proto=0x%04x len=%d\n", |
||||
(int) ntohs(eth->proto), |
||||
len)); |
||||
} |
||||
} |
||||
|
||||
#endif |
||||
@ -1,88 +0,0 @@
|
||||
/*
|
||||
* TAP-Windows -- A kernel driver to provide virtual tap |
||||
* device functionality on Windows. |
||||
* |
||||
* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. |
||||
* |
||||
* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., |
||||
* and is released under the GPL version 2 (see below). |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License version 2 |
||||
* as published by the Free Software Foundation. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program (see the file COPYING included with this |
||||
* distribution); if not, write to the Free Software Foundation, Inc., |
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||
*/ |
||||
|
||||
//-----------------
|
||||
// DEBUGGING OUTPUT
|
||||
//-----------------
|
||||
|
||||
#define NOTE_ERROR() \ |
||||
{ \
|
||||
g_LastErrorFilename = __FILE__; \
|
||||
g_LastErrorLineNumber = __LINE__; \
|
||||
} |
||||
|
||||
#if DBG |
||||
|
||||
typedef struct { |
||||
unsigned int in; |
||||
unsigned int out; |
||||
unsigned int capacity; |
||||
char *text; |
||||
BOOLEAN error; |
||||
MUTEX lock; |
||||
} DebugOutput; |
||||
|
||||
VOID MyDebugPrint (const unsigned char* format, ...); |
||||
|
||||
VOID MyAssert (const unsigned char *file, int line); |
||||
|
||||
VOID DumpPacket (const char *prefix, |
||||
const unsigned char *data, |
||||
unsigned int len); |
||||
|
||||
VOID DumpPacket2 (const char *prefix, |
||||
const ETH_HEADER *eth, |
||||
const unsigned char *data, |
||||
unsigned int len); |
||||
|
||||
#define CAN_WE_PRINT (DEBUGP_AT_DISPATCH || KeGetCurrentIrql () < DISPATCH_LEVEL) |
||||
|
||||
#if ALSO_DBGPRINT |
||||
#define DEBUGP(fmt) { MyDebugPrint fmt; if (CAN_WE_PRINT) DbgPrint fmt; } |
||||
#else |
||||
#define DEBUGP(fmt) { MyDebugPrint fmt; } |
||||
#endif |
||||
|
||||
#define MYASSERT(exp) \ |
||||
{ \
|
||||
if (!(exp)) \
|
||||
{ \
|
||||
MyAssert(__FILE__, __LINE__); \
|
||||
} \
|
||||
} |
||||
|
||||
#define DUMP_PACKET(prefix, data, len) \ |
||||
DumpPacket (prefix, data, len) |
||||
|
||||
#define DUMP_PACKET2(prefix, eth, data, len) \ |
||||
DumpPacket2 (prefix, eth, data, len) |
||||
|
||||
#else |
||||
|
||||
#define DEBUGP(fmt) |
||||
#define MYASSERT(exp) |
||||
#define DUMP_PACKET(prefix, data, len) |
||||
#define DUMP_PACKET2(prefix, eth, data, len) |
||||
|
||||
#endif |
||||
@ -1,241 +0,0 @@
|
||||
/*
|
||||
* TAP-Windows -- A kernel driver to provide virtual tap |
||||
* device functionality on Windows. |
||||
* |
||||
* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. |
||||
* |
||||
* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., |
||||
* and is released under the GPL version 2 (see below). |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License version 2 |
||||
* as published by the Free Software Foundation. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program (see the file COPYING included with this |
||||
* distribution); if not, write to the Free Software Foundation, Inc., |
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||
*/ |
||||
|
||||
#define INSTANCE_KEY(a) ((PVOID)((a)->m_Extension.m_TapDevice)) |
||||
|
||||
#define N_INSTANCE_BUCKETS 256 |
||||
|
||||
typedef struct _INSTANCE { |
||||
struct _INSTANCE *next; |
||||
TapAdapterPointer m_Adapter; |
||||
} INSTANCE; |
||||
|
||||
typedef struct { |
||||
INSTANCE *list; |
||||
MUTEX lock; |
||||
} INSTANCE_BUCKET; |
||||
|
||||
typedef struct { |
||||
INSTANCE_BUCKET buckets[N_INSTANCE_BUCKETS]; |
||||
} INSTANCE_HASH; |
||||
|
||||
INSTANCE_HASH *g_InstanceHash = NULL; |
||||
|
||||
// must return a hash >= 0 and < N_INSTANCE_BUCKETS
|
||||
int |
||||
InstanceHashValue (PVOID addr) |
||||
{ |
||||
UCHAR *p = (UCHAR *) &addr; |
||||
|
||||
if (sizeof (addr) == 4) |
||||
return p[0] ^ p[1] ^ p[2] ^ p[3]; |
||||
else if (sizeof (addr) == 8) |
||||
return p[0] ^ p[1] ^ p[2] ^ p[3] ^ p[4] ^ p[5] ^ p[6] ^ p[7]; |
||||
else |
||||
{ |
||||
MYASSERT (0); |
||||
} |
||||
} |
||||
|
||||
BOOLEAN |
||||
InitInstanceList (VOID) |
||||
{ |
||||
MYASSERT (g_InstanceHash == NULL); |
||||
g_InstanceHash = MemAlloc (sizeof (INSTANCE_HASH), TRUE); |
||||
if (g_InstanceHash) |
||||
{ |
||||
int i; |
||||
for (i = 0; i < N_INSTANCE_BUCKETS; ++i) |
||||
INIT_MUTEX (&g_InstanceHash->buckets[i].lock); |
||||
return TRUE; |
||||
} |
||||
else |
||||
return FALSE; |
||||
} |
||||
|
||||
int |
||||
NInstances (VOID) |
||||
{ |
||||
int i, n = 0; |
||||
|
||||
if (g_InstanceHash) |
||||
{ |
||||
for (i = 0; i < N_INSTANCE_BUCKETS; ++i) |
||||
{ |
||||
BOOLEAN got_lock; |
||||
INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[i]; |
||||
ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock); |
||||
|
||||
if (got_lock) |
||||
{ |
||||
INSTANCE *current; |
||||
for (current = ib->list; current != NULL; current = current->next) |
||||
++n; |
||||
RELEASE_MUTEX (&ib->lock); |
||||
} |
||||
else |
||||
return -1; |
||||
} |
||||
} |
||||
|
||||
return n; |
||||
} |
||||
|
||||
int |
||||
InstanceMaxBucketSize (VOID) |
||||
{ |
||||
int i, n = 0; |
||||
|
||||
if (g_InstanceHash) |
||||
{ |
||||
for (i = 0; i < N_INSTANCE_BUCKETS; ++i) |
||||
{ |
||||
BOOLEAN got_lock; |
||||
int bucket_size = 0; |
||||
INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[i]; |
||||
ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock); |
||||
|
||||
if (got_lock) |
||||
{ |
||||
INSTANCE *current; |
||||
for (current = ib->list; current != NULL; current = current->next) |
||||
++bucket_size; |
||||
if (bucket_size > n) |
||||
n = bucket_size; |
||||
RELEASE_MUTEX (&ib->lock); |
||||
} |
||||
else |
||||
return -1; |
||||
} |
||||
} |
||||
|
||||
return n; |
||||
} |
||||
|
||||
VOID |
||||
FreeInstanceList (VOID) |
||||
{ |
||||
if (g_InstanceHash) |
||||
{ |
||||
MYASSERT (NInstances() == 0); |
||||
MemFree (g_InstanceHash, sizeof (INSTANCE_HASH)); |
||||
g_InstanceHash = NULL; |
||||
} |
||||
} |
||||
|
||||
BOOLEAN |
||||
AddAdapterToInstanceList (TapAdapterPointer p_Adapter) |
||||
{ |
||||
BOOLEAN got_lock; |
||||
BOOLEAN ret = FALSE; |
||||
const int hash = InstanceHashValue(INSTANCE_KEY(p_Adapter)); |
||||
INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[hash]; |
||||
|
||||
DEBUGP (("[TAP] AddAdapterToInstanceList hash=%d\n", hash)); |
||||
|
||||
ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock); |
||||
|
||||
if (got_lock) |
||||
{ |
||||
INSTANCE *i = MemAlloc (sizeof (INSTANCE), FALSE); |
||||
if (i) |
||||
{ |
||||
MYASSERT (p_Adapter); |
||||
i->m_Adapter = p_Adapter; |
||||
i->next = ib->list; |
||||
ib->list = i; |
||||
ret = TRUE; |
||||
} |
||||
RELEASE_MUTEX (&ib->lock); |
||||
} |
||||
|
||||
return ret; |
||||
} |
||||
|
||||
BOOLEAN |
||||
RemoveAdapterFromInstanceList (TapAdapterPointer p_Adapter) |
||||
{ |
||||
BOOLEAN got_lock; |
||||
BOOLEAN ret = FALSE; |
||||
INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[InstanceHashValue(INSTANCE_KEY(p_Adapter))]; |
||||
|
||||
ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock); |
||||
|
||||
if (got_lock) |
||||
{ |
||||
INSTANCE *current, *prev=NULL; |
||||
for (current = ib->list; current != NULL; current = current->next) |
||||
{ |
||||
if (current->m_Adapter == p_Adapter) // found match
|
||||
{ |
||||
if (prev) |
||||
prev->next = current->next; |
||||
else |
||||
ib->list = current->next; |
||||
MemFree (current->m_Adapter, sizeof (TapAdapter)); |
||||
MemFree (current, sizeof (INSTANCE)); |
||||
ret = TRUE; |
||||
break; |
||||
} |
||||
prev = current; |
||||
} |
||||
RELEASE_MUTEX (&ib->lock); |
||||
} |
||||
|
||||
return ret; |
||||
} |
||||
|
||||
TapAdapterPointer |
||||
LookupAdapterInInstanceList (PDEVICE_OBJECT p_DeviceObject) |
||||
{ |
||||
BOOLEAN got_lock; |
||||
TapAdapterPointer ret = NULL; |
||||
INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[InstanceHashValue((PVOID)p_DeviceObject)]; |
||||
|
||||
ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock); |
||||
|
||||
if (got_lock) |
||||
{ |
||||
INSTANCE *current, *prev=NULL; |
||||
for (current = ib->list; current != NULL; current = current->next) |
||||
{ |
||||
if (p_DeviceObject == INSTANCE_KEY (current->m_Adapter)) // found match
|
||||
{ |
||||
// move it to head of list
|
||||
if (prev) |
||||
{ |
||||
prev->next = current->next; |
||||
current->next = ib->list; |
||||
ib->list = current; |
||||
} |
||||
ret = ib->list->m_Adapter; |
||||
break; |
||||
} |
||||
prev = current; |
||||
} |
||||
RELEASE_MUTEX (&ib->lock); |
||||
} |
||||
|
||||
return ret; |
||||
} |
||||
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* TAP-Windows -- A kernel driver to provide virtual tap |
||||
* device functionality on Windows. |
||||
* |
||||
* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. |
||||
* |
||||
* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., |
||||
* and is released under the GPL version 2 (see below). |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License version 2 |
||||
* as published by the Free Software Foundation. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program (see the file COPYING included with this |
||||
* distribution); if not, write to the Free Software Foundation, Inc., |
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||
*/ |
||||
|
||||
typedef struct |
||||
{ |
||||
volatile long count; |
||||
} MUTEX; |
||||
|
||||
#define MUTEX_SLEEP_TIME 10000 // microseconds
|
||||
|
||||
#define INIT_MUTEX(m) { (m)->count = 0; } |
||||
|
||||
#define ACQUIRE_MUTEX_BLOCKING(m) \ |
||||
{ \
|
||||
while (NdisInterlockedIncrement (&((m)->count)) != 1) \
|
||||
{ \
|
||||
NdisInterlockedDecrement(&((m)->count)); \
|
||||
NdisMSleep(MUTEX_SLEEP_TIME); \
|
||||
} \
|
||||
} |
||||
|
||||
#define RELEASE_MUTEX(m) \ |
||||
{ \
|
||||
NdisInterlockedDecrement(&((m)->count)); \
|
||||
} |
||||
|
||||
#define ACQUIRE_MUTEX_NONBLOCKING(m, result) \ |
||||
{ \
|
||||
if (NdisInterlockedIncrement (&((m)->count)) != 1) \
|
||||
{ \
|
||||
NdisInterlockedDecrement(&((m)->count)); \
|
||||
result = FALSE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
result = TRUE; \
|
||||
} \
|
||||
} |
||||
|
||||
#define ACQUIRE_MUTEX_ADAPTIVE(m, result) \ |
||||
{ \
|
||||
result = TRUE; \
|
||||
while (NdisInterlockedIncrement (&((m)->count)) != 1) \
|
||||
{ \
|
||||
NdisInterlockedDecrement(&((m)->count)); \
|
||||
if (KeGetCurrentIrql () < DISPATCH_LEVEL) \
|
||||
NdisMSleep(MUTEX_SLEEP_TIME); \
|
||||
else \
|
||||
{ \
|
||||
result = FALSE; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} |
||||
@ -1,154 +0,0 @@
|
||||
/*
|
||||
* TAP-Windows -- A kernel driver to provide virtual tap |
||||
* device functionality on Windows. |
||||
* |
||||
* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. |
||||
* |
||||
* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., |
||||
* and is released under the GPL version 2 (see below). |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License version 2 |
||||
* as published by the Free Software Foundation. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program (see the file COPYING included with this |
||||
* distribution); if not, write to the Free Software Foundation, Inc., |
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||
*/ |
||||
|
||||
#include "macinfo.h" |
||||
|
||||
int |
||||
HexStringToDecimalInt (const int p_Character) |
||||
{ |
||||
int l_Value = 0; |
||||
|
||||
if (p_Character >= 'A' && p_Character <= 'F') |
||||
l_Value = (p_Character - 'A') + 10; |
||||
else if (p_Character >= 'a' && p_Character <= 'f') |
||||
l_Value = (p_Character - 'a') + 10; |
||||
else if (p_Character >= '0' && p_Character <= '9') |
||||
l_Value = p_Character - '0'; |
||||
|
||||
return l_Value; |
||||
} |
||||
|
||||
BOOLEAN |
||||
ParseMAC (MACADDR dest, const char *src) |
||||
{ |
||||
int c; |
||||
int mac_index = 0; |
||||
BOOLEAN high_digit = FALSE; |
||||
int delim_action = 1; |
||||
|
||||
MYASSERT (src); |
||||
MYASSERT (dest); |
||||
|
||||
CLEAR_MAC (dest); |
||||
|
||||
while (c = *src++) |
||||
{ |
||||
if (IsMacDelimiter (c)) |
||||
{ |
||||
mac_index += delim_action; |
||||
high_digit = FALSE; |
||||
delim_action = 1; |
||||
} |
||||
else if (IsHexDigit (c)) |
||||
{ |
||||
const int digit = HexStringToDecimalInt (c); |
||||
if (mac_index < sizeof (MACADDR)) |
||||
{ |
||||
if (!high_digit) |
||||
{ |
||||
dest[mac_index] = (char)(digit); |
||||
high_digit = TRUE; |
||||
delim_action = 1; |
||||
} |
||||
else |
||||
{ |
||||
dest[mac_index] = (char)(dest[mac_index] * 16 + digit); |
||||
++mac_index; |
||||
high_digit = FALSE; |
||||
delim_action = 0; |
||||
} |
||||
} |
||||
else |
||||
return FALSE; |
||||
} |
||||
else |
||||
return FALSE; |
||||
} |
||||
|
||||
return (mac_index + delim_action) >= sizeof (MACADDR); |
||||
} |
||||
|
||||
/*
|
||||
* Generate a MAC using the GUID in the adapter name. |
||||
* |
||||
* The mac is constructed as 00:FF:xx:xx:xx:xx where |
||||
* the Xs are taken from the first 32 bits of the GUID in the |
||||
* adapter name. This is similar to the Linux 2.4 tap MAC |
||||
* generator, except linux uses 32 random bits for the Xs. |
||||
* |
||||
* In general, this solution is reasonable for most |
||||
* applications except for very large bridged TAP networks, |
||||
* where the probability of address collisions becomes more |
||||
* than infintesimal. |
||||
* |
||||
* Using the well-known "birthday paradox", on a 1000 node |
||||
* network the probability of collision would be |
||||
* 0.000116292153. On a 10,000 node network, the probability |
||||
* of collision would be 0.01157288998621678766. |
||||
*/ |
||||
|
||||
VOID GenerateRandomMac (MACADDR mac, const unsigned char *adapter_name) |
||||
{ |
||||
unsigned const char *cp = adapter_name; |
||||
unsigned char c; |
||||
unsigned int i = 2; |
||||
unsigned int byte = 0; |
||||
int brace = 0; |
||||
int state = 0; |
||||
|
||||
CLEAR_MAC (mac); |
||||
|
||||
mac[0] = 0x00; |
||||
mac[1] = 0xFF; |
||||
|
||||
while (c = *cp++) |
||||
{ |
||||
if (i >= sizeof (MACADDR)) |
||||
break; |
||||
if (c == '{') |
||||
brace = 1; |
||||
if (IsHexDigit (c) && brace) |
||||
{ |
||||
const unsigned int digit = HexStringToDecimalInt (c); |
||||
if (state) |
||||
{ |
||||
byte <<= 4; |
||||
byte |= digit; |
||||
mac[i++] = (unsigned char) byte; |
||||
state = 0; |
||||
} |
||||
else |
||||
{ |
||||
byte = digit; |
||||
state = 1; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
VOID GenerateRelatedMAC (MACADDR dest, const MACADDR src, const int delta) |
||||
{ |
||||
COPY_MAC (dest, src); |
||||
dest[2] += (UCHAR) delta; |
||||
} |
||||
@ -1,38 +0,0 @@
|
||||
/*
|
||||
* TAP-Windows -- A kernel driver to provide virtual tap |
||||
* device functionality on Windows. |
||||
* |
||||
* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. |
||||
* |
||||
* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., |
||||
* and is released under the GPL version 2 (see below). |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License version 2 |
||||
* as published by the Free Software Foundation. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program (see the file COPYING included with this |
||||
* distribution); if not, write to the Free Software Foundation, Inc., |
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||
*/ |
||||
|
||||
#ifndef MacInfoDefined |
||||
#define MacInfoDefined |
||||
|
||||
//===================================================================================
|
||||
// Macros
|
||||
//===================================================================================
|
||||
#define IsMacDelimiter(a) (a == ':' || a == '-' || a == '.') |
||||
#define IsHexDigit(c) ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')) |
||||
|
||||
#define COPY_MAC(dest, src) NdisMoveMemory ((dest), (src), sizeof (MACADDR)) |
||||
#define CLEAR_MAC(dest) NdisZeroMemory ((dest), sizeof (MACADDR)) |
||||
#define MAC_EQUAL(a,b) (memcmp ((a), (b), sizeof (MACADDR)) == 0) |
||||
|
||||
#endif |
||||
@ -1,186 +0,0 @@
|
||||
/*
|
||||
* TAP-Windows -- A kernel driver to provide virtual tap |
||||
* device functionality on Windows. |
||||
* |
||||
* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. |
||||
* |
||||
* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., |
||||
* and is released under the GPL version 2 (see below). |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License version 2 |
||||
* as published by the Free Software Foundation. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program (see the file COPYING included with this |
||||
* distribution); if not, write to the Free Software Foundation, Inc., |
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||
*/ |
||||
|
||||
//------------------
|
||||
// Memory Management
|
||||
//------------------
|
||||
|
||||
PVOID |
||||
MemAlloc (ULONG p_Size, BOOLEAN zero) |
||||
{ |
||||
PVOID l_Return = NULL; |
||||
|
||||
if (p_Size) |
||||
{ |
||||
__try |
||||
{ |
||||
if (NdisAllocateMemoryWithTag (&l_Return, p_Size, 'APAT') |
||||
== NDIS_STATUS_SUCCESS) |
||||
{ |
||||
if (zero) |
||||
NdisZeroMemory (l_Return, p_Size); |
||||
} |
||||
else |
||||
l_Return = NULL; |
||||
} |
||||
__except (EXCEPTION_EXECUTE_HANDLER) |
||||
{ |
||||
l_Return = NULL; |
||||
} |
||||
} |
||||
|
||||
return l_Return; |
||||
} |
||||
|
||||
VOID |
||||
MemFree (PVOID p_Addr, ULONG p_Size) |
||||
{ |
||||
if (p_Addr && p_Size) |
||||
{ |
||||
__try |
||||
{ |
||||
#if DBG |
||||
NdisZeroMemory (p_Addr, p_Size); |
||||
#endif |
||||
NdisFreeMemory (p_Addr, p_Size, 0); |
||||
} |
||||
__except (EXCEPTION_EXECUTE_HANDLER) |
||||
{ |
||||
} |
||||
} |
||||
} |
||||
|
||||
/*
|
||||
* Circular queue management routines. |
||||
*/ |
||||
|
||||
#define QUEUE_BYTE_ALLOCATION(size) \ |
||||
(sizeof (Queue) + (size * sizeof (PVOID))) |
||||
|
||||
#define QUEUE_ADD_INDEX(var, inc) \ |
||||
{ \
|
||||
var += inc; \
|
||||
if (var >= q->capacity) \
|
||||
var -= q->capacity; \
|
||||
MYASSERT (var < q->capacity); \
|
||||
} |
||||
|
||||
#define QUEUE_SANITY_CHECK() \ |
||||
MYASSERT (q != NULL && q->base < q->capacity && q->size <= q->capacity) |
||||
|
||||
#define QueueCount(q) (q->size) |
||||
|
||||
#define UPDATE_MAX_SIZE() \ |
||||
{ \
|
||||
if (q->size > q->max_size) \
|
||||
q->max_size = q->size; \
|
||||
} |
||||
|
||||
Queue * |
||||
QueueInit (ULONG capacity) |
||||
{ |
||||
Queue *q; |
||||
|
||||
MYASSERT (capacity > 0); |
||||
q = (Queue *) MemAlloc (QUEUE_BYTE_ALLOCATION (capacity), TRUE); |
||||
if (!q) |
||||
return NULL; |
||||
|
||||
q->base = q->size = 0; |
||||
q->capacity = capacity; |
||||
q->max_size = 0; |
||||
return q; |
||||
} |
||||
|
||||
VOID |
||||
QueueFree (Queue *q) |
||||
{ |
||||
if (q) |
||||
{ |
||||
QUEUE_SANITY_CHECK (); |
||||
MemFree (q, QUEUE_BYTE_ALLOCATION (q->capacity)); |
||||
} |
||||
} |
||||
|
||||
PVOID |
||||
QueuePush (Queue *q, PVOID item) |
||||
{ |
||||
ULONG dest; |
||||
QUEUE_SANITY_CHECK (); |
||||
if (q->size == q->capacity) |
||||
return NULL; |
||||
dest = q->base; |
||||
QUEUE_ADD_INDEX (dest, q->size); |
||||
q->data[dest] = item; |
||||
++q->size; |
||||
UPDATE_MAX_SIZE(); |
||||
return item; |
||||
} |
||||
|
||||
PVOID |
||||
QueuePop (Queue *q) |
||||
{ |
||||
ULONG oldbase; |
||||
QUEUE_SANITY_CHECK (); |
||||
if (!q->size) |
||||
return NULL; |
||||
oldbase = q->base; |
||||
QUEUE_ADD_INDEX (q->base, 1); |
||||
--q->size; |
||||
UPDATE_MAX_SIZE(); |
||||
return q->data[oldbase]; |
||||
} |
||||
|
||||
PVOID |
||||
QueueExtract (Queue *q, PVOID item) |
||||
{ |
||||
ULONG src, dest, count, n; |
||||
QUEUE_SANITY_CHECK (); |
||||
n = 0; |
||||
src = dest = q->base; |
||||
count = q->size; |
||||
while (count--) |
||||
{ |
||||
if (item == q->data[src]) |
||||
{ |
||||
++n; |
||||
--q->size; |
||||
} |
||||
else |
||||
{ |
||||
q->data[dest] = q->data[src]; |
||||
QUEUE_ADD_INDEX (dest, 1);
|
||||
} |
||||
QUEUE_ADD_INDEX (src, 1); |
||||
} |
||||
if (n) |
||||
return item; |
||||
else |
||||
return NULL; |
||||
} |
||||
|
||||
#undef QUEUE_BYTE_ALLOCATION |
||||
#undef QUEUE_ADD_INDEX |
||||
#undef QUEUE_SANITY_CHECK |
||||
#undef UPDATE_MAX_SIZE |
||||
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* TAP-Windows -- A kernel driver to provide virtual tap |
||||
* device functionality on Windows. |
||||
* |
||||
* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. |
||||
* |
||||
* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., |
||||
* and is released under the GPL version 2 (see below). |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License version 2 |
||||
* as published by the Free Software Foundation. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program (see the file COPYING included with this |
||||
* distribution); if not, write to the Free Software Foundation, Inc., |
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||
*/ |
||||
|
||||
//============================================================
|
||||
// MAC address, Ethernet header, and ARP
|
||||
//============================================================
|
||||
|
||||
#pragma pack(1) |
||||
|
||||
typedef unsigned char MACADDR [6]; |
||||
|
||||
//-----------------
|
||||
// Ethernet address
|
||||
//-----------------
|
||||
|
||||
typedef struct { |
||||
MACADDR addr; |
||||
} ETH_ADDR; |
||||
|
||||
typedef struct { |
||||
ETH_ADDR list[NIC_MAX_MCAST_LIST]; |
||||
} MC_LIST; |
||||
|
||||
//----------------
|
||||
// Ethernet header
|
||||
//----------------
|
||||
|
||||
typedef struct |
||||
{ |
||||
MACADDR dest; /* destination eth addr */ |
||||
MACADDR src; /* source ether addr */ |
||||
|
||||
# define ETH_P_IP 0x0800 /* IPv4 protocol */ |
||||
# define ETH_P_IPV6 0x86DD /* IPv6 protocol */ |
||||
# define ETH_P_ARP 0x0806 /* ARP protocol */ |
||||
USHORT proto; /* packet type ID field */ |
||||
} ETH_HEADER, *PETH_HEADER; |
||||
|
||||
#pragma pack() |
||||
@ -1,163 +0,0 @@
|
||||
/*
|
||||
* TAP-Windows -- A kernel driver to provide virtual tap |
||||
* device functionality on Windows. |
||||
* |
||||
* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. |
||||
* |
||||
* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., |
||||
* and is released under the GPL version 2 (see below). |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License version 2 |
||||
* as published by the Free Software Foundation. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program (see the file COPYING included with this |
||||
* distribution); if not, write to the Free Software Foundation, Inc., |
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||
*/ |
||||
|
||||
#ifndef TAP_PROTOTYPES_DEFINED |
||||
#define TAP_PROTOTYPES_DEFINED |
||||
|
||||
NTSTATUS DriverEntry |
||||
( |
||||
IN PDRIVER_OBJECT p_DriverObject, |
||||
IN PUNICODE_STRING p_RegistryPath |
||||
); |
||||
|
||||
VOID TapDriverUnload |
||||
( |
||||
IN PDRIVER_OBJECT p_DriverObject |
||||
); |
||||
|
||||
NDIS_STATUS AdapterCreate |
||||
( |
||||
OUT PNDIS_STATUS p_ErrorStatus, |
||||
OUT PUINT p_MediaIndex, |
||||
IN PNDIS_MEDIUM p_Media, |
||||
IN UINT p_MediaCount, |
||||
IN NDIS_HANDLE p_AdapterHandle, |
||||
IN NDIS_HANDLE p_ConfigurationHandle |
||||
); |
||||
|
||||
VOID AdapterHalt |
||||
( |
||||
IN NDIS_HANDLE p_AdapterContext |
||||
); |
||||
|
||||
VOID AdapterFreeResources |
||||
( |
||||
TapAdapterPointer p_Adapter |
||||
); |
||||
|
||||
NDIS_STATUS AdapterReset |
||||
( |
||||
OUT PBOOLEAN p_AddressingReset, |
||||
IN NDIS_HANDLE p_AdapterContext |
||||
); |
||||
|
||||
NDIS_STATUS AdapterQuery |
||||
( |
||||
IN NDIS_HANDLE p_AdapterContext, |
||||
IN NDIS_OID p_OID, |
||||
IN PVOID p_Buffer, |
||||
IN ULONG p_BufferLength, |
||||
OUT PULONG p_BytesWritten, |
||||
OUT PULONG p_BytesNeeded |
||||
); |
||||
|
||||
NDIS_STATUS AdapterModify |
||||
( |
||||
IN NDIS_HANDLE p_AdapterContext, |
||||
IN NDIS_OID p_OID, |
||||
IN PVOID p_Buffer, |
||||
IN ULONG p_BufferLength, |
||||
OUT PULONG p_BytesRead, |
||||
OUT PULONG p_BytesNeeded |
||||
); |
||||
|
||||
NDIS_STATUS AdapterTransmit |
||||
( |
||||
IN NDIS_HANDLE p_AdapterContext, |
||||
IN PNDIS_PACKET p_Packet, |
||||
IN UINT p_Flags |
||||
); |
||||
|
||||
NDIS_STATUS AdapterReceive |
||||
( |
||||
OUT PNDIS_PACKET p_Packet, |
||||
OUT PUINT p_Transferred, |
||||
IN NDIS_HANDLE p_AdapterContext, |
||||
IN NDIS_HANDLE p_ReceiveContext, |
||||
IN UINT p_Offset, |
||||
IN UINT p_ToTransfer |
||||
); |
||||
|
||||
NTSTATUS TapDeviceHook |
||||
( |
||||
IN PDEVICE_OBJECT p_DeviceObject, |
||||
IN PIRP p_IRP |
||||
); |
||||
|
||||
NDIS_STATUS CreateTapDevice |
||||
( |
||||
TapExtensionPointer p_Extension, |
||||
const char *p_Name |
||||
); |
||||
|
||||
VOID DestroyTapDevice |
||||
( |
||||
TapExtensionPointer p_Extension |
||||
); |
||||
|
||||
VOID TapDeviceFreeResources |
||||
( |
||||
TapExtensionPointer p_Extension |
||||
); |
||||
|
||||
NTSTATUS CompleteIRP |
||||
( |
||||
IN PIRP p_IRP, |
||||
IN TapPacketPointer p_PacketBuffer, |
||||
IN CCHAR PriorityBoost |
||||
); |
||||
|
||||
VOID CancelIRPCallback |
||||
( |
||||
IN PDEVICE_OBJECT p_DeviceObject, |
||||
IN PIRP p_IRP |
||||
); |
||||
|
||||
VOID CancelIRP |
||||
( |
||||
TapExtensionPointer p_Extension, |
||||
IN PIRP p_IRP, |
||||
BOOLEAN callback |
||||
); |
||||
|
||||
VOID FlushQueues |
||||
( |
||||
TapExtensionPointer p_Extension |
||||
); |
||||
|
||||
VOID SetMediaStatus |
||||
( |
||||
TapAdapterPointer p_Adapter, |
||||
BOOLEAN state |
||||
); |
||||
|
||||
VOID HookDispatchFunctions(); |
||||
|
||||
struct WIN2K_NDIS_MINIPORT_BLOCK |
||||
{ |
||||
unsigned char opaque[16]; |
||||
UNICODE_STRING MiniportName; // how mini-port refers to us
|
||||
}; |
||||
|
||||
#endif |
||||
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* TAP-Windows -- A kernel driver to provide virtual tap |
||||
* device functionality on Windows. |
||||
* |
||||
* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. |
||||
* |
||||
* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., |
||||
* and is released under the GPL version 2 (see below). |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License version 2 |
||||
* as published by the Free Software Foundation. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program (see the file COPYING included with this |
||||
* distribution); if not, write to the Free Software Foundation, Inc., |
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||
*/ |
||||
#ifndef __TAP_WIN_H |
||||
#define __TAP_WIN_H |
||||
|
||||
/*
|
||||
* ============= |
||||
* TAP IOCTLs |
||||
* ============= |
||||
*/ |
||||
|
||||
#define TAP_WIN_CONTROL_CODE(request,method) \ |
||||
CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS) |
||||
|
||||
#define TAP_WIN_IOCTL_GET_MAC TAP_WIN_CONTROL_CODE (1, METHOD_BUFFERED) |
||||
#define TAP_WIN_IOCTL_GET_VERSION TAP_WIN_CONTROL_CODE (2, METHOD_BUFFERED) |
||||
#define TAP_WIN_IOCTL_GET_MTU TAP_WIN_CONTROL_CODE (3, METHOD_BUFFERED) |
||||
#define TAP_WIN_IOCTL_SET_MEDIA_STATUS TAP_WIN_CONTROL_CODE (6, METHOD_BUFFERED) |
||||
#define TAP_WIN_IOCTL_GET_LOG_LINE TAP_WIN_CONTROL_CODE (8, METHOD_BUFFERED) |
||||
#define TAP_WIN_IOCTL_GET_MULTICAST_MEMBERSHIPS TAP_WIN_CONTROL_CODE (11, METHOD_BUFFERED) |
||||
|
||||
// Must be the same as NIC_MAX_MCAST_LIST in constants.h
|
||||
#define TAP_MAX_MCAST_LIST 128 |
||||
|
||||
// Amount of memory that must be provided to ioctl TAP_WIN_IOCTL_GET_MULTICAST_MEMBERSHIPS
|
||||
#define TAP_WIN_IOCTL_GET_MULTICAST_MEMBERSHIPS_OUTPUT_BUF_SIZE (TAP_MAX_MCAST_LIST * 6) |
||||
|
||||
/*
|
||||
* ================= |
||||
* Registry keys |
||||
* ================= |
||||
*/ |
||||
|
||||
#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}" |
||||
#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}" |
||||
|
||||
/*
|
||||
* ====================== |
||||
* Filesystem prefixes |
||||
* ====================== |
||||
*/ |
||||
|
||||
#define USERMODEDEVICEDIR "\\\\.\\Global\\" |
||||
#define SYSDEVICEDIR "\\Device\\" |
||||
#define USERDEVICEDIR "\\DosDevices\\Global\\" |
||||
#define TAP_WIN_SUFFIX ".tap" |
||||
|
||||
#endif |
||||
@ -1,137 +0,0 @@
|
||||
/*
|
||||
* TAP-Windows -- A kernel driver to provide virtual tap |
||||
* device functionality on Windows. |
||||
* |
||||
* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. |
||||
* |
||||
* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., |
||||
* and is released under the GPL version 2 (see below). |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License version 2 |
||||
* as published by the Free Software Foundation. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program (see the file COPYING included with this |
||||
* distribution); if not, write to the Free Software Foundation, Inc., |
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||
*/ |
||||
|
||||
#ifndef TAP_TYPES_DEFINED |
||||
#define TAP_TYPES_DEFINED |
||||
|
||||
typedef struct _Queue |
||||
{ |
||||
ULONG base; |
||||
ULONG size; |
||||
ULONG capacity; |
||||
ULONG max_size; |
||||
PVOID data[]; |
||||
} Queue; |
||||
|
||||
typedef struct _TapAdapter; |
||||
typedef struct _TapPacket; |
||||
|
||||
typedef union _TapAdapterQuery |
||||
{ |
||||
NDIS_HARDWARE_STATUS m_HardwareStatus; |
||||
NDIS_MEDIUM m_Medium; |
||||
NDIS_PHYSICAL_MEDIUM m_PhysicalMedium; |
||||
UCHAR m_MacAddress [6]; |
||||
UCHAR m_Buffer [256]; |
||||
ULONG m_Long; |
||||
USHORT m_Short; |
||||
UCHAR m_Byte; |
||||
} |
||||
TapAdapterQuery, *TapAdapterQueryPointer; |
||||
|
||||
typedef struct _TapExtension |
||||
{ |
||||
// TAP device object and packet queues
|
||||
Queue *m_PacketQueue, *m_IrpQueue; |
||||
PDEVICE_OBJECT m_TapDevice; |
||||
NDIS_HANDLE m_TapDeviceHandle; |
||||
ULONG m_TapOpens; |
||||
|
||||
// Used to lock packet queues
|
||||
NDIS_SPIN_LOCK m_QueueLock; |
||||
BOOLEAN m_AllocatedSpinlocks; |
||||
|
||||
// Used to bracket open/close
|
||||
// state changes.
|
||||
MUTEX m_OpenCloseMutex; |
||||
|
||||
// True if device has been permanently halted
|
||||
BOOLEAN m_Halt; |
||||
|
||||
// TAP device name
|
||||
unsigned char *m_TapName; |
||||
UNICODE_STRING m_UnicodeLinkName; |
||||
BOOLEAN m_CreatedUnicodeLinkName; |
||||
|
||||
// Used for device status ioctl only
|
||||
const char *m_LastErrorFilename; |
||||
int m_LastErrorLineNumber; |
||||
LONG m_NumTapOpens; |
||||
|
||||
// Flags
|
||||
BOOLEAN m_TapIsRunning; |
||||
BOOLEAN m_CalledTapDeviceFreeResources; |
||||
} |
||||
TapExtension, *TapExtensionPointer; |
||||
|
||||
typedef struct _TapPacket |
||||
{ |
||||
# define TAP_PACKET_SIZE(data_size) (sizeof (TapPacket) + (data_size)) |
||||
# define TP_TUN 0x80000000 |
||||
# define TP_SIZE_MASK (~TP_TUN) |
||||
ULONG m_SizeFlags; |
||||
UCHAR m_Data []; // m_Data must be the last struct member
|
||||
} |
||||
TapPacket, *TapPacketPointer; |
||||
|
||||
typedef struct _TapAdapter |
||||
{ |
||||
# define NAME(a) ((a)->m_NameAnsi.Buffer) |
||||
ANSI_STRING m_NameAnsi; |
||||
MACADDR m_MAC; |
||||
BOOLEAN m_InterfaceIsRunning; |
||||
NDIS_HANDLE m_MiniportAdapterHandle; |
||||
LONG m_Rx, m_Tx, m_RxErr, m_TxErr; |
||||
NDIS_MEDIUM m_Medium; |
||||
ULONG m_Lookahead; |
||||
ULONG m_MTU; |
||||
|
||||
// TRUE if adapter should always be
|
||||
// "connected" even when device node
|
||||
// is not open by a userspace process.
|
||||
BOOLEAN m_MediaStateAlwaysConnected; |
||||
|
||||
// TRUE if device is "connected"
|
||||
BOOLEAN m_MediaState; |
||||
|
||||
// Adapter power state
|
||||
char m_DeviceState; |
||||
|
||||
// Help to tear down the adapter by keeping
|
||||
// some state information on allocated
|
||||
// resources.
|
||||
BOOLEAN m_CalledAdapterFreeResources; |
||||
BOOLEAN m_RegisteredAdapterShutdownHandler; |
||||
|
||||
// Multicast list info
|
||||
NDIS_SPIN_LOCK m_MCLock; |
||||
BOOLEAN m_MCLockAllocated; |
||||
ULONG m_MCListSize; |
||||
MC_LIST m_MCList; |
||||
|
||||
// Information on the TAP device
|
||||
TapExtension m_Extension; |
||||
} TapAdapter, *TapAdapterPointer; |
||||
|
||||
#endif |
||||
@ -1,78 +0,0 @@
|
||||
[Version] |
||||
Signature="$WINDOWS NT$" |
||||
Class=Net |
||||
ClassGuid={4d36e972-e325-11ce-bfc1-08002be10318} |
||||
Provider=%Provider% |
||||
CatalogFile=zttap200.cat |
||||
|
||||
[Strings] |
||||
DeviceDescription = "ZeroTier One Virtual Network Port" |
||||
Provider = "ZeroTier Networks LLC" |
||||
|
||||
; To build for x86, take NTamd64 off this and off the named section manually, build, then put it back! |
||||
[Manufacturer] |
||||
%Provider%=zttap200,NTamd64 |
||||
|
||||
[zttap200] |
||||
%DeviceDescription%=zttap200.ndi,zttap200 |
||||
|
||||
[ztTap200.NTamd64] |
||||
%DeviceDescription%=zttap200.ndi,zttap200 |
||||
|
||||
[zttap200.ndi] |
||||
CopyFiles = zttap200.driver,zttap200.files |
||||
AddReg = zttap200.reg |
||||
AddReg = zttap200.params.reg |
||||
Characteristics = 0x81 |
||||
|
||||
[zttap200.ndi.Services] |
||||
AddService = zttap200, 2, zttap200.service |
||||
|
||||
[zttap200.reg] |
||||
HKR, Ndi, Service, 0, "zttap200" |
||||
HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" |
||||
HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" |
||||
HKR, , Manufacturer, 0, "%Provider%" |
||||
HKR, , ProductName, 0, "%DeviceDescription%" |
||||
|
||||
[zttap200.params.reg] |
||||
HKR, Ndi\params\MTU, ParamDesc, 0, "MTU" |
||||
HKR, Ndi\params\MTU, Type, 0, "int" |
||||
HKR, Ndi\params\MTU, Default, 0, "2800" |
||||
HKR, Ndi\params\MTU, Optional, 0, "0" |
||||
HKR, Ndi\params\MTU, Min, 0, "100" |
||||
HKR, Ndi\params\MTU, Max, 0, "2800" |
||||
HKR, Ndi\params\MTU, Step, 0, "1" |
||||
HKR, Ndi\params\MediaStatus, ParamDesc, 0, "Media Status" |
||||
HKR, Ndi\params\MediaStatus, Type, 0, "enum" |
||||
HKR, Ndi\params\MediaStatus, Default, 0, "0" |
||||
HKR, Ndi\params\MediaStatus, Optional, 0, "0" |
||||
HKR, Ndi\params\MediaStatus\enum, "0", 0, "Application Controlled" |
||||
HKR, Ndi\params\MediaStatus\enum, "1", 0, "Always Connected" |
||||
HKR, Ndi\params\MAC, ParamDesc, 0, "MAC Address" |
||||
HKR, Ndi\params\MAC, Type, 0, "edit" |
||||
HKR, Ndi\params\MAC, Optional, 0, "1" |
||||
|
||||
[zttap200.service] |
||||
DisplayName = %DeviceDescription% |
||||
ServiceType = 1 |
||||
StartType = 3 |
||||
ErrorControl = 1 |
||||
LoadOrderGroup = NDIS |
||||
ServiceBinary = %12%\zttap200.sys |
||||
|
||||
[SourceDisksNames] |
||||
1 = %DeviceDescription%, zttap200.sys |
||||
|
||||
[SourceDisksFiles] |
||||
zttap200.sys = 1 |
||||
|
||||
[DestinationDirs] |
||||
zttap200.files = 11 |
||||
zttap200.driver = 12 |
||||
|
||||
[zttap200.files] |
||||
; |
||||
|
||||
[zttap200.driver] |
||||
zttap200.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK |
||||
Loading…
Reference in new issue