aboutsummaryrefslogtreecommitdiffstats
path: root/capchild/capture_sync.c
diff options
context:
space:
mode:
authorTomasz Moń <desowin@gmail.com>2019-09-11 16:46:00 +0200
committerAnders Broman <a.broman58@gmail.com>2019-09-23 04:38:00 +0000
commite52f33f66c979ac493fa738005815bb01d5304a8 (patch)
tree32a87b0b934f176cd139f6131336713fe505c42a /capchild/capture_sync.c
parentbd439c909045de71f3ab6907ff3f2e74682e7f3a (diff)
extcap: Multiple extcap instance support on Windows
Wireshark does create named pipes and waits for the child process to connect. The named pipe server handle is inheritable and thus available in child dumpcap process. Pass the handle identifier instead of named pipe name so dumpcap can use it. Bug: 13653 Change-Id: Id2c019f67a63f1ea3d98b9da2153d6de5078cd01 Reviewed-on: https://code.wireshark.org/review/34503 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'capchild/capture_sync.c')
-rw-r--r--capchild/capture_sync.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/capchild/capture_sync.c b/capchild/capture_sync.c
index c46871d229..d2ed2ee75a 100644
--- a/capchild/capture_sync.c
+++ b/capchild/capture_sync.c
@@ -324,7 +324,15 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session, inf
argv = sync_pipe_add_arg(argv, &argc, "-i");
if (interface_opts->extcap_fifo != NULL)
+ {
+#ifdef _WIN32
+ char *pipe = g_strdup_printf("%s%" G_GUINTPTR_FORMAT, EXTCAP_PIPE_PREFIX, interface_opts->extcap_pipe_h);
+ argv = sync_pipe_add_arg(argv, &argc, pipe);
+ g_free(pipe);
+#else
argv = sync_pipe_add_arg(argv, &argc, interface_opts->extcap_fifo);
+#endif
+ }
else
argv = sync_pipe_add_arg(argv, &argc, interface_opts->name);
@@ -500,11 +508,7 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session, inf
#else
si.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE; /* this hides the console window */
- if(interface_opts->extcap_pipe_h != INVALID_HANDLE_VALUE)
- si.hStdInput = interface_opts->extcap_pipe_h;
- else
- si.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
-
+ si.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
si.hStdError = sync_pipe_write;
/*si.hStdError = (HANDLE) _get_osfhandle(2);*/