From d35653e3d09e95a72a1690faa0066ee144ee806e Mon Sep 17 00:00:00 2001 From: Paul Hollinsky Date: Mon, 14 Feb 2022 19:24:46 -0500 Subject: [PATCH] Windows: PCAP: Fix WinPCAP loading Used when LIBICSNEO_NPCAP_INCLUDE_DIR is not defined --- platform/windows/internal/pcapdll.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/windows/internal/pcapdll.cpp b/platform/windows/internal/pcapdll.cpp index 80a6223..02672f0 100644 --- a/platform/windows/internal/pcapdll.cpp +++ b/platform/windows/internal/pcapdll.cpp @@ -28,19 +28,21 @@ bool PCAPDLL::ok() const PCAPDLL::PCAPDLL() { +#ifdef NPCAP // Use -DLIBICSNEO_NPCAP_INCLUDE_DIR when configuring, point towards the npcap includes DLL_DIRECTORY_COOKIE cookie = 0; -#ifdef NPCAP TCHAR dllPath[512] = { 0 }; int len = GetSystemDirectory(dllPath, 480); // be safe if (len) { _tcscat_s(dllPath, 512, TEXT("\\Npcap")); cookie = AddDllDirectory(dllPath); } -#endif dll = LoadLibraryEx(TEXT("wpcap.dll"), nullptr, LOAD_LIBRARY_SEARCH_USER_DIRS); if (cookie) RemoveDllDirectory(cookie); +#else // Otherwise we'll use WinPCAP, or npcap in compatibility mode + dll = LoadLibrary(TEXT("wpcap.dll")); +#endif if(dll == NULL) { closeDLL();