diff options
author | Roland Knall <roland.knall@br-automation.com> | 2016-06-23 10:43:30 +0200 |
---|---|---|
committer | Roland Knall <rknall@gmail.com> | 2016-06-25 15:06:27 +0000 |
commit | 79836fa23ae275466fd7414967bd17e0f629c888 (patch) | |
tree | 7174732c7a462f81d6e2402f18513dab470f5546 /wsutil/win32-utils.h | |
parent | fe6856684b9c48edd093dbe3b9931630d9325ce6 (diff) |
wsutil: Move Win32 helper routines from capchild
Move error handling and argument quoting routines from
capchild to wsutil, as those methods will be used by
extcap_spawn as well.
Change-Id: I2c4515fefd5aecad317fcdaefa721734288f792c
Reviewed-on: https://code.wireshark.org/review/16123
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'wsutil/win32-utils.h')
-rw-r--r-- | wsutil/win32-utils.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/wsutil/win32-utils.h b/wsutil/win32-utils.h new file mode 100644 index 0000000000..01026bcf8e --- /dev/null +++ b/wsutil/win32-utils.h @@ -0,0 +1,79 @@ +/* win32-utils.h + * Windows utility definitions + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 2006 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __WIN32UTIL_H__ +#define __WIN32UTIL_H__ + +#include <config.h> + +#include "ws_symbol_export.h" + +#include <glib.h> +#include <windows.h> + +/** + * @file + * Unicode convenience routines. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** 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. + * + * @param argv The string to be quoted. May be NULL. + * @return The string quoted to be used by CreateProcess + */ +WS_DLL_PUBLIC +gchar * protect_arg (const gchar *argv); + +/** Generate a string for a Win32 error. + * + * @param error The windows error code + * @return a localized string containing the corresponding error message + */ +WS_DLL_PUBLIC +const char * win32strerror(DWORD error); + +/** Generate a string for a Win32 exception code. + * + * @param exception The exception code + * @return a non-localized string containing the error message + */ +WS_DLL_PUBLIC +const char * win32strexception(DWORD exception); + +#ifdef __cplusplus +} +#endif + +#endif /* __WIN32UTIL_H__ */ |