From 27d55effbabee9a4d593756ef370dc565ec32348 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Wed, 1 Sep 2021 12:03:20 +0300 Subject: [PATCH] Driver: Separate builds for Windows 7 & 10. --- deploy/deployment.json | 10 +++++----- deploy/setup-deployment-win10.bat | 2 +- deploy/setup-deployment-win7.bat | 2 +- deploy/setup-deployment.ps1 | 1 + src/driver/common/common.h | 7 +++++-- src/driver/fortdrv.vcxproj | 3 ++- src/driver/msvcbuild-win10.bat | 1 + src/driver/msvcbuild-win7-32.bat | 1 + src/driver/msvcbuild-win7-64.bat | 1 + src/driver/msvcbuild.bat | 17 +++++++++++------ 10 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 src/driver/msvcbuild-win10.bat create mode 100644 src/driver/msvcbuild-win7-32.bat create mode 100644 src/driver/msvcbuild-win7-64.bat diff --git a/deploy/deployment.json b/deploy/deployment.json index fe933803..b530da3e 100644 --- a/deploy/deployment.json +++ b/deploy/deployment.json @@ -14,11 +14,11 @@ ] }, "${TARGET}/driver": { - "driver-x32 | Win7": [ - "${BUILD}-driver/fortfw32.sys" + "driver-x32 | win7": [ + "${BUILD}-driver-${CONFIG}/fortfw32.sys" ], "driver-x64": [ - "${BUILD}-driver/fortfw64.sys" + "${BUILD}-driver-${CONFIG}/fortfw64.sys" ], "scripts": [ "${ROOT}/src/driver/scripts | *.bat *.lnk |" @@ -28,8 +28,8 @@ "qt": [ "${QTPATH}/plugins/platforms | qwindows.dll | *d.dll" ], - "qt-tls | Win10": [ - "${QTPATH}/plugins/tls | schannelbackend.dll | *dd.dll" + "qt-tls | win10": [ + "${QTPATH}/plugins/tls | qschannelbackend.dll | *dd.dll" ] } } diff --git a/deploy/setup-deployment-win10.bat b/deploy/setup-deployment-win10.bat index 5137ac86..4a5214b5 100644 --- a/deploy/setup-deployment-win10.bat +++ b/deploy/setup-deployment-win10.bat @@ -1 +1 @@ -@%~dp0setup-deployment.bat -QtPath ".\build-qt\qtbase" -Config Win10 +@%~dp0setup-deployment.bat -QtPath ".\build-qt\qtbase" -Config win10 diff --git a/deploy/setup-deployment-win7.bat b/deploy/setup-deployment-win7.bat index 84bf9f8a..3f89da92 100644 --- a/deploy/setup-deployment-win7.bat +++ b/deploy/setup-deployment-win7.bat @@ -1 +1 @@ -@%~dp0setup-deployment.bat -QtPath ".\build-qt-win7\qtbase" -Config Win7 +@%~dp0setup-deployment.bat -QtPath ".\build-qt-win7\qtbase" -Config win7 diff --git a/deploy/setup-deployment.ps1 b/deploy/setup-deployment.ps1 index 1365123b..1e2640ea 100644 --- a/deploy/setup-deployment.ps1 +++ b/deploy/setup-deployment.ps1 @@ -50,6 +50,7 @@ for ($i = 0; $i -lt $targetDirs.length; $i++) { $file = $file -replace '\${BUILD}', "$BuildPath" $file = $file -replace '\${ROOT}', "$RootPath" $file = $file -replace '\${QTPATH}', "$QtPath" + $file = $file -replace '\${CONFIG}', "$Config" if ($file.Contains('|')) { $fileParts = $file.Split('|') diff --git a/src/driver/common/common.h b/src/driver/common/common.h index c6abb2fe..a00559c4 100644 --- a/src/driver/common/common.h +++ b/src/driver/common/common.h @@ -5,8 +5,11 @@ # define NDIS_WDM 1 # define NDIS630 1 -# define WIN9X_COMPAT_SPINLOCK /* XXX: Support Windows 7: KeInitializeSpinLock() */ -# define POOL_NX_OPTIN 1 /* Enhanced protection of NX pool */ +# if defined(FORT_WIN7_COMPAT) +# define WIN9X_COMPAT_SPINLOCK /* XXX: Support Windows 7: KeInitializeSpinLock() */ +# endif + +# define POOL_NX_OPTIN 1 /* Enhanced protection of NX pool */ # include # include diff --git a/src/driver/fortdrv.vcxproj b/src/driver/fortdrv.vcxproj index 13118dc5..4b0c9841 100644 --- a/src/driver/fortdrv.vcxproj +++ b/src/driver/fortdrv.vcxproj @@ -23,11 +23,12 @@ Release Win32 $(DefineConstants);NDEBUG + $(DefineConstants);FORT_WIN7_COMPAT WindowsV6.3 - $(DDK_LIB_PATH)\BufferOverflowK.lib + $(DDK_LIB_PATH)\BufferOverflowK.lib WindowsKernelModeDriver10.0 Driver WDM diff --git a/src/driver/msvcbuild-win10.bat b/src/driver/msvcbuild-win10.bat new file mode 100644 index 00000000..42a2b8ec --- /dev/null +++ b/src/driver/msvcbuild-win10.bat @@ -0,0 +1 @@ +@%~dp0msvcbuild.bat x64 win10 diff --git a/src/driver/msvcbuild-win7-32.bat b/src/driver/msvcbuild-win7-32.bat new file mode 100644 index 00000000..3642a8ff --- /dev/null +++ b/src/driver/msvcbuild-win7-32.bat @@ -0,0 +1 @@ +@%~dp0msvcbuild.bat Win32 win7 diff --git a/src/driver/msvcbuild-win7-64.bat b/src/driver/msvcbuild-win7-64.bat new file mode 100644 index 00000000..545e4c83 --- /dev/null +++ b/src/driver/msvcbuild-win7-64.bat @@ -0,0 +1 @@ +@%~dp0msvcbuild.bat x64 win7 diff --git a/src/driver/msvcbuild.bat b/src/driver/msvcbuild.bat index ed347557..8c2e0922 100644 --- a/src/driver/msvcbuild.bat +++ b/src/driver/msvcbuild.bat @@ -6,15 +6,20 @@ @rem PLAT: x64, Win32 @set PLAT=%1 +@if "%PLAT%"=="" PLAT=x64 -@set OutDir=..\..\build-driver +@rem CONFIG: win7, win10 +@set CONFIG=%2 +@if "%CONFIG%"=="" PLAT=win10 + +@set OutDir=..\..\build-driver-%CONFIG% @set IntDir=%OutDir%-%PLAT% -MSBuild fortdrv.vcxproj /p:OutDir=%OutDir%\;IntDir=%IntDir%\;Platform=%PLAT% +MSBuild fortdrv.vcxproj /p:OutDir=%OutDir%\;IntDir=%IntDir%\;Platform=%PLAT%;Config=%CONFIG% -@rem DumpBin /SYMBOLS %IntDir%\fortdrv.obj > symbols.txt +@rem DumpBin /SYMBOLS "%IntDir%\fortdrv.obj" > symbols.txt -@rd /S /Q %IntDir% +@rd /S /Q "%IntDir%" -@rd /S /Q %OutDir%\fortdrv -@del /Q %OutDir%\fortfw*.cer %OutDir%\fortfw*.pdb +@rd /S /Q "%OutDir%\fortdrv" +@del /Q "%OutDir%\fortfw*.cer" "%OutDir%\fortfw*.pdb"