diff options
author | Simon Rozman <simon@rozman.si> | 2021-07-28 13:50:40 +0200 |
---|---|---|
committer | Simon Rozman <simon@rozman.si> | 2021-07-28 20:22:18 +0200 |
commit | 7dffa4be72c77bd7322039ffdc558a842abba8af (patch) | |
tree | 1712373ccfbd56596959206cb6b48c8d02d395ca | |
parent | driver: workaround SDV failure with code analysis (diff) | |
download | wintun-7dffa4be72c77bd7322039ffdc558a842abba8af.tar.xz wintun-7dffa4be72c77bd7322039ffdc558a842abba8af.zip |
vs: move shared configuration to wintun.props and upgrade
Remember to rename wintun.vcxproj.user file in your local working folder
to wintun.props.user manually.
Signed-off-by: Simon Rozman <simon@rozman.si>
-rw-r--r-- | api/adapter.c | 24 | ||||
-rw-r--r-- | api/api.vcxproj | 167 | ||||
-rw-r--r-- | api/api.vcxproj.filters | 6 | ||||
-rw-r--r-- | api/logger.h | 2 | ||||
-rw-r--r-- | api/main.c (renamed from api/entry.c) | 1 | ||||
-rw-r--r-- | api/main.h (renamed from api/entry.h) | 0 | ||||
-rw-r--r-- | api/namespace.c | 2 | ||||
-rw-r--r-- | api/registry.c | 1 | ||||
-rw-r--r-- | api/resource.c | 2 | ||||
-rw-r--r-- | api/resources.rc | 18 | ||||
-rw-r--r-- | api/rundll32.c | 20 | ||||
-rw-r--r-- | api/session.c | 2 | ||||
-rw-r--r-- | driver/driver.vcxproj | 88 | ||||
-rw-r--r-- | example/example.c | 2 | ||||
-rw-r--r-- | example/example.vcxproj | 109 | ||||
-rw-r--r-- | wintun.proj | 18 | ||||
-rw-r--r-- | wintun.props | 120 | ||||
-rw-r--r-- | wintun.sln | 38 |
18 files changed, 229 insertions, 391 deletions
diff --git a/api/adapter.c b/api/adapter.c index 348441a..4d75351 100644 --- a/api/adapter.c +++ b/api/adapter.c @@ -21,8 +21,8 @@ #include <devioctl.h> #include "adapter.h" -#include "entry.h" #include "logger.h" +#include "main.h" #include "namespace.h" #include "nci.h" #include "ntdll.h" @@ -401,8 +401,7 @@ static _Return_type_success_(return != FALSE) BOOL void AdapterInit(void) { - if (!MAYBE_WOW64) - return; +#ifdef MAYBE_WOW64 typedef BOOL(WINAPI * IsWow64Process2_t)( _In_ HANDLE hProcess, _Out_ USHORT * pProcessMachine, _Out_opt_ USHORT * pNativeMachine); HANDLE Kernel32; @@ -416,6 +415,7 @@ AdapterInit(void) NativeMachine = IsWow64Process(GetCurrentProcess(), &IsWoW64) && IsWoW64 ? IMAGE_FILE_MACHINE_AMD64 : IMAGE_FILE_PROCESS; } +#endif } static BOOL @@ -905,9 +905,11 @@ IsWindows10(void) static BOOL HaveWHQL(void) { - if (HAVE_WHQL) - return IsWindows10(); +#if defined(HAVE_WHQL) + return IsWindows10(); +#else return FALSE; +#endif } static _Return_type_success_(return != FALSE) BOOL InstallCertificate(_In_z_ const WCHAR *SignedResource) @@ -1778,12 +1780,14 @@ _Return_type_success_(return != NULL) WINTUN_ADAPTER *WINAPI WintunCreateAdapter *RebootRequired = FALSE; DWORD LastError; WINTUN_ADAPTER *Adapter; - if (MAYBE_WOW64 && NativeMachine != IMAGE_FILE_PROCESS) +#ifdef MAYBE_WOW64 + if (NativeMachine != IMAGE_FILE_PROCESS) { Adapter = CreateAdapterViaRundll32(Pool, Name, RequestedGUID, RebootRequired); LastError = Adapter ? ERROR_SUCCESS : GetLastError(); goto cleanup; } +#endif Adapter = CreateAdapter(Pool, Name, RequestedGUID, RebootRequired); LastError = Adapter ? ERROR_SUCCESS : GetLastError(); cleanup: @@ -1800,12 +1804,14 @@ _Return_type_success_(return != FALSE) BOOL WINAPI WintunDeleteAdapter( RebootRequired = &DummyRebootRequired; *RebootRequired = FALSE; DWORD LastError; - if (MAYBE_WOW64 && NativeMachine != IMAGE_FILE_PROCESS) +#ifdef MAYBE_WOW64 + if (NativeMachine != IMAGE_FILE_PROCESS) { LastError = DeleteAdapterViaRundll32(Adapter, ForceCloseSessions, RebootRequired) ? ERROR_SUCCESS : GetLastError(); goto cleanup; } +#endif HANDLE Mutex = NamespaceTakePoolMutex(Adapter->Pool); if (!Mutex) @@ -1916,11 +1922,13 @@ _Return_type_success_(return != FALSE) BOOL WINAPI *RebootRequired = FALSE; DWORD LastError = ERROR_SUCCESS; - if (MAYBE_WOW64 && NativeMachine != IMAGE_FILE_PROCESS) +#ifdef MAYBE_WOW64 + if (NativeMachine != IMAGE_FILE_PROCESS) { LastError = DeletePoolDriverViaRundll32(Pool, RebootRequired) ? ERROR_SUCCESS : GetLastError(); goto cleanup; } +#endif if (!DeleteAllOurAdapters(Pool, RebootRequired)) { diff --git a/api/api.vcxproj b/api/api.vcxproj index 5aeedc1..00a6266 100644 --- a/api/api.vcxproj +++ b/api/api.vcxproj @@ -1,162 +1,46 @@ <?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|ARM"> - <Configuration>Debug</Configuration> - <Platform>ARM</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|ARM64"> - <Configuration>Debug</Configuration> - <Platform>ARM64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|ARM"> - <Configuration>Release</Configuration> - <Platform>ARM</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|ARM64"> - <Configuration>Release</Configuration> - <Platform>ARM64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> <PropertyGroup Label="Globals"> - <VCProjectVersion>16.0</VCProjectVersion> <ProjectGuid>{897F02E3-3EAA-40AF-A6DC-17EB2376EDAF}</ProjectGuid> - <Keyword>Win32Proj</Keyword> <RootNamespace>api</RootNamespace> - <WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion> <ProjectName>api</ProjectName> </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> - <SpectreMitigation>false</SpectreMitigation> - <Driver_SpectreMitigation>false</Driver_SpectreMitigation> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration"> - <UseDebugLibraries>true</UseDebugLibraries> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration"> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Platform)'=='Win32'" Label="Configuration"> - <TargetVersion>Windows7</TargetVersion> - </PropertyGroup> - <PropertyGroup Condition="'$(Platform)'=='ARM'" Label="Configuration"> - <TargetVersion>Windows8</TargetVersion> - </PropertyGroup> - <PropertyGroup Condition="'$(Platform)'=='x64'" Label="Configuration"> - <TargetVersion>Windows7</TargetVersion> </PropertyGroup> - <PropertyGroup Condition="'$(Platform)'=='ARM64'" Label="Configuration"> - <TargetVersion>Windows10</TargetVersion> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Label="Shared"> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\wintun.props" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\wintun.props" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\wintun.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\wintun.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\wintun.props" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\wintun.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\wintun.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\wintun.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> + <Import Project="..\wintun.props" /> <PropertyGroup> - <OutDir>..\$(Configuration)\$(WintunPlatform)\</OutDir> - <IntDir>..\$(Configuration)\$(WintunPlatform)\$(ProjectName)-intermediate\</IntDir> <TargetName>wintun</TargetName> - <CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet> - <RunCodeAnalysis>true</RunCodeAnalysis> <IgnoreImportLibrary>true</IgnoreImportLibrary> </PropertyGroup> <ItemDefinitionGroup> <ClCompile> <PreprocessorDefinitions>_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions Condition="Exists('$(OutDir)whql\')">HAVE_WHQL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Platform)'=='Win32'">MAYBE_WOW64;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Platform)'=='x64'">ACCEPT_WOW64;MAYBE_WOW64;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Platform)'=='ARM'">MAYBE_WOW64;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Platform)'=='ARM64'">ACCEPT_WOW64;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalOptions>/volatile:iso %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4100;4201;$(DisableSpecificWarnings)</DisableSpecificWarnings> <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> <ResourceCompile> <AdditionalIncludeDirectories>..\$(Configuration)\$(WintunPlatform);..\$(Configuration);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions Condition="Exists('$(OutDir)whql\')">HAVE_WHQL;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <PreprocessorDefinitions Condition="'$(Platform)'=='Win32'">_M_IX86=600;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <PreprocessorDefinitions Condition="'$(Platform)'=='x64'">_M_AMD64=100;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <PreprocessorDefinitions Condition="'$(Platform)'=='ARM'">_M_ARM=7;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <PreprocessorDefinitions Condition="'$(Platform)'=='ARM64'">_M_ARM64=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="Exists('..\$(Configuration)\arm64\wintun.dll')">BUILT_ARM64_WOW64;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="Exists('..\$(Configuration)\amd64\wintun.dll')">BUILT_AMD64_WOW64;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Platform)'=='Win32'">WANT_ARM64_WOW64;WANT_AMD64_WOW64;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Platform)'=='x64'">WANT_ARM64_WOW64;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Platform)'=='ARM'">WANT_ARM64_WOW64;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> <Link> <DelayLoadDLLs>advapi32.dll;bcrypt.dll;crypt32.dll;cfgmgr32.dll;iphlpapi.dll;ole32.dll;nci.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll</DelayLoadDLLs> <AdditionalDependencies>Bcrypt.lib;Crypt32.lib;Cfgmgr32.lib;Iphlpapi.lib;$(IntDir)nci.lib;ntdll.lib;Setupapi.lib;shlwapi.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies> <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> <SubSystem>Windows</SubSystem> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'"> - <ClCompile> - <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - </ClCompile> - <ResourceCompile> - <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ResourceCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'"> - <ClCompile> - <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - </ClCompile> - <ResourceCompile> - <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ResourceCompile> - <Link> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> + <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary> </Link> </ItemDefinitionGroup> <ItemGroup> @@ -167,7 +51,7 @@ <None Include="nci.def" /> </ItemGroup> <ItemGroup> - <ClInclude Include="entry.h" /> + <ClInclude Include="main.h" /> <ClInclude Include="adapter.h" /> <ClInclude Include="rundll32_i.c"> <ExcludedFromBuild>true</ExcludedFromBuild> @@ -181,7 +65,7 @@ <ClInclude Include="wintun.h" /> </ItemGroup> <ItemGroup> - <ClCompile Include="entry.c" /> + <ClCompile Include="main.c" /> <ClCompile Include="adapter.c" /> <ClCompile Include="logger.c" /> <ClCompile Include="namespace.c" /> @@ -190,18 +74,14 @@ <ClCompile Include="session.c" /> <ClCompile Include="rundll32.c" /> </ItemGroup> + <Import Project="..\wintun.props.user" Condition="exists('..\wintun.props.user')" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> - <Import Project="..\wintun.vcxproj.user" Condition="exists('..\wintun.vcxproj.user')" /> + <ImportGroup Label="ExtensionTargets" /> <PropertyGroup> - <BuildDependsOn>$(BuildDependsOn);SignTarget</BuildDependsOn> - <CleanDependsOn>CleanInfVersion;CleanNci;CleanSignTarget;$(CleanDependsOn)</CleanDependsOn> - <SignTargetCommandLine Condition="$(SignMode)=='TestSign'">"$(SignToolPath)" sign /sha1 "$(TestCertificate)" /fd sha256 "$(TargetPath)"</SignTargetCommandLine> - <SignTargetCommandLine Condition="$(SignMode)=='ProductionSign'">"$(SignToolPath)" sign /sha1 "$(ProductionCertificate)" /fd sha256 /tr "$(TimeStampServer)" /td sha256 "$(TargetPath)"</SignTargetCommandLine> + <CleanDependsOn>CleanInfVersion;CleanNci;$(CleanDependsOn)</CleanDependsOn> </PropertyGroup> - <Target Name="BuildInfVersion" BeforeTargets="ClCompile" Inputs="$(OutDir)wintun\wintun.inf" Outputs="$(IntDir)wintun-inf.h"> - <Exec Command="cscript.exe /nologo "extract-driverver.js" < "$(OutDir)wintun\wintun.inf" > "$(IntDir)wintun-inf.h"" /> + <Target Name="BuildInfVersion" BeforeTargets="ClCompile" Inputs="$(OutDir)driver\wintun.inf" Outputs="$(IntDir)wintun-inf.h"> + <Exec Command="cscript.exe /nologo "extract-driverver.js" < "$(OutDir)driver\wintun.inf" > "$(IntDir)wintun-inf.h"" /> </Target> <Target Name="CleanInfVersion"> <Delete Files="$(IntDir)wintun-inf.h" /> @@ -213,11 +93,4 @@ <Target Name="CleanNci"> <Delete Files="$(IntDir)nci.obj;$(IntDir)nci.lib" /> </Target> - <Target Name="SignTarget" Condition="'$(SignTargetCommandLine)'!=''" Inputs="$(TargetPath)" Outputs="$(IntermediateOutputPath)$(TargetName).sign"> - <Exec Command="$(SignTargetCommandLine)" /> - <Touch Files="$(IntermediateOutputPath)$(TargetName).sign" AlwaysCreate="true" /> - </Target> - <Target Name="CleanSignTarget"> - <Delete Files="$(IntermediateOutputPath)$(TargetName).sign" /> - </Target> -</Project> +</Project>
\ No newline at end of file diff --git a/api/api.vcxproj.filters b/api/api.vcxproj.filters index 05c580d..9bcf3d5 100644 --- a/api/api.vcxproj.filters +++ b/api/api.vcxproj.filters @@ -49,7 +49,7 @@ <ClInclude Include="wintun.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="entry.h"> + <ClInclude Include="main.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="ntdll.h"> @@ -81,8 +81,8 @@ <ClCompile Include="session.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="entry.c"> + <ClCompile Include="main.c"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> -</Project> +</Project>
\ No newline at end of file diff --git a/api/logger.h b/api/logger.h index 3ffda6e..0ba4d55 100644 --- a/api/logger.h +++ b/api/logger.h @@ -6,7 +6,7 @@ #pragma once #include "wintun.h" -#include "entry.h" +#include "main.h" #include "registry.h" #include <Windows.h> #include <stdarg.h> @@ -4,7 +4,6 @@ */ #include "adapter.h" -#include "entry.h" #include "logger.h" #include "registry.h" #include "namespace.h" diff --git a/api/namespace.c b/api/namespace.c index aa8ffb4..8f1449a 100644 --- a/api/namespace.c +++ b/api/namespace.c @@ -3,8 +3,8 @@ * Copyright (C) 2018-2021 WireGuard LLC. All Rights Reserved. */ -#include "entry.h" #include "logger.h" +#include "main.h" #include "namespace.h" #include <Windows.h> diff --git a/api/registry.c b/api/registry.c index bf012e2..5da05e7 100644 --- a/api/registry.c +++ b/api/registry.c @@ -3,7 +3,6 @@ * Copyright (C) 2018-2021 WireGuard LLC. All Rights Reserved. */ -#include "entry.h" #include "logger.h" #include "registry.h" #include <Windows.h> diff --git a/api/resource.c b/api/resource.c index 9a7379c..ce590e1 100644 --- a/api/resource.c +++ b/api/resource.c @@ -3,8 +3,8 @@ * Copyright (C) 2018-2021 WireGuard LLC. All Rights Reserved. */ -#include "entry.h" #include "logger.h" +#include "main.h" #include "resource.h" #include <Windows.h> diff --git a/api/resources.rc b/api/resources.rc index 4186db8..aa61806 100644 --- a/api/resources.rc +++ b/api/resources.rc @@ -8,9 +8,9 @@ #pragma code_page(1252) -wintun.cat RCDATA "wintun\\wintun.cat" -wintun.inf RCDATA "wintun\\wintun.inf" -wintun.sys RCDATA "wintun\\wintun.sys" +wintun.cat RCDATA "driver\\wintun.cat" +wintun.inf RCDATA "driver\\wintun.inf" +wintun.sys RCDATA "driver\\wintun.sys" #ifdef HAVE_WHQL wintun-whql.cat RCDATA "whql\\wintun.cat" @@ -18,11 +18,19 @@ wintun-whql.inf RCDATA "whql\\wintun.inf" wintun-whql.sys RCDATA "whql\\wintun.sys" #endif -#if defined(_M_IX86) +#if defined(WANT_AMD64_WOW64) +# if defined(BUILT_AMD64_WOW64) wintun-amd64.dll RCDATA "amd64\\wintun.dll" +# else +# pragma message("AMD64 wintun.dll was not built, so this will not work from WOW64") +# endif #endif -#if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_ARM) +#if defined(WANT_ARM64_WOW64) +# if defined(BUILT_ARM64_WOW64) wintun-arm64.dll RCDATA "arm64\\wintun.dll" +# else +# pragma message("ARM64 wintun.dll was not built, so this will not work from WOW64") +# endif #endif #define STRINGIZE(x) #x diff --git a/api/rundll32.c b/api/rundll32.c index 80ada15..99b1b26 100644 --- a/api/rundll32.c +++ b/api/rundll32.c @@ -3,19 +3,17 @@ * Copyright (C) 2018-2021 WireGuard LLC. All Rights Reserved. */ -#include "entry.h" -#include <shellapi.h> - -#if ACCEPT_WOW64 == 1 +#include "adapter.h" +#include "logger.h" +#include "wintun.h" -# include "adapter.h" -# include "logger.h" -# include "wintun.h" +#include <Windows.h> +#include <shellapi.h> +#include <cfgmgr32.h> +#include <objbase.h> +#include <assert.h> -# include <Windows.h> -# include <cfgmgr32.h> -# include <objbase.h> -# include <assert.h> +#ifdef ACCEPT_WOW64 # define EXPORT comment(linker, "/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__) diff --git a/api/session.c b/api/session.c index 41c623f..ff158a8 100644 --- a/api/session.c +++ b/api/session.c @@ -4,8 +4,8 @@ */ #include "adapter.h" -#include "entry.h" #include "logger.h" +#include "main.h" #include "wintun.h" #include <Windows.h> #include <devioctl.h> diff --git a/driver/driver.vcxproj b/driver/driver.vcxproj index a2ecd00..b326e41 100644 --- a/driver/driver.vcxproj +++ b/driver/driver.vcxproj @@ -1,93 +1,18 @@ <?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|ARM"> - <Configuration>Debug</Configuration> - <Platform>ARM</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|ARM64"> - <Configuration>Debug</Configuration> - <Platform>ARM64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|ARM"> - <Configuration>Release</Configuration> - <Platform>ARM</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|ARM64"> - <Configuration>Release</Configuration> - <Platform>ARM64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGuid>{F7679B65-2FEC-469A-8BAC-B07BF4439422}</ProjectGuid> - <RootNamespace>wintun</RootNamespace> - <WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion> - <ProjectName>wintun</ProjectName> + <RootNamespace>driver</RootNamespace> + <ProjectName>driver</ProjectName> </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Label="Configuration"> <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> <ConfigurationType>Driver</ConfigurationType> <DriverType>WDM</DriverType> - <SpectreMitigation>false</SpectreMitigation> - <Driver_SpectreMitigation>false</Driver_SpectreMitigation> - <Inf2CatUseLocalTime>true</Inf2CatUseLocalTime> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration"> - <UseDebugLibraries>false</UseDebugLibraries> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration"> - <UseDebugLibraries>true</UseDebugLibraries> - </PropertyGroup> - <PropertyGroup Condition="'$(Platform)'=='Win32'" Label="Configuration"> - <TargetVersion>Windows7</TargetVersion> - </PropertyGroup> - <PropertyGroup Condition="'$(Platform)'=='ARM'" Label="Configuration"> - <TargetVersion>Windows8</TargetVersion> - </PropertyGroup> - <PropertyGroup Condition="'$(Platform)'=='x64'" Label="Configuration"> - <TargetVersion>Windows7</TargetVersion> </PropertyGroup> - <PropertyGroup Condition="'$(Platform)'=='ARM64'" Label="Configuration"> - <TargetVersion>Windows10</TargetVersion> - </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> <Import Project="..\wintun.props" /> - <PropertyGroup Label="UserMacros" /> <PropertyGroup> - <_ProjectFileVersion>15.0.28127.55</_ProjectFileVersion> - <IntDir>..\$(Configuration)\$(WintunPlatform)\$(ProjectName)-intermediate\</IntDir> - <OutDir>..\$(ConfigurationName)\$(WintunPlatform)\</OutDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)'=='Debug'"> - <RunCodeAnalysis>true</RunCodeAnalysis> - </PropertyGroup> - <PropertyGroup Condition="'$(RunCodeAnalysis)'=='true'"> - <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> - <ClCompile> - <EnablePREfast>true</EnablePREfast> - </ClCompile> + <TargetName>wintun</TargetName> </PropertyGroup> <ItemDefinitionGroup> <ClCompile> @@ -100,9 +25,6 @@ <Link> <AdditionalDependencies>ndis.lib;wdmsec.lib;%(AdditionalDependencies)</AdditionalDependencies> </Link> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'"> <Inf> @@ -122,12 +44,12 @@ </ItemGroup> <ItemGroup> <Inf Include="wintun.inf" /> - <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> + <FilesToPackage Include="$(TargetPath)" /> </ItemGroup> <ItemGroup> <ClInclude Include="undocumented.h" /> </ItemGroup> + <Import Project="..\wintun.props.user" Condition="exists('..\wintun.props.user')" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets" /> - <Import Project="..\wintun.vcxproj.user" Condition="exists('..\wintun.vcxproj.user')" /> </Project> diff --git a/example/example.c b/example/example.c index 9e5f2e8..54ea0ec 100644 --- a/example/example.c +++ b/example/example.c @@ -7,9 +7,11 @@ #include <Windows.h>
#include <ws2ipdef.h>
#include <iphlpapi.h>
+#include <mstcpip.h>
#include <ip2string.h>
#include <stdarg.h>
#include <stdio.h>
+#include <stdlib.h>
#include "wintun.h"
static WINTUN_CREATE_ADAPTER_FUNC WintunCreateAdapter;
diff --git a/example/example.vcxproj b/example/example.vcxproj index 3c8d8d1..3e5bb35 100644 --- a/example/example.vcxproj +++ b/example/example.vcxproj @@ -1,84 +1,16 @@ <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|ARM">
- <Configuration>Debug</Configuration>
- <Platform>ARM</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|ARM64">
- <Configuration>Debug</Configuration>
- <Platform>ARM64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|ARM">
- <Configuration>Release</Configuration>
- <Platform>ARM</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|ARM64">
- <Configuration>Release</Configuration>
- <Platform>ARM64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="example.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\api\api.vcxproj">
- <Project>{897f02e3-3eaa-40af-a6dc-17eb2376edaf}</Project>
- </ProjectReference>
- </ItemGroup>
<PropertyGroup Label="Globals">
- <VCProjectVersion>16.0</VCProjectVersion>
- <Keyword>Win32Proj</Keyword>
<ProjectGuid>{2abac503-245d-4f53-85c5-0f844def738b}</ProjectGuid>
<RootNamespace>example</RootNamespace>
- <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>example</ProjectName>
</PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
<PropertyGroup Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
- <PlatformToolset>v142</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- <SpectreMitigation>false</SpectreMitigation>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="Shared">
- </ImportGroup>
- <ImportGroup Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="..\wintun.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <OutDir>..\$(Configuration)\$(WintunPlatform)\</OutDir>
- <IntDir>..\$(Configuration)\$(WintunPlatform)\$(ProjectName)-intermediate\</IntDir>
- <CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
- <RunCodeAnalysis>true</RunCodeAnalysis>
+ <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
+ <TargetVersion>Windows10</TargetVersion>
</PropertyGroup>
+ <Import Project="..\wintun.props" />
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -87,32 +19,23 @@ <SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
- <ClCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
+ <ItemDefinitionGroup>
<ClCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <AdditionalIncludeDirectories>..\api</AdditionalIncludeDirectories>
</ClCompile>
<Link>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup>
- <Link>
<AdditionalDependencies>iphlpapi.lib;kernel32.lib;ntdll.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
- <ClCompile>
- <AdditionalIncludeDirectories>..\api</AdditionalIncludeDirectories>
- </ClCompile>
</ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="example.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\api\api.vcxproj">
+ <Project>{897f02e3-3eaa-40af-a6dc-17eb2376edaf}</Project>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="..\wintun.props.user" Condition="exists('..\wintun.props.user')" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file + <ImportGroup Label="ExtensionTargets" />
+</Project>
diff --git a/wintun.proj b/wintun.proj index 76e746e..a1cd244 100644 --- a/wintun.proj +++ b/wintun.proj @@ -13,9 +13,10 @@ General Properties --> <Import Project="wintun.props" /> - <Import Project="wintun.vcxproj.user" Condition="exists('wintun.vcxproj.user')" /> + <Import Project="wintun.props.user" Condition="exists('wintun.props.user')" /> - <Target Name="Build" DependsOnTargets="Driver-x86;Driver-amd64;Driver-arm;Driver-arm64" /> + <Target Name="Driver" DependsOnTargets="Driver-x86;Driver-amd64;Driver-arm;Driver-arm64" /> + <Target Name="Dll" DependsOnTargets="Dll-x86;Dll-amd64;Dll-arm;Dll-arm64" /> <Target Name="Clean"> <RemoveDir Directories="$(Configuration)\amd64\" /> <RemoveDir Directories="$(Configuration)\arm\" /> @@ -24,7 +25,6 @@ <RemoveDir Directories="driver\sdv\;dist\" /> <Delete Files="driver\smvbuild.log;driver\smvstats.txt;driver\wintun.DVL.XML" /> </Target> - <Target Name="Rebuild" DependsOnTargets="Clean;Build" /> <!-- Driver Building @@ -34,22 +34,22 @@ <DriverInputs>driver\undocumented.h;driver\wintun.c;driver\wintun.inf;wintun.props;driver\wintun.rc;driver\driver.vcxproj;$(DriverInputs)</DriverInputs> </PropertyGroup> <Target Name="Driver-x86" - Outputs="$(Configuration)\x86\wintun\wintun.sys;$(Configuration)\x86\wintun\wintun.inf;$(Configuration)\x86\wintun\wintun.cat" + Outputs="$(Configuration)\x86\driver\wintun.sys;$(Configuration)\x86\driver\wintun.inf;$(Configuration)\x86\driver\wintun.cat" Inputs="$(DriverInputs)"> <MSBuild Projects="driver\driver.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=Win32" /> </Target> <Target Name="Driver-amd64" - Outputs="$(Configuration)\amd64\wintun\wintun.sys;$(Configuration)\amd64\wintun\wintun.inf;$(Configuration)\amd64\wintun\wintun.cat" + Outputs="$(Configuration)\amd64\driver\wintun.sys;$(Configuration)\amd64\driver\wintun.inf;$(Configuration)\amd64\driver\wintun.cat" Inputs="$(DriverInputs)"> <MSBuild Projects="driver\driver.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=x64" /> </Target> <Target Name="Driver-arm" - Outputs="$(Configuration)\arm\wintun\wintun.sys;$(Configuration)\arm\wintun\wintun.inf;$(Configuration)\arm\wintun\wintun.cat" + Outputs="$(Configuration)\arm\driver\wintun.sys;$(Configuration)\arm\driver\wintun.inf;$(Configuration)\arm\driver\wintun.cat" Inputs="$(DriverInputs)"> <MSBuild Projects="driver\driver.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=ARM" /> </Target> <Target Name="Driver-arm64" - Outputs="$(Configuration)\arm64\wintun\wintun.sys;$(Configuration)\arm64\wintun\wintun.inf;$(Configuration)\arm64\wintun\wintun.cat" + Outputs="$(Configuration)\arm64\driver\wintun.sys;$(Configuration)\arm64\driver\wintun.inf;$(Configuration)\arm64\driver\wintun.cat" Inputs="$(DriverInputs)"> <MSBuild Projects="driver\driver.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=ARM64" /> </Target> @@ -102,7 +102,7 @@ --> <PropertyGroup> <ZipTargetPath>dist\wintun-$(WintunVersion).zip</ZipTargetPath> - <ZipIntDir>dist\.tmp\</ZipIntDir> + <ZipIntDir>dist\zip-intermediate\</ZipIntDir> </PropertyGroup> <ItemGroup> <ZipFilesSrc Include="prebuilt-binaries-license.txt" /><ZipFilesDst Include="$(ZipIntDir)wintun\LICENSE.txt" /> @@ -116,7 +116,7 @@ <Target Name="Zip" Inputs="@(ZipFilesSrc)" Outputs="$(ZipTargetPath)" - DependsOnTargets="Dll-x86;Dll-amd64;Dll-arm;Dll-arm64"> + DependsOnTargets="Dll"> <RemoveDir Directories="$(ZipIntDir)" /> <Copy SourceFiles="@(ZipFilesSrc)" DestinationFiles="@(ZipFilesDst)" /> <ZipDirectory DestinationFile="$(ZipTargetPath)" Overwrite="true" SourceDirectory="$(ZipIntDir)" /> diff --git a/wintun.props b/wintun.props index 21a3e73..05ede6a 100644 --- a/wintun.props +++ b/wintun.props @@ -5,6 +5,74 @@ Copyright (C) 2019 WireGuard LLC. All Rights Reserved. --> <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|ARM"> + <Configuration>Debug</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|ARM64"> + <Configuration>Debug</Configuration> + <Platform>ARM64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|ARM"> + <Configuration>Release</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|ARM64"> + <Configuration>Release</Configuration> + <Platform>ARM64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <VCProjectVersion>16.0</VCProjectVersion> + <WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Label="Configuration"> + <CharacterSet>Unicode</CharacterSet> + <Driver_SpectreMitigation>false</Driver_SpectreMitigation> + <Inf2CatUseLocalTime Condition="'$(ConfigurationType)'=='Driver'">true</Inf2CatUseLocalTime> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration"> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration"> + <UseDebugLibraries>true</UseDebugLibraries> + </PropertyGroup> + <PropertyGroup Condition="'$(Platform)'=='Win32'" Label="Configuration"> + <TargetVersion Condition="'$(TargetVersion)'==''">Windows7</TargetVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Platform)'=='ARM'" Label="Configuration"> + <TargetVersion Condition="'$(TargetVersion)'==''">Windows8</TargetVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Platform)'=='x64'" Label="Configuration"> + <TargetVersion Condition="'$(TargetVersion)'==''">Windows7</TargetVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Platform)'=='ARM64'" Label="Configuration"> + <TargetVersion Condition="'$(TargetVersion)'==''">Windows10</TargetVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings" /> + <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> <WintunVersionMaj>0</WintunVersionMaj> <WintunVersionMin>12</WintunVersionMin> @@ -19,6 +87,20 @@ <WintunPlatform Condition="'$(Platform)'=='ARM64'">arm64</WintunPlatform> <WintunPlatform Condition="'$(Platform)'=='Win32'">x86</WintunPlatform> <WintunPlatform Condition="'$(Platform)'=='x64'">amd64</WintunPlatform> + + <IntDir>..\$(Configuration)\$(WintunPlatform)\$(ProjectName)-intermediate\</IntDir> + <OutDir>..\$(Configuration)\$(WintunPlatform)\</OutDir> + <OutDir Condition="'$(ConfigurationType)'=='Driver'">$(IntDir)</OutDir> + <PackageDir>..\$(Configuration)\$(WintunPlatform)\$(ProjectName)\</PackageDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)'=='Debug'"> + <RunCodeAnalysis>true</RunCodeAnalysis> + </PropertyGroup> + <PropertyGroup Condition="'$(RunCodeAnalysis)'=='true'"> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> + <ClCompile> + <EnablePREfast>true</EnablePREfast> + </ClCompile> </PropertyGroup> <ItemDefinitionGroup> <ClCompile> @@ -28,6 +110,13 @@ <ResourceCompile> <PreprocessorDefinitions>WINTUN_VERSION_MAJ=$(WintunVersionMaj);WINTUN_VERSION_MIN=$(WintunVersionMin);WINTUN_VERSION_REL=$(WintunVersionRel);WINTUN_VERSION="$(WintunVersion)";%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> + <Link> + <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile> + <ProgramDatabaseFile Condition="'$(ConfigurationType)'=='Driver'">$(PackageDir)$(TargetName).pdb</ProgramDatabaseFile> + </Link> + <DriverSign> + <FileDigestAlgorithm>sha256</FileDigestAlgorithm> + </DriverSign> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'"> <ClCompile> @@ -35,18 +124,33 @@ <IntrinsicFunctions>true</IntrinsicFunctions> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> </ClCompile> + <Link> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> + </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'"> <ClCompile> <Optimization>Disabled</Optimization> </ClCompile> - <Link> - <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> - </Link> </ItemDefinitionGroup> - <PropertyGroup> - <WindowsSdkToolchainPlatform>$(PROCESSOR_ARCHITECTURE)</WindowsSdkToolchainPlatform> - <WindowsSdkToolchainPlatform Condition="'$(PROCESSOR_ARCHITECTURE)'=='AMD64'">x64</WindowsSdkToolchainPlatform> - <SignToolPath>$(WindowsSdkDir)bin\$(TargetPlatformVersion)\$(WindowsSdkToolchainPlatform)\signtool.exe</SignToolPath> - </PropertyGroup> + <ItemDefinitionGroup Condition="'$(PlatformToolset)|$(Configuration)'=='WindowsApplicationForDrivers10.0|Release'"> + <ClCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ResourceCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(PlatformToolset)|$(Configuration)'=='WindowsApplicationForDrivers10.0|Debug'"> + <ClCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ResourceCompile> + </ItemDefinitionGroup> </Project> @@ -5,12 +5,14 @@ MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example", "example\example.vcxproj", "{2ABAC503-245D-4F53-85C5-0F844DEF738B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "api", "api\api.vcxproj", "{897F02E3-3EAA-40AF-A6DC-17EB2376EDAF}" + ProjectSection(ProjectDependencies) = postProject + {F7679B65-2FEC-469A-8BAC-B07BF4439422} = {F7679B65-2FEC-469A-8BAC-B07BF4439422} + EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wintun", "driver\driver.vcxproj", "{F7679B65-2FEC-469A-8BAC-B07BF4439422}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "driver", "driver\driver.vcxproj", "{F7679B65-2FEC-469A-8BAC-B07BF4439422}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3A98F138-EE02-4488-B856-B3C48500BEA8}" ProjectSection(SolutionItems) = preProject - COPYING = COPYING README.md = README.md wintun.proj = wintun.proj wintun.props = wintun.props @@ -28,6 +30,22 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Debug|amd64.ActiveCfg = Debug|x64 + {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Debug|amd64.Build.0 = Debug|x64 + {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Debug|arm.ActiveCfg = Debug|ARM + {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Debug|arm.Build.0 = Debug|ARM + {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Debug|arm64.ActiveCfg = Debug|ARM64 + {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Debug|arm64.Build.0 = Debug|ARM64 + {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Debug|x86.ActiveCfg = Debug|Win32 + {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Debug|x86.Build.0 = Debug|Win32 + {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Release|amd64.ActiveCfg = Release|x64 + {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Release|amd64.Build.0 = Release|x64 + {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Release|arm.ActiveCfg = Release|ARM + {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Release|arm.Build.0 = Release|ARM + {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Release|arm64.ActiveCfg = Release|ARM64 + {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Release|arm64.Build.0 = Release|ARM64 + {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Release|x86.ActiveCfg = Release|Win32 + {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Release|x86.Build.0 = Release|Win32 {897F02E3-3EAA-40AF-A6DC-17EB2376EDAF}.Debug|amd64.ActiveCfg = Debug|x64 {897F02E3-3EAA-40AF-A6DC-17EB2376EDAF}.Debug|amd64.Build.0 = Debug|x64 {897F02E3-3EAA-40AF-A6DC-17EB2376EDAF}.Debug|arm.ActiveCfg = Debug|ARM @@ -60,22 +78,6 @@ Global {F7679B65-2FEC-469A-8BAC-B07BF4439422}.Release|arm64.Build.0 = Release|ARM64 {F7679B65-2FEC-469A-8BAC-B07BF4439422}.Release|x86.ActiveCfg = Release|Win32 {F7679B65-2FEC-469A-8BAC-B07BF4439422}.Release|x86.Build.0 = Release|Win32 - {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Debug|amd64.ActiveCfg = Debug|x64 - {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Debug|amd64.Build.0 = Debug|x64 - {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Debug|arm.ActiveCfg = Debug|ARM - {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Debug|arm.Build.0 = Debug|ARM - {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Debug|arm64.ActiveCfg = Debug|ARM64 - {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Debug|arm64.Build.0 = Debug|ARM64 - {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Debug|x86.ActiveCfg = Debug|Win32 - {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Debug|x86.Build.0 = Debug|Win32 - {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Release|amd64.ActiveCfg = Release|x64 - {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Release|amd64.Build.0 = Release|x64 - {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Release|arm.ActiveCfg = Release|ARM - {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Release|arm.Build.0 = Release|ARM - {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Release|arm64.ActiveCfg = Release|ARM64 - {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Release|arm64.Build.0 = Release|ARM64 - {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Release|x86.ActiveCfg = Release|Win32 - {2ABAC503-245D-4F53-85C5-0F844DEF738B}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE |