From 0c368f402babbaeda4b3dc7a86ab00e4b69d8b52 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Sat, 3 Jan 2026 09:27:07 -0500 Subject: [PATCH] refactor: use ArchDaemonWindows::runDeamon directly remove now unused ArchMiscWindows::runDaemon --- src/lib/arch/IArchDaemon.h | 2 +- src/lib/arch/win32/ArchMiscWindows.cpp | 6 ------ src/lib/arch/win32/ArchMiscWindows.h | 6 ------ src/lib/deskflow/DaemonApp.cpp | 4 ++-- src/lib/deskflow/win32/AppUtilWindows.cpp | 2 +- 5 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/lib/arch/IArchDaemon.h b/src/lib/arch/IArchDaemon.h index 3a78a6fc4..7b6771b97 100644 --- a/src/lib/arch/IArchDaemon.h +++ b/src/lib/arch/IArchDaemon.h @@ -41,7 +41,7 @@ public: Becomes a service. Argument 0 is the name of the service and the rest are the arguments passed to StartService(). \c func is only called when the service is actually started. - \c func must call \c ArchMiscWindows::runDaemon() to finally + \c func must call \c ArchDaemonWindows::runDaemon() to finally becoming a service. The \c runFunc function passed to \c runDaemon() must call \c ArchDaemonWindows::daemonRunning(true) when it enters the main loop (i.e. after initialization) and diff --git a/src/lib/arch/win32/ArchMiscWindows.cpp b/src/lib/arch/win32/ArchMiscWindows.cpp index 2820ddc61..b202b15aa 100644 --- a/src/lib/arch/win32/ArchMiscWindows.cpp +++ b/src/lib/arch/win32/ArchMiscWindows.cpp @@ -8,7 +8,6 @@ #include "arch/win32/ArchMiscWindows.h" -#include "arch/win32/ArchDaemonWindows.h" #include "arch/win32/XArchWindows.h" #include "base/Log.h" #include "base/String.h" @@ -65,11 +64,6 @@ void ArchMiscWindows::init() SetErrorMode(SEM_FAILCRITICALERRORS); } -int ArchMiscWindows::runDaemon(RunFunc runFunc) -{ - return ArchDaemonWindows::runDaemon(runFunc); -} - HKEY ArchMiscWindows::openKey(HKEY key, const TCHAR *keyName) { return openKey(key, keyName, false); diff --git a/src/lib/arch/win32/ArchMiscWindows.h b/src/lib/arch/win32/ArchMiscWindows.h index fe85b7184..c294acc1e 100644 --- a/src/lib/arch/win32/ArchMiscWindows.h +++ b/src/lib/arch/win32/ArchMiscWindows.h @@ -41,12 +41,6 @@ public: //! Initialize static void init(); - //! Run the daemon - /*! - Delegates to ArchDaemonWindows. - */ - static int runDaemon(RunFunc runFunc); - //! Open and return a registry key, closing the parent key static HKEY openKey(HKEY parent, const TCHAR *child); diff --git a/src/lib/deskflow/DaemonApp.cpp b/src/lib/deskflow/DaemonApp.cpp index 750b35259..905e8a965 100644 --- a/src/lib/deskflow/DaemonApp.cpp +++ b/src/lib/deskflow/DaemonApp.cpp @@ -17,7 +17,7 @@ #if SYSAPI_WIN32 -#include "arch/win32/ArchMiscWindows.h" // IWYU pragma: keep +#include "arch/win32/ArchDaemonWindows.h" #include "deskflow/Screen.h" #include "platform/MSWindowsDebugOutputter.h" #include "platform/MSWindowsEventQueueBuffer.h" @@ -164,7 +164,7 @@ int DaemonApp::daemonLoop() { #if SYSAPI_WIN32 // Runs the daemon through the Windows service controller, which controls the program lifecycle. - return ArchMiscWindows::runDaemon([this]() { return mainLoop(); }); + return ArchDaemonWindows::runDaemon([this]() { return mainLoop(); }); #elif SYSAPI_UNIX return mainLoop(); #endif diff --git a/src/lib/deskflow/win32/AppUtilWindows.cpp b/src/lib/deskflow/win32/AppUtilWindows.cpp index 1b950c843..992d03a54 100644 --- a/src/lib/deskflow/win32/AppUtilWindows.cpp +++ b/src/lib/deskflow/win32/AppUtilWindows.cpp @@ -65,7 +65,7 @@ int AppUtilWindows::daemonNTMainLoop() { app().initApp(); - return ArchMiscWindows::runDaemon(mainLoopStatic); + return ArchDaemonWindows::runDaemon(mainLoopStatic); } void AppUtilWindows::exitApp(int code)