From 53fbe7343e7795507891345d2bf531b11067ccb3 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Wed, 20 Mar 2024 22:30:11 +0500 Subject: [PATCH] Check for pcap DLL in Npcap's installation directory on Windows --- src/network/net_pcap.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/network/net_pcap.c b/src/network/net_pcap.c index e1747580b..16caaec7e 100644 --- a/src/network/net_pcap.c +++ b/src/network/net_pcap.c @@ -365,7 +365,13 @@ net_pcap_prepare(netdev_t *list) /* Try loading the DLL. */ #ifdef _WIN32 + /* Add the Npcap directory to the DLL search path. */ + char npcap_dir[512]; + GetSystemDirectoryA(npcap_dir, 480); + strcat(npcap_dir, "\\Npcap"); + SetDllDirectoryA(npcap_dir); libpcap_handle = dynld_module("wpcap.dll", pcap_imports); + SetDllDirectoryA(NULL); /* reset the DLL search path */ #elif defined __APPLE__ libpcap_handle = dynld_module("libpcap.dylib", pcap_imports); #else