the-tcpdump-group / libpcap

the LIBpcap interface to various kernel packet capture mechanism
https://www.tcpdump.org/
Other
2.68k stars 847 forks source link

Test programs fail to run on Windows as "C:\WINDOWS\system32\Npcap\Packet.dll" is not in path #1368

Open AndersBroman opened 6 days ago

AndersBroman commented 6 days ago

Built on windows with Visual Studio 2022, NPCAP SDK 1.13 and NPCAP 1.79 installed. Build works fine but when trying to run testprogram run\RelWithDebInfo\findalldevstest.exe it complains the packet.dll is missing.

Either packet-dll should be copied to run dir from "C:\WINDOWS\system32\Npcap\Packet.dll" or maybe mention to add to PATH or copy manually in doc /README.windows.md

guyharris commented 6 days ago

Is there a packet.dll in C;\Windows\System32 (i.e., in the top-level system DLL directory, as well as in C:\Windows\System32\Npcap)?

If not, you probably installed Npcap with "WinPcap API-compatible Mode" disabled. (It's enabled by default; as I understand it, it only needs to be enabled if you have a program on your system that's built with WinPcap and aren't certain that it will work with Npcap, and have WinPcap installed for it, so you want to ensure that that program will run with WinPcap rather than with Npcap, so you don't install Npcap's DLLs into the system DLL directory, just into its Npcap subdirectory. @bonsaiviking , is that what disabling "WinPcap API-compatible Mode" is for?)

If so, that means this is probably the same problem as in the-tcpdump-group/tcpdump#1226, and requires that the same change be made to the test programs and their build procedure as in the-tcpdump-group/tcpdump#1227.

See https://npcap.com/guide/npcap-devguide.html#npcap-feature-native-dll-implicitly for details.

AndersBroman commented 6 days ago

No packet.dll in C;\Windows\System32. I actually "used" the default instalation of NPCAP by Wireshark.

guyharris commented 6 days ago

I actually "used" the default instalation of NPCAP by Wireshark.

...which shows the installation options dialog with all three items unchecked ("require Administrator access", "support monitor mode on 802.11 adapters", and "install in WinPcap API-compatible Mode"), so it defaults to not installing the DLLs in C:\Windows\System32.

AndersBroman commented 5 days ago

Is it time to ditch winpcap and airpcap? Not sure how useful airpcap is these days with new wifi standards.

guyharris commented 5 days ago

Is it time to ditch winpcap and airpcap?

Ditching WinPcap support from tcpdump won't help this issue; ditching from Npcap support for applications that might require WinPcap, by always installing the DLLs in C:\Windows\system32, would.

Ditching it from libpcap, in the sense of no longer supporting building libpcap with the WinPcap version of packet.dll, also wouldn't help this issue; it'd be more of "removing tired old code", similar to dropping support for the old Linux PF_INET/SOCK_PACKET sockets and for non-memory-mapped capture on Linux PF_PACKET sockets.

I'll address airpcap in the libpcap issue.