diff options
author | Yang Luo <hsluoyz@gmail.com> | 2016-06-16 11:39:32 +0800 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2016-06-21 08:19:35 +0000 |
commit | d50b981d3839b212508523d02004ace41f1a731b (patch) | |
tree | 441314171f23509bff0044ddd4ca6ee2d89f2819 /wsutil | |
parent | 6ccee3ecd52b1827152a813fc05b0bca73bb5d1d (diff) | |
download | wireshark-d50b981d3839b212508523d02004ace41f1a731b.tar.gz |
pcap: Add support to "new" Npcap native mode without setting PATH
Npcap decided not to add "C:\Windows\System32\Npcap" to
system PATH in the installation any more (starting from
Npcap 0.07 r14). So this patch needs to be applied, otherwise
Wireshark will not find Packet.dll (the error message will
only say wpcap.dll is missing, but actually is Packet.dll
missing).
Change-Id: Ifd8b6e6d8ecf9866cd37c3368b604de210ff8c7b
Reviewed-on: https://code.wireshark.org/review/15959
Reviewed-by: Yang Luo <hsluoyz@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/file_util.c | 9 |
1 files changed, 9 insertions, 0 deletions
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()) { |