Commit Graph

100 Commits

Author SHA1 Message Date
Simon Rozman
6c3084c53c Quote platform names
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-26 13:44:44 +02:00
Simon Rozman
95c5503027 Prevent WoW64 installations
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-26 09:38:42 +02:00
Jason A. Donenfeld
f2c3720aa7 README: only specify SHA1 in certificate specifier
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-04-25 08:05:19 +02:00
Jason A. Donenfeld
66525255d0 README: Be explicit about timestamp server
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-04-25 07:56:16 +02:00
Simon Rozman
eb16ea534d De-haiku wintun.proj
No need for breaking every XML tag with attributes into lines - besides,
we're imposing 2-space indentation on .proj files making lines even
shorter and indentation combined with excessive line breaking harder to
follow visually.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-23 13:32:19 +02:00
Simon Rozman
56424d52f7 Extend MSBuild project to build all supported platforms at once
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-23 13:32:18 +02:00
Jason A. Donenfeld
daba4f4c7d README: fix up documentation 2019-04-20 11:37:09 +09:00
Simon Rozman
38f44fe46c MSM: Migrate WiX command line options to appropriate ItemGroups
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-19 21:24:08 +02:00
Simon Rozman
532156de82 MSM: Fix digital signing of output files
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-19 21:24:08 +02:00
Simon Rozman
a979361217 MSM: Install driver files to C:\Program Files\Wintun
This is temporary until we figure out how to use WiX's Difx to install
driver without leaving staged driver files behind.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-19 21:24:08 +02:00
Simon Rozman
13183d8ac6 Add missing dependencies
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-19 21:24:08 +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
Jason A. Donenfeld
6f38514280 Makefile: use more standard output filenames for msm
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-04-19 08:04:44 +09: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
e4f4d71477 Make Makefile build all supported platforms
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-18 15:32:09 +02:00
Simon Rozman
cd34b73893 Move MSM files to a distribution folder
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-18 15:32:09 +02:00
Simon Rozman
6efdb3a317 Add version and platform designation to wintun.msm filenames
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-18 15:32:08 +02:00
Simon Rozman
50b9e241d4 Stop producing wixpdb
We do not plan to distribute them.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-18 15:32:08 +02:00
Simon Rozman
18a9219507 Remove smvbuild.log on clean
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-18 15:32:08 +02:00
Simon Rozman
04ccd6744c Nuke output folder on clean
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-18 15:32:08 +02:00
Simon Rozman
c223393e7c Cleanup clean target
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-17 15:39:51 +02:00
Simon Rozman
bfa3b3f6cc MSM: Explicitly version driver files
wintun.inf and wintun.cat have no version resource. WiX linker cannot
determine their versions and the MSM will use file sizes and hashes for
update logic. By setting explicit file version and language, the version
will always be used to determine which version is newer on updates.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-17 15:39:51 +02:00
Simon Rozman
361dd60a04 MSM: Mark package as read-only
Thou, this serves as a hint only and provides no real enforcement.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-17 15:39:51 +02:00
Simon Rozman
baba7bb6d0 MSM: Mark package to require elevated and per-machine install
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-17 15:39:51 +02:00
Simon Rozman
1ec2a54a5c MSM: Mark module as language-independent
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-17 15:39:50 +02:00
Simon Rozman
1031ad44da Add MSM packaging support
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-16 16:11:24 +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
Jason A. Donenfeld
82655e6e0e Fixup readme markdown formatting
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-04-14 08:48:00 +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
207144965a Revise OID request return statuses
MINIPORT_OID_REQUEST handler should return:
- NDIS_STATUS_NOT_SUPPORTED => NDIS_STATUS_INVALID_OID if the OID
  request was not recognized.
- NDIS_STATUS_INVALID_OID => NDIS_STATUS_NOT_SUPPORTED if particular OID
  is not supported.
- NDIS_STATUS_INVALID_LENGTH => NDIS_STATUS_BUFFER_TOO_SHORT if output
  buffer is too short.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-12 15:35:39 +02:00
Simon Rozman
207e1c4896 Assist SDV in realizing that non-NULL IRP => non-NULL buffer
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-12 15:35:39 +02:00
Simon Rozman
4c47c2fbbf TunCanFitIntoIrp => TunWontFitIntoIrp
The function name was inverted and misleading.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-12 15:35:39 +02:00
Simon Rozman
366e8f1eef .gitignore Static Driver Verifier output
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-12 15:35:38 +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
9cda719d85 Fix indentation
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-12 08:09:33 +02:00
Simon Rozman
d9831a9197 InterlockedAdd/Subtract(val, 1) => InterlockedIncrement/Decrement(val)
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-12 08:09:33 +02:00
Simon Rozman
1770ac146d Wait for handles to close before returning from TunHaltEx()
This allows Windows to unload the driver from memory when the last
adapter is halted. Hence driver can be updated without a reboot.

Unfortunately, a client refusing to close device pipe handle can block
adapter halting indefinitely. So, we now have a new challenge to
address.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-11 19:30:23 +02:00
Simon Rozman
ca79fd1368 Revise I/O errors
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-11 19:30:23 +02:00
Simon Rozman
d3cc0570de Initialize ActiveTransactionCount to 1
This always sets the reference counter to predictable state on resume
and eliminates the need to bump it on pausing.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-11 19:30:23 +02:00
Simon Rozman
5cecd1536c Clean excessive miniport adapter state checks
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-11 14:08:20 +02:00
Simon Rozman
6d230d616e Clean unneeded TunSetOptions()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-11 14:08:20 +02:00
Simon Rozman
83d3e175d9 Merge TUN_CTX and TUN_DEVEXT and save entire context in device extension
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-10 13:45:36 +02:00
Simon Rozman
cb741f4d1e Cancel pending IRPs and selectively block new ones when halted
This unblocks waiting clients and prevents new handles to be opened on
device pipe while allowing graceful cleanup.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-10 13:43:13 +02:00
Simon Rozman
df23e41a7f Fix spacing
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-10 13:43:13 +02:00
Simon Rozman
04f2cc318e Migrate device-specific data to device extension
This allows to keep all device pipe specific information to persist as
long as device is in use.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-04-09 15:20:03 +02:00