Closed JonathanBelanger closed 3 years ago
Thanks for the very detailed report! You said the code worked with WinPcap. In order to avoid conflicting with existing WinPcap installs, Npcap was designed to install its DLLs to a different path, which requires delay-loading the DLLs and using SetDllDirectory()
before using any Npcap functions. Here is the relevant section of the Npcap developer's guide, and you can also check out the code examples in the Npcap SDK, which put the appropriate code into a function called LoadNpcapDlls
.
I'm NOT using Visual Studio. How do I do this on Cygwin? I get the call stuff. What if I rename the all other DLL files to
I have not tested building Npcap-compatible tools with MinGW, but it appears you would do it this way:
wpcap.dll
using the -y
option to dlltool
.SetDllDirectory
appropriately before calling any pcap-API functions.I understand this code came from the Npcap Development Tutorial, which was adapted from the WinPcap documentation. I will have to revisit that tutorial and ensure that its code contains the appropriate delay-loading DLL code.
As a stopgap measure, you can install Npcap in WinPcap-API compatible mode, which should enable most WinPcap software to function, though Npcap-specific feature improvements may not be available.
This will probably be a bit long. Sorry about that.
I am running Npcap on Windows 10 and cygwin. This code did work when using WinPcap. Here is the output from
DiaReport
(run on Windows directly):Here is the program I am compiling cleanly using gcc 7.4.0 on Cygwin 3.0.7.
When I run this outside of teh debugger, it returns without displaying anything. When I run it in the debugger and set a break point on main, a few times it never gets to main (I have a feeling that it is happening during the library loading), and when it does brean on main, when I step over
pcap_findalldevs_ex
, I get the following output (includes the times when the debugger did not break on main):