aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rawshark.c1
-rw-r--r--tshark.c1
-rw-r--r--wireshark-qt.cpp1
-rw-r--r--wsutil/file_util.c9
4 files changed, 12 insertions, 0 deletions
diff --git a/rawshark.c b/rawshark.c
index cd59d9fdf9..3d54ca3a63 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -574,6 +574,7 @@ main(int argc, char *argv[])
}
#ifdef _WIN32
+ ws_init_dll_search_path();
/* Load Wpcap, if possible */
load_wpcap();
#endif
diff --git a/tshark.c b/tshark.c
index 87eea3d137..87a317c411 100644
--- a/tshark.c
+++ b/tshark.c
@@ -649,6 +649,7 @@ main(int argc, char *argv[])
initialize_funnel_ops();
#ifdef _WIN32
+ ws_init_dll_search_path();
/* Load wpcap if possible. Do this before collecting the run-time version information */
load_wpcap();
diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp
index 6aff5979c8..16fc62dc2e 100644
--- a/wireshark-qt.cpp
+++ b/wireshark-qt.cpp
@@ -383,6 +383,7 @@ int main(int argc, char *argv[])
g_log(NULL, G_LOG_LEVEL_DEBUG, "progfile_dir: %s", get_progfile_dir());
#ifdef _WIN32
+ ws_init_dll_search_path();
/* Load wpcap if possible. Do this before collecting the run-time version information */
load_wpcap();
diff --git a/wsutil/file_util.c b/wsutil/file_util.c
index a5cd62fdb7..cdbe0a4f01 100644
--- a/wsutil/file_util.c
+++ b/wsutil/file_util.c
@@ -514,6 +514,8 @@ ws_init_dll_search_path()
{
gboolean dll_dir_set = FALSE;
wchar_t *program_path_w;
+ wchar_t npcap_path_w[MAX_PATH];
+ unsigned int retval;
typedef BOOL (WINAPI *SetDllDirectoryHandler)(LPCTSTR);
SetDllDirectoryHandler PSetDllDirectory;
@@ -521,6 +523,13 @@ ws_init_dll_search_path()
PSetDllDirectory = (SetDllDirectoryHandler) GetProcAddress(GetModuleHandle(_T("kernel32.dll")), "SetDllDirectoryW");
if (PSetDllDirectory) {
dll_dir_set = PSetDllDirectory(_T(""));
+ if (dll_dir_set) {
+ retval = GetSystemDirectoryW(npcap_path_w, MAX_PATH);
+ if (0 < retval && retval <= MAX_PATH) {
+ wcscat_s(npcap_path_w, MAX_PATH, L"\\Npcap");
+ dll_dir_set = PSetDllDirectory(npcap_path_w);
+ }
+ }
}
if (!dll_dir_set && init_dll_load_paths()) {