From d09ee887d80fec8ef035218cbd6b1337767ef932 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Mon, 14 Oct 2013 17:15:03 +0000 Subject: [PATCH] renamed CMSWindowsRelauncher to CMSWindowsWatchdog --- ...sRelauncher.cpp => CMSWindowsWatchdog.cpp} | 38 +++++++++---------- ...ndowsRelauncher.h => CMSWindowsWatchdog.h} | 8 ++-- src/lib/platform/CMakeLists.txt | 4 +- src/lib/synergy/CDaemonApp.cpp | 3 +- src/lib/synergy/CDaemonApp.h | 5 +-- 5 files changed, 27 insertions(+), 31 deletions(-) rename src/lib/platform/{CMSWindowsRelauncher.cpp => CMSWindowsWatchdog.cpp} (91%) rename src/lib/platform/{CMSWindowsRelauncher.h => CMSWindowsWatchdog.h} (94%) diff --git a/src/lib/platform/CMSWindowsRelauncher.cpp b/src/lib/platform/CMSWindowsWatchdog.cpp similarity index 91% rename from src/lib/platform/CMSWindowsRelauncher.cpp rename to src/lib/platform/CMSWindowsWatchdog.cpp index c398ebdc..4aeb6123 100644 --- a/src/lib/platform/CMSWindowsRelauncher.cpp +++ b/src/lib/platform/CMSWindowsWatchdog.cpp @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -#include "CMSWindowsRelauncher.h" +#include "CMSWindowsWatchdog.h" #include "CThread.h" #include "TMethodJob.h" #include "CLog.h" @@ -41,7 +41,7 @@ enum { typedef VOID (WINAPI *SendSas)(BOOL asUser); -CMSWindowsRelauncher::CMSWindowsRelauncher( +CMSWindowsWatchdog::CMSWindowsWatchdog( bool autoDetectCommand, CIpcServer& ipcServer, CIpcLogOutputter& ipcLogOutputter) : @@ -59,22 +59,22 @@ CMSWindowsRelauncher::CMSWindowsRelauncher( { } -CMSWindowsRelauncher::~CMSWindowsRelauncher() +CMSWindowsWatchdog::~CMSWindowsWatchdog() { } void -CMSWindowsRelauncher::startAsync() +CMSWindowsWatchdog::startAsync() { - m_thread = new CThread(new TMethodJob( - this, &CMSWindowsRelauncher::mainLoop, nullptr)); + m_thread = new CThread(new TMethodJob( + this, &CMSWindowsWatchdog::mainLoop, nullptr)); - m_outputThread = new CThread(new TMethodJob( - this, &CMSWindowsRelauncher::outputLoop, nullptr)); + m_outputThread = new CThread(new TMethodJob( + this, &CMSWindowsWatchdog::outputLoop, nullptr)); } void -CMSWindowsRelauncher::stop() +CMSWindowsWatchdog::stop() { m_monitoring = false; @@ -86,7 +86,7 @@ CMSWindowsRelauncher::stop() } HANDLE -CMSWindowsRelauncher::duplicateProcessToken(HANDLE process, LPSECURITY_ATTRIBUTES security) +CMSWindowsWatchdog::duplicateProcessToken(HANDLE process, LPSECURITY_ATTRIBUTES security) { HANDLE sourceToken; @@ -117,7 +117,7 @@ CMSWindowsRelauncher::duplicateProcessToken(HANDLE process, LPSECURITY_ATTRIBUTE } HANDLE -CMSWindowsRelauncher::getUserToken(LPSECURITY_ATTRIBUTES security) +CMSWindowsWatchdog::getUserToken(LPSECURITY_ATTRIBUTES security) { // always elevate if we are at the vista/7 login screen. we could also // elevate for the uac dialog (consent.exe) but this would be pointless, @@ -142,7 +142,7 @@ CMSWindowsRelauncher::getUserToken(LPSECURITY_ATTRIBUTES security) } void -CMSWindowsRelauncher::mainLoop(void*) +CMSWindowsWatchdog::mainLoop(void*) { shutdownExistingProcesses(); @@ -223,7 +223,7 @@ CMSWindowsRelauncher::mainLoop(void*) } bool -CMSWindowsRelauncher::isProcessRunning() +CMSWindowsWatchdog::isProcessRunning() { bool running; if (m_launched) { @@ -256,7 +256,7 @@ CMSWindowsRelauncher::isProcessRunning() } void -CMSWindowsRelauncher::startProcess(std::string& command) +CMSWindowsWatchdog::startProcess(std::string& command) { m_commandChanged = false; @@ -318,7 +318,7 @@ CMSWindowsRelauncher::startProcess(std::string& command) } void -CMSWindowsRelauncher::setCommand(const std::string& command, bool elevate) +CMSWindowsWatchdog::setCommand(const std::string& command, bool elevate) { LOG((CLOG_INFO "service command updated")); m_command = command; @@ -327,7 +327,7 @@ CMSWindowsRelauncher::setCommand(const std::string& command, bool elevate) } std::string -CMSWindowsRelauncher::getCommand() const +CMSWindowsWatchdog::getCommand() const { if (!m_autoDetectCommand) { return m_command; @@ -353,7 +353,7 @@ CMSWindowsRelauncher::getCommand() const } void -CMSWindowsRelauncher::outputLoop(void*) +CMSWindowsWatchdog::outputLoop(void*) { // +1 char for \0 CHAR buffer[kOutputBufferSize + 1]; @@ -380,7 +380,7 @@ CMSWindowsRelauncher::outputLoop(void*) } void -CMSWindowsRelauncher::shutdownProcess(HANDLE handle, DWORD pid, int timeout) +CMSWindowsWatchdog::shutdownProcess(HANDLE handle, DWORD pid, int timeout) { DWORD exitCode; GetExitCodeProcess(handle, &exitCode); @@ -420,7 +420,7 @@ CMSWindowsRelauncher::shutdownProcess(HANDLE handle, DWORD pid, int timeout) } void -CMSWindowsRelauncher::shutdownExistingProcesses() +CMSWindowsWatchdog::shutdownExistingProcesses() { // first we need to take a snapshot of the running processes HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); diff --git a/src/lib/platform/CMSWindowsRelauncher.h b/src/lib/platform/CMSWindowsWatchdog.h similarity index 94% rename from src/lib/platform/CMSWindowsRelauncher.h rename to src/lib/platform/CMSWindowsWatchdog.h index e62f9a4e..24752348 100644 --- a/src/lib/platform/CMSWindowsRelauncher.h +++ b/src/lib/platform/CMSWindowsWatchdog.h @@ -16,8 +16,6 @@ * along with this program. If not, see . */ -// TODO: rename class to CMSWindowsWatchdog - #pragma once #define WIN32_LEAN_AND_MEAN @@ -31,13 +29,13 @@ class CThread; class CIpcLogOutputter; class CIpcServer; -class CMSWindowsRelauncher { +class CMSWindowsWatchdog { public: - CMSWindowsRelauncher( + CMSWindowsWatchdog( bool autoDetectCommand, CIpcServer& ipcServer, CIpcLogOutputter& ipcLogOutputter); - virtual ~CMSWindowsRelauncher(); + virtual ~CMSWindowsWatchdog(); void startAsync(); std::string getCommand() const; diff --git a/src/lib/platform/CMakeLists.txt b/src/lib/platform/CMakeLists.txt index 89b8f38c..551f9305 100644 --- a/src/lib/platform/CMakeLists.txt +++ b/src/lib/platform/CMakeLists.txt @@ -29,7 +29,7 @@ if (WIN32) CMSWindowsScreen.h CMSWindowsScreenSaver.h CMSWindowsUtil.h - CMSWindowsRelauncher.h + CMSWindowsWatchdog.h CMSWindowsHookLibraryLoader.h IMSWindowsClipboardFacade.h CMSWindowsDebugOutputter.h @@ -50,7 +50,7 @@ if (WIN32) CMSWindowsScreen.cpp CMSWindowsScreenSaver.cpp CMSWindowsUtil.cpp - CMSWindowsRelauncher.cpp + CMSWindowsWatchdog.cpp CMSWindowsHookLibraryLoader.cpp CMSWindowsDebugOutputter.cpp CMSWindowsSession.cpp diff --git a/src/lib/synergy/CDaemonApp.cpp b/src/lib/synergy/CDaemonApp.cpp index 5c846790..19a41fd6 100644 --- a/src/lib/synergy/CDaemonApp.cpp +++ b/src/lib/synergy/CDaemonApp.cpp @@ -43,7 +43,6 @@ #include "XArchWindows.h" #include "CScreen.h" #include "CMSWindowsScreen.h" -#include "CMSWindowsRelauncher.h" #include "CMSWindowsDebugOutputter.h" #define WIN32_LEAN_AND_MEAN @@ -210,7 +209,7 @@ CDaemonApp::mainLoop(bool logToFile) CLOG->insert(m_ipcLogOutputter); #if SYSAPI_WIN32 - m_relauncher = new CMSWindowsRelauncher(false, *m_ipcServer, *m_ipcLogOutputter); + m_relauncher = new CMSWindowsWatchdog(false, *m_ipcServer, *m_ipcLogOutputter); #endif m_events->adoptHandler( diff --git a/src/lib/synergy/CDaemonApp.h b/src/lib/synergy/CDaemonApp.h index 75d8caeb..46732e51 100644 --- a/src/lib/synergy/CDaemonApp.h +++ b/src/lib/synergy/CDaemonApp.h @@ -22,7 +22,7 @@ #include "CIpcServer.h" #if SYSAPI_WIN32 -#include "CMSWindowsRelauncher.h" +#include "CMSWindowsWatchdog.h" #endif #include @@ -48,8 +48,7 @@ public: static CDaemonApp* s_instance; #if SYSAPI_WIN32 - CMSWindowsRelauncher* - m_relauncher; + CMSWindowsWatchdog* m_relauncher; #endif private: