Check for pcap DLL in Npcap's installation directory on Windows

This commit is contained in:
Alexander Babikov
2024-03-20 22:30:11 +05:00
parent d2c5420a34
commit 53fbe7343e

View File

@@ -365,7 +365,13 @@ net_pcap_prepare(netdev_t *list)
/* Try loading the DLL. */ /* Try loading the DLL. */
#ifdef _WIN32 #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); libpcap_handle = dynld_module("wpcap.dll", pcap_imports);
SetDllDirectoryA(NULL); /* reset the DLL search path */
#elif defined __APPLE__ #elif defined __APPLE__
libpcap_handle = dynld_module("libpcap.dylib", pcap_imports); libpcap_handle = dynld_module("libpcap.dylib", pcap_imports);
#else #else