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>
This commit is contained in:
Simon Rozman 2021-07-28 13:50:40 +02:00
parent 7de5d2e6c8
commit 7dffa4be72
18 changed files with 230 additions and 392 deletions

View File

@ -21,8 +21,8 @@
#include <devioctl.h> #include <devioctl.h>
#include "adapter.h" #include "adapter.h"
#include "entry.h"
#include "logger.h" #include "logger.h"
#include "main.h"
#include "namespace.h" #include "namespace.h"
#include "nci.h" #include "nci.h"
#include "ntdll.h" #include "ntdll.h"
@ -401,8 +401,7 @@ static _Return_type_success_(return != FALSE) BOOL
void void
AdapterInit(void) AdapterInit(void)
{ {
if (!MAYBE_WOW64) #ifdef MAYBE_WOW64
return;
typedef BOOL(WINAPI * IsWow64Process2_t)( typedef BOOL(WINAPI * IsWow64Process2_t)(
_In_ HANDLE hProcess, _Out_ USHORT * pProcessMachine, _Out_opt_ USHORT * pNativeMachine); _In_ HANDLE hProcess, _Out_ USHORT * pProcessMachine, _Out_opt_ USHORT * pNativeMachine);
HANDLE Kernel32; HANDLE Kernel32;
@ -416,6 +415,7 @@ AdapterInit(void)
NativeMachine = NativeMachine =
IsWow64Process(GetCurrentProcess(), &IsWoW64) && IsWoW64 ? IMAGE_FILE_MACHINE_AMD64 : IMAGE_FILE_PROCESS; IsWow64Process(GetCurrentProcess(), &IsWoW64) && IsWoW64 ? IMAGE_FILE_MACHINE_AMD64 : IMAGE_FILE_PROCESS;
} }
#endif
} }
static BOOL static BOOL
@ -905,9 +905,11 @@ IsWindows10(void)
static BOOL static BOOL
HaveWHQL(void) HaveWHQL(void)
{ {
if (HAVE_WHQL) #if defined(HAVE_WHQL)
return IsWindows10(); return IsWindows10();
#else
return FALSE; return FALSE;
#endif
} }
static _Return_type_success_(return != FALSE) BOOL InstallCertificate(_In_z_ const WCHAR *SignedResource) 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; *RebootRequired = FALSE;
DWORD LastError; DWORD LastError;
WINTUN_ADAPTER *Adapter; WINTUN_ADAPTER *Adapter;
if (MAYBE_WOW64 && NativeMachine != IMAGE_FILE_PROCESS) #ifdef MAYBE_WOW64
if (NativeMachine != IMAGE_FILE_PROCESS)
{ {
Adapter = CreateAdapterViaRundll32(Pool, Name, RequestedGUID, RebootRequired); Adapter = CreateAdapterViaRundll32(Pool, Name, RequestedGUID, RebootRequired);
LastError = Adapter ? ERROR_SUCCESS : GetLastError(); LastError = Adapter ? ERROR_SUCCESS : GetLastError();
goto cleanup; goto cleanup;
} }
#endif
Adapter = CreateAdapter(Pool, Name, RequestedGUID, RebootRequired); Adapter = CreateAdapter(Pool, Name, RequestedGUID, RebootRequired);
LastError = Adapter ? ERROR_SUCCESS : GetLastError(); LastError = Adapter ? ERROR_SUCCESS : GetLastError();
cleanup: cleanup:
@ -1800,12 +1804,14 @@ _Return_type_success_(return != FALSE) BOOL WINAPI WintunDeleteAdapter(
RebootRequired = &DummyRebootRequired; RebootRequired = &DummyRebootRequired;
*RebootRequired = FALSE; *RebootRequired = FALSE;
DWORD LastError; DWORD LastError;
if (MAYBE_WOW64 && NativeMachine != IMAGE_FILE_PROCESS) #ifdef MAYBE_WOW64
if (NativeMachine != IMAGE_FILE_PROCESS)
{ {
LastError = LastError =
DeleteAdapterViaRundll32(Adapter, ForceCloseSessions, RebootRequired) ? ERROR_SUCCESS : GetLastError(); DeleteAdapterViaRundll32(Adapter, ForceCloseSessions, RebootRequired) ? ERROR_SUCCESS : GetLastError();
goto cleanup; goto cleanup;
} }
#endif
HANDLE Mutex = NamespaceTakePoolMutex(Adapter->Pool); HANDLE Mutex = NamespaceTakePoolMutex(Adapter->Pool);
if (!Mutex) if (!Mutex)
@ -1916,11 +1922,13 @@ _Return_type_success_(return != FALSE) BOOL WINAPI
*RebootRequired = FALSE; *RebootRequired = FALSE;
DWORD LastError = ERROR_SUCCESS; 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(); LastError = DeletePoolDriverViaRundll32(Pool, RebootRequired) ? ERROR_SUCCESS : GetLastError();
goto cleanup; goto cleanup;
} }
#endif
if (!DeleteAllOurAdapters(Pool, RebootRequired)) if (!DeleteAllOurAdapters(Pool, RebootRequired))
{ {

View File

@ -1,162 +1,46 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <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"> <PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{897F02E3-3EAA-40AF-A6DC-17EB2376EDAF}</ProjectGuid> <ProjectGuid>{897F02E3-3EAA-40AF-A6DC-17EB2376EDAF}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>api</RootNamespace> <RootNamespace>api</RootNamespace>
<WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
<ProjectName>api</ProjectName> <ProjectName>api</ProjectName>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration"> <PropertyGroup Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
<SpectreMitigation>false</SpectreMitigation>
<Driver_SpectreMitigation>false</Driver_SpectreMitigation>
</PropertyGroup> </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" /> <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" />
<PropertyGroup> <PropertyGroup>
<OutDir>..\$(Configuration)\$(WintunPlatform)\</OutDir>
<IntDir>..\$(Configuration)\$(WintunPlatform)\$(ProjectName)-intermediate\</IntDir>
<TargetName>wintun</TargetName> <TargetName>wintun</TargetName>
<CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
<IgnoreImportLibrary>true</IgnoreImportLibrary> <IgnoreImportLibrary>true</IgnoreImportLibrary>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
<PreprocessorDefinitions>_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="Exists('$(OutDir)whql\')">HAVE_WHQL;%(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> <AdditionalOptions>/volatile:iso %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4100;4201;$(DisableSpecificWarnings)</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
<AdditionalIncludeDirectories>..\$(Configuration)\$(WintunPlatform);..\$(Configuration);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\$(Configuration)\$(WintunPlatform);..\$(Configuration);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="Exists('$(OutDir)whql\')">HAVE_WHQL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions Condition="Exists('$(OutDir)whql\')">HAVE_WHQL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='Win32'">_M_IX86=600;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions Condition="Exists('..\$(Configuration)\arm64\wintun.dll')">BUILT_ARM64_WOW64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='x64'">_M_AMD64=100;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions Condition="Exists('..\$(Configuration)\amd64\wintun.dll')">BUILT_AMD64_WOW64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='ARM'">_M_ARM=7;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions Condition="'$(Platform)'=='Win32'">WANT_ARM64_WOW64;WANT_AMD64_WOW64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='ARM64'">_M_ARM64=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions Condition="'$(Platform)'=='x64'">WANT_ARM64_WOW64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='ARM'">WANT_ARM64_WOW64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile> </ResourceCompile>
<Link> <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> <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> <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> <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
</Link> <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
</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>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
@ -167,7 +51,7 @@
<None Include="nci.def" /> <None Include="nci.def" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="entry.h" /> <ClInclude Include="main.h" />
<ClInclude Include="adapter.h" /> <ClInclude Include="adapter.h" />
<ClInclude Include="rundll32_i.c"> <ClInclude Include="rundll32_i.c">
<ExcludedFromBuild>true</ExcludedFromBuild> <ExcludedFromBuild>true</ExcludedFromBuild>
@ -181,7 +65,7 @@
<ClInclude Include="wintun.h" /> <ClInclude Include="wintun.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="entry.c" /> <ClCompile Include="main.c" />
<ClCompile Include="adapter.c" /> <ClCompile Include="adapter.c" />
<ClCompile Include="logger.c" /> <ClCompile Include="logger.c" />
<ClCompile Include="namespace.c" /> <ClCompile Include="namespace.c" />
@ -190,18 +74,14 @@
<ClCompile Include="session.c" /> <ClCompile Include="session.c" />
<ClCompile Include="rundll32.c" /> <ClCompile Include="rundll32.c" />
</ItemGroup> </ItemGroup>
<Import Project="..\wintun.props.user" Condition="exists('..\wintun.props.user')" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets" />
</ImportGroup>
<Import Project="..\wintun.vcxproj.user" Condition="exists('..\wintun.vcxproj.user')" />
<PropertyGroup> <PropertyGroup>
<BuildDependsOn>$(BuildDependsOn);SignTarget</BuildDependsOn> <CleanDependsOn>CleanInfVersion;CleanNci;$(CleanDependsOn)</CleanDependsOn>
<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>
</PropertyGroup> </PropertyGroup>
<Target Name="BuildInfVersion" BeforeTargets="ClCompile" Inputs="$(OutDir)wintun\wintun.inf" Outputs="$(IntDir)wintun-inf.h"> <Target Name="BuildInfVersion" BeforeTargets="ClCompile" Inputs="$(OutDir)driver\wintun.inf" Outputs="$(IntDir)wintun-inf.h">
<Exec Command="cscript.exe /nologo &quot;extract-driverver.js&quot; &lt; &quot;$(OutDir)wintun\wintun.inf&quot; &gt; &quot;$(IntDir)wintun-inf.h&quot;" /> <Exec Command="cscript.exe /nologo &quot;extract-driverver.js&quot; &lt; &quot;$(OutDir)driver\wintun.inf&quot; &gt; &quot;$(IntDir)wintun-inf.h&quot;" />
</Target> </Target>
<Target Name="CleanInfVersion"> <Target Name="CleanInfVersion">
<Delete Files="$(IntDir)wintun-inf.h" /> <Delete Files="$(IntDir)wintun-inf.h" />
@ -213,11 +93,4 @@
<Target Name="CleanNci"> <Target Name="CleanNci">
<Delete Files="$(IntDir)nci.obj;$(IntDir)nci.lib" /> <Delete Files="$(IntDir)nci.obj;$(IntDir)nci.lib" />
</Target> </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>

View File

@ -49,7 +49,7 @@
<ClInclude Include="wintun.h"> <ClInclude Include="wintun.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="entry.h"> <ClInclude Include="main.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="ntdll.h"> <ClInclude Include="ntdll.h">
@ -81,7 +81,7 @@
<ClCompile Include="session.c"> <ClCompile Include="session.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="entry.c"> <ClCompile Include="main.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>

View File

@ -6,7 +6,7 @@
#pragma once #pragma once
#include "wintun.h" #include "wintun.h"
#include "entry.h" #include "main.h"
#include "registry.h" #include "registry.h"
#include <Windows.h> #include <Windows.h>
#include <stdarg.h> #include <stdarg.h>

View File

@ -4,7 +4,6 @@
*/ */
#include "adapter.h" #include "adapter.h"
#include "entry.h"
#include "logger.h" #include "logger.h"
#include "registry.h" #include "registry.h"
#include "namespace.h" #include "namespace.h"

View File

@ -3,8 +3,8 @@
* Copyright (C) 2018-2021 WireGuard LLC. All Rights Reserved. * Copyright (C) 2018-2021 WireGuard LLC. All Rights Reserved.
*/ */
#include "entry.h"
#include "logger.h" #include "logger.h"
#include "main.h"
#include "namespace.h" #include "namespace.h"
#include <Windows.h> #include <Windows.h>

View File

@ -3,7 +3,6 @@
* Copyright (C) 2018-2021 WireGuard LLC. All Rights Reserved. * Copyright (C) 2018-2021 WireGuard LLC. All Rights Reserved.
*/ */
#include "entry.h"
#include "logger.h" #include "logger.h"
#include "registry.h" #include "registry.h"
#include <Windows.h> #include <Windows.h>

View File

@ -3,8 +3,8 @@
* Copyright (C) 2018-2021 WireGuard LLC. All Rights Reserved. * Copyright (C) 2018-2021 WireGuard LLC. All Rights Reserved.
*/ */
#include "entry.h"
#include "logger.h" #include "logger.h"
#include "main.h"
#include "resource.h" #include "resource.h"
#include <Windows.h> #include <Windows.h>

View File

@ -8,9 +8,9 @@
#pragma code_page(1252) #pragma code_page(1252)
wintun.cat RCDATA "wintun\\wintun.cat" wintun.cat RCDATA "driver\\wintun.cat"
wintun.inf RCDATA "wintun\\wintun.inf" wintun.inf RCDATA "driver\\wintun.inf"
wintun.sys RCDATA "wintun\\wintun.sys" wintun.sys RCDATA "driver\\wintun.sys"
#ifdef HAVE_WHQL #ifdef HAVE_WHQL
wintun-whql.cat RCDATA "whql\\wintun.cat" 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" wintun-whql.sys RCDATA "whql\\wintun.sys"
#endif #endif
#if defined(_M_IX86) #if defined(WANT_AMD64_WOW64)
# if defined(BUILT_AMD64_WOW64)
wintun-amd64.dll RCDATA "amd64\\wintun.dll" 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 #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" 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 #endif
#define STRINGIZE(x) #x #define STRINGIZE(x) #x

View File

@ -3,19 +3,17 @@
* Copyright (C) 2018-2021 WireGuard LLC. All Rights Reserved. * Copyright (C) 2018-2021 WireGuard LLC. All Rights Reserved.
*/ */
#include "entry.h" #include "adapter.h"
#include "logger.h"
#include "wintun.h"
#include <Windows.h>
#include <shellapi.h> #include <shellapi.h>
#include <cfgmgr32.h>
#include <objbase.h>
#include <assert.h>
#if ACCEPT_WOW64 == 1 #ifdef ACCEPT_WOW64
# include "adapter.h"
# include "logger.h"
# include "wintun.h"
# include <Windows.h>
# include <cfgmgr32.h>
# include <objbase.h>
# include <assert.h>
# define EXPORT comment(linker, "/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__) # define EXPORT comment(linker, "/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__)

View File

@ -4,8 +4,8 @@
*/ */
#include "adapter.h" #include "adapter.h"
#include "entry.h"
#include "logger.h" #include "logger.h"
#include "main.h"
#include "wintun.h" #include "wintun.h"
#include <Windows.h> #include <Windows.h>
#include <devioctl.h> #include <devioctl.h>

View File

@ -1,93 +1,18 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <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"> <PropertyGroup Label="Globals">
<ProjectGuid>{F7679B65-2FEC-469A-8BAC-B07BF4439422}</ProjectGuid> <ProjectGuid>{F7679B65-2FEC-469A-8BAC-B07BF4439422}</ProjectGuid>
<RootNamespace>wintun</RootNamespace> <RootNamespace>driver</RootNamespace>
<WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion> <ProjectName>driver</ProjectName>
<ProjectName>wintun</ProjectName>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration"> <PropertyGroup Label="Configuration">
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType> <ConfigurationType>Driver</ConfigurationType>
<DriverType>WDM</DriverType> <DriverType>WDM</DriverType>
<SpectreMitigation>false</SpectreMitigation>
<Driver_SpectreMitigation>false</Driver_SpectreMitigation>
<Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>
</PropertyGroup> </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" /> <Import Project="..\wintun.props" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup> <PropertyGroup>
<_ProjectFileVersion>15.0.28127.55</_ProjectFileVersion> <TargetName>wintun</TargetName>
<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>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
@ -100,9 +25,6 @@
<Link> <Link>
<AdditionalDependencies>ndis.lib;wdmsec.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>ndis.lib;wdmsec.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
<DriverSign>
<FileDigestAlgorithm>sha256</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'"> <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<Inf> <Inf>
@ -122,12 +44,12 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Inf Include="wintun.inf" /> <Inf Include="wintun.inf" />
<FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> <FilesToPackage Include="$(TargetPath)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="undocumented.h" /> <ClInclude Include="undocumented.h" />
</ItemGroup> </ItemGroup>
<Import Project="..\wintun.props.user" Condition="exists('..\wintun.props.user')" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" /> <ImportGroup Label="ExtensionTargets" />
<Import Project="..\wintun.vcxproj.user" Condition="exists('..\wintun.vcxproj.user')" />
</Project> </Project>

View File

@ -7,9 +7,11 @@
#include <Windows.h> #include <Windows.h>
#include <ws2ipdef.h> #include <ws2ipdef.h>
#include <iphlpapi.h> #include <iphlpapi.h>
#include <mstcpip.h>
#include <ip2string.h> #include <ip2string.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include "wintun.h" #include "wintun.h"
static WINTUN_CREATE_ADAPTER_FUNC WintunCreateAdapter; static WINTUN_CREATE_ADAPTER_FUNC WintunCreateAdapter;

View File

@ -1,84 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <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"> <PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{2abac503-245d-4f53-85c5-0f844def738b}</ProjectGuid> <ProjectGuid>{2abac503-245d-4f53-85c5-0f844def738b}</ProjectGuid>
<RootNamespace>example</RootNamespace> <RootNamespace>example</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>example</ProjectName> <ProjectName>example</ProjectName>
</PropertyGroup> </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"> <PropertyGroup Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <TargetVersion>Windows10</TargetVersion>
<SpectreMitigation>false</SpectreMitigation>
</PropertyGroup> </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" /> <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>
</PropertyGroup>
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
<PreprocessorDefinitions>_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -87,32 +19,23 @@
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup> <ItemDefinitionGroup>
<Link>
<AdditionalDependencies>iphlpapi.lib;kernel32.lib;ntdll.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>..\api</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\api</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link>
<AdditionalDependencies>iphlpapi.lib;kernel32.lib;ntdll.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup> </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" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets" />
</ImportGroup>
</Project> </Project>

View File

@ -13,9 +13,10 @@
General Properties General Properties
--> -->
<Import Project="wintun.props" /> <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"> <Target Name="Clean">
<RemoveDir Directories="$(Configuration)\amd64\" /> <RemoveDir Directories="$(Configuration)\amd64\" />
<RemoveDir Directories="$(Configuration)\arm\" /> <RemoveDir Directories="$(Configuration)\arm\" />
@ -24,7 +25,6 @@
<RemoveDir Directories="driver\sdv\;dist\" /> <RemoveDir Directories="driver\sdv\;dist\" />
<Delete Files="driver\smvbuild.log;driver\smvstats.txt;driver\wintun.DVL.XML" /> <Delete Files="driver\smvbuild.log;driver\smvstats.txt;driver\wintun.DVL.XML" />
</Target> </Target>
<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
<!-- <!--
Driver Building 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> <DriverInputs>driver\undocumented.h;driver\wintun.c;driver\wintun.inf;wintun.props;driver\wintun.rc;driver\driver.vcxproj;$(DriverInputs)</DriverInputs>
</PropertyGroup> </PropertyGroup>
<Target Name="Driver-x86" <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)"> Inputs="$(DriverInputs)">
<MSBuild Projects="driver\driver.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=Win32" /> <MSBuild Projects="driver\driver.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=Win32" />
</Target> </Target>
<Target Name="Driver-amd64" <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)"> Inputs="$(DriverInputs)">
<MSBuild Projects="driver\driver.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=x64" /> <MSBuild Projects="driver\driver.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=x64" />
</Target> </Target>
<Target Name="Driver-arm" <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)"> Inputs="$(DriverInputs)">
<MSBuild Projects="driver\driver.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=ARM" /> <MSBuild Projects="driver\driver.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=ARM" />
</Target> </Target>
<Target Name="Driver-arm64" <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)"> Inputs="$(DriverInputs)">
<MSBuild Projects="driver\driver.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=ARM64" /> <MSBuild Projects="driver\driver.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=ARM64" />
</Target> </Target>
@ -102,7 +102,7 @@
--> -->
<PropertyGroup> <PropertyGroup>
<ZipTargetPath>dist\wintun-$(WintunVersion).zip</ZipTargetPath> <ZipTargetPath>dist\wintun-$(WintunVersion).zip</ZipTargetPath>
<ZipIntDir>dist\.tmp\</ZipIntDir> <ZipIntDir>dist\zip-intermediate\</ZipIntDir>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ZipFilesSrc Include="prebuilt-binaries-license.txt" /><ZipFilesDst Include="$(ZipIntDir)wintun\LICENSE.txt" /> <ZipFilesSrc Include="prebuilt-binaries-license.txt" /><ZipFilesDst Include="$(ZipIntDir)wintun\LICENSE.txt" />
@ -116,7 +116,7 @@
<Target Name="Zip" <Target Name="Zip"
Inputs="@(ZipFilesSrc)" Inputs="@(ZipFilesSrc)"
Outputs="$(ZipTargetPath)" Outputs="$(ZipTargetPath)"
DependsOnTargets="Dll-x86;Dll-amd64;Dll-arm;Dll-arm64"> DependsOnTargets="Dll">
<RemoveDir Directories="$(ZipIntDir)" /> <RemoveDir Directories="$(ZipIntDir)" />
<Copy SourceFiles="@(ZipFilesSrc)" DestinationFiles="@(ZipFilesDst)" /> <Copy SourceFiles="@(ZipFilesSrc)" DestinationFiles="@(ZipFilesDst)" />
<ZipDirectory DestinationFile="$(ZipTargetPath)" Overwrite="true" SourceDirectory="$(ZipIntDir)" /> <ZipDirectory DestinationFile="$(ZipTargetPath)" Overwrite="true" SourceDirectory="$(ZipIntDir)" />

