Wireshark-commits: [Wireshark-commits] master a679ae6: Use wsetargv.obj, and wmain() rather than ma

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Sun, 07 Oct 2018 18:58:00 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=a679ae6f791ac6b02f342d3b73d6b4aecb9ca6e9
Submitter: "Guy Harris <guy@xxxxxxxxxxxx>"
Changed: branch: master
Repository: wireshark

Commits:

a679ae6 by Guy Harris (guy@xxxxxxxxxxxx):

    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@xxxxxxxxxxxx>
    Tested-by: Petri Dish Buildbot
    Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
    

Actions performed:

    from  ce53b4c   NGAP: prettify a bit mode fields
     add  a679ae6   Use wsetargv.obj, and wmain() rather than main(), on Windows.


Summary of changes:
 CMakeLists.txt         |  4 ++--
 capinfos.c             | 25 ++++++++++++++++++++++---
 captype.c              | 25 ++++++++++++++++++++++---
 dumpcap.c              | 24 +++++++++++++++++++++---
 editcap.c              | 25 ++++++++++++++++++++++---
 mergecap.c             | 27 ++++++++++++++++++++++-----
 randpkt.c              | 25 ++++++++++++++++++++++---
 rawshark.c             | 25 ++++++++++++++++++++++---
 text2pcap.c            | 34 ++++++++++++++++++++++++++--------
 tfshark.c              | 25 ++++++++++++++++++++++---
 tshark.c               | 25 ++++++++++++++++++++++---
 ui/qt/main.cpp         | 36 +++++++++++++++++++++++++++++-------
 wsutil/unicode-utils.c | 18 ------------------
 wsutil/unicode-utils.h | 14 --------------
 14 files changed, 254 insertions(+), 78 deletions(-)