Commit Graph

20 Commits

Author SHA1 Message Date
João Valverde 70cea91c8a wsutil: argv[] is a NULL terminated array 2021-06-10 16:22:12 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Guy Harris bce13644e9 Bring back arg_list_utf_16to8(), but have it just do UTF-16-to-UTF-8 mapping.
Call it from wmain() in the command-line tools, passing it the input
argument count and vector, and call it from main() in Wireshark, after
getting a UTF-16 argument vector from passing the result of
GetCommandLineW() to CommandLineToArgvW().

Change-Id: I0e51703c0a6c92f7892d196e700ab437bd702514
Reviewed-on: https://code.wireshark.org/review/30063
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-10-08 03:05:45 +00:00
Guy Harris a679ae6f79 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>
2018-10-07 18:57:54 +00:00
Guy Harris 9f2dff98f6 Include <config.h> so UNICODE is defined.
All other files should do so; this file should, so that we're using the
Unicode versions of Windows APIs (especially given that other files that
include wsutil/unicode-utils.h will be doing so and expecting UTF-16
strings from utf_8to16_snprintf()).

Change-Id: I7eccf580ab0dc504aa78b345e36e2fcda818a7c5
Reviewed-on: https://code.wireshark.org/review/26170
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-28 17:26:29 +00:00
Dario Lombardo 8cd389e161 replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.
The first is deprecated, as per https://spdx.org/licenses/.

Change-Id: I8e21e1d32d09b8b94b93a2dc9fbdde5ffeba6bed
Reviewed-on: https://code.wireshark.org/review/25661
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 14:57:36 +00:00
Michael Mann 3d673da88c Convert to using use SPDX identifier on wsutil directory
Change-Id: Id73e641499e75bc1afc1dea29682418156f461fe
Reviewed-on: https://code.wireshark.org/review/24751
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-10 04:36:29 +00:00
Gerald Combs 91b154236b Win32: Pass a mutable string to CreateProcess.
CreateProcess can modify its second (lpCommandLine) argument. Don't
pass it the output of utf_8to16.

Constify the return value of utf_8to16.

Change-Id: I0d4361396e90c88a4ab2a3f2f0e058230e897fdf
Reviewed-on: https://code.wireshark.org/review/15155
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-04-28 23:50:28 +00:00
Pascal Quantin 60f33b6581 Qt: fix a crash when closing application under Windows
QCoreApplication visits eldritch horrors upon argv on Windows. Keep a
local copy for our own processing.

---
[ Pascal's original comments ]
g6c4ec4a introduced the use of arg_list_utf_16to8 that triggers a crash on my
computer when freeing the g_allocated memory.
Let's do a similar work but with a memory allocator that does not trigger an exception.

Also fix a memory leak in arg_list_utf_16to8 while we are at it.

Change-Id: I93d899af20b09c9a5d584a46297f715591502df9
Reviewed-on: https://code.wireshark.org/review/8961
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-06-17 23:24:58 +00:00
Bill Meier 10b83e6931 Add editor-modelines; adjust whitespace.
Change-Id: I8cad872cee972a6d22a72852dac57fd188daca84
Reviewed-on: https://code.wireshark.org/review/4683
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-14 16:45:09 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Guy Harris 2adcfcd914 Need <strsafe.h> for StringCchPrintf().
svn path=/trunk/; revision=54644
2014-01-08 00:39:14 +00:00
Guy Harris e8dd800cc1 As checkAPIs.pl says, "use StringCchPrintf".
svn path=/trunk/; revision=54641
2014-01-07 23:56:21 +00:00
Jakub Zawadzki abda30e9e6 Fix bug #9618: Invalid utf8 causes JSON dissector assertion failure "g_utf8_validate"
Validate JSON UTF-8 characters, replace with '?' when invalid.

svn path=/trunk/; revision=54633
2014-01-07 22:17:32 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Gerald Combs a24687ce8e Move the Windows argument list conversion code to a common routine.
svn path=/trunk/; revision=37372
2011-05-24 00:07:56 +00:00
Jeff Morriss ad47f04c94 Move getenv_utf8() to wsutil.
svn path=/trunk/; revision=35148
2010-12-07 20:24:57 +00:00
Kovarththanan Rajaratnam 418699b85d Add utf_8to16_snprintf() which creates a UTF16 string according to the given format string. The format string + arguments are expected to be in UTF-8 format. This change effectively removes the only place where we use PRIu64.
svn path=/trunk/; revision=29635
2009-08-31 18:16:16 +00:00
Jeff Morriss 2cd9755e81 unicode-utils.c is only for Windows; don't build it on UN*X. Put in a check
to cause it to fail when built on UN*X.

svn path=/trunk/; revision=25704
2008-07-11 16:18:32 +00:00
Jeff Morriss 83f9ecf96f Move privileges.c and unicode-utils.c from epan to wsutil (so things like
capinfos and dumpcap don't need to depend on libwireshark nor directly pull
in those modules).  Because capinfos and editcap were only being linked with
privileges.c if we had plugins, this allows those programs to be linked when
someone is compiling --without-plugins.

svn path=/trunk/; revision=25640
2008-06-30 17:16:29 +00:00