diff options
author | Gerald Combs <gerald@wireshark.org> | 2011-01-06 23:28:58 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2011-01-06 23:28:58 +0000 |
commit | 3bc1fc38026b7438361c23e3fe0d8bb16a4b1583 (patch) | |
tree | d8e63f631f4eb3535026e250352b0254e49be4f1 /editcap.c | |
parent | b0beaec6a19b496bed93a040c9fcddc65abc4806 (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 'editcap.c')
-rw-r--r-- | editcap.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -49,6 +49,8 @@ #endif #ifdef _WIN32 +#include <windows.h> +#include <shellapi.h> #include <process.h> /* getpid */ #ifdef HAVE_WINSOCK2_H #include <winsock2.h> @@ -813,6 +815,12 @@ main(int argc, char *argv[]) int i, j, err; gchar *err_info; int opt; + +#ifdef _WIN32 + LPWSTR *wc_argv; + int wc_argc; +#endif /* _WIN32 */ + char *p; unsigned int snaplen = 0; /* No limit */ unsigned int choplen = 0; /* No chop */ @@ -838,6 +846,16 @@ main(int argc, char *argv[]) char* init_progfile_dir_error; #endif +#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. */ |