diff --git a/GUI/host/host.cpp b/GUI/host/host.cpp index a65517b..275219a 100644 --- a/GUI/host/host.cpp +++ b/GUI/host/host.cpp @@ -134,11 +134,12 @@ namespace { auto tp = *(ThreadParam*)buffer; auto textThreadsByParams = ::textThreadsByParams.Acquire(); - if (textThreadsByParams->count(tp) == 0) + if (textThreadsByParams->count(tp) == 0) try { TextThread& created = textThreadsByParams->try_emplace(tp, tp, Host::GetHookParam(tp)).first->second; OnCreate(created); } + catch (std::out_of_range) { continue; } // probably garbage data in pipe, try again textThreadsByParams->find(tp)->second.Push(buffer + sizeof(tp), bytesRead - sizeof(tp)); } break; diff --git a/GUI/mainwindow.cpp b/GUI/mainwindow.cpp index 42b35ee..d1c372b 100644 --- a/GUI/mainwindow.cpp +++ b/GUI/mainwindow.cpp @@ -375,7 +375,7 @@ void MainWindow::FindHooks() QByteArray pattern = QByteArray::fromHex(patternInput->text().replace("??", "11").toUtf8()); if (pattern.size() < 3) return; std::wregex filter(L"."); - if (!filterInput->text().isEmpty()) try { filter = std::wregex(S(filterInput->text())); } catch (std::regex_error&) {}; + if (!filterInput->text().isEmpty()) try { filter = std::wregex(S(filterInput->text())); } catch (std::regex_error) {}; memcpy(sp.pattern, pattern.data(), sp.length = min(pattern.size(), 25)); auto hooks = std::make_shared(); Host::FindHooks(processId, sp, [hooks, filter](HookParam hp, DWORD processId, const std::wstring& text) diff --git a/extensions/regexfilter.cpp b/extensions/regexfilter.cpp index 5890020..4fb0825 100644 --- a/extensions/regexfilter.cpp +++ b/extensions/regexfilter.cpp @@ -18,7 +18,7 @@ struct : QMainWindow { std::lock_guard l(m); try { regex = newRegex.toStdWString(); } - catch (...) { return ui.output->setText(INVALID_REGEX); } + catch (std::regex_error) { return ui.output->setText(INVALID_REGEX); } ui.output->setText(QString(CURRENT_FILTER).arg(newRegex)); }); setWindowTitle(REGEX_FILTER); diff --git a/include/common.h b/include/common.h index 4a52cc2..a183d40 100644 --- a/include/common.h +++ b/include/common.h @@ -74,7 +74,7 @@ private: std::unique_ptr h; }; -inline struct +static struct { BYTE DUMMY[100]; template diff --git a/texthook/hookfinder.cc b/texthook/hookfinder.cc index 53ce36f..c6814d2 100644 --- a/texthook/hookfinder.cc +++ b/texthook/hookfinder.cc @@ -160,7 +160,7 @@ void SearchForHooks(SearchParam sp) std::scoped_lock lock(m); try { records = std::make_unique(recordsAvailable = CACHE_SIZE); } - catch (std::bad_alloc&) { return ConsoleOutput("Textractor: SearchForHooks ERROR (out of memory)"); } + catch (std::bad_alloc) { return ConsoleOutput("Textractor: SearchForHooks ERROR (out of memory)"); } current = sp;