Commit Graph

204 Commits

Author SHA1 Message Date
Gerald Combs 6dfa2cb0ae Win32: Fix a string length check.
Check the length of a string directly. Fixes Coverity CID 1487026.
2021-07-08 04:12:45 +00:00
Gerald Combs d3f8754874 Win32: Fix a couple of Coverity warnings.
Fix

838             elapsed_time = (unsigned int)(stats.stop_time-stats.start_time);
839             if(status == PREVIEW_TIMED_OUT) {
>>>     CID 1486835:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "StringCchPrintfW(string_buf...".

and

909             /* Default window background */
910             SendMessage(hwnd, EM_SETBKGNDCOLOR, (WPARAM) 1, COLOR_WINDOW);
>>>     CID 1486836:  Resource leaks  (RESOURCE_LEAK)
>>>     Variable "strval" going out of scope leaks the storage it points to.
2021-07-06 07:32:31 +00:00
Gerald Combs 0bc39aa2eb Win32: Compile ui/win32 as C++.
We always build the .c files in ui/win32 with Visual C++, so rename
them to .cpp and update CMakeLists.txt to match. Leave the C code mostly
intact for now, but this lets us take advantage of C++ features in the
future if desired.
2021-07-02 08:02:38 +00:00
João Valverde 0e50979b3f Replace g_assert() with ws_assert() 2021-06-19 01:23:31 +00:00
João Valverde dc7f0b88bb Refactor our logging and extend the wslog API
Experience has shown that:

  1. The current logging methods are not very reliable or practical.
A logging bitmask makes little sense as the user-facing interface (who
would want debug but not crtical messages for example?); it's
computer-friendly and user-unfriendly. More importantly the console
log level preference is initialized too late in the startup process
to be used for the logging subsystem and that fact raises a number
of annoying and hard-to-fix usability issues.

  2. Coding around G_MESSAGES_DEBUG to comply with our log level mask
and not clobber the user's settings or not create unexpected log misses
is unworkable and generally follows the principle of most surprise.
The fact that G_MESSAGES_DEBUG="all" can leak to other programs using
GLib is also annoying.

  3. The non-structured GLib logging API is very opinionated and lacks
configurability beyond replacing the log handler.

  4. Windows GUI has some special code to attach to a console,
but it would be nice to abstract away the rest under a single
interface.

  5. Using this logger seems to be noticeably faster.

Deprecate the console log level preference and extend our API to
implement a log handler in wsutil/wslog.h to provide easy-to-use,
flexible and dependable logging during all execution phases.

Log levels have a hierarchy, from most verbose to least verbose
(debug to error). When a given level is set everything above that
is also enabled.

The log level can be set with an environment variable or a command
line option (parsed as soon as possible but still later than the
environment). The default log level is "message".

Dissector logging is not included because it is not clear what log
domain they should use. An explosion to thousands of domains is
not desirable and putting everything in a single domain is probably
too coarse and noisy. For now I think it makes sense to let them do
their own thing using g_log_default_handler() and continue using the
G_MESSAGES_DEBUG mechanism with specific domains for each individual
dissector.

In the future a mechanism may be added to selectively enable these
domains at runtime while trying to avoid the problems introduced
by G_MESSAGES_DEBUG.
2021-06-11 09:40:28 +00:00
Gerald Combs 9222bd77cd Remove unneeded modelines in ui.
Remove the editor modeline blocks from the source files in ui that use 4
space indentation by running

perl -i -p0e 's{ \n+ /[ *\n]+ editor \s+ modelines .* shiftwidth= .* \*/ \s+ } {\n}gsix' $( ag -l shiftwidth=4 $( ag -g '\.(c|cpp|h|m|mm)') )

This gives us one source of indentation truth for these files, and it
*shouldn't* affect anyone since

- These files match the default in our top-level .editorconfig.

- The one notable editor that's likely to be used on these files and
*doesn't* support EditorConfig (Qt Creator) defaults to 4 space
indentation.
2021-04-20 07:43:39 +00:00
Guy Harris a7256d50b5 wiretap: more work on file type/subtypes.
Provide a wiretap routine to get an array of all savable file
type/subtypes, sorted with pcap and pcapng at the top, followed by the
other types, sorted either by the name or the description.

Use that routine to list options for the -F flag for various commands

Rename wtap_get_savable_file_types_subtypes() to
wtap_get_savable_file_types_subtypes_for_file(), to indicate that it
provides an array of all file type/subtypes in which a given file can be
saved.  Have it sort all types, other than the default type/subtype and,
if there is one, the "other" type (both of which are put at the top), by
the name or the description.

Don't allow wtap_register_file_type_subtypes() to override any existing
registrations; have them always register a new type.  In that routine,
if there are any emply slots in the table, due to an entry being
unregistered, use it rather than allocating a new slot.

Don't allow unregistration of built-in types.

Rename the "dump open table" to the "file type/subtype table", as it has
entries for all types/subtypes, even if we can't write them.

Initialize that table in a routine that pre-allocates the GArray before
filling it with built-in types/subtypes, so it doesn't keep getting
reallocated.

Get rid of wtap_num_file_types_subtypes - it's just a copy of the size
of the GArray.

Don't have wtap_file_type_subtype_description() crash if handed an
file type/subtype that isn't a valid array index - just return NULL, as
we do with wtap_file_type_subtype_name().

In wtap_name_to_file_type_subtype(), don't use WTAP_FILE_TYPE_SUBTYPE_
names for the backwards-compatibility names - map those names to the
current names, and then look them up.  This reduces the number of
uses of hardwired WTAP_FILE_TYPE_SUBTYPE_ values.

Clean up the type of wtap_module_count - it has no need to be a gulong.

Have built-in wiretap file handlers register names to be used for their
file type/subtypes, rather than building the table in init.lua.

Add a new Lua C function get_wtap_filetypes() to construct the
wtap_filetypes table, based on the registered names, and use it in
init.lua.

Add a #define WSLUA_INTERNAL_FUNCTION to register functions intended
only for internal use in init.lua, so they can be made available from
Lua without being documented.

Get rid of WTAP_NUM_FILE_TYPES_SUBTYPES - most code has no need to use
it, as it can just request arrays of types, and the space of
type/subtype codes can be sparse due to registration in any case, so
code has to be careful using it.

wtap_get_num_file_types_subtypes() is no longer used, so remove it.  It
returns the number of elements in the file type/subtype array, which is
not necessarily the name of known file type/subtypes, as there may have
been some deregistered types, and those types do *not* get removed from
the array, they just get cleared so that they're available for future
allocation (we don't want the indices of any registered types to changes
if another type is deregistered, as those indicates are the type/subtype
values, so we can't shrink the array).

Clean up white space and remove some comments that shouldn't have been
added.
2021-02-17 21:54:28 +00:00
Guy Harris 24acef0885 wiretap: file types have a name and a description.
The "short name" is really just the name, used to look it up.  The
"name" is really a description intended solely for human consumption.
Rename the fields, and the functions that access them, to match.

The "description" maintained by Lua for file type handlers is used
*only* for one debugging message; we should probably just eliminate it.
Call it an "internal description" for now.
2021-02-13 01:25:39 -08:00
Jaap Keuter beb1877841 Qt: Add missing break in Win32 file export init dialog function 2020-12-12 14:36:18 +00:00
Gerald Combs 6e1142c33a Win32: Add an include guard.
Add "#ifdef _WIN32" to file_dlg_win32.c so that it's ignored by
tools/validate-clang-check.sh.
2020-12-11 13:38:14 -08:00
Chuck Craft 44241f694e win32: fix MR180 - broke "-i -" input pipe 2020-11-02 12:56:44 +00:00
Chuck Craft 5b242d62b0 WIN32 logging: connect stdio earlier in main() 2020-10-20 13:49:27 +00:00
David Perry 00b5c2809a Sort list of available filetypes when loading a capture
When loading a capture file in the GUI, this change causes the list of
available file types to be sorted alphabetically. "Automatically detect
file type", pcap, and pcapng remain at the top of the list.

Unlike my prior crack at this in change #36862, this is done directly in
the file open dialogs (open_file_hook_proc() for Windows,
CaptureFileDialog::addFormatTypeSelector() and CaptureFileDialog::open()
for Qt). No changes to wiretap.

It's not a huge deal if you folks decide this isn't necessary, I just
think this gives a bit of extra polish to the load-file dialog. It also
makes it easier for the user to spot the format they want if they aren't
aware that the file-format dropdown accepts keyboard input.

Change-Id: Ie81c6d99e83fe862f20b413318ac8ce76463a766
Reviewed-on: https://code.wireshark.org/review/37749
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2020-07-14 16:25:11 +00:00
Roland Knall 7fcac9c955 Qt: Fix export of dissection
Exporting dissected bytes did not consider the
selection of packets on Windows, if multiple
packets had been selected

Bug: 16516
Change-Id: I9d914fe1fed22f842d73caea397a3f37ffc0d523
Reviewed-on: https://code.wireshark.org/review/36958
Reviewed-by: Roland Knall <rknall@gmail.com>
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2020-04-27 16:00:03 +00:00
Gerald Combs 50713161c3 Win32: Remove win32_save_as_statstree.
win32_save_as_statstree was GTK+-only.

Change-Id: Ief029cd1a702b0c17d9602bee8a2d75ee4c3c393
Reviewed-on: https://code.wireshark.org/review/35384
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2019-12-10 01:05:43 +00:00
Gerald Combs dc19356be2 Win32: Fixup our file dialog titles.
Add a "title" argument to each of the Win32 file dialog routines, and
pass in one constructed using wsApp->windowTitleString.

Change-Id: I5ff862bd28cd16093d99ae1559ecbaca907350da
Reviewed-on: https://code.wireshark.org/review/35383
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2019-12-10 01:04:47 +00:00
Gerald Combs ef67401c33 Win32: Remove some unused code.
Remove some code that's been #if 0'ed out since 2006 and 2012. Include
file.h instead of globals.h.

Change-Id: Ib4a84c03e112d732b25df4b7b26b54e029f717a4
Reviewed-on: https://code.wireshark.org/review/35378
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2019-12-10 01:00:18 +00:00
Gerald Combs 7c883dd771 Win32: Factor out win32_check_save_as_with_comments.
Stop using win32_check_save_as_with_comments and just use the
Qt equivalent on Windows. It started out as a static funtion in
file_dlg_win32.c and using the native Windows event loop may have been
required for GTK+, but neither of those apply now.

Change-Id: I66d7f1c6346df65b0fadb3aa9cba823c0e457703
Reviewed-on: https://code.wireshark.org/review/35382
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2019-12-10 00:59:00 +00:00
Gerald Combs fe647fb085 Win32: Fix the Export Packet Dissections dialog title.
Change-Id: I25c40511b369ce93e1be2887488fc5389fdafd07
Reviewed-on: https://code.wireshark.org/review/35346
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-12-08 15:05:09 +00:00
Roland Knall b3f240dbf8 Qt: Multiselection in PacketList
This implements multi-selection for the PacketList. It
allows multiple lines to be selected, and either drag/drop
them to a text editor or use Ctrl/Cmd+C to copy the content
to a clipboard.

Opening the context menu disables the selection, and it
does not change the underlying currently selection. This is
done on purpose, as multi-selection is a copy-task only
functionality at this point

Export & Print work as expected, exporting just the selected
items. Same goes for the copy menu, which has the additional
entries for copying the list elements

Bug: 14612
Change-Id: I77960aa1ab1d172a21abfa469baac0cd57f9f9d9
Reviewed-on: https://code.wireshark.org/review/35073
Petri-Dish: Roland Knall <rknall@gmail.com>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-11-17 12:20:29 +00:00
Tomasz Moń 893a2d9c62 MSVC: Warn about unused formal parameters
Provide _U_ macro definition for Visual Studio.

Change the way _U_ macro is ifdefed for some targets to allow Visual
Studio to recognize it.

Ping-Bug: 15832
Change-Id: Ic7ce145cbe9e8aa751d64c9c09ce8ba6c1bbbd30
Reviewed-on: https://code.wireshark.org/review/34530
Tested-by: Petri Dish Buildbot
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-09-21 08:51:34 +00:00
Guy Harris 245086eb83 HTTPS In Still More Places, update more URLs.
Microsoft reshuffled their documentation - almost all of it moved from
msdn.microsoft.com to docs.microsoft.com.  Some blogs moved to
devblogs.microsoft.com; the comments *didn't* move, so in one case we go
to the Wayback Machine - the link isn't dead, but it formats horribly,
at least on my browser, but the archived version formats OK.

Use the Wayback Machine for some URLs, and update others.

Update the sections for MS-ADTS.

Point to the HTML versions of some RFCs and I-Ds.

Change-Id: I344b20f880de63f1ae2a4e3f9ff98af78a7fe139
Reviewed-on: https://code.wireshark.org/review/34101
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-27 22:56:35 +00:00
Guy Harris 5cf3fd03f1 HTTPS In More Places, update some URLs.
Change-Id: Ice2e1e2e4d94f6c9da7c651866cfa1a8ac4a31d8
Reviewed-on: https://code.wireshark.org/review/34096
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-27 07:55:36 +00:00
Gerald Combs 14796eb04a Windows: Console log handler fixups.
Make sure that we always print log messages on Windows. External programs
or scripts (including our test suite) might need to see log messages
independent of our console settings.

Make sure that we always use our log handler and that its stdout /
stderr routing matches GLib's. Flush our log output, which is something
that GLib's default handler sometimes doesn't do:
https://bugzilla.gnome.org/show_bug.cgi?id=792432

Bug: 15605
Change-Id: I4b17f2cb9269b2c87c21835d82770dae93bbfa20
Reviewed-on: https://code.wireshark.org/review/32412
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2019-03-14 21:15:08 +00:00
Guy Harris a88d60509d Update the comment again.
The third URL works, but let's go https: for it.  The other two don't.

Line-wrap another part of the comment while we're at it.

Change-Id: I744770c859b317ace2a71e82f86e2419b6d7ef2b
Reviewed-on: https://code.wireshark.org/review/31276
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-12-31 07:50:11 +00:00
Guy Harris 67621a6ac2 Update a comment.
(Thanks for killing off a bunch of comment mechanisms, not saving the
old comments and placing them somewhere useful, and not even allowing
the Wayback Machine to archive at least some of those sites, Microsoft.)

Change-Id: Ie4258250a0176a56ee33be77604acf43c6886e0f
Reviewed-on: https://code.wireshark.org/review/31274
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-12-31 05:53:18 +00:00
Guy Harris 7eb3e47fa4 Try to squeeze some bytes out of the frame_data structure.
Make the time stamp precision a 4-bit bitfield, so, when combined with
the other bitfields, we have 32 bits.  That means we put the flags at
the same structure level as the time stamp precision, so they can be
combined; that gets rid of an extra "flags." for references to the flags.

Put the two pointers next to each other, and after a multiple of 8 bytes
worth of other fields, so that there's no padding before or between them.

It's still not down to 64 bytes, which is the next lower power of 2, so
there's more work to do.

Change-Id: I6f3e9d9f6f48137bbee8f100c152d2c42adb8fbe
Reviewed-on: https://code.wireshark.org/review/31213
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-12-27 04:34:29 +00:00
Guy Harris a1372f6d01 Use an enum for compression types in various interfaces.
This:

1) means that we don't have to flag the compression argument with a
comment to indicate what it means (FALSE doesn't obviously say "not
compressed", WTAP_UNCOMPRESSED does);

2) leaves space in the interfaces in question for additional compression
types.

(No, this is not part 1 of an implementation of additional compression
types, it's just an API cleanup.  Implementing additional compression
types involves significant work in libwiretap, as well as UI changes to
replace "compress the file" checkboxes with something to indicate *how*
to compress the file, or to always use some other form of compression).

Change-Id: I1d23dc720be10158e6b34f97baa247ba8a537abf
Reviewed-on: https://code.wireshark.org/review/30660
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-16 09:20:36 +00:00
Peter Wu b0582230f3 UI: Remove Win32 file dialog stuff specific to GTK
Remove "Export SSL Session Keys", "Import/Export Color Filters" and
"Export Raw Bytes" dialogs. These were only used by GTK+ as Qt has its
own implementation.

Change-Id: I0520a0f6e35d0f8a55c58e77f89c5229393c2b23
Reviewed-on: https://code.wireshark.org/review/30559
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-10 07:42:44 +00:00
Graham Bloice d8459d8930 packet export: Add default file extension
Adds a default file extension when exporting packet dissection
in various formats:

text       -> txt
postscript -> ps
csv        -> csv
pdml       -> pdml
psml       -> psml
c arrays   -> c
json       -> json

Change-Id: Ie5d942a3c694abd8edf9df184f6e219d4b870a1b
Reviewed-on: https://code.wireshark.org/review/28490
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Petri-Dish: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2018-06-27 23:01:03 +00:00
Gerald Combs fe94133f0d Remove code specific to older versions of Visual Studio.
Remove -DBUILD_WINDOWS and sections of code that we no longer use.

Bug: 14715
Change-Id: Iae1a950e2f52f4ce45fcf0ae5dea06c1172c3a28
Reviewed-on: https://code.wireshark.org/review/28466
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-06-26 22:30:50 +00:00
Gerald Combs f8092f96b3 Qt: Move wireshark-qt.cpp back to ui/qt/main.cpp.
The Qt UI's main module started out as ui/qt/main.cpp but was moved to
the top-level directory in order to appease Autotools. We don't need to
do that any more, so move it back.

Change-Id: Ic5bc0ed5b754e36cc2b9e682f2ca097781233dfd
Reviewed-on: https://code.wireshark.org/review/28090
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-06-08 03:50:22 +00:00
Gerald Combs a0b46a06f3 Win32: Add a missing check.
...otherwise we'll crash on older versions of Windows.

Change-Id: If9c1b653496930fbfad4e9e663a8340990f3f295
Reviewed-on: https://code.wireshark.org/review/27626
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-05-17 22:21:04 +00:00
Gerald Combs 23e1cde5e7 Windows: Make sure native dialogs handle HiDPI.
Enable per-monitor v2 DPI awareness before displaying native file
dialogs so that they will render correctly on HiDPI displays.
Add some notes about DPI awareness in our manifest and in
wireshark-qt.cpp.

Remove win32_get_ofnsize while we're here.

Change-Id: Ic553fdeea0c05020c3a7ff06f648692cb814b3eb
Reviewed-on: https://code.wireshark.org/review/27435
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-05-09 20:02:34 +00:00
Gerald Combs 1d030928ef Remove some GTK+-only code.
Change-Id: Ic2498c7acd6a1a522be45094148402ee34a6b4d1
Reviewed-on: https://code.wireshark.org/review/26958
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-17 03:44:47 +00:00
Roland Knall 9c5049a80b Gtk: Remove source code
Removing all gtk source code, except for main.? which will remain
for the official removal during SFUS18

Change-Id: I4273baf207df1eaaa4b94623cfd10bf74b1fc4a4
Reviewed-on: https://code.wireshark.org/review/26937
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-04-15 05:45:32 +00:00
Guy Harris 16ac61e2a3 Fix StringCchPrintf() calls.
One was missing an argument; supply the necessary string.

The other was assuming that an LPARAM was 32 bits when that's not the
case on 64-bit Windows - the underlying value is 32-bit, so we just cast
to int.

Change-Id: Ie2a38e27f2ea211628d2c751a7807bb9ed396c64
Reviewed-on: https://code.wireshark.org/review/26190
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-28 21:15:02 +00:00
Guy Harris 0b649a0910 Separately count all records and data records.
A file might contain only metadata records, which exist only to provide
information needed to interpret data records; no point in showing them
in record counts.

Put the counts into the structure that we fill in, and rename the
structure and the routine to reflect that it determines statistics other
than just times.

Speak of data records rather than packets; the file might be full of
Sysdig event records but not have any packets in it, for example.

Change-Id: I8553181dca4129736bdae2c0cbba92becc28d6ef
Reviewed-on: https://code.wireshark.org/review/25722
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-10 03:44:10 +00:00
Guy Harris 9797f34074 Move the merge_action_e enum to the Win32 file dialog source file.
It's only used with the Windows dialog, so no need to make it public.

Change-Id: I4976748d642399b57abc89bccc26f680e3938509
Reviewed-on: https://code.wireshark.org/review/25719
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-09 20:43:35 +00:00
Guy Harris 25d90cb13c Put the preview-generation loop into a common routine.
Don't have all the file open dialogs have their own copies.

Change-Id: Icd6f2fd44b081575e6481a134027c90046938c64
Reviewed-on: https://code.wireshark.org/review/25717
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-09 20:29:08 +00:00
AndersBroman 99e645bfdb Do changes from Generalize wtap_pkthdr into a structure for packet and
non-packet records for file_dlg_win32.c

Change-Id: I34ce10e574036b2d857675008c7109d5e38be6e7
Reviewed-on: https://code.wireshark.org/review/25710
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2018-02-09 11:09:31 +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
Gerald Combs 62fc862bc6 Squelch an rc warning.
Don't include glib if RC_INVOKED is defined so that the Microsoft Windows
Resource Compiler doesn't generate the following complaint:

\path\to\glib/gatomic.h(87): warning RC4011: identifier truncated to '__GCC_HAVE_SYNC_COMPARE_AND_SWA'

Change-Id: I6637aee2842de4e7041b66ff4428f617478efcb4
Reviewed-on: https://code.wireshark.org/review/25670
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-02-07 22:12:32 +00:00
Guy Harris af0f49e80d Use pcapng as the name of the file format.
At one point, I remember a discussion resulting in the official name of
the next-generation replacement for pcap format being changed to
"pcapng", with no hyphen.

Make Wireshark reflect that.

Change-Id: Ie66fb13a0fe3a8682143106dab601952e9154e2a
Reviewed-on: https://code.wireshark.org/review/25214
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-01-09 00:38:51 +00:00
Jakub Zawadzki 2cee4f432f Try to fix win32 build, add ui/packet_range.h include.
add ui/packet_range.h include to try to fix win32 build, compilation log:

         export_sslkeys.c
    99>C:\buildbot\builders\windows-x86-64-petri-dish\windows-x86-64-petri-dish\build\ui/win32/file_dlg_win32.h(73): error C2143: syntax error: missing ')' before '*' (compiling source file C:\buildbot\builders\windows-x86-64-petri-dish\windows-x86-64-petri-dish\build\ui\gtk\export_sslkeys.c) [C:\buildbot\builders\windows-x86-64-petri-dish\windows-x86-64-petri-dish\build\cmbuild\ui\gtk\gtkui.vcxproj]
    99>C:\buildbot\builders\windows-x86-64-petri-dish\windows-x86-64-petri-dish\build\ui/win32/file_dlg_win32.h(73): error C2081: 'packet_range_t': name in formal parameter list illegal (compiling source file C:\buildbot\builders\windows-x86-64-petri-dish\windows-x86-64-petri-dish\build\ui\gtk\export_sslkeys.c) [C:\buildbot\builders\windows-x86-64-petri-dish\windows-x86-64-petri-dish\build\cmbuild\ui\gtk\gtkui.vcxproj]
    99>C:\buildbot\builders\windows-x86-64-petri-dish\windows-x86-64-petri-dish\build\ui/win32/file_dlg_win32.h(73): error C2143: syntax error: missing '{' before '*' (compiling source file C:\buildbot\builders\windows-x86-64-petri-dish\windows-x86-64-petri-dish\build\ui\gtk\export_sslkeys.c) [C:\buildbot\builders\windows-x86-64-petri-dish\windows-x86-64-petri-dish\build\cmbuild\ui\gtk\gtkui.vcxproj]
    99>C:\buildbot\builders\windows-x86-64-petri-dish\windows-x86-64-petri-dish\build\ui/win32/file_dlg_win32.h(73): error C2059: syntax error: ')' (compiling source file C:\buildbot\builders\windows-x86-64-petri-dish\windows-x86-64-petri-dish\build\ui\gtk\export_sslkeys.c) [C:\buildbot\builders\windows-x86-64-petri-dish\windows-x86-64-petri-dish\build\cmbuild\ui\gtk\gtkui.vcxproj]

Change-Id: I58c77fdcbe3fe2e738601c4ef97596c7774704ec
Reviewed-on: https://code.wireshark.org/review/24743
Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
2017-12-08 19:04:49 +00:00
Guy Harris 8aa14236f8 Have the frame_tvbuff.c routines not use the global cfile.
Have the routines that create them take a pointer to a struct
packet_provider_data, store that in the tvbuff data, and use it to get
the wtap from which packets are being read.

While we're at it, don't include globals.h in any header files, and
include it in source files iff the source file actually uses cfile.  Add
whatever includes that requires.

Change-Id: I9f1ee391f951dc427ff62c80f67aa4877a37c229
Reviewed-on: https://code.wireshark.org/review/24733
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-08 08:31:41 +00:00
Guy Harris ccc55bc80c Put the structure of a capture_file back in cfile.h.
The split isn't necessary now that epan no longer uses the capture_file
structure.

Change-Id: Ia232712a2fb5db511865805518e8d03509b2167f
Reviewed-on: https://code.wireshark.org/review/24693
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-04 05:35:36 +00:00
Guy Harris 461c8a7b44 This also looks inside a capture_file structure.
Change-Id: I6c4de5212028643fa34c5d939608b592f554f2bd
Reviewed-on: https://code.wireshark.org/review/24689
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-03 20:23:50 +00:00
Gerald Combs 18b240d7d2 Normalize ui/win32 indentation and switch to SPDX.
Switch ui/win32/console_win32.[ch] to 4-space indentation to match the
other files in that directory. Remove ui/.editorconfig. SPDX-abbreviate
the license blurb in all files in that directory.

Change-Id: I68aa5a3ae7ae184ea8d27d9dba06b968ac3d2472
Reviewed-on: https://code.wireshark.org/review/24636
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-11-29 03:36:30 +00:00
Ahmad Fatoum 9d49e13166 Remove superfluous null-checks before strdup/free
NULL checks were removed for following free functions:

- g_free "If mem is NULL it simply returns"
  https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#g-free

- g_slist_free(_full)? "NULL is considered to be the empty list"
  https://developer.gnome.org/glib/stable/glib-Singly-Linked-Lists.html

- g_strfreev "If str_array is NULL, this function simply returns."
  https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strfreev

- g_slice_free "If mem is NULL, this macro does nothing."
  https://developer.gnome.org/glib/stable/glib-Memory-Slices.html#g-slice-free

- g_match_info_free "not NULL... otherwise does nothing"
  https://developer.gnome.org/glib/stable/glib-Perl-compatible-regular-expressions.html#g-match-info-free

- dfilter_free defined in Wireshark code. Returns early when passed NULL
  epan/dfilter/dfilter.c

They were also removed around calls to g_strdup where applicable:

- g_strdup "If str is NULL it returns NULL."
  https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strdup

Change-Id: Ie80c2db89bef531edc3aed7b7c9f654e1d654d04
Reviewed-on: https://code.wireshark.org/review/23406
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-15 12:38:51 +00:00