Skip to content

Commit c5a6695

Browse files
committed
Prefer Npcap on Windows
Set dll search directory to prefer Npcap.
1 parent 5a15b1a commit c5a6695

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/pcap/pcapplayback.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#ifdef Q_OS_WIN
1212
#include <windows.h>
1313
#include <delayimp.h>
14+
#include <tchar.h>
1415
#endif
1516

1617
PcapPlayback::PcapPlayback(QWidget *parent) :
@@ -38,6 +39,12 @@ bool PcapPlayback::foundLibPcap()
3839
return EXCEPTION_CONTINUE_SEARCH;
3940
};
4041

42+
// Prefer Npcap
43+
TCHAR npcapDir[BUFSIZ];
44+
GetSystemDirectory(npcapDir, BUFSIZ);
45+
_tcscat_s(npcapDir, BUFSIZ, TEXT("\\Npcap"));
46+
SetDllDirectory(npcapDir);
47+
4148
__try {
4249
HRESULT hr = __HrLoadAllImportsForDll("wpcap.dll");
4350
if (FAILED(hr)) {

0 commit comments

Comments
 (0)