diff options
author | Gerald Combs <gerald@wireshark.org> | 2018-03-12 08:49:12 -0700 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-03-13 17:18:30 +0000 |
commit | a2f926761525ac67feeda742a796917a1f043b33 (patch) | |
tree | cf79825b1d983633dc7d7f6d1a28ec2fe70dfa1e /wsutil/win32-utils.h | |
parent | 0874b8bac6ca89f1d91d30d66d54f425e4e7c81e (diff) |
Windows: Always assign newly-created processes to our job.
Move ws_pipe_kill_child_on_exit to win32-utils. Add win32_create_process,
which calls CreateProcess + AssignProcessToJobObject. Use
win32_create_process instead of CreateProcess everywhere.
Bug: 1419
Change-Id: I7a1f17dddf6a73f6973d54621f271b69311400d1
Reviewed-on: https://code.wireshark.org/review/26448
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'wsutil/win32-utils.h')
-rw-r--r-- | wsutil/win32-utils.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/wsutil/win32-utils.h b/wsutil/win32-utils.h index 6a84dd0fa0..553d8f1921 100644 --- a/wsutil/win32-utils.h +++ b/wsutil/win32-utils.h @@ -64,6 +64,28 @@ const char * win32strerror(DWORD error); WS_DLL_PUBLIC const char * win32strexception(DWORD exception); +/** + * @brief ws_pipe_create_process Create a process and assign it to the main application + * job object so that it will be killed the the main application exits. + * @param application_name Application name. Will be converted to its UTF-16 equivalent or NULL. + * @param command_line Command line. Will be converted to its UTF-16 equivalent. + * @param process_attributes Same as CreateProcess. + * @param thread_attributes Same as CreateProcess. + * @param inherit_handles Same as CreateProcess. + * @param creation_flags Will be ORed with CREATE_SUSPENDED|CREATE_BREAKAWAY_FROM_JOB. + * @param environment Same as CreateProcess. + * @param current_directory Current directory. Will be converted to its UTF-16 equivalent or NULL. + * @param startup_info Same as CreateProcess. + * @param process_information Same as CreateProcess. + * @return + */ +WS_DLL_PUBLIC +BOOL win32_create_process(const char *application_name, const char *command_line, + LPSECURITY_ATTRIBUTES process_attributes, LPSECURITY_ATTRIBUTES thread_attributes, + BOOL inherit_handles, DWORD creation_flags, LPVOID environment, + const char *current_directory, LPSTARTUPINFO startup_info, LPPROCESS_INFORMATION process_information +); + #ifdef __cplusplus } #endif |