2 * Windows utility definitions
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 2006 Gerald Combs
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef __WIN32UTIL_H__
24 #define __WIN32UTIL_H__
28 #include "ws_symbol_export.h"
35 * Unicode convenience routines.
42 /** Quote the argument element if necessary, so that it will get
43 * reconstructed correctly in the C runtime startup code. Note that
44 * the unquoting algorithm in the C runtime is really weird, and
45 * rather different than what Unix shells do. See stdargv.c in the C
46 * runtime sources (in the Platform SDK, in src/crt).
48 * Stolen from GLib's protect_argv(), an internal routine that quotes
49 * string in an argument list so that they arguments will be handled
50 * correctly in the command-line string passed to CreateProcess()
51 * if that string is constructed by gluing those strings together.
53 * @param argv The string to be quoted. May be NULL.
54 * @return The string quoted to be used by CreateProcess
57 gchar * protect_arg (const gchar *argv);
59 /** Generate a string for a Win32 error.
61 * @param error The windows error code
62 * @return a localized string containing the corresponding error message
65 const char * win32strerror(DWORD error);
67 /** Generate a string for a Win32 exception code.
69 * @param exception The exception code
70 * @return a non-localized string containing the error message
73 const char * win32strexception(DWORD exception);
79 #endif /* __WIN32UTIL_H__ */