From 0d68295e7697cad2ec0d39251213f143b199673d Mon Sep 17 00:00:00 2001 From: segfault Date: Tue, 15 Dec 2020 18:49:34 +0100 Subject: CheattEngineServer: CMD_OPENPROCESS, CMD_PROCESS32FIRST, CMD_PROCESS32NEXT, CMD_CLOSEHANDLE * KMemDriver integration * generic MT-Support achieved by synchronized wrapper functions * ability to spawn a Ping-Only Thread --- MemDriverLib/MemDriverLib.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'MemDriverLib/MemDriverLib.cpp') 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 -- cgit v1.2.3