13#define WIN32_LEAN_AND_MEAN
20#define ARCH_DAEMON ArchDaemonWindows
71 const char *
name,
const char *description,
const char *pathname,
const char *
commandLine,
const char *dependencies
85 static HKEY openNTServicesKey();
87 int doRunDaemon(
RunFunc runFunc);
88 void doDaemonRunning(
bool running);
89 UINT doGetDaemonQuitMessage();
91 static void setStatus(
DWORD state);
93 static void setStatusError(
DWORD error);
95 static bool isRunState(
DWORD state);
97 void serviceMain(
DWORD, LPTSTR *);
98 static void WINAPI serviceMainEntry(
DWORD, LPTSTR *);
100 void serviceHandler(
DWORD ctrl);
101 static void WINAPI serviceHandlerEntry(
DWORD ctrl);
103 void start(
const char *
name);
104 void stop(
const char *
name);
107 class XArchDaemonRunFailed
110 XArchDaemonRunFailed(
int result) : m_result(result)
123 DWORD m_serviceState;
124 bool m_serviceHandlerWaiting;
125 bool m_serviceRunning;
127 DWORD m_daemonThreadID;
131 SERVICE_STATUS_HANDLE m_statusHandle;
135 std::string m_commandLine;
138#define DEFAULT_DAEMON_INFO _T("Runs the Core process on secure desktops (UAC prompts, login screen, etc).")
140#define LEGACY_SERVER_DAEMON_NAME _T("Deskflow Server")
141#define LEGACY_CLIENT_DAEMON_NAME _T("Deskflow Client")
static const struct sockaddr FAR * name
Definition ArchNetworkWinsock.cpp:27
static const WSAEVENT FAR DWORD
Definition ArchNetworkWinsock.cpp:54
static int(PASCAL FAR *bind_winsock)(SOCKET s
ArchMutexImpl * ArchMutex
Opaque mutex type. An opaque type representing a mutex.
Definition IArchMultithread.h:39
ArchCondImpl * ArchCond
Opaque condition variable type. An opaque type representing a condition variable.
Definition IArchMultithread.h:25
void uninstallDaemon() override
Uninstall daemon.
Definition ArchDaemonWindows.cpp:622
~ArchDaemonWindows() override=default
bool canInstallDaemon(const char *name) override
Check if user has permission to install the daemon.
Definition ArchDaemonWindows.cpp:221
void installDaemon() override
Install daemon.
Definition ArchDaemonWindows.cpp:606
static UINT getDaemonQuitMessage()
Get daemon quit message.
Definition ArchDaemonWindows.cpp:42
static void daemonRunning(bool running)
Indicate daemon is in main loop.
Definition ArchDaemonWindows.cpp:35
bool isDaemonInstalled(const char *name) override
Check if the daemon is installed.
Definition ArchDaemonWindows.cpp:237
std::function< int()> RunFunc
Definition ArchDaemonWindows.h:26
static void daemonFailed(int result)
Indicate failure of running daemon.
Definition ArchDaemonWindows.cpp:51
std::string commandLine() const override
Get the command line.
Definition ArchDaemonWindows.h:79
static int runDaemon(RunFunc runFunc)
Run the daemon.
Definition ArchDaemonWindows.cpp:29
int daemonize(const char *name, DaemonFunc const &func) override
Daemonize the process.
Definition ArchDaemonWindows.cpp:193
ArchDaemonWindows()
Definition ArchDaemonWindows.cpp:24
Interface for architecture dependent daemonizing.
Definition IArchDaemon.h:22
std::function< int(int, const char **)> DaemonFunc
Definition IArchDaemon.h:24