OpenVPN / tap-windows6

Windows TAP driver (NDIS 6)
Other
788 stars 237 forks source link

Win7 -> Win10 build system change #53

Closed jkunkee closed 6 years ago

jkunkee commented 6 years ago

This changeset makes a number of changes so that tap-windows6 will build using the newer Windows 10 EWDK instead of the Windows 7 DDK. No driver code changes were needed.

jkunkee commented 6 years ago

AppVeyor CI test success is a red herring. It will need changes to properly build with the new system.

mattock commented 6 years ago

Looks good. That said, I will have to setup a new build rig and try this out to be sure.

djdv commented 6 years ago

FWIW I applied https://github.com/OpenVPN/tap-windows6/pull/55 on top of this and had success building on W10 1803 x64 using the EWDK ISO.

mattock commented 6 years ago

@djdv thanks for sharing! I'm in the process of setting up my build rig. It takes a bit of time as I'm putting it into configuration management at the same time.

jkunkee commented 6 years ago

@djdv, did you need #55 or was it just useful to you? As I understand it, AMD64 and x86 Windows 10 systems should still support NDIS 6.1.

djdv commented 6 years ago

@jkunkee I don't believe it's necessary. I was just interested to see if it was also compatible with my environments (build+run). However, I haven't tried building with this patchset alone.

jkunkee commented 6 years ago

So not necessary, just locally useful. Good to hear :)

jkunkee commented 6 years ago

I have tried to install this on x64 Windows 7. It fails with error 39 because it can't find KeInitializeSpinLock; I'm working on fixing it.

jkunkee commented 6 years ago

With the latest batch of changes, driver installation and pinging the VPN server's private address succeed on Windows 7 SP1 and Windows 10 1803 x64 systems.

jkunkee commented 6 years ago

Rebased and squashed some commits.

jkunkee commented 6 years ago

Tweaked makefile and buildtap.py to fix DDK versioning issues

mattock commented 6 years ago

@jkunkee my new Windows Server 2016 -based build computer is now fully operational. I merged all your branches (arm64-port/*) on top of upstream "master" branch successfully. I have installed EWDK and mounted the ISO image using the "Mount-Diskimage" cmdlet under D:\ drive. I've also installed Python 2.7 and Git from Chocolatey packages.

Now, when I try to build (as Administrator) I get errors:

PS C:\users\Administrator\opt\tap-windows6> python.exe buildtap.py -b
***** BUILD TAP config
***** BUILD TAP arch=i386
RUN: cmd /c ""C:\WinWDK\16299\BuildEnv\SetupBuildEnv.cmd" && msbuild C:\users\Administrator\opt\tap-windows6\src\tap-windows6.vcxproj /p:Configuration=Release /p:Platform=Win32"
The system cannot find the path specified.
***** BUILD TAP arch=amd64
RUN: cmd /c ""C:\WinWDK\16299\BuildEnv\SetupBuildEnv.cmd" && msbuild C:\users\Administrator\opt\tap-windows6\src\tap-windows6.vcxproj /p:Configuration=Release /p:Platform=x64"
The system cannot find the path specified.
***** BUILD TAP arch=arm64
RUN: cmd /c ""C:\WinWDK\16299\BuildEnv\SetupBuildEnv.cmd" && msbuild C:\users\Administrator\opt\tap-windows6\src\tap-windows6.vcxproj /p:Configuration=Release /p:Platform=arm64"
The system cannot find the path specified.
COPY C:\users\Administrator\opt\tap-windows6\src\tap-windows.h C:\users\Administrator\opt\tap-windows6\dist\include
***** Generated files
C:\users\Administrator\opt\tap-windows6\dist
C:\users\Administrator\opt\tap-windows6\dist\amd64
C:\users\Administrator\opt\tap-windows6\dist\amd64\OemVista.inf
C:\users\Administrator\opt\tap-windows6\dist\arm64
C:\users\Administrator\opt\tap-windows6\dist\i386
C:\users\Administrator\opt\tap-windows6\dist\i386\OemVista.inf
C:\users\Administrator\opt\tap-windows6\dist\include
C:\users\Administrator\opt\tap-windows6\dist\include\tap-windows.h
***** Generated tarball: C:\users\Administrator\opt\tap-windows6\tap6.tar.gz

The error messages are because C:\WinWDK\16299\BuildEnv\SetupBuildEnv.cmd is missing. However, I can't fix the full path in paths.py, only the directory name. In EWDK 10 the build environment uses a script of different name:

PS C:\users\Administrator\opt\tap-windows6> Get-ChildItem D:\|Select name

Name
----
BuildEnv
Program Files
Utilities
LaunchBuildEnv.cmd

Is EWDK 10 supposed to be sufficient? If yes, then we should get the build environment script name from a config file (e.g. paths.py) instead of having a hardcoded value in buildtap.py.

jkunkee commented 6 years ago

Yes, the EWDK is sufficient.

I intended paths.py to point to the root of the EWDK, so d:\ in your case.. If you look in those scripts, the one you're suggesting I use launches its own CMD window and then runs the script in builtdap.py. I think I found a place the second script is documented so it should be stable going forward--it's the same between the 1803 and 1709 EWDKs, at least.

mattock commented 6 years ago

Yeah, my bad. Builds fine when EWDK = "D:" in paths.py. I do get lots of compiler warnings but otherwise all looks good.

mattock commented 6 years ago

Building devcon.exe also works, except that arm64 build fails, which is to be expected. We should document the exact procedure for building devcon.exe in README.rst, e.g. from Powershell:

git clone https://github.com/Microsoft/Windows-driver-samples
Copy-Item -Recurse Windows-driver-samples/setup/devcon tap-windows6
cd tap-windows6
python.exe buildtap.py -b --ti=devcon

But this is by no means a blocker.

jkunkee commented 6 years ago

The warnings are by design--someone who knows what the driver should be doing should revisit those to make sure there aren't any bugs hiding among them.

I'll add the devcon build instructions to one of the next PRs.