deskflow/src/apps/deskflow-daemon/deskflow-daemon.cpp
Nick Bolton 0fc5368253 fix: Prevent access violation by moving events, arch, and log objects to top of stack in Windows daemon
This is how we do it in the server/client apps, so it makes sense to mirror the same pattern.
2025-02-28 12:57:15 +00:00

48 lines
906 B
C++

/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
* SPDX-FileCopyrightText: (C) 2012 Nick Bolton
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
*/
#include "deskflow/DaemonApp.h"
#include "arch/Arch.h"
#include "base/EventQueue.h"
#include "base/Log.h"
#if SYSAPI_WIN32
#include "arch/win32/ArchMiscWindows.h"
#endif
#ifdef SYSAPI_UNIX
int main(int argc, char **argv)
{
DaemonApp app;
return app.run(argc, argv);
}
#elif SYSAPI_WIN32
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
#if SYSAPI_WIN32
// win32 instance needed for threading, etc.
ArchMiscWindows::setInstanceWin32(GetModuleHandle(nullptr));
#endif
Arch arch;
arch.init();
Log log;
EventQueue events;
DaemonApp app(&events);
return app.run(__argc, __argv);
}
#endif