Commit Graph

29 Commits

Author SHA1 Message Date
Simon Rozman
b79703bba8 vcxproj: swap configuration and platform subfolder hierarchy
This should allow wintun.dll to simplify referencing same configuration
but different platform wintun.dll for WoW64 support.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:51:00 +01:00
Shawn Hoffman
9c39b2b567 Use standard volatile semantics
Make all archs are use the standardized concept of volatile.
This patch will cause the most changes to arm64 codegen.

Signed-off-by: Shawn Hoffman <godisgovernment@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-10-30 17:08:10 +01:00
Jason A. Donenfeld
c072f4f3c4 Explicitly opt-in to READ_ONCE/WRITE_ONCE semantics
We mark all atomic variables as volatile and have our atomic accessors
built around that. We probably, therefore, want Linux-style
READ/WRITE_ONCE semantics of implying memory barriers. /volatile:ms does
this automatically.

This was already the default on amd64 and x86 but not on ARM.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reported-by: Lev Stipakov <lstipakov@gmail.com>
2019-08-24 12:26:00 +00:00
Jason A. Donenfeld
28ba2d4600 Separate out atomic helpers
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-02 09:43:32 +00:00
Jason A. Donenfeld
22e2da002d Rewrite installer logic in C
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-02 09:43:32 +00:00
Jason A. Donenfeld
5239d53db0 Add handle closing ioctl
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-07-31 13:59:54 +00:00
Jason A. Donenfeld
58ce3c5000 Piggy-back on top of NDIS' device object instead of adding our own
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-07-18 10:34:38 +00:00
Simon Rozman
ca120aa1c0 Declare NDIS 6.83 compliant
After confirming with Microsoft Documentation that Wintun is already
NDIS 6.83 compliant, we declare it so.

In order to build NDIS 6.83 miniport driver, WDK for Windows 10, version
1903 is required: documentation updated.

https://docs.microsoft.com/en-us/windows-hardware/drivers/network/introduction-to-ndis-6-81
https://docs.microsoft.com/en-us/windows-hardware/drivers/network/introduction-to-ndis-6-82
https://docs.microsoft.com/en-us/windows-hardware/drivers/network/introduction-to-ndis-6-83

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-07-03 08:50:30 +00:00
Simon Rozman
de2c48db84 Make NDIS 6.80 compliant
Implement support for synchronous OID requests and declare the Wintun as
NDIS 6.80 compliant.

https://docs.microsoft.com/en-us/windows-hardware/drivers/network/introduction-to-ndis-6-80

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-07-03 08:50:30 +00:00
Simon Rozman
c394368e88 Declare NDIS 6.70 compliant
After confirming with Microsoft Documentation that Wintun is already
NDIS 6.70 compliant, we declare it so.

Furthermore, determine NDIS version bounds from NDISxxx_MINIPORT
automatically.

https://docs.microsoft.com/en-us/windows-hardware/drivers/network/introduction-to-ndis-6-40
https://docs.microsoft.com/en-us/windows-hardware/drivers/network/introduction-to-ndis-6-50
https://docs.microsoft.com/en-us/windows-hardware/drivers/network/introduction-to-ndis-6-60
https://docs.microsoft.com/en-us/windows-hardware/drivers/network/introduction-to-ndis-6-70

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-07-03 08:50:30 +00:00
Simon Rozman
85b4a769cf Replace PnP notifications with IRP_MJ_PNP dispatch handler
By replacing the NDIS' IRP_MJ_PNP dispatch handler we get the first
chance to clear the NBL queue to make NDIS proceed to TunPause() on
device removal.

This method is simpler than PnP notifications and we are chasing
surprise removal issues in WHLK tests. If this works, I'll hopefully
come back and update this commit message.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-06-20 11:54:58 +02:00
Simon Rozman
bbbe72ce84 Remove documentation files from project file
...they are part of solution now.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-06-07 13:05:57 +02:00
Jason A. Donenfeld
b6cc08d574 Force handles closed if required
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-06-03 10:53:11 +00:00
Jason A. Donenfeld
44ddfbe357 Clear NBLs on PnP notification
Otherwise Pause&Halt aren't called.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-06-03 10:53:11 +00:00
Jason A. Donenfeld
c0c1bae82e Turn on compiler speed options
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-06-03 12:47:05 +02:00
Simon Rozman
9f31f27840 Switch from NMake to MSBuild
This allows common version and other configuration in wintun.props.

- MSM packaging migrated to WiX MSBuild project and extended to support
  digital signing
- Building supports single Platform|Configuration per run - again :(
- wintun.vcxproj cleanup

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-19 15:25:44 +02:00
Simon Rozman
64ce036fb6 Preset version to 0.1
Revision (third) and build (fourth) fields were also dropped:
- NDIS_MINIPORT_DRIVER_CHARACTERISTICS supports only a.b
- MSI checks only a.b.c
- GPO compares only a.b when checking if the new MSI is an update

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-18 15:32:09 +02:00
Simon Rozman
f8a2923b93 Reintroduce Windows 7 support
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-16 16:11:24 +02:00
Simon Rozman
84f3c3e455 Add ARM64 compiling support
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-15 13:35:23 +02:00
Simon Rozman
afef39616c Revise architecture naming convention
Adopt PROCESSOR_ARCHITECTURE environment variable platform designation,
make it lowercase, and unify output folder naming.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-15 13:35:23 +02:00
Simon Rozman
6298787aa3 Establish command line building support
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-13 19:50:49 +02:00
Simon Rozman
5120529350 Fix output folder
The compiled result is put into $(SolutionDir)$(Platform)\
$(ConfigurationName) by default. Unfortunately Static Driver Verifier
sets the $(SolutionDir) without a trailing backslash, resulting some
files end up in a "wintunx64" folder of the project parent folder.

Until driver building and packaging is automated, the output folder has
been manually matched to the intermediate folder.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-12 15:35:38 +02:00
Simon Rozman
50a09cad71 Move #define NDIS... to ClCompile/PreprocessorDefinitions
These constants must be defined in the project file in order for Static
Driver Verifier to work correctly. Otherwise, SDV returns error MSB3073:
The command "staticdv /check:*" exited with code -1.

Since the ClCompile/PreprocessorDefinitions management became
cumbersome, all platform and configuration independent MSVC settings
were rearranged in a single <ItemDefinitionGroup>, while platform
independent but configuration dependent were rearranged to a conditional
<ItemDefinitionGroup>(s).

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-12 15:35:38 +02:00
Simon Rozman
4eb3c1f7c0 Enable code analysis on Release build and set it to DriverMustFixRules
Wintun will need to deliver code analysis results of Release build to
WHLK.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-12 15:35:38 +02:00
Simon Rozman
67ebf9fe4a Set UseDebugLibraries to true for debug driver builds
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-12 15:35:38 +02:00
Simon Rozman
58900a4841 Implement dynamic NDIS 6.30 detection
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-03 03:37:24 +02:00
Simon Rozman
55e911020e Add documentation files to the .vcxproj
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-03-28 14:30:44 +01:00
Simon Rozman
775386173c Enable better debugging support for Debug driver builds
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-03-22 16:52:31 -06:00
Jason A. Donenfeld
03479caf9d Initial commit
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-03-22 16:52:31 -06:00