View File

@ -5,6 +5,74 @@
Copyright (C) 2019 WireGuard LLC. All Rights Reserved. Copyright (C) 2019 WireGuard LLC. All Rights Reserved.
--> -->
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <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> <PropertyGroup>
<WintunVersionMaj>0</WintunVersionMaj> <WintunVersionMaj>0</WintunVersionMaj>
<WintunVersionMin>12</WintunVersionMin> <WintunVersionMin>12</WintunVersionMin>
@ -19,6 +87,20 @@
<WintunPlatform Condition="'$(Platform)'=='ARM64'">arm64</WintunPlatform> <WintunPlatform Condition="'$(Platform)'=='ARM64'">arm64</WintunPlatform>
<WintunPlatform Condition="'$(Platform)'=='Win32'">x86</WintunPlatform> <WintunPlatform Condition="'$(Platform)'=='Win32'">x86</WintunPlatform>
<WintunPlatform Condition="'$(Platform)'=='x64'">amd64</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> </PropertyGroup>
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
@ -28,6 +110,13 @@
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>WINTUN_VERSION_MAJ=$(WintunVersionMaj);WINTUN_VERSION_MIN=$(WintunVersionMin);WINTUN_VERSION_REL=$(WintunVersionRel);WINTUN_VERSION="$(WintunVersion)";%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WINTUN_VERSION_MAJ=$(WintunVersionMaj);WINTUN_VERSION_MIN=$(WintunVersionMin);WINTUN_VERSION_REL=$(WintunVersionRel);WINTUN_VERSION="$(WintunVersion)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile> </ResourceCompile>
<Link>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<ProgramDatabaseFile Condition="'$(ConfigurationType)'=='Driver'">$(PackageDir)$(TargetName).pdb</ProgramDatabaseFile>
</Link>
<DriverSign>
<FileDigestAlgorithm>sha256</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'"> <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile> <ClCompile>
@ -35,18 +124,33 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile> </ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'"> <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
</ClCompile> </ClCompile>
<Link>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
</Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<PropertyGroup> <ItemDefinitionGroup Condition="'$(PlatformToolset)|$(Configuration)'=='WindowsApplicationForDrivers10.0|Release'">
<WindowsSdkToolchainPlatform>$(PROCESSOR_ARCHITECTURE)</WindowsSdkToolchainPlatform> <ClCompile>
<WindowsSdkToolchainPlatform Condition="'$(PROCESSOR_ARCHITECTURE)'=='AMD64'">x64</WindowsSdkToolchainPlatform> <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SignToolPath>$(WindowsSdkDir)bin\$(TargetPlatformVersion)\$(WindowsSdkToolchainPlatform)\signtool.exe</SignToolPath> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</PropertyGroup> </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> </Project>

View File

@ -5,12 +5,14 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example", "example\example.vcxproj", "{2ABAC503-245D-4F53-85C5-0F844DEF738B}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example", "example\example.vcxproj", "{2ABAC503-245D-4F53-85C5-0F844DEF738B}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "api", "api\api.vcxproj", "{897F02E3-3EAA-40AF-A6DC-17EB2376EDAF}" 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 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 EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3A98F138-EE02-4488-B856-B3C48500BEA8}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3A98F138-EE02-4488-B856-B3C48500BEA8}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
COPYING = COPYING
README.md = README.md README.md = README.md
wintun.proj = wintun.proj wintun.proj = wintun.proj
wintun.props = wintun.props wintun.props = wintun.props
@ -28,6 +30,22 @@ Global
Release|x86 = Release|x86 Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution 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.ActiveCfg = Debug|x64
{897F02E3-3EAA-40AF-A6DC-17EB2376EDAF}.Debug|amd64.Build.0 = Debug|x64 {897F02E3-3EAA-40AF-A6DC-17EB2376EDAF}.Debug|amd64.Build.0 = Debug|x64
{897F02E3-3EAA-40AF-A6DC-17EB2376EDAF}.Debug|arm.ActiveCfg = Debug|ARM {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|arm64.Build.0 = Release|ARM64
{F7679B65-2FEC-469A-8BAC-B07BF4439422}.Release|x86.ActiveCfg = Release|Win32 {F7679B65-2FEC-469A-8BAC-B07BF4439422}.Release|x86.ActiveCfg = Release|Win32
{F7679B65-2FEC-469A-8BAC-B07BF4439422}.Release|x86.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE