aboutsummaryrefslogtreecommitdiffstats
path: root/randpkt.c
diff options
context:
space:
mode:
Diffstat (limited to 'randpkt.c')
-rw-r--r--randpkt.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/randpkt.c b/randpkt.c
index 2a2ce08d89..c4786c6452 100644
--- a/randpkt.c
+++ b/randpkt.c
@@ -99,8 +99,8 @@ usage(gboolean is_error)
fprintf(output, "\nIf type is not specified, a random packet will be chosen\n\n");
}
-int
-main(int argc, char **argv)
+static int
+real_main(int argc, char **argv)
{
char *init_progfile_dir_error;
int opt;
@@ -143,7 +143,6 @@ main(int argc, char **argv)
cmdarg_err_init(failure_warning_message, failure_message_cont);
#ifdef _WIN32
- arg_list_utf_16to8(argc, argv);
create_app_running_mutex();
#endif /* _WIN32 */
@@ -247,6 +246,26 @@ clean_exit:
return ret;
}
+#ifdef _WIN32
+int
+wmain(int argc, wchar_t **argv)
+{
+ char **argv_utf8;
+
+ /* Convert our arg list from UTF-16LE to UTF-8. */
+ argv_utf8 = g_malloc(argc * sizeof *argv_utf8);
+ for (int i = 0; i < argc; i++)
+ argv_utf8[i] = g_utf16_to_utf8(argv[i], -1, NULL, NULL, NULL);
+ return real_main(argc, argv_utf8);
+}
+#else
+int
+main(int argc, char **argv)
+{
+ return real_main(argc, argv);
+}
+#endif
+
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*