diff options
author | Simon Rozman <simon@rozman.si> | 2019-04-13 19:15:23 +0200 |
---|---|---|
committer | Simon Rozman <simon@rozman.si> | 2019-04-13 19:50:49 +0200 |
commit | 6298787aa39c956f53c43c5e8b58e1466195dee7 (patch) | |
tree | 274da5a0e04ea15d6dfef1a01d69c4639184c9b4 | |
parent | Revise OID request return statuses (diff) | |
download | wintun-6298787aa39c956f53c43c5e8b58e1466195dee7.tar.xz wintun-6298787aa39c956f53c43c5e8b58e1466195dee7.zip |
Establish command line building support
Signed-off-by: Simon Rozman <simon@rozman.si>
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | Makefile | 41 | ||||
-rw-r--r-- | README.md | 39 | ||||
-rw-r--r-- | wintun.vcxproj | 4 |
4 files changed, 87 insertions, 4 deletions
@@ -9,10 +9,9 @@ /x64/Debug # Static Driver Verifier Output -/runsdvui.cmd /sdv -/SDV-default.xml -/sdv-user.sdv /smvbuild.log -/smvexecute-*.log /smvstats.txt + +# Driver Verification Log +/wintun.DVL.XML diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..66b04e2 --- /dev/null +++ b/Makefile @@ -0,0 +1,41 @@ +# +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (C) 2018-2019 WireGuard LLC. All Rights Reserved. +# + +!IFNDEF CFG +CFG=Release +!ENDIF +!IFNDEF PLAT +PLAT=x64 +!ENDIF +!IF "$(PLAT)" == "Win32" +OUTPUT_DIR=$(CFG) +!ELSE +OUTPUT_DIR=$(PLAT)\$(CFG) +!ENDIF +MSBUILD_FLAGS=/p:Configuration="$(CFG)" /p:Platform="$(PLAT)" /m /v:minimal /nologo + +build :: + msbuild.exe "wintun.vcxproj" /t:Build $(MSBUILD_FLAGS) + +clean :: + msbuild.exe "wintun.vcxproj" /t:Clean $(MSBUILD_FLAGS) + +!IF "$(CFG)" == "Release" + +dvl :: "wintun.DVL.XML" + +clean :: + msbuild.exe "wintun.vcxproj" /t:sdv /p:Inputs="/clean" $(MSBUILD_FLAGS) + -if exist "wintun.DVL.XML" del /f /q "wintun.DVL.XML" + -if exist "smvstats.txt" del /f /q "smvstats.txt" + +"sdv\SDV.DVL.xml" "$(OUTPUT_DIR)\vc.nativecodeanalysis.all.xml" : + msbuild.exe "wintun.vcxproj" /t:sdv /p:Inputs="/check:*" $(MSBUILD_FLAGS) + +"wintun.DVL.XML" : "sdv\SDV.DVL.xml" "$(OUTPUT_DIR)\vc.nativecodeanalysis.all.xml" + msbuild.exe "wintun.vcxproj" /t:dvl $(MSBUILD_FLAGS) + +!ENDIF @@ -30,6 +30,45 @@ Modify the `<CrossCertificateFile>` to contain the full path to the cross-signin If you already have `wintun.vcxproj.user` file, just add the `<PropertyGroup>` section. + +## Building from Command Line + +Open _Developer Command Prompt for VS 2017_ and use `nmake` command: + +``` +nmake [<target>] [CFG=<configuration>] [PLAT=<platform>] +``` + +### Targets + +`build` + Builds the driver. This is the default target. + +`clean` + Deletes all intermediate and output files. + +`dvl` + Runs Static Driver Verifier, which includes a clean driver build, and creates a Driver Verification Log in `wintun.DVL.XML` file. Release configurations only. When you are ready to test your driver using the Windows Hardware Certification Kit (HCK), you need to copy the `wintun.DVL.XML` file to the `%SystemDrive%\DVL` directory on the test computer. + +The driver output folder is: +| Platform and Configuration | Folder | +| -------------------------- | -------------------- | +| x86 Debug | `Debug\wintun` | +| x86 Release | `Release\wintun` | +| AMD64 Debug | `x64\Debug\wintun` | +| AMD64 Release | `x64\Release\wintun` | + +### Properties + +Properties may be defined as environment variables, or specified on the `nmake` command line. + +`CFG` + Specifies configuration to build or clean. May be `Debug` or `Release` (default). + +`PLAT` + Specifies driver platform to build. May be `Win32` or `x64` (default). + + ## Usage After loading the driver and creating a network interface the typical way using [SetupAPI](https://docs.microsoft.com/en-us/windows-hardware/drivers/install/setupapi), open `\\.\Device\WINTUN%d` as Local System, where `%d` is the [LUID](https://docs.microsoft.com/en-us/windows/desktop/api/ifdef/ns-ifdef-_net_luid_lh) index (`NetLuidIndex` member) of the network device. You may then [`ReadFile`](https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-readfile) and [`WriteFile`](https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-writefile) bundles of packets of the following format: diff --git a/wintun.vcxproj b/wintun.vcxproj index acafbc2..448d30d 100644 --- a/wintun.vcxproj +++ b/wintun.vcxproj @@ -85,21 +85,25 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <RunCodeAnalysis>true</RunCodeAnalysis> <CodeAnalysisRuleSet>$(WDKContentRoot)CodeAnalysis\DriverMustFixRules.ruleset</CodeAnalysisRuleSet> + <IntDir>$(ConfigurationName)\</IntDir> <OutDir>$(ConfigurationName)\</OutDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <RunCodeAnalysis>true</RunCodeAnalysis> <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> + <IntDir>$(ConfigurationName)\</IntDir> <OutDir>$(ConfigurationName)\</OutDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <RunCodeAnalysis>true</RunCodeAnalysis> <CodeAnalysisRuleSet>$(WDKContentRoot)CodeAnalysis\DriverMustFixRules.ruleset</CodeAnalysisRuleSet> + <IntDir>$(Platform)\$(ConfigurationName)\</IntDir> <OutDir>$(Platform)\$(ConfigurationName)\</OutDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <RunCodeAnalysis>true</RunCodeAnalysis> <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> + <IntDir>$(Platform)\$(ConfigurationName)\</IntDir> <OutDir>$(Platform)\$(ConfigurationName)\</OutDir> </PropertyGroup> <ItemDefinitionGroup> |