diff options
author | João Valverde <j@v6e.pt> | 2022-10-06 06:43:30 +0100 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2022-10-11 14:25:04 +0100 |
commit | a19834b98cda6d31bc31534b8cd497d055645439 (patch) | |
tree | 7de3e05fa14042c9d014bd353c5ed33460c8440d /ui/qt | |
parent | 44d1cc6d4a8ac93c235356554d505759ea1d6aba (diff) |
Windows: Store "gui.console_open" in the Windows registry
This removes the last dependency of the logging subsystem on the
preferences module. The latter is started much later than the former
and this is an issue.
The Windows-only preference "gui.console_open" is stored in the
registry as HKEY_LOCAL_USER\Software\Wireshark\ConsoleOpen. The semantics
are exactly the same. The preference is read by the logging subsystem
for initialization and then again by the preferences (read/write) so
the user can configure it as before.
The code to store the preference also in the preferences file was
kept, for backward compatibility and because it is not incompatible
with using the Registry concurrently.
The elimination of the prefs dependency also allows moving the Windows
console logic to wsutil and add the functionality to wslog directly,
thereby eliminating the superfluous Wireshark/Logray custom log handler.
To be able to read the ws_log_console_open global variable from
libwireshark it becomes necessary to add a new export macro
symbol called WSUTIL_EXPORT.
Diffstat (limited to 'ui/qt')
-rw-r--r-- | ui/qt/main.cpp | 5 | ||||
-rw-r--r-- | ui/qt/main_application.cpp | 8 |
2 files changed, 2 insertions, 11 deletions
diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp index 575e924a13..c090a7d350 100644 --- a/ui/qt/main.cpp +++ b/ui/qt/main.cpp @@ -19,7 +19,7 @@ #include <tchar.h> #include <wchar.h> #include <shellapi.h> -#include "ui/win32/console_win32.h" +#include <wsutil/console_win32.h> #endif #include <ui/clopts_common.h> @@ -64,7 +64,6 @@ #include "epan/srt_table.h" #include "ui/alert_box.h" -#include "ui/console.h" #include "ui/iface_lists.h" #include "ui/language.h" #include "ui/persfilepath_opt.h" @@ -486,7 +485,7 @@ int main(int argc, char *qt_argv[]) cmdarg_err_init(wireshark_cmdarg_err, wireshark_cmdarg_err_cont); /* Initialize log handler early so we can have proper logging during startup. */ - ws_log_init_with_writer("wireshark", console_log_writer, vcmdarg_err); + ws_log_init("wireshark", vcmdarg_err); /* For backward compatibility with GLib logging and Wireshark 3.4. */ ws_log_console_writer_set_use_stdout(TRUE); diff --git a/ui/qt/main_application.cpp b/ui/qt/main_application.cpp index 1d9f35930d..25941be6d8 100644 --- a/ui/qt/main_application.cpp +++ b/ui/qt/main_application.cpp @@ -63,7 +63,6 @@ #include "wsutil/utf8_entities.h" #ifdef _WIN32 -# include "ui/win32/console_win32.h" # include "wsutil/file_util.h" # include <QMessageBox> # include <QSettings> @@ -1073,13 +1072,6 @@ _e_prefs *MainApplication::readConfigurationFiles(bool reset) /* Load libwireshark settings from the current profile. */ prefs_p = epan_load_settings(); -#ifdef _WIN32 - /* if the user wants a console to be always there, well, we should open one for him */ - if (prefs_p->gui_console_open == console_open_always) { - create_console(); - } -#endif - /* Read the capture filter file. */ read_filter_list(CFILTER_LIST); |