This is our old Q&A Site. Please post any new questions and answers at

tshark` fails if its parameters contain Chinese characters (in a path parameter). For example:

tshark -r d:\中文.pcap -V -T text > d:\1.txt

wireshark 1.5.1 has solved the problem. but how to correct the source code if i just want to use wireshark1.2.9 ? which code of wireshark1.2.9 should be modified in order to solve the problem.


asked 15 Sep '11, 19:20

ylda_ljm0620's gravatar image

accept rate: 0%

edited 15 Sep '11, 23:49

CommandLineToArgvW requires shell32.lib. You probably just need to make this change to Makefile.nmake. In fact, you may want to apply all the changes committed in r35411.

permanent link

answered 16 Sep '11, 14:14

cmaynard's gravatar image

cmaynard ♦♦
accept rate: 20%

edited 16 Sep '11, 14:17

to solve the problem, i modified in tshark.c of wireshark1.2.9 as follow:

main(int argc, char *argv[])
  char                *init_progfile_dir_error;
  int                  opt, i;
  extern char         *optarg;
  gboolean             arg_error = FALSE;

#ifdef _WIN32
  WSADATA       wsaData;
  LPWSTR              *wc_argv;
  int                  wc_argc,j;
#endif  /* _WIN32 */


  static const char    optstring[] = OPTSTRING_INIT OPTSTRING_WIN32;

#ifdef _WIN32
  /* Convert our arg list to UTF-8. */
  wc_argv = CommandLineToArgvW(GetCommandLineW(), &wc_argc);
  if (wc_argv && wc_argc == argc) {
    for (j = 0; j < argc; j++) {
      argv[j] = g_utf16_to_utf8(wc_argv[j], -1, NULL, NULL, NULL);
  } /* XXX else bail because something is horribly, horribly wrong? */
#endif /* _WIN32 */


but i can not compile successfully. the error :

tshark.c(772) : error C2220: warning treated as error - no 'object' file generat
tshark.c(772) : warning C4013: 'CommandLineToArgvW' undefined; assuming extern r
eturning int
tshark.c(772) : warning C4047: '=' : 'LPWSTR *' differs in levels of indirection
 from 'int'
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN
\cl.EXE"' : return code '0x2'

how should i modify the thark.c?

(16 Sep '11, 02:10) ylda_ljm0620

thanks. It success.

i add shell32.lib to tshark_LIBS in Makefile.nmake, add #include <shellapi.h> in tshark.c.

(18 Sep '11, 20:19) ylda_ljm0620
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 15 Sep '11, 19:20

question was seen: 4,720 times

last updated: 18 Sep '11, 20:19

p​o​w​e​r​e​d by O​S​Q​A