diff options
author | gerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7> | 2011-01-06 23:28:58 +0000 |
---|---|---|
committer | gerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7> | 2011-01-06 23:28:58 +0000 |
commit | eb492e28afd20ccb931ffa0f3d0190257b7f654e (patch) | |
tree | d8e63f631f4eb3535026e250352b0254e49be4f1 /capinfos.c | |
parent | b0231277a83ec91cc8489d2765aaf78afd6110e8 (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.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@35411 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'capinfos.c')
-rw-r--r-- | capinfos.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/capinfos.c b/capinfos.c index 08017999b4..86f9b81606 100644 --- a/capinfos.c +++ b/capinfos.c @@ -85,6 +85,10 @@ #include "wsutil/wsgetopt.h" #endif +#ifdef _WIN32 +#include <shellapi.h> +#endif /* _WIN32 */ + #include "svnversion.h" /* @@ -802,6 +806,13 @@ main(int argc, char *argv[]) int err; gchar *err_info; int opt; + +#ifdef _WIN32 + WSADATA wsaData; + LPWSTR *wc_argv; + int wc_argc, i; +#endif /* _WIN32 */ + int status = 0; #ifdef HAVE_PLUGINS char* init_progfile_dir_error; @@ -813,6 +824,16 @@ main(int argc, char *argv[]) size_t hash_bytes; #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. */ |