diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2018-05-07 23:37:31 +0200 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2018-05-08 17:29:34 +0000 |
commit | e9c5d937b5e78b63b58116e300fa7553b83d1a3d (patch) | |
tree | f128385f2bc3a6088f1863ce1e47c2e3d0c7f96a /wsutil | |
parent | 8756d0ad1238916f11ea7f185f6fdab1dc1b36c6 (diff) |
Windows: prioritize Npcap over WinPcap
It is now considered stable enough to be our default capture driver if present
Change-Id: I7f3cdabcbaea526949afa47164e520202e6b93f2
Reviewed-on: https://code.wireshark.org/review/27393
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/file_util.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/wsutil/file_util.c b/wsutil/file_util.c index fad4fd287e..4045b978a8 100644 --- a/wsutil/file_util.c +++ b/wsutil/file_util.c @@ -491,32 +491,18 @@ init_dll_load_paths() gboolean ws_init_dll_search_path() { - gboolean dll_dir_set = FALSE, npf_found = FALSE; + gboolean dll_dir_set = FALSE; wchar_t *program_path_w; wchar_t npcap_path_w[MAX_PATH]; unsigned int retval; - SC_HANDLE h_scm, h_serv; dll_dir_set = SetDllDirectory(_T("")); if (dll_dir_set) { - /* Do not systematically add Npcap path as long as we favor WinPcap over Npcap. */ - h_scm = OpenSCManager(NULL, NULL, 0); - if (h_scm) { - h_serv = OpenService(h_scm, _T("npf"), SC_MANAGER_CONNECT|SERVICE_QUERY_STATUS); - if (h_serv) { - CloseServiceHandle(h_serv); - npf_found = TRUE; - } - CloseServiceHandle(h_scm); - } - if (!npf_found) { - /* npf service was not found, so WinPcap is not (properly) installed. - Add Npcap folder to libraries search path. */ - 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 = SetDllDirectory(npcap_path_w); - } + /* Add Npcap folder to libraries search path. */ + 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 = SetDllDirectory(npcap_path_w); } } @@ -595,8 +581,8 @@ ws_module_open(gchar *module_name, GModuleFlags flags) } } - /* Next try the system directory */ - full_path = g_module_build_path(system_path, module_name); + /* Next try the Npcap directory */ + full_path = g_module_build_path(npcap_path, module_name); if (full_path) { mod = g_module_open(full_path, flags); @@ -606,8 +592,8 @@ ws_module_open(gchar *module_name, GModuleFlags flags) } } - /* At last try the Npcap directory */ - full_path = g_module_build_path(npcap_path, module_name); + /* At last try the system directory */ + full_path = g_module_build_path(system_path, module_name); if (full_path) { mod = g_module_open(full_path, flags); |