diff --git a/examples/netdump/netdump.vcxproj b/examples/netdump/netdump.vcxproj index 21768b4..f316042 100644 --- a/examples/netdump/netdump.vcxproj +++ b/examples/netdump/netdump.vcxproj @@ -28,7 +28,7 @@ ..\..\include;%(AdditionalIncludeDirectories) - ws2_32.lib;..\..\dll\Release\WinDivert.lib + ws2_32.lib;..\..\install\MSVC\WinDivert.lib diff --git a/examples/netfilter/netfilter.vcxproj b/examples/netfilter/netfilter.vcxproj index 5b32844..4b2f4e5 100644 --- a/examples/netfilter/netfilter.vcxproj +++ b/examples/netfilter/netfilter.vcxproj @@ -28,7 +28,7 @@ ..\..\include;%(AdditionalIncludeDirectories) - ws2_32.lib;..\..\dll\Release\WinDivert.lib + ws2_32.lib;..\..\install\MSVC\WinDivert.lib diff --git a/examples/passthru/passthru.c b/examples/passthru/passthru.c index b3f3924..f14fbd5 100644 --- a/examples/passthru/passthru.c +++ b/examples/passthru/passthru.c @@ -33,7 +33,7 @@ #define MAXBUF 0xFFFF -static __stdcall DWORD passthru(LPVOID arg); +static DWORD passthru(LPVOID arg); /* * Entry. @@ -72,7 +72,8 @@ int __cdecl main(int argc, char **argv) // Start the threads for (i = 1; i < num_threads; i++) { - thread = CreateThread(NULL, 1, passthru, (LPVOID)handle, 0, NULL); + thread = CreateThread(NULL, 1, (LPTHREAD_START_ROUTINE)passthru, + (LPVOID)handle, 0, NULL); if (thread == NULL) { fprintf(stderr, "error: failed to start passthru thread (%u)\n", @@ -88,7 +89,7 @@ int __cdecl main(int argc, char **argv) } // Passthru thread. -static __stdcall DWORD passthru(LPVOID arg) +static DWORD passthru(LPVOID arg) { char packet[MAXBUF]; UINT packet_len; diff --git a/examples/passthru/passthru.vcxproj b/examples/passthru/passthru.vcxproj index 5c1d9b2..8f573de 100644 --- a/examples/passthru/passthru.vcxproj +++ b/examples/passthru/passthru.vcxproj @@ -28,7 +28,7 @@ ..\..\include;%(AdditionalIncludeDirectories) - ws2_32.lib;..\..\dll\Release\WinDivert.lib + ws2_32.lib;..\..\install\MSVC\WinDivert.lib diff --git a/examples/webfilter/webfilter.vcxproj b/examples/webfilter/webfilter.vcxproj index 53732ca..b1d89ca 100644 --- a/examples/webfilter/webfilter.vcxproj +++ b/examples/webfilter/webfilter.vcxproj @@ -28,7 +28,7 @@ ..\..\include;%(AdditionalIncludeDirectories) - ws2_32.lib;..\..\dll\Release\WinDivert.lib + ws2_32.lib;..\..\install\MSVC\WinDivert.lib diff --git a/msvc-build.bat b/msvc-build.bat index 1879865..8477f25 100644 --- a/msvc-build.bat +++ b/msvc-build.bat @@ -19,8 +19,20 @@ @echo off -set WDDK_INSTALL=install\WDDK\i386\ -set MSVC_INSTALL=install\MSVC\i386\ +:: Determine target CPU. + +cl 2>&1 | findstr "32" > NUL + +if %ERRORLEVEL% == 0 ( + set TARGET=i386 + set PLATFORM=Win32 +) ELSE ( + set TARGET=amd64 + set PLATFORM=x64 +) + +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 @@ -30,33 +42,39 @@ mkdir %MSVC_INSTALL% :: Build WinDivert.dll cd dll -msbuild -copy /Y Release\WinDivert.dll ..\%MSVC_INSTALL% -copy /Y Release\WinDivert.lib ..\%MSVC_INSTALL% +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 -copy /Y Release\netdump.exe ..\..\%MSVC_INSTALL% +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 -copy /Y Release\netfilter.exe ..\..\%MSVC_INSTALL% +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 -copy /Y Release\passthru.exe ..\..\%MSVC_INSTALL% +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 -copy /Y Release\webfilter.exe ..\..\%MSVC_INSTALL% +msbuild /p:Platform=%PLATFORM% /p:OutDir=build\ +copy /Y build\webfilter.exe ..\..\%MSVC_INSTALL% +rd /s /q build\ cd ..\.. :: Copy files @@ -64,3 +82,6 @@ copy /Y %WDDK_INSTALL%\WinDivert.sys %MSVC_INSTALL% copy /Y %WDDK_INSTALL%\WinDivert.inf %MSVC_INSTALL% copy /Y %WDDK_INSTALL%\WdfCoInstaller*.dll %MSVC_INSTALL% +:: Clean-up +del %MSVC_INSTALL%..\WinDivert.lib +