Open spacemeowx2 opened 5 years ago
@spacemeowx2 Thank you for your report. I have done some debugging and research to better understand the problem.
You are basically right - npcap when installed together with wpcap is installed in such a way that you cannot just open it using LoadLibrary(). This is unexpected. However my understanding is that it works OK when installed as the main library.
We have two choices here. The first one is to assume that rawsock supports only "full" installation of npcap. The second one is to modify the code so that it loads npcap even when installed together with wpcap. My prefference is the second option but at the same time I can see it as a kind of costly change with relatively small value. Not many users will be using npcap together with wpcap and still strictly prefer the first one. Additionally I would like to first implement in dlopen a feature that would allow you to set dll search path from within the process in a portable way. I am not even sure if this is possible (maybe the setenv() function on POSIX will allow you to modify LD_LIBRARY_PATH variable, maybe not).
So I will keep this issue as an low-priority enhancement and try to extend dlopen first.
Blocked by: dlopen issue
Is any workaround now? After I have a glance at the discussion, I think I can release with 2 dll files in the current directory, which is not that elegant. :-P
It seems that we prefer
npcap
. But whenWinPcap
andnpcap
coexist,rawsock
actually loadsWinPcap
.https://github.com/szymonwieloch/rust-rawsock/blob/53408bd5c2d3511002482cf60a39dd773ccde153/src/wpcap/paths.rs#L3-L8
Since
Npcap\wpcap.dll
searchsPacket.dll
instead ofNpcap\Packet.dll
(could be seen using procmon), andNpcap\wpcap.dll
wouldn't load correctly with wrongPacket.dll
.And because what we need is
wpcap.dll
, I think allPacket.dll
could be removed from default paths.Solution:
I think it should be an issue about dlopen.
According to the document (
npcap-sdk-1.03/docs/npcap-devguide.html#npcap-feature-native
in npcap-sdk-1.03.zip), we need to callSetDllDirectory
to makewpcap.dll
loading rightdll
.