aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil/unicode-utils.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-10-07 10:06:00 -0700
committerGuy Harris <guy@alum.mit.edu>2018-10-07 18:57:54 +0000
commita679ae6f791ac6b02f342d3b73d6b4aecb9ca6e9 (patch)
treed2f21c87ea7422fa56ba8cc2ff6f23d18bea36f2 /wsutil/unicode-utils.c
parentce53b4c170e0b0b1c7bb521fe677db1eadc7792b (diff)
Use wsetargv.obj, and wmain() rather than main(), on Windows.
Doing so for command-line programs means that the argument list doesn't ever get converted to the local code page; converting to the local code page can mangle file names that *can't* be converted to the local code page. Furthermore, code that uses setargv.obj rather than wsetargv.obj has issues in some versions of Windows 10; see bug 15151. That means that converting the argument list to UTF-8 is a bit simpler - we don't need to call GetCommandLineW() or CommandLineToArgvW(), we just loop over the UTF-16LE argument strings in argv[]. While we're at it, note in Wireshark's main() why we discard argv on Windows (Qt does the same "convert-to-the-local-code-page" stuff); that means we *do* need to call GetCommandLineW() and CommandLineToArgvW() in main() (i.e., we duplicate what Qt's WinMain() does, but converting to UTF-8 rather than to the local code page). Change-Id: I35b57c1b658fb3e9b0c685097afe324e9fe98649 Ping-Bug: 15151 Reviewed-on: https://code.wireshark.org/review/30051 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wsutil/unicode-utils.c')
-rw-r--r--wsutil/unicode-utils.c18
1 files changed, 0 insertions, 18 deletions
diff --git a/wsutil/unicode-utils.c b/wsutil/unicode-utils.c
index 80323a53aa..5a8fa2336a 100644
--- a/wsutil/unicode-utils.c
+++ b/wsutil/unicode-utils.c
@@ -27,7 +27,6 @@ ws_utf8_char_len(guint8 ch)
#ifdef _WIN32
-#include <shellapi.h>
#include <strsafe.h>
/** @file
@@ -142,23 +141,6 @@ utf_16to8(const wchar_t *utf16str)
return utf8buf[idx];
}
-
-/* Convert our argument list from UTF-16 to UTF-8. */
-void
-arg_list_utf_16to8(int argc, char *argv[]) {
- LPWSTR *wc_argv;
- int wc_argc, i;
-
- /* 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? */
- LocalFree(wc_argv);
-}
-
#endif
/*