diff options
Diffstat (limited to 'MemDriverLib/MemDriverLib.cpp')
-rw-r--r-- | MemDriverLib/MemDriverLib.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/MemDriverLib/MemDriverLib.cpp b/MemDriverLib/MemDriverLib.cpp index c79a01a..8123d34 100644 --- a/MemDriverLib/MemDriverLib.cpp +++ b/MemDriverLib/MemDriverLib.cpp @@ -154,6 +154,10 @@ bool KInterface::Modules(HANDLE targetPID, bool KInterface::Exit() { + if (m_pingThreadStarted == true) { + m_pingThreadStarted = false; + m_pingThread.join(); + } m_last_ntstatus = INVALID_NTSTATUS; return SendRecvWait(MEM_EXIT, INFINITE) == SRR_SIGNALED; } @@ -353,4 +357,18 @@ SendRecvReturn KInterface::RecvWait(DWORD timeout) return SRR_ERR_UEVENT; } +void KInterface::PingThread(void) +{ + while (m_pingThreadStarted == true) { + std::this_thread::sleep_for(std::chrono::milliseconds(DEFAULT_TIMEOUT_MS)); + MtPing(); + } +} + +void KInterface::StartPingThread(void) +{ + m_pingThreadStarted = true; + m_pingThread = std::move(std::thread(&KInterface::PingThread, this)); +} + #pragma warning(pop)
\ No newline at end of file |