aboutsummaryrefslogtreecommitdiffstats
path: root/rawshark.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2011-01-06 23:28:58 +0000
committerGerald Combs <gerald@wireshark.org>2011-01-06 23:28:58 +0000
commit3bc1fc38026b7438361c23e3fe0d8bb16a4b1583 (patch)
treed8e63f631f4eb3535026e250352b0254e49be4f1 /rawshark.c
parentb0beaec6a19b496bed93a040c9fcddc65abc4806 (diff)
On Windows, convert all of our command-line arguments from UTF-16 to
UTF-8 where we don't already do so. In Wireshark use g_utf16_to_utf8 instead of utf_16to8. This should fix bug 5520. svn path=/trunk/; revision=35411
Diffstat (limited to 'rawshark.c')
-rw-r--r--rawshark.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/rawshark.c b/rawshark.c
index a88d6fee5e..27d4d7639d 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -117,6 +117,10 @@
#endif /* HAVE_LIBPCAP */
#include "log.h"
+#ifdef _WIN32
+#include <shellapi.h>
+#endif /* _WIN32 */
+
/*
* This is the template for the decode as option; it is shared between the
* various functions that output the usage for this parameter.
@@ -430,7 +434,9 @@ main(int argc, char *argv[])
gboolean arg_error = FALSE;
#ifdef _WIN32
- WSADATA wsaData;
+ WSADATA wsaData;
+ LPWSTR *wc_argv;
+ int wc_argc;
#endif /* _WIN32 */
char *gpf_path, *pf_path;
@@ -453,6 +459,16 @@ main(int argc, char *argv[])
static const char optstring[] = OPTSTRING_INIT;
+#ifdef _WIN32
+ /* Convert our arg list to UTF-8. */
+ wc_argv = CommandLineToArgvW(GetCommandLineW(), &wc_argc);
+ if (wc_argv && wc_argc == argc) {
+ for (i = 0; i < argc; i++) {
+ argv[i] = g_utf16_to_utf8(wc_argv[i], -1, NULL, NULL, NULL);
+ }
+ } /* XXX else bail because something is horribly, horribly wrong? */
+#endif /* _WIN32 */
+
/*
* Get credential information for later use.
*/