Establish command line building support
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
207144965a
commit
6298787aa3
7
.gitignore
vendored
7
.gitignore
vendored
@ -9,10 +9,9 @@
|
|||||||
/x64/Debug
|
/x64/Debug
|
||||||
|
|
||||||
# Static Driver Verifier Output
|
# Static Driver Verifier Output
|
||||||
/runsdvui.cmd
|
|
||||||
/sdv
|
/sdv
|
||||||
/SDV-default.xml
|
|
||||||
/sdv-user.sdv
|
|
||||||
/smvbuild.log
|
/smvbuild.log
|
||||||
/smvexecute-*.log
|
|
||||||
/smvstats.txt
|
/smvstats.txt
|
||||||
|
|
||||||
|
# Driver Verification Log
|
||||||
|
/wintun.DVL.XML
|
||||||
|
41
Makefile
Normal file
41
Makefile
Normal file
@ -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
|
39
README.md
39
README.md
@ -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.
|
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
|
## 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:
|
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:
|
||||||
|
@ -85,21 +85,25 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
<CodeAnalysisRuleSet>$(WDKContentRoot)CodeAnalysis\DriverMustFixRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet>$(WDKContentRoot)CodeAnalysis\DriverMustFixRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<IntDir>$(ConfigurationName)\</IntDir>
|
||||||
<OutDir>$(ConfigurationName)\</OutDir>
|
<OutDir>$(ConfigurationName)\</OutDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<IntDir>$(ConfigurationName)\</IntDir>
|
||||||
<OutDir>$(ConfigurationName)\</OutDir>
|
<OutDir>$(ConfigurationName)\</OutDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
<CodeAnalysisRuleSet>$(WDKContentRoot)CodeAnalysis\DriverMustFixRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet>$(WDKContentRoot)CodeAnalysis\DriverMustFixRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<IntDir>$(Platform)\$(ConfigurationName)\</IntDir>
|
||||||
<OutDir>$(Platform)\$(ConfigurationName)\</OutDir>
|
<OutDir>$(Platform)\$(ConfigurationName)\</OutDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<IntDir>$(Platform)\$(ConfigurationName)\</IntDir>
|
||||||
<OutDir>$(Platform)\$(ConfigurationName)\</OutDir>
|
<OutDir>$(Platform)\$(ConfigurationName)\</OutDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user