#include <wireshark.h>
#include <windows.h>
Go to the source code of this file.
|
WS_DLL_PUBLIC char * | protect_arg (const char *argv) |
|
WS_DLL_PUBLIC bool | win32_is_pipe_name (const char *pipe_name) |
|
WS_DLL_PUBLIC const char * | win32strerror (DWORD error) |
|
WS_DLL_PUBLIC const char * | win32strexception (DWORD exception) |
|
WS_DLL_PUBLIC BOOL | win32_create_process (const char *application_name, const char *command_line, LPSECURITY_ATTRIBUTES process_attributes, LPSECURITY_ATTRIBUTES thread_attributes, size_t n_inherit_handles, HANDLE *inherit_handles, DWORD creation_flags, LPVOID environment, const char *current_directory, LPSTARTUPINFO startup_info, LPPROCESS_INFORMATION process_information) |
| ws_pipe_create_process Create a process and assign it to the main application job object so that it will be killed when the main application exits.
|
|
Unicode convenience routines.
◆ protect_arg()
WS_DLL_PUBLIC char * protect_arg |
( |
const char * |
argv | ) |
|
Quote the argument element if necessary, so that it will get reconstructed correctly in the C runtime startup code. Note that the unquoting algorithm in the C runtime is really weird, and rather different than what Unix shells do. See stdargv.c in the C runtime sources (in the Platform SDK, in src/crt).
Stolen from GLib's protect_argv(), an internal routine that quotes string in an argument list so that they arguments will be handled correctly in the command-line string passed to CreateProcess() if that string is constructed by gluing those strings together.
- Parameters
-
argv | The string to be quoted. May be NULL. |
- Returns
- The string quoted to be used by CreateProcess
◆ win32_create_process()
WS_DLL_PUBLIC BOOL win32_create_process |
( |
const char * |
application_name, |
|
|
const char * |
command_line, |
|
|
LPSECURITY_ATTRIBUTES |
process_attributes, |
|
|
LPSECURITY_ATTRIBUTES |
thread_attributes, |
|
|
size_t |
n_inherit_handles, |
|
|
HANDLE * |
inherit_handles, |
|
|
DWORD |
creation_flags, |
|
|
LPVOID |
environment, |
|
|
const char * |
current_directory, |
|
|
LPSTARTUPINFO |
startup_info, |
|
|
LPPROCESS_INFORMATION |
process_information |
|
) |
| |
ws_pipe_create_process Create a process and assign it to the main application job object so that it will be killed when the main application exits.
In order to limit unwanted handle duplicates in subprocesses all handles should be created as not inheritable and passed in the inherit_handles array. This function marks the handles as inheritable for as short time as possible. Note that handles passed to this function will have the inheritable flag cleared on exit. Processes created with this function inherit only the provided handles.
- Parameters
-
application_name | Application name. Will be converted to its UTF-16 equivalent or NULL. |
command_line | Command line. Will be converted to its UTF-16 equivalent. |
process_attributes | Same as CreateProcess. |
thread_attributes | Same as CreateProcess. |
n_inherit_handles | Number of handles the child process will inherit. |
inherit_handles | Handles the child process will inherit. |
creation_flags | Will be ORed with CREATE_SUSPENDED|CREATE_BREAKAWAY_FROM_JOB. |
environment | Same as CreateProcess. |
current_directory | Current directory. Will be converted to its UTF-16 equivalent or NULL. |
startup_info | Same as CreateProcess. |
process_information | Same as CreateProcess. |
- Returns
◆ win32_is_pipe_name()
WS_DLL_PUBLIC bool win32_is_pipe_name |
( |
const char * |
pipe_name | ) |
|
Tests a UTF-8 string to see if it is a Windows pipe name. Under Windows, named pipes must have the form "\\<server>\pipe\<pipename>". <server> may be "." for localhost. This does not check that a pipe server has actually created the pipe, only that the name is the proper form.
- Parameters
-
pipename | The UTF-8 string to be checked |
- Returns
- TRUE if the string is a valid Windows pipe name.
◆ win32strerror()
WS_DLL_PUBLIC const char * win32strerror |
( |
DWORD |
error | ) |
|
Generate a string for a Windows error.
- Parameters
-
error | The Windows error code |
- Returns
- a localized UTF-8 string containing the corresponding error message
◆ win32strexception()
WS_DLL_PUBLIC const char * win32strexception |
( |
DWORD |
exception | ) |
|
Generate a string for a Win32 exception code.
- Parameters
-
exception | The exception code |
- Returns
- a non-localized string containing the error message