Merge pull request #4285 from lemondrops/npcapfix

[v4.2] Check for pcap DLL in Npcap's installation directory on Windows
This commit is contained in:
Miran Grča
2024-03-20 20:05:25 +01:00
committed by GitHub

View File

@@ -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