diff --git a/GUI/host/host.cpp b/GUI/host/host.cpp index a578ddd..1eedf3c 100644 --- a/GUI/host/host.cpp +++ b/GUI/host/host.cpp @@ -143,16 +143,6 @@ namespace Host CreatePipe(); } - void Shutdown() - { - auto NOP = [](auto... args) { return NULL; }; - ProcessRecord::OnConnect = NOP; - ProcessRecord::OnDisconnect = NOP; - TextThread::OnCreate = NOP; - TextThread::OnDestroy = NOP; - TextThread::Output = NOP; - } - bool InjectProcess(DWORD processId, DWORD timeout) { if (processId == GetCurrentProcessId()) return false; diff --git a/GUI/host/host.h b/GUI/host/host.h index 569a1f3..52c001d 100644 --- a/GUI/host/host.h +++ b/GUI/host/host.h @@ -7,7 +7,6 @@ namespace Host { using ProcessEventCallback = std::function; void Start(ProcessEventCallback OnConnect, ProcessEventCallback OnDisconnect, TextThread::EventCallback OnCreate, TextThread::EventCallback OnDestroy, TextThread::OutputCallback Output); - void Shutdown(); bool InjectProcess(DWORD processId, DWORD timeout = 5000); void DetachProcess(DWORD processId); diff --git a/GUI/mainwindow.cpp b/GUI/mainwindow.cpp index 9c4fbaf..8da1aa3 100644 --- a/GUI/mainwindow.cpp +++ b/GUI/mainwindow.cpp @@ -35,10 +35,10 @@ MainWindow::MainWindow(QWidget *parent) : MainWindow::~MainWindow() { - Host::Shutdown(); settings.setValue(WINDOW, geometry()); settings.sync(); delete ui; + ExitProcess(0); } void MainWindow::closeEvent(QCloseEvent*) diff --git a/extensions/regexfilter/regexfilter.cpp b/extensions/regexfilter/regexfilter.cpp index fe22a5e..2c0103e 100644 --- a/extensions/regexfilter/regexfilter.cpp +++ b/extensions/regexfilter/regexfilter.cpp @@ -15,7 +15,7 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved break; case DLL_PROCESS_DETACH: { - delete w; + if (lpReserved == NULL && w != nullptr) delete w; // https://blogs.msdn.microsoft.com/oldnewthing/20120105-00/?p=8683 } break; } diff --git a/extensions/threadlinker/threadlinker.cpp b/extensions/threadlinker/threadlinker.cpp index eac598b..794ce32 100644 --- a/extensions/threadlinker/threadlinker.cpp +++ b/extensions/threadlinker/threadlinker.cpp @@ -15,7 +15,7 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved break; case DLL_PROCESS_DETACH: { - delete w; + if (lpReserved == NULL && w != nullptr) delete w; // https://blogs.msdn.microsoft.com/oldnewthing/20120105-00/?p=8683 } break; }