From 6ac22c1650e7bd0a3f1e82421c41382fc8c14eeb Mon Sep 17 00:00:00 2001 From: basil00 Date: Mon, 2 Jul 2018 19:23:49 +0800 Subject: [PATCH] Retire MSVC-2012 and (non-driver) WDDK builds. The new MINGW build should be compatible with all major compilers, including Visual Studio 201X. --- dirs | 6 +- dll/Makefile | 1 - dll/sources | 17 --- dll/windivert.vcxproj | 61 ----------- doc/windivert.html | 137 ++++++------------------- examples/dirs | 6 -- examples/netdump/Makefile | 1 - examples/netdump/netdump.vcxproj | 58 ----------- examples/netdump/sources | 21 ---- examples/netfilter/Makefile | 1 - examples/netfilter/netfilter.vcxproj | 58 ----------- examples/netfilter/sources | 21 ---- examples/passthru/Makefile | 1 - examples/passthru/passthru.vcxproj | 58 ----------- examples/passthru/sources | 21 ---- examples/streamdump/Makefile | 1 - examples/streamdump/sources | 21 ---- examples/streamdump/streamdump.vcxproj | 58 ----------- examples/webfilter/Makefile | 1 - examples/webfilter/sources | 21 ---- examples/webfilter/webfilter.vcxproj | 58 ----------- msvc-build.bat | 110 -------------------- release-build.sh | 16 +-- 23 files changed, 41 insertions(+), 713 deletions(-) delete mode 100644 dll/Makefile delete mode 100644 dll/sources delete mode 100644 dll/windivert.vcxproj delete mode 100644 examples/dirs delete mode 100644 examples/netdump/Makefile delete mode 100644 examples/netdump/netdump.vcxproj delete mode 100644 examples/netdump/sources delete mode 100644 examples/netfilter/Makefile delete mode 100644 examples/netfilter/netfilter.vcxproj delete mode 100644 examples/netfilter/sources delete mode 100644 examples/passthru/Makefile delete mode 100644 examples/passthru/passthru.vcxproj delete mode 100644 examples/passthru/sources delete mode 100644 examples/streamdump/Makefile delete mode 100644 examples/streamdump/sources delete mode 100644 examples/streamdump/streamdump.vcxproj delete mode 100644 examples/webfilter/Makefile delete mode 100644 examples/webfilter/sources delete mode 100644 examples/webfilter/webfilter.vcxproj delete mode 100644 msvc-build.bat diff --git a/dirs b/dirs index c768d5d..ff8133f 100644 --- a/dirs +++ b/dirs @@ -1,4 +1,2 @@ -DIRS= \ - dll \ - examples \ - sys \ No newline at end of file +DIRS= \ + sys diff --git a/dll/Makefile b/dll/Makefile deleted file mode 100644 index 53b9a3d..0000000 --- a/dll/Makefile +++ /dev/null @@ -1 +0,0 @@ -!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/dll/sources b/dll/sources deleted file mode 100644 index 9d3926c..0000000 --- a/dll/sources +++ /dev/null @@ -1,17 +0,0 @@ - -TARGETNAME=WinDivert -TARGETTYPE=DYNLINK -TARGETPATH=..\install\WDDK -TARGETLIBS=\ - $(SDK_LIB_PATH)\advapi32.lib \ - $(SDK_LIB_PATH)\setupapi.lib \ - $(SDK_LIB_PATH)\user32.lib \ - $(SDK_LIB_PATH)\kernel32.lib \ - $(SDK_LIB_PATH)\ws2_32.lib -C_DEFINES=/DWIN32 /D_WINDOWS /D_USRDLL /DUSE_STDAFX /DUNICODE /D_UNICODE -DLLENTRY=WinDivertDllEntry -DLLDEF=windivert.def -USE_MSVCRT=1 -INCLUDES=$(DDK_INC_PATH);$(KMDF_INC_PATH)\$(KMDF_VER_PATH);..\include -SOURCES=windivert.c - diff --git a/dll/windivert.vcxproj b/dll/windivert.vcxproj deleted file mode 100644 index 5151e16..0000000 --- a/dll/windivert.vcxproj +++ /dev/null @@ -1,61 +0,0 @@ - - - - - Release - x64 - - - Debug - x64 - - - Release - Win32 - - - Debug - Win32 - - - - DynamicLibrary - WinDivert - Release - - - - ..\include;%(AdditionalIncludeDirectories) - - - windivert.def - - - - - v110 - - - v110 - - - v110 - - - v110 - - - True - - - False - - - - - - - - - - diff --git a/doc/windivert.html b/doc/windivert.html index 6efd03b..3dab255 100644 --- a/doc/windivert.html +++ b/doc/windivert.html @@ -11,8 +11,6 @@
  • 2. Building
  • 3. Installing
  • 4. Uninstalling
  • @@ -87,76 +85,63 @@ WinDivert also supports passive packet sniffing similar to Winpcap.

    2. Building

    +Note that pre-built WinDivert binary distributions are available from the +WinDivert website. +Most users do not need to build their own version of WinDivert from source. +

    +

    The source code for WinDivert is available for download at

    https://github.com/basil00/Divert
    -To build the WinDivert package from source: +To build the WinDivert drivers from source:
    1. Download and install Windows Driver Kit 7.1.0.
    2. -
    3. Open a Free Build Environment console (or - Checked Build Environment for debugging).
    4. +
    5. Open a x86 Free Build Environment console.
    6. In the WinDivert package root directory, run the command:
       wddk-build.bat
       
      -This will build the following files and place them in the -install\WDDK subdirectory: -
        -
      • WinDivert.dll: User-mode library.
      • -
      • WinDivert32.sys or WinDivert64.sys: - Kernel-mode WDF/WFP call-out driver.
      • -
      • *.exe: Sample applications from the divert\examples - directory.
      • -
    7. -
    -NOTE: The WinDivert.dll and WinDivert.lib files -are only compatible with programs compiled with the WDDK compiler. -See below for Visual Studio 2012 and MinGW support. -

    - -

    2.1 Driver Signing

    -

    -Before the WinDivert package can be used, the -WinDivert32.sys/WinDivert64.sys driver -must be digitally signed. -See Driver Signing Requirements for Windows -for more information. -

    - -

    2.2 Visual Studio 2012 Support

    -

    -To build the WinDivert package for Visual Studio 2012: -

      -
    1. First build the driver by running wddk-build.bat as per the -instructions above.
    2. -
    3. Open a Visual Studio Command Prompt environment.
    4. -
    5. In the WinDivert package root directory, run the command: -
      -msvc-build.bat
      -
      -This will build Visual Studio 2012 compatible files and place them in the -install\MSVC subdirectory.
    6. +This will build the install\WDDK\i386\WinDivert32.sys driver. +
    7. Next, open a x64 Free Build Environment console.
    8. +
    9. Re-run the wddk-build.bat command to build the +install\WDDK\amd64\WinDivert64.sys driver.

    - -

    2.3 MinGW Support

    -To build the WinDivert package for MinGW: +To build the WinDivert user-mode library (WinDivert.dll) and sample +programs:

      -
    1. First build the driver by running wddk-build.bat as per -the instructions above.
    2. +
    3. First, build the WinDivert drivers by running the +wddk-build.bat command described above.
    4. In Linux (with the MinGW cross-compilers installed) and in the WinDivert package root directory, run the command:
       sh mingw-build.sh
       
      -This will build MinGW compatible files and place them in the -install\MINGW subdirectory.
    5. +This will the user-mode library and sample programs which will be placed +in the install\MINGW subdirectory.
    +

    +

    +The generated WinDivert.dll/WinDivert.lib files +should be compatible with all major compilers, including both MinGW and +Visual Studio. +

    +

    2.1 Driver Signing

    +

    +If you built your own +WinDivert32.sys/WinDivert64.sys drivers, +they must be digitally signed before they can be used. +See Driver Signing Requirements for Windows +for more information. +

    +

    +Note that the pre-built WinDivert32.sys/WinDivert64.sys +drivers from the official WinDivert distribution are already digitally signed.


    @@ -221,60 +206,6 @@ whenever your application calls WinDivertOpen(). The calling application must have Administrator privileges.

    -

    -The WinDivert.dll also depends on a C run-time library. -This is not distributed with the WinDivert binaries, and must be -installed/distributed separately if required. -

    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Build/Compiler - -C-Runtime Dependency - -Installed on Windows by Default? -
    -WDDK (Windows Driver Kit 7.1) - -MSVCRT.dll - -Yes -
    -MSVC (Visual Studio 2012) - -MSVCRT110.dll - -No. -Must be installed separately or included with your application. -
    -MINGW - -MSVCRT.dll - -Yes -
    -

    4. Uninstalling

    diff --git a/examples/dirs b/examples/dirs deleted file mode 100644 index c11e553..0000000 --- a/examples/dirs +++ /dev/null @@ -1,6 +0,0 @@ -DIRS= \ - netdump \ - netfilter \ - passthru \ - webfilter \ - streamdump diff --git a/examples/netdump/Makefile b/examples/netdump/Makefile deleted file mode 100644 index 53b9a3d..0000000 --- a/examples/netdump/Makefile +++ /dev/null @@ -1 +0,0 @@ -!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/examples/netdump/netdump.vcxproj b/examples/netdump/netdump.vcxproj deleted file mode 100644 index 2b44489..0000000 --- a/examples/netdump/netdump.vcxproj +++ /dev/null @@ -1,58 +0,0 @@ - - - - - Release - x64 - - - Debug - x64 - - - Release - Win32 - - - Debug - Win32 - - - - Application - netdump - Release - - - - ..\..\include;%(AdditionalIncludeDirectories) - - - ws2_32.lib;..\..\install\MSVC\WinDivert.lib - - - - - v110 - - - v110 - - - v110 - - - v110 - - - True - - - False - - - - - - - diff --git a/examples/netdump/sources b/examples/netdump/sources deleted file mode 100644 index 3149a3d..0000000 --- a/examples/netdump/sources +++ /dev/null @@ -1,21 +0,0 @@ - -!IF "$(_BUILDARCH)" == "x86" -CPU=i386 -!ELSE -CPU=$(_BUILDARCH) -!ENDIF - -TARGETNAME=netdump -TARGETTYPE=PROGRAM -TARGETPATH=..\..\install\WDDK -TARGETLIBS=\ - $(SDK_LIB_PATH)\setupapi.lib \ - $(SDK_LIB_PATH)\user32.lib \ - $(SDK_LIB_PATH)\ws2_32.lib \ - $(TARGETPATH)\$(CPU)\WinDivert.lib -UMTYPE=console -UMENTRY=main -USE_MSVCRT=1 -INCLUDES=$(DDK_INC_PATH);$(KMDF_INC_PATH)\$(KMDF_VER_PATH);..\..\include -SOURCES=netdump.c - diff --git a/examples/netfilter/Makefile b/examples/netfilter/Makefile deleted file mode 100644 index 53b9a3d..0000000 --- a/examples/netfilter/Makefile +++ /dev/null @@ -1 +0,0 @@ -!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/examples/netfilter/netfilter.vcxproj b/examples/netfilter/netfilter.vcxproj deleted file mode 100644 index cda5b4b..0000000 --- a/examples/netfilter/netfilter.vcxproj +++ /dev/null @@ -1,58 +0,0 @@ - - - - - Release - x64 - - - Debug - x64 - - - Release - Win32 - - - Debug - Win32 - - - - Application - netfilter - Release - - - - ..\..\include;%(AdditionalIncludeDirectories) - - - ws2_32.lib;..\..\install\MSVC\WinDivert.lib - - - - - v110 - - - v110 - - - v110 - - - v110 - - - True - - - False - - - - - - - diff --git a/examples/netfilter/sources b/examples/netfilter/sources deleted file mode 100644 index 4f27df3..0000000 --- a/examples/netfilter/sources +++ /dev/null @@ -1,21 +0,0 @@ - -!IF "$(_BUILDARCH)" == "x86" -CPU=i386 -!ELSE -CPU=$(_BUILDARCH) -!ENDIF - -TARGETNAME=netfilter -TARGETTYPE=PROGRAM -TARGETPATH=..\..\install\WDDK -TARGETLIBS=\ - $(SDK_LIB_PATH)\setupapi.lib \ - $(SDK_LIB_PATH)\user32.lib \ - $(SDK_LIB_PATH)\ws2_32.lib \ - $(TARGETPATH)\$(CPU)\WinDivert.lib -UMTYPE=console -UMENTRY=main -USE_MSVCRT=1 -INCLUDES=$(DDK_INC_PATH);$(KMDF_INC_PATH)\$(KMDF_VER_PATH);..\..\include -SOURCES=netfilter.c - diff --git a/examples/passthru/Makefile b/examples/passthru/Makefile deleted file mode 100644 index 53b9a3d..0000000 --- a/examples/passthru/Makefile +++ /dev/null @@ -1 +0,0 @@ -!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/examples/passthru/passthru.vcxproj b/examples/passthru/passthru.vcxproj deleted file mode 100644 index 44feed1..0000000 --- a/examples/passthru/passthru.vcxproj +++ /dev/null @@ -1,58 +0,0 @@ - - - - - Release - x64 - - - Debug - x64 - - - Release - Win32 - - - Debug - Win32 - - - - Application - passthru - Release - - - - ..\..\include;%(AdditionalIncludeDirectories) - - - ws2_32.lib;..\..\install\MSVC\WinDivert.lib - - - - - v110 - - - v110 - - - v110 - - - v110 - - - True - - - False - - - - - - - diff --git a/examples/passthru/sources b/examples/passthru/sources deleted file mode 100644 index 983b3bf..0000000 --- a/examples/passthru/sources +++ /dev/null @@ -1,21 +0,0 @@ - -!IF "$(_BUILDARCH)" == "x86" -CPU=i386 -!ELSE -CPU=$(_BUILDARCH) -!ENDIF - -TARGETNAME=passthru -TARGETTYPE=PROGRAM -TARGETPATH=..\..\install\WDDK -TARGETLIBS=\ - $(SDK_LIB_PATH)\setupapi.lib \ - $(SDK_LIB_PATH)\user32.lib \ - $(SDK_LIB_PATH)\ws2_32.lib \ - $(TARGETPATH)\$(CPU)\WinDivert.lib -UMTYPE=console -UMENTRY=main -USE_MSVCRT=1 -INCLUDES=$(DDK_INC_PATH);$(KMDF_INC_PATH)\$(KMDF_VER_PATH);..\..\include -SOURCES=passthru.c - diff --git a/examples/streamdump/Makefile b/examples/streamdump/Makefile deleted file mode 100644 index 53b9a3d..0000000 --- a/examples/streamdump/Makefile +++ /dev/null @@ -1 +0,0 @@ -!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/examples/streamdump/sources b/examples/streamdump/sources deleted file mode 100644 index 50f72f4..0000000 --- a/examples/streamdump/sources +++ /dev/null @@ -1,21 +0,0 @@ - -!IF "$(_BUILDARCH)" == "x86" -CPU=i386 -!ELSE -CPU=$(_BUILDARCH) -!ENDIF - -TARGETNAME=streamdump -TARGETTYPE=PROGRAM -TARGETPATH=..\..\install\WDDK -TARGETLIBS=\ - $(SDK_LIB_PATH)\setupapi.lib \ - $(SDK_LIB_PATH)\user32.lib \ - $(SDK_LIB_PATH)\ws2_32.lib \ - $(TARGETPATH)\$(CPU)\WinDivert.lib -UMTYPE=console -UMENTRY=main -USE_MSVCRT=1 -INCLUDES=$(DDK_INC_PATH);$(KMDF_INC_PATH)\$(KMDF_VER_PATH);..\..\include -SOURCES=streamdump.c - diff --git a/examples/streamdump/streamdump.vcxproj b/examples/streamdump/streamdump.vcxproj deleted file mode 100644 index f254766..0000000 --- a/examples/streamdump/streamdump.vcxproj +++ /dev/null @@ -1,58 +0,0 @@ - - - - - Release - x64 - - - Debug - x64 - - - Release - Win32 - - - Debug - Win32 - - - - Application - streamdump - Release - - - - ..\..\include;%(AdditionalIncludeDirectories) - - - ws2_32.lib;..\..\install\MSVC\WinDivert.lib - - - - - v110 - - - v110 - - - v110 - - - v110 - - - True - - - False - - - - - - - diff --git a/examples/webfilter/Makefile b/examples/webfilter/Makefile deleted file mode 100644 index 53b9a3d..0000000 --- a/examples/webfilter/Makefile +++ /dev/null @@ -1 +0,0 @@ -!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/examples/webfilter/sources b/examples/webfilter/sources deleted file mode 100644 index 7ef37c2..0000000 --- a/examples/webfilter/sources +++ /dev/null @@ -1,21 +0,0 @@ - -!IF "$(_BUILDARCH)" == "x86" -CPU=i386 -!ELSE -CPU=$(_BUILDARCH) -!ENDIF - -TARGETNAME=webfilter -TARGETTYPE=PROGRAM -TARGETPATH=..\..\install\WDDK -TARGETLIBS=\ - $(SDK_LIB_PATH)\setupapi.lib \ - $(SDK_LIB_PATH)\user32.lib \ - $(SDK_LIB_PATH)\ws2_32.lib \ - $(TARGETPATH)\$(CPU)\WinDivert.lib -UMTYPE=console -UMENTRY=main -USE_MSVCRT=1 -INCLUDES=$(DDK_INC_PATH);$(KMDF_INC_PATH)\$(KMDF_VER_PATH);..\..\include -SOURCES=webfilter.c - diff --git a/examples/webfilter/webfilter.vcxproj b/examples/webfilter/webfilter.vcxproj deleted file mode 100644 index efabe32..0000000 --- a/examples/webfilter/webfilter.vcxproj +++ /dev/null @@ -1,58 +0,0 @@ - - - - - Release - x64 - - - Debug - x64 - - - Release - Win32 - - - Debug - Win32 - - - - Application - webfilter - Release - - - - ..\..\include;%(AdditionalIncludeDirectories) - - - ws2_32.lib;..\..\install\MSVC\WinDivert.lib - - - - - v110 - - - v110 - - - v110 - - - v110 - - - True - - - False - - - - - - - diff --git a/msvc-build.bat b/msvc-build.bat deleted file mode 100644 index ac53d33..0000000 --- a/msvc-build.bat +++ /dev/null @@ -1,110 +0,0 @@ -:: msvc-build.bat -:: (C) 2018, all rights reserved, -:: -:: This file is part of WinDivert. -:: -:: WinDivert is free software: you can redistribute it and/or modify it under -:: the terms of the GNU Lesser General Public License as published by the -:: Free Software Foundation, either version 3 of the License, or (at your -:: option) any later version. -:: -:: This program is distributed in the hope that it will be useful, but -:: WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -:: or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -:: License for more details. -:: -:: You should have received a copy of the GNU Lesser General Public License -:: along with this program. If not, see . -:: -:: WinDivert is free software; you can redistribute it and/or modify it under -:: the terms of the GNU General Public License as published by the Free -:: Software Foundation; either version 2 of the License, or (at your option) -:: any later version. -:: -:: This program is distributed in the hope that it will be useful, but -:: WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -:: or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -:: for more details. -:: -:: You should have received a copy of the GNU General Public License along -:: with this program; if not, write to the Free Software Foundation, Inc., 51 -:: Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -:: -:: Script for MSVC (Microsoft Visual Studio 2012) compilation. -:: NOTE: run wddk-build.bat before this script. - -@echo off - -:: Determine target CPU. - -cl 2>&1 | findstr "x86" > NUL - -if %ERRORLEVEL% == 0 ( - set TARGET=i386 - set PLATFORM=Win32 - set BITS=32 -) ELSE ( - set TARGET=amd64 - set PLATFORM=x64 - set BITS=64 -) - -set WDDK_INSTALL=install\WDDK\%TARGET%\ -set MSVC_INSTALL=install\MSVC\%TARGET%\ - -if not exist %WDDK_INSTALL% ( - echo ERROR: Missing WDDK build; run wddk-build.bat first - exit /B -) -mkdir %MSVC_INSTALL% - -:: Build WinDivert.dll -cd dll -msbuild /p:Platform=%PLATFORM% /p:OutDir=build\ -copy /Y build\WinDivert.dll ..\%MSVC_INSTALL% -copy /Y build\WinDivert.lib ..\%MSVC_INSTALL% -copy /Y build\WinDivert.lib ..\%MSVC_INSTALL%.. -rd /s /q build\ -cd .. - -:: Build netdump -cd examples\netdump -msbuild /p:Platform=%PLATFORM% /p:OutDir=build\ -copy /Y build\netdump.exe ..\..\%MSVC_INSTALL% -rd /s /q build\ -cd ..\.. - -:: Build netfilter -cd examples\netfilter -msbuild /p:Platform=%PLATFORM% /p:OutDir=build\ -copy /Y build\netfilter.exe ..\..\%MSVC_INSTALL% -rd /s /q build\ -cd ..\.. - -:: Build passthru -cd examples\passthru -msbuild /p:Platform=%PLATFORM% /p:OutDir=build\ -copy /Y build\passthru.exe ..\..\%MSVC_INSTALL% -rd /s /q build\ -cd ..\.. - -:: Build webfilter -cd examples\webfilter -msbuild /p:Platform=%PLATFORM% /p:OutDir=build\ -copy /Y build\webfilter.exe ..\..\%MSVC_INSTALL% -rd /s /q build\ -cd ..\.. - -:: Build streamdump -cd examples\streamdump -msbuild /p:Platform=%PLATFORM% /p:OutDir=build\ -copy /Y build\streamdump.exe ..\..\%MSVC_INSTALL% -rd /s /q build\ -cd ..\.. - -:: Copy files -copy /Y %WDDK_INSTALL%\WinDivert%BITS%.sys %MSVC_INSTALL% - -:: Clean-up -del %MSVC_INSTALL%..\WinDivert.lib - diff --git a/release-build.sh b/release-build.sh index 5204bb7..80cd0fe 100644 --- a/release-build.sh +++ b/release-build.sh @@ -40,15 +40,15 @@ set -e VERSION=`cat ./VERSION` NAME=WinDivert-$VERSION -for TARGET in WDDK MSVC MINGW +for TARGET in MINGW do if [ ! -d "install/$TARGET" ] then echo "SKIP $NAME-$TARGET" continue fi - echo "BUILD $NAME-$TARGET" - INSTALL=install/$NAME-$TARGET + echo "BUILD $NAME" + INSTALL=install/$NAME echo "\tmake $INSTALL..." mkdir -p $INSTALL echo "\tcopy $INSTALL/README..." @@ -118,17 +118,11 @@ do else echo "\tWARNING: skipping missing AMD64 build..." fi - PACKAGE=$NAME-$TARGET.tar.gz + PACKAGE=$NAME.zip echo "\tbuilding $PACKAGE..." ( cd install; - tar cvz --owner root --group root -f $PACKAGE $NAME-$TARGET > /dev/null - ) - PACKAGE=$NAME-$TARGET.zip - echo "\tbuilding $PACKAGE..." - ( - cd install; - zip -r $PACKAGE $NAME-$TARGET > /dev/null + zip -r $PACKAGE $NAME > /dev/null ) echo -n "\tclean $INSTALL..." rm -rf $INSTALL