Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bc96ddebdd | |||
| 80606ef040 | |||
| 836d9b9a2b | |||
| f2063f9e05 | |||
| a74d792b5b | |||
| 256ba2411b | |||
| 0a23e62093 | |||
| e38a8e6b15 | |||
| 6f022ff700 | |||
| 265c2c2a2c | |||
| 1594b8e760 | |||
| 029cb8fc0b | |||
| 8e236e7e5c | |||
| 38b2798bb7 | |||
| d580dfba57 | |||
| da4237f349 | |||
| a78d1acc71 | |||
| 24d5b26da2 | |||
| 9c81f1c045 | |||
| 899a49d09a | |||
| 3a4bf35e22 | |||
| 495331108b | |||
| a7ce936d68 | |||
| f6ccd2a25b | |||
| 5d310be807 | |||
| bd674f546b | |||
| cc821f750d | |||
| 2485e993a4 | |||
| b5d12b8aa5 |
@ -19,7 +19,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
# Fallback for when git can not be found
|
||||
set(DESKFLOW_VERSION_MAJOR 1)
|
||||
set(DESKFLOW_VERSION_MINOR 20)
|
||||
set(DESKFLOW_VERSION_PATCH 0)
|
||||
set(DESKFLOW_VERSION_PATCH 1)
|
||||
set(DESKFLOW_VERSION_TWEAK 0)
|
||||
|
||||
# Get the version from git if it's a git repository
|
||||
|
||||
@ -1,61 +0,0 @@
|
||||
MICROSOFT SOFTWARE LICENSE TERMS
|
||||
|
||||
MICROSOFT VISUAL C++ 2015 - 2022 RUNTIME
|
||||
|
||||
These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. They apply to the software named above. The terms also apply to any Microsoft services or updates for the software, except to the extent those have different terms.
|
||||
|
||||
IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE RIGHTS BELOW.
|
||||
|
||||
1. INSTALLATION AND USE RIGHTS.
|
||||
|
||||
You may install and use any number of copies of the software.
|
||||
|
||||
2. TERMS FOR SPECIFIC COMPONENTS.
|
||||
|
||||
a. Microsoft Platforms. The software may include components from Microsoft Windows; Microsoft Windows Server; Microsoft SQL Server; Microsoft Exchange; Microsoft Office; and Microsoft SharePoint. These components are governed by separate agreements and their own product support policies, as described in the Microsoft “Licenses” folder accompanying the software, except that, if license terms for those components are also included in the associated installation directory, those license terms control.
|
||||
|
||||
b. Third Party Components. The software may include third party components with separate legal notices or governed by other agreements, as may be described in the notices file(s) accompanying the software.
|
||||
|
||||
3. SCOPE OF LICENSE. The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not
|
||||
|
||||
· work around any technical limitations in the software;
|
||||
|
||||
· reverse engineer, decompile or disassemble the software, or otherwise attempt to derive the source code for the software except, and only to the extent required by third party licensing terms governing the use of certain open source components that may be included in the software;
|
||||
|
||||
· remove, minimize, block or modify any notices of Microsoft or its suppliers in the software;
|
||||
|
||||
· use the software in any way that is against the law;
|
||||
|
||||
· share, publish, rent or lease the software; or
|
||||
|
||||
· provide the software as a stand-alone offering or combined with any of your applications for others to use, or transfer the software or this agreement to any third party.
|
||||
|
||||
4. EXPORT RESTRICTIONS. You must comply with all domestic and international export laws and regulations that apply to the software, which include restrictions on destinations, end users, and end use. For further information on export restrictions, visit www.microsoft.com/exporting.
|
||||
|
||||
5. SUPPORT SERVICES. Because this software is “as is,” we may not provide support services for it.
|
||||
|
||||
6. ENTIRE AGREEMENT. This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.
|
||||
|
||||
7. APPLICABLE LAW. If you acquired the software in the United States, Washington law applies to interpretation of and claims for breach of this agreement, and the laws of the state where you live apply to all other claims. If you acquired the software in any other country, its laws apply.
|
||||
|
||||
8. CONSUMER RIGHTS; REGIONAL VARIATIONS. This agreement describes certain legal rights. You may have other rights, including consumer rights, under the laws of your state or country. Separate and apart from your relationship with Microsoft, you may also have rights with respect to the party from which you acquired the software. This agreement does not change those other rights if the laws of your state or country do not permit it to do so. For example, if you acquired the software in one of the below regions, or mandatory country law applies, then the following provisions apply to you:
|
||||
|
||||
a. Australia. You have statutory guarantees under the Australian Consumer Law and nothing in this agreement is intended to affect those rights.
|
||||
|
||||
b. Canada. If you acquired this software in Canada, you may stop receiving updates by turning off the automatic update feature, disconnecting your device from the Internet (if and when you re-connect to the Internet, however, the software will resume checking for and installing updates), or uninstalling the software. The product documentation, if any, may also specify how to turn off updates for your specific device or software.
|
||||
|
||||
c. Germany and Austria.
|
||||
|
||||
(i) Warranty. The properly licensed software will perform substantially as described in any Microsoft materials that accompany the software. However, Microsoft gives no contractual guarantee in relation to the licensed software.
|
||||
|
||||
(ii) Limitation of Liability. In case of intentional conduct, gross negligence, claims based on the Product Liability Act, as well as, in case of death or personal or physical injury, Microsoft is liable according to the statutory law.
|
||||
|
||||
Subject to the foregoing clause (ii), Microsoft will only be liable for slight negligence if Microsoft is in breach of such material contractual obligations, the fulfillment of which facilitate the due performance of this agreement, the breach of which would endanger the purpose of this agreement and the compliance with which a party may constantly trust in (so-called "cardinal obligations"). In other cases of slight negligence, Microsoft will not be liable for slight negligence.
|
||||
|
||||
9. DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS-IS.” YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
|
||||
10. LIMITATION ON AND EXCLUSION OF DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.
|
||||
|
||||
This limitation applies to (a) anything related to the software, services, content (including code) on third party Internet sites, or third party applications; and (b) claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.
|
||||
|
||||
It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.
|
||||
@ -64,7 +64,12 @@ For instructions on building Deskflow, use the wiki page: [Building](https://git
|
||||
|
||||
We support all major operating systems, including Windows, macOS, Linux, and Unix-like BSD-derived.
|
||||
|
||||
Windows 10 or higher is required.
|
||||
> [!NOTE]
|
||||
> On Windows, you will need to install the
|
||||
> [Microsoft Visual C++ Redistributable](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#latest-microsoft-visual-c-redistributable-version).
|
||||
> Download latest: [`vc_redist.x64.exe`](https://aka.ms/vs/17/release/vc_redist.x64.exe)
|
||||
|
||||
Windows 10 or higher is required.
|
||||
|
||||
macOS 12 or higher is required.
|
||||
|
||||
|
||||
@ -127,12 +127,6 @@ precedence = "override"
|
||||
SPDX-FileCopyrightText = "Deskflow Developers"
|
||||
SPDX-License-Identifier = "MIT"
|
||||
|
||||
[[annotations]]
|
||||
path = "deploy/windows/Microsoft_VC142_CRT_x64.msm"
|
||||
precedence = "override"
|
||||
SPDX-FileCopyrightText = "Microsoft"
|
||||
SPDX-License-Identifier = "LicenseRef-Microsoft-vc-redist"
|
||||
|
||||
[[annotations]]
|
||||
path = "src/apps/deskflow-client/deskflow-client.exe.manifest"
|
||||
precedence = "override"
|
||||
|
||||
@ -8,10 +8,9 @@ macro(configure_libs)
|
||||
if(UNIX)
|
||||
configure_unix_libs()
|
||||
elseif(WIN32)
|
||||
find_package(Python REQUIRED QUIET)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /D _BIND_TO_CURRENT_VCLIBS_VERSION=1")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD /O2 /Ob2")
|
||||
list(APPEND libs Wtsapi32 Userenv Wininet comsuppw Shlwapi)
|
||||
list(APPEND libs Wtsapi32 Userenv Wininet comsuppw Shlwapi version)
|
||||
add_definitions(
|
||||
/DWIN32
|
||||
/D_WINDOWS
|
||||
@ -21,6 +20,9 @@ macro(configure_libs)
|
||||
endif()
|
||||
|
||||
find_package(Qt6 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Widgets Network)
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_package(Qt6 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS DBus)
|
||||
endif()
|
||||
|
||||
# Define the location of Qt deployment tool
|
||||
if(WIN32)
|
||||
@ -33,19 +35,12 @@ macro(configure_libs)
|
||||
find_program(DEPLOYQT macdeployqt)
|
||||
endif()
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
message(STATUS "Qt version: ${Qt6_VERSION}")
|
||||
|
||||
# TODO SSL check can happen in lib/net when don't have to deploy it any longer on windows
|
||||
|
||||
# Apple has to use static libraries because "Use of the Apple-provided OpenSSL
|
||||
# libraries by apps is strongly discouraged."
|
||||
# https://developer.apple.com/library/archive/documentation/Security/Conceptual/cryptoservices/SecureNetworkCommunicationAPIs/SecureNetworkCommunicationAPIs.html
|
||||
if(APPLE)
|
||||
set(OPENSSL_USE_STATIC_LIBS TRUE)
|
||||
endif()
|
||||
|
||||
find_package(OpenSSL ${REQUIRED_OPENSSL_VERSION} REQUIRED COMPONENTS SSL Crypto)
|
||||
|
||||
option(ENABLE_COVERAGE "Enable test coverage" OFF)
|
||||
if(ENABLE_COVERAGE)
|
||||
message(STATUS "Enabling code coverage")
|
||||
|
||||
@ -42,7 +42,18 @@
|
||||
</branding>
|
||||
<content_rating type="oars-1.0" />
|
||||
<releases>
|
||||
<release version="1.20.0" date="2025-3-03" urgency="high">
|
||||
<release version="1.20.1" date="2025-03-07" urgency="low">
|
||||
<description>
|
||||
<p>This stable release introduces a Windows dependency requirement and fixes a macOS bug.</p>
|
||||
<ul>
|
||||
<li>Fix: macOS menu bar icon invisible when menu bar is light</li>
|
||||
<li>Feature: Add Windows installer check for Visual C++ Redistributable</li>
|
||||
<li>Feature: Prevent Windows binaries running if MSVC runtime too old</li>
|
||||
</ul>
|
||||
</description>
|
||||
<url>https://github.com/deskflow/deskflow/releases/tag/v1.20.1</url>
|
||||
</release>
|
||||
<release version="1.20.0" date="2025-03-03" urgency="high">
|
||||
<description>
|
||||
<p>This stable release fixes a few security issues, additionally fixes several bugs and adds a few new features. For the full changelog see the release page.</p>
|
||||
<ul>
|
||||
@ -56,9 +67,9 @@
|
||||
<li>Win32: Fix clear settings</li>
|
||||
</ul>
|
||||
</description>
|
||||
<url>https://github.com/deskflow/deskflow/releases/tag/v1.20.0</url>
|
||||
<url>https://github.com/deskflow/deskflow/releases/tag/v1.20.0</url>
|
||||
</release>
|
||||
<release version="1.19.0" date="2025-1-31" urgency="high">
|
||||
<release version="1.19.0" date="2025-01-31" urgency="high">
|
||||
<description>
|
||||
<p>This stable release fixes several bugs and adds a few new features. For the full changelog see the release page.</p>
|
||||
<ul>
|
||||
@ -76,7 +87,7 @@
|
||||
<li>Lots of Internal Cleanup</li>
|
||||
</ul>
|
||||
</description>
|
||||
<url>https://github.com/deskflow/deskflow/releases/tag/v1.19.0</url>
|
||||
<url>https://github.com/deskflow/deskflow/releases/tag/v1.19.0</url>
|
||||
</release>
|
||||
<release version="1.18.0" date="2024-12-26" urgency="high">
|
||||
<description>
|
||||
@ -95,7 +106,7 @@
|
||||
<li>Update the windows clipboard format listener to monitor the clipboard</li>
|
||||
</ul>
|
||||
</description>
|
||||
<url>https://github.com/deskflow/deskflow/releases/tag/v1.18.0</url>
|
||||
<url>https://github.com/deskflow/deskflow/releases/tag/v1.18.0</url>
|
||||
</release>
|
||||
<release version="1.17.2" date="2024-11-20" urgency="medium">
|
||||
<description>
|
||||
@ -149,9 +160,9 @@
|
||||
<li>ci: build flatpaks</li>
|
||||
</ul>
|
||||
</description>
|
||||
<url>https://github.com/deskflow/deskflow/releases/tag/v1.17.2</url>
|
||||
<url>https://github.com/deskflow/deskflow/releases/tag/v1.17.2</url>
|
||||
</release>
|
||||
<release version="1.17.1" date="2024-11-7" urgency="high">
|
||||
<release version="1.17.1" date="2024-11-07" urgency="high">
|
||||
<description>
|
||||
<p>This stable release has a very long changelog some notable ones are.</p>
|
||||
<ul>
|
||||
@ -266,7 +277,7 @@
|
||||
<li>ci: adjust pacakge script to use the names we would like when in cpack</li>
|
||||
</ul>
|
||||
</description>
|
||||
<url>https://github.com/deskflow/deskflow/releases/tag/v1.17.1</url>
|
||||
<url>https://github.com/deskflow/deskflow/releases/tag/v1.17.1</url>
|
||||
</release>
|
||||
<release version="1.17.0" date="2024-10-02" urgency="low">
|
||||
<description>
|
||||
@ -316,7 +327,7 @@
|
||||
<li>Use sonarsource/sonarcloud-github-c-cpp</li>
|
||||
</ul>
|
||||
</description>
|
||||
<url>https://github.com/deskflow/deskflow/releases/tag/v1.17.0</url>
|
||||
<url>https://github.com/deskflow/deskflow/releases/tag/v1.17.0</url>
|
||||
</release>
|
||||
</releases>
|
||||
</component>
|
||||
|
||||
Binary file not shown.
@ -46,7 +46,6 @@ list(APPEND CPACK_WIX_EXTENSIONS "WixToolset.Util.wixext" "WixToolset.Firewall.w
|
||||
list(APPEND CPACK_WIX_CUSTOM_XMLNS "util=http://wixtoolset.org/schemas/v4/wxs/util" "firewall=http://wixtoolset.org/schemas/v4/wxs/firewall")
|
||||
|
||||
# The patch has to know the full path of our msm file
|
||||
set(CPACK_WIX_MSM_FILE "${MY_DIR}/Microsoft_VC142_CRT_x64.msm")
|
||||
configure_file(
|
||||
${MY_DIR}/wix-patch.xml.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/wix-patch.xml @ONLY
|
||||
|
||||
@ -1,25 +1,50 @@
|
||||
<CPackWiXPatch>
|
||||
<CPackWiXFragment Id="CM_CP_deskflow_daemon.exe">
|
||||
<ServiceInstall Description="Controls the Deskflow foreground processes." DisplayName="Deskflow" ErrorControl="normal" Id="ServiceInstall" Name="Deskflow" Start="auto" Type="ownProcess">
|
||||
<util:ServiceConfig FirstFailureActionType="restart" ResetPeriodInDays="1" RestartServiceDelayInSeconds="1" SecondFailureActionType="restart" ThirdFailureActionType="restart"/>
|
||||
<ServiceInstall
|
||||
Id="ServiceInstall"
|
||||
Name="Deskflow"
|
||||
DisplayName="Deskflow"
|
||||
Description="Runs the Core process on secure desktops (UAC prompts, login screen, etc)."
|
||||
ErrorControl="normal"
|
||||
Start="auto"
|
||||
Type="ownProcess">
|
||||
<util:ServiceConfig
|
||||
ResetPeriodInDays="1"
|
||||
RestartServiceDelayInSeconds="1"
|
||||
FirstFailureActionType="restart"
|
||||
SecondFailureActionType="restart"
|
||||
ThirdFailureActionType="none"
|
||||
/>
|
||||
</ServiceInstall>
|
||||
<ServiceControl Id="ServiceControl" Name="Deskflow" Remove="uninstall" Start="install" Stop="both"/>
|
||||
</CPackWiXFragment>
|
||||
|
||||
<CPackWiXFragment Id="CM_CP_deskflow_server.exe">
|
||||
<firewall:FirewallException Id="ServerFirewallException" Name="Deskflow Server" Program="[INSTALL_ROOT]deskflow-server.exe" Scope="any"/>
|
||||
</CPackWiXFragment>
|
||||
|
||||
<CPackWiXFragment Id="CM_CP_deskflow_client.exe">
|
||||
<firewall:FirewallException Id="ClientFirewallException" Name="Deskflow Client" Program="[INSTALL_ROOT]deskflow-client.exe" Scope="any"/>
|
||||
</CPackWiXFragment>
|
||||
|
||||
<CPackWiXFragment Id="#PRODUCT">
|
||||
<StandardDirectory Id="TARGETDIR">
|
||||
<Merge Id="VCRedist" SourceFile="@CPACK_WIX_MSM_FILE@" DiskId="1" Language="0"/>
|
||||
</StandardDirectory >
|
||||
<Feature Id="VCRedist" Title="Visual C++ Runtime" AllowAbsent="no" AllowAdvertise="yes" Display="hidden" InstallDefault="local" TypicalDefault="install">
|
||||
<MergeRef Id="VCRedist" Primary="yes"/>
|
||||
</Feature>
|
||||
<Property Id="VC_REDIST_INSTALLED">
|
||||
<RegistrySearch
|
||||
Id="FindVCRedist"
|
||||
Root="HKLM"
|
||||
Key="SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64"
|
||||
Name="Installed"
|
||||
Type="raw" />
|
||||
</Property>
|
||||
|
||||
<CustomAction Id="Run_Deskflow" ExeCommand="Deskflow" FileRef="CM_FP_deskflow.exe" Return="asyncNoWait"/>
|
||||
|
||||
<CustomAction
|
||||
Id="ShowVCRedistError"
|
||||
Error="Latest Microsoft Visual C++ Redistributable is required. Please install it before proceeding."/>
|
||||
|
||||
<InstallExecuteSequence>
|
||||
<Custom Action="ShowVCRedistError" Before="InstallServices" Condition="NOT Installed AND NOT VC_REDIST_INSTALLED"/>
|
||||
<Custom Action="Run_Deskflow" OnExit="success" Condition="NOT Installed"/>
|
||||
</InstallExecuteSequence>
|
||||
</CPackWiXFragment>
|
||||
|
||||
@ -18,6 +18,8 @@
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#if SYSAPI_WIN32
|
||||
ArchMiscWindows::guardRuntimeVersion();
|
||||
|
||||
// record window instance for tray icon, etc
|
||||
ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));
|
||||
#endif
|
||||
|
||||
@ -8,14 +8,12 @@ if(WIN32)
|
||||
set(target ${CMAKE_PROJECT_NAME}-daemon)
|
||||
|
||||
# Generate rc file
|
||||
set(EXE_DESCRIPTION "Windows service to run ${CMAKE_PROJECT_NAME} in secure desktops (UAC prompts, login screen, etc)")
|
||||
set(EXE_DESCRIPTION "${CMAKE_PROJECT_PROPER_NAME} Daemon for handling secure desktops (UAC prompts, login screen, etc)")
|
||||
set(EXE_ICON "IDI_DESKFLOW ICON DISCARDABLE \"${CMAKE_SOURCE_DIR}/src/apps/res/deskflow.ico\"")
|
||||
configure_file(${CMAKE_SOURCE_DIR}/src/apps/res/windows.rc.in ${target}.rc)
|
||||
|
||||
add_executable(${target} WIN32 ${target}.cpp ${CMAKE_CURRENT_BINARY_DIR}/${target}.rc)
|
||||
|
||||
find_package(Qt6 COMPONENTS Core Network)
|
||||
|
||||
target_link_libraries(
|
||||
${target}
|
||||
arch
|
||||
@ -25,6 +23,7 @@ if(WIN32)
|
||||
net
|
||||
platform
|
||||
app
|
||||
common
|
||||
${libs}
|
||||
Qt6::Core)
|
||||
|
||||
|
||||
@ -6,15 +6,12 @@
|
||||
*/
|
||||
|
||||
#include "arch/Arch.h"
|
||||
#include "base/EventQueue.h"
|
||||
#include "base/Log.h"
|
||||
#include "common/constants.h"
|
||||
#include "deskflow/DaemonApp.h"
|
||||
#include "deskflow/ipc/DaemonIpcServer.h"
|
||||
|
||||
#include "arch/Arch.h"
|
||||
#include "base/EventQueue.h"
|
||||
#include "base/Log.h"
|
||||
|
||||
#if SYSAPI_WIN32
|
||||
|
||||
#include "arch/win32/ArchMiscWindows.h"
|
||||
@ -34,6 +31,8 @@ void handleError(const char *message);
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#if SYSAPI_WIN32
|
||||
ArchMiscWindows::guardRuntimeVersion();
|
||||
|
||||
// Save window instance for later use, e.g. `GetModuleFileName` which is used when installing the daemon.
|
||||
ArchMiscWindows::setInstanceWin32(GetModuleHandle(nullptr));
|
||||
#endif
|
||||
@ -44,8 +43,6 @@ int main(int argc, char **argv)
|
||||
Log log;
|
||||
EventQueue events;
|
||||
|
||||
LOG((CLOG_PRINT "%s daemon (v%s)", kAppName, kVersion));
|
||||
|
||||
auto &daemon = DaemonApp::instance();
|
||||
DaemonApp::InitResult initResult;
|
||||
try {
|
||||
@ -58,6 +55,13 @@ int main(int argc, char **argv)
|
||||
return kExitFailed;
|
||||
}
|
||||
|
||||
// Important: Log the app name and version number to the log file after the daemon app init
|
||||
// because the file log outputter is created there. Logging before would only log to stdout
|
||||
// which is not useful for troubleshooting Windows services.
|
||||
// It's important to write the version number to the log file so we can be certain the old daemon
|
||||
// was uninstalled, since sometimes Windows services can get stuck and fail to be removed.
|
||||
LOG_PRINT("%s Daemon v%s", kAppName, kDisplayVersion);
|
||||
|
||||
switch (initResult) {
|
||||
using enum DaemonApp::InitResult;
|
||||
|
||||
|
||||
@ -8,10 +8,6 @@ else()
|
||||
set(target deskflow)
|
||||
endif()
|
||||
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
if(WIN32)
|
||||
@ -107,6 +103,7 @@ add_executable(${target} WIN32 MACOSX_BUNDLE
|
||||
target_link_libraries(
|
||||
${target}
|
||||
gui
|
||||
common
|
||||
Qt6::Core
|
||||
Qt6::Widgets
|
||||
Qt6::Network)
|
||||
|
||||
@ -741,8 +741,9 @@ void MainWindow::setIcon()
|
||||
if (m_appConfig.colorfulTrayIcon()) {
|
||||
m_trayIcon->setIcon(QIcon::fromTheme(QStringLiteral("deskflow")));
|
||||
} else {
|
||||
m_trayIcon->setIcon(QIcon::fromTheme(QStringLiteral("deskflow-symbolic")));
|
||||
m_trayIcon->icon().setIsMask(true);
|
||||
auto icon = QIcon::fromTheme(QStringLiteral("deskflow-symbolic"));
|
||||
icon.setIsMask(true);
|
||||
m_trayIcon->setIcon(icon);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
#include "ui_AboutDialog.h"
|
||||
|
||||
#include "common/constants.h"
|
||||
#include "gui/style_utils.h"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QDateTime>
|
||||
@ -32,15 +31,7 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui{std::make_unique
|
||||
ui->btnCopyVersion->setIcon(QIcon::fromTheme(QIcon::ThemeIcon::EditCopy));
|
||||
connect(ui->btnCopyVersion, &QPushButton::clicked, this, &AboutDialog::copyVersionText);
|
||||
|
||||
// Set up the displayed version number
|
||||
auto versionString = QString(kVersion);
|
||||
if (versionString.endsWith(QStringLiteral(".0"))) {
|
||||
versionString.chop(2);
|
||||
} else {
|
||||
versionString.append(QStringLiteral(" (%1)").arg(kVersionGitSha));
|
||||
}
|
||||
|
||||
ui->lblVersion->setText(versionString);
|
||||
ui->lblVersion->setText(kDisplayVersion);
|
||||
|
||||
ui->lblDescription->setText(kAppDescription);
|
||||
ui->lblCopyright->setText(kCopyright);
|
||||
|
||||
@ -18,6 +18,8 @@
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#if SYSAPI_WIN32
|
||||
ArchMiscWindows::guardRuntimeVersion();
|
||||
|
||||
// record window instance for tray icon, etc
|
||||
ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));
|
||||
#endif
|
||||
|
||||
@ -82,9 +82,8 @@ add_library(arch STATIC ${PLATFORM_CODE}
|
||||
)
|
||||
|
||||
if(UNIX)
|
||||
target_link_libraries(arch ${CMAKE_DL_LIBS} ${libs})
|
||||
target_link_libraries(arch ${libs})
|
||||
if(NOT APPLE)
|
||||
find_package(Qt6 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS DBus)
|
||||
target_link_libraries(arch Qt6::DBus)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -135,7 +135,7 @@ private:
|
||||
};
|
||||
|
||||
#define DEFAULT_DAEMON_NAME _T(kAppName)
|
||||
#define DEFAULT_DAEMON_INFO _T("Manages the Deskflow foreground processes.")
|
||||
#define DEFAULT_DAEMON_INFO _T("Runs the Core process on secure desktops (UAC prompts, login screen, etc).")
|
||||
|
||||
#define LEGACY_SERVER_DAEMON_NAME _T("Deskflow Server")
|
||||
#define LEGACY_CLIENT_DAEMON_NAME _T("Deskflow Client")
|
||||
|
||||
@ -6,16 +6,48 @@
|
||||
*/
|
||||
|
||||
#include "arch/win32/ArchMiscWindows.h"
|
||||
|
||||
#include "arch/win32/ArchDaemonWindows.h"
|
||||
#include "arch/win32/XArchWindows.h"
|
||||
#include "base/Log.h"
|
||||
#include "common/constants.h"
|
||||
#include "base/String.h"
|
||||
|
||||
#include <Wtsapi32.h>
|
||||
#pragma warning(disable : 4099)
|
||||
#include <Userenv.h>
|
||||
#pragma warning(default : 4099)
|
||||
|
||||
#include <array>
|
||||
|
||||
// Welcome to DLL hell! :)
|
||||
//
|
||||
// Microsoft lets you run a program with an old runtime DLL, as long as the name matches.
|
||||
// Unfortunately if you compile on VS2022 and then use the VS2019 runtime, which both have the
|
||||
// same runtime DLL name, the app will randomly crash (e.g. access violation) or break in strange
|
||||
// and unpredictable ways due to ABI differences.
|
||||
//
|
||||
// In Windows, there is no concept of requiring a minimum version of the runtime DLL, so we have
|
||||
// to check the version ourselves.
|
||||
//
|
||||
// Our CI is set up to build with the latest compiler, so in this case we should insist on the
|
||||
// latest runtime DLL.
|
||||
//
|
||||
// As a developer convenience, we also allow builds on older compilers such as the minimum
|
||||
// requirements for the current Qt version we support.
|
||||
//
|
||||
// See table of the compiler versions and the matching runtime DLL versions:
|
||||
// https://dev.to/yumetodo/list-of-mscver-and-mscfullver-8nd
|
||||
#if _MSC_VER >= 1942 // Visual Studio 2022 Update 12 (v17.12.4)
|
||||
const auto kRequiredMajor = 14;
|
||||
const auto kRequiredMinor = 42;
|
||||
#elif _MSC_VER >= 1920 // Visual Studio 2019 Update 7 (v16.7)
|
||||
const auto kRequiredMajor = 14;
|
||||
const auto kRequiredMinor = 27;
|
||||
#else
|
||||
#pragma message("MSC version: " STRINGIFY(_MSC_VER))
|
||||
#error "Unsupported MSC version"
|
||||
#endif
|
||||
|
||||
// parent process name for services in Vista
|
||||
#define SERVICE_LAUNCHER "services.exe"
|
||||
|
||||
@ -30,6 +62,11 @@
|
||||
#endif
|
||||
using EXECUTION_STATE = DWORD;
|
||||
|
||||
void errorMessageBox(const char *message, const char *title = "Fatal Error")
|
||||
{
|
||||
MessageBoxA(nullptr, message, title, MB_ICONERROR | MB_OK);
|
||||
}
|
||||
|
||||
//
|
||||
// ArchMiscWindows
|
||||
//
|
||||
@ -483,3 +520,56 @@ std::string ArchMiscWindows::getActiveDesktopName()
|
||||
CloseDesktop(desk);
|
||||
return name;
|
||||
}
|
||||
|
||||
void ArchMiscWindows::guardRuntimeVersion() // NOSONAR - `noreturn` is not available
|
||||
{
|
||||
const auto kRuntimeDll = "vcruntime140.dll";
|
||||
|
||||
HMODULE hModule = nullptr;
|
||||
if (!GetModuleHandleEx(0, kRuntimeDll, &hModule) && hModule) {
|
||||
errorMessageBox("Microsoft Visual C++ Runtime is not installed.");
|
||||
abort();
|
||||
}
|
||||
|
||||
std::array<char, MAX_PATH> pathBuffer;
|
||||
const auto path = pathBuffer.data();
|
||||
if (!GetModuleFileNameA(hModule, path, MAX_PATH)) {
|
||||
errorMessageBox("Failed to get the path of Microsoft Visual C++ Runtime.");
|
||||
abort();
|
||||
}
|
||||
|
||||
DWORD handle;
|
||||
DWORD size = GetFileVersionInfoSizeA(path, &handle);
|
||||
if (size <= 0) {
|
||||
errorMessageBox("Failed to get the version info size for Microsoft Visual C++ Runtime.");
|
||||
abort();
|
||||
}
|
||||
|
||||
std::vector<BYTE> versionInfo(size);
|
||||
if (!GetFileVersionInfoA(path, handle, size, versionInfo.data())) {
|
||||
errorMessageBox("Failed to get the file version info for Microsoft Visual C++ Runtime.");
|
||||
abort();
|
||||
}
|
||||
|
||||
VS_FIXEDFILEINFO *fileInfo = nullptr;
|
||||
const auto lplpFileInfo = reinterpret_cast<void **>(&fileInfo); // NOSONAR - Idiomatic Win32
|
||||
if (UINT len = 0; !VerQueryValueA(versionInfo.data(), "\\", lplpFileInfo, &len)) {
|
||||
errorMessageBox("Failed to get the version information for Microsoft Visual C++ Runtime.");
|
||||
abort();
|
||||
}
|
||||
|
||||
const auto currentMajor = HIWORD(fileInfo->dwFileVersionMS);
|
||||
const auto currentMinor = LOWORD(fileInfo->dwFileVersionMS);
|
||||
const auto currentBuild = HIWORD(fileInfo->dwFileVersionLS);
|
||||
|
||||
if (currentMajor < kRequiredMajor || currentMinor < kRequiredMinor) {
|
||||
const auto message = deskflow::string::sprintf(
|
||||
"Installed Microsoft Visual C++ Runtime v%d.%d.%d is outdated.\n\n"
|
||||
"Minimum required version: v%d.%d\n\n"
|
||||
"Please update to the latest Microsoft Visual C++ Redistributable.",
|
||||
currentMajor, currentMinor, currentBuild, kRequiredMajor, kRequiredMinor
|
||||
);
|
||||
MessageBoxA(nullptr, message.c_str(), "Dependency Error", MB_ICONERROR | MB_OK);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,6 +157,9 @@ public:
|
||||
//! Returns true if we got the parent process name.
|
||||
static bool getParentProcessName(std::string &name);
|
||||
|
||||
//! Prevent hard to troubleshoot errors, e.g. access violations.
|
||||
static void guardRuntimeVersion();
|
||||
|
||||
static HINSTANCE instanceWin32();
|
||||
static void setInstanceWin32(HINSTANCE instance);
|
||||
static BOOL WINAPI getProcessEntry(PROCESSENTRY32 &entry, DWORD processID);
|
||||
|
||||
@ -1,17 +1,13 @@
|
||||
# SPDX-FileCopyrightText: (C) 2024 Chris Rizzitello <sithlord48@gmail.com>
|
||||
# SPDX-FileCopyrightText: (C) 2024 - 2025 Chris Rizzitello <sithlord48@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
|
||||
|
||||
configure_file(constants.h.in constants.h @ONLY)
|
||||
|
||||
add_library(common INTERFACE
|
||||
add_library(common STATIC
|
||||
common.h
|
||||
IInterface.h
|
||||
stdbitset.h
|
||||
stddeque.h
|
||||
stdexcept.h
|
||||
stdfstream.h
|
||||
stdistream.h
|
||||
stdlist.h
|
||||
stdmap.h
|
||||
@ -19,12 +15,13 @@ add_library(common INTERFACE
|
||||
stdpost.h
|
||||
stdpre.h
|
||||
stdset.h
|
||||
stdsstream.h
|
||||
stdvector.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/constants.h
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
target_sources(common INTERFACE MacOSXPrecomp.h)
|
||||
endif()
|
||||
set_target_properties(common PROPERTIES LINKER_LANGUAGE CXX)
|
||||
target_link_libraries(common PUBLIC Qt6::Core)
|
||||
|
||||
if(APPLE)
|
||||
target_sources(common PUBLIC MacOSXPrecomp.h)
|
||||
endif()
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* SPDX-FileCopyrightText: (C) 2024 Chris Rizzitello <sithlord48@gmail.com>
|
||||
* SPDX-FileCopyrightText: (C) 2024 - 2025 Chris Rizzitello <sithlord48@gmail.com>
|
||||
* SPDX-FileCopyrightText: (C) 2025 Symless Ltd.
|
||||
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
||||
*/
|
||||
@ -12,6 +12,7 @@ const auto kAppId = "@CMAKE_PROJECT_NAME@";
|
||||
const auto kAppDescription = "@CMAKE_PROJECT_DESCRIPTION@";
|
||||
const auto kVersion = "@CMAKE_PROJECT_VERSION@";
|
||||
const auto kVersionGitSha = "@GIT_SHA_SHORT@";
|
||||
const auto kDisplayVersion = @CMAKE_PROJECT_VERSION_TWEAK@ ? "@CMAKE_PROJECT_VERSION@ (@GIT_SHA_SHORT@)" : "@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@.@CMAKE_PROJECT_VERSION_PATCH@";
|
||||
const auto kDaemonBinName = "@CMAKE_PROJECT_NAME@-daemon";
|
||||
const auto kDaemonIpcName = "@CMAKE_PROJECT_NAME@-daemon";
|
||||
const auto kDaemonLogFilename = "@CMAKE_PROJECT_NAME@-daemon.log";
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
|
||||
* SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman
|
||||
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "stdpre.h"
|
||||
|
||||
#include <bitset>
|
||||
|
||||
#include "stdpost.h"
|
||||
@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
|
||||
* SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman
|
||||
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "stdpre.h"
|
||||
|
||||
#include "stdistream.h"
|
||||
#include <fstream>
|
||||
|
||||
#include "stdpost.h"
|
||||
@ -1,334 +0,0 @@
|
||||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
|
||||
* SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman
|
||||
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "stdpre.h"
|
||||
|
||||
#if HAVE_SSTREAM || !defined(__GNUC__) || (__GNUC__ >= 3)
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#elif defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 95)
|
||||
// g++ 2.95 didn't ship with sstream. the following is a backport
|
||||
// by Magnus Fromreide of the sstream in g++ 3.0.
|
||||
|
||||
/* This is part of libio/iostream, providing -*- C++ -*- input/output.
|
||||
Copyright (C) 2012-2016 Symless Ltd.
|
||||
Copyright (C) 2000 Free Software Foundation
|
||||
|
||||
This file is part of the GNU IO Library. This library is free
|
||||
software; you can redistribute it and/or modify it under the
|
||||
terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file LICENSE. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does not cause
|
||||
the resulting executable to be covered by the GNU General Public License.
|
||||
This exception does not however invalidate any other reasons why
|
||||
the executable file might be covered by the GNU General Public License. */
|
||||
|
||||
/* Written by Magnus Fromreide (magfr@lysator.liu.se). */
|
||||
/* seekoff and ideas for overflow is largely borrowed from libstdc++-v3 */
|
||||
|
||||
#include <iostream.h>
|
||||
#include <streambuf.h>
|
||||
#include <string>
|
||||
|
||||
namespace std {
|
||||
class stringbuf : public streambuf
|
||||
{
|
||||
public:
|
||||
using char_type = char;
|
||||
using int_type = int;
|
||||
using pos_type = streampos;
|
||||
using off_type = streamoff;
|
||||
|
||||
explicit stringbuf(int which = ios::in | ios::out)
|
||||
: streambuf(),
|
||||
mode(static_cast<ios::open_mode>(which)),
|
||||
stream(NULL),
|
||||
stream_len(0)
|
||||
{
|
||||
stringbuf_init();
|
||||
}
|
||||
|
||||
explicit stringbuf(const string &str, int which = ios::in | ios::out)
|
||||
: streambuf(),
|
||||
mode(static_cast<ios::open_mode>(which)),
|
||||
stream(NULL),
|
||||
stream_len(0)
|
||||
{
|
||||
if (mode & (ios::in | ios::out)) {
|
||||
stream_len = str.size();
|
||||
stream = new char_type[stream_len];
|
||||
str.copy(stream, stream_len);
|
||||
}
|
||||
stringbuf_init();
|
||||
}
|
||||
|
||||
virtual ~stringbuf()
|
||||
{
|
||||
delete[] stream;
|
||||
}
|
||||
|
||||
string str() const
|
||||
{
|
||||
if (pbase() != 0)
|
||||
return string(stream, pptr() - pbase());
|
||||
else
|
||||
return string();
|
||||
}
|
||||
|
||||
void str(const string &str)
|
||||
{
|
||||
delete[] stream;
|
||||
stream_len = str.size();
|
||||
stream = new char_type[stream_len];
|
||||
str.copy(stream, stream_len);
|
||||
stringbuf_init();
|
||||
}
|
||||
|
||||
protected:
|
||||
// The buffer is already in gptr, so if it ends then it is out of data.
|
||||
virtual int underflow()
|
||||
{
|
||||
return EOF;
|
||||
}
|
||||
|
||||
virtual int overflow(int c = EOF)
|
||||
{
|
||||
int res;
|
||||
if (mode & ios::out) {
|
||||
if (c != EOF) {
|
||||
streamsize old_stream_len = stream_len;
|
||||
stream_len += 1;
|
||||
char_type *new_stream = new char_type[stream_len];
|
||||
memcpy(new_stream, stream, old_stream_len);
|
||||
delete[] stream;
|
||||
stream = new_stream;
|
||||
stringbuf_sync(gptr() - eback(), pptr() - pbase());
|
||||
sputc(c);
|
||||
res = c;
|
||||
} else
|
||||
res = EOF;
|
||||
} else
|
||||
res = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
virtual streambuf *setbuf(char_type *s, streamsize n)
|
||||
{
|
||||
if (n != 0) {
|
||||
delete[] stream;
|
||||
stream = new char_type[n];
|
||||
memcpy(stream, s, n);
|
||||
stream_len = n;
|
||||
stringbuf_sync(0, 0);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
virtual pos_type seekoff(off_type off, ios::seek_dir way, int which = ios::in | ios::out)
|
||||
{
|
||||
pos_type ret = pos_type(off_type(-1));
|
||||
bool testin = which & ios::in && mode & ios::in;
|
||||
bool testout = which & ios::out && mode & ios::out;
|
||||
bool testboth = testin && testout && way != ios::cur;
|
||||
|
||||
if (stream_len && ((testin != testout) || testboth)) {
|
||||
char_type *beg = stream;
|
||||
char_type *curi = NULL;
|
||||
char_type *curo = NULL;
|
||||
char_type *endi = NULL;
|
||||
char_type *endo = NULL;
|
||||
|
||||
if (testin) {
|
||||
curi = gptr();
|
||||
endi = egptr();
|
||||
}
|
||||
if (testout) {
|
||||
curo = pptr();
|
||||
endo = epptr();
|
||||
}
|
||||
|
||||
off_type newoffi = 0;
|
||||
off_type newoffo = 0;
|
||||
if (way == ios::beg) {
|
||||
newoffi = beg - curi;
|
||||
newoffo = beg - curo;
|
||||
} else if (way == ios::end) {
|
||||
newoffi = endi - curi;
|
||||
newoffo = endo - curo;
|
||||
}
|
||||
|
||||
if (testin && newoffi + off + curi - beg >= 0 && endi - beg >= newoffi + off + curi - beg) {
|
||||
gbump(newoffi + off);
|
||||
ret = pos_type(newoffi + off + curi);
|
||||
}
|
||||
if (testout && newoffo + off + curo - beg >= 0 && endo - beg >= newoffo + off + curo - beg) {
|
||||
pbump(newoffo + off);
|
||||
ret = pos_type(newoffo + off + curo);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
virtual pos_type seekpos(pos_type sp, int which = ios::in | ios::out)
|
||||
{
|
||||
pos_type ret = seekoff(sp, ios::beg, which);
|
||||
return ret;
|
||||
}
|
||||
|
||||
private:
|
||||
void stringbuf_sync(streamsize i, streamsize o)
|
||||
{
|
||||
if (mode & ios::in)
|
||||
setg(stream, stream + i, stream + stream_len);
|
||||
if (mode & ios::out) {
|
||||
setp(stream, stream + stream_len);
|
||||
pbump(o);
|
||||
}
|
||||
}
|
||||
void stringbuf_init()
|
||||
{
|
||||
if (mode & ios::ate)
|
||||
stringbuf_sync(0, stream_len);
|
||||
else
|
||||
stringbuf_sync(0, 0);
|
||||
}
|
||||
|
||||
private:
|
||||
ios::open_mode mode;
|
||||
char_type *stream;
|
||||
streamsize stream_len;
|
||||
};
|
||||
|
||||
class istringstream : public istream
|
||||
{
|
||||
public:
|
||||
using char_type = char;
|
||||
using int_type = int;
|
||||
using pos_type = streampos;
|
||||
using off_type = streamoff;
|
||||
|
||||
explicit istringstream(int which = ios::in) : istream(&sb), sb(which | ios::in)
|
||||
{
|
||||
}
|
||||
|
||||
explicit istringstream(const string &str, int which = ios::in) : istream(&sb), sb(str, which | ios::in)
|
||||
{
|
||||
}
|
||||
|
||||
stringbuf *rdbuf() const
|
||||
{
|
||||
return const_cast<stringbuf *>(&sb);
|
||||
}
|
||||
|
||||
string str() const
|
||||
{
|
||||
return rdbuf()->str();
|
||||
}
|
||||
void str(const string &s)
|
||||
{
|
||||
rdbuf()->str(s);
|
||||
}
|
||||
|
||||
private:
|
||||
stringbuf sb;
|
||||
};
|
||||
|
||||
class ostringstream : public ostream
|
||||
{
|
||||
public:
|
||||
using char_type = char;
|
||||
using int_type = int;
|
||||
using pos_type = streampos;
|
||||
using off_type = streamoff;
|
||||
|
||||
explicit ostringstream(int which = ios::out) : ostream(&sb), sb(which | ios::out)
|
||||
{
|
||||
}
|
||||
|
||||
explicit ostringstream(const string &str, int which = ios::out) : ostream(&sb), sb(str, which | ios::out)
|
||||
{
|
||||
}
|
||||
|
||||
stringbuf *rdbuf() const
|
||||
{
|
||||
return const_cast<stringbuf *>(&sb);
|
||||
}
|
||||
|
||||
string str() const
|
||||
{
|
||||
return rdbuf()->str();
|
||||
}
|
||||
|
||||
void str(const string &s)
|
||||
{
|
||||
rdbuf()->str(s);
|
||||
}
|
||||
|
||||
private:
|
||||
stringbuf sb;
|
||||
};
|
||||
|
||||
class stringstream : public iostream
|
||||
{
|
||||
public:
|
||||
using char_type = char;
|
||||
using int_type = int;
|
||||
using pos_type = streampos;
|
||||
using off_type = streamoff;
|
||||
|
||||
explicit stringstream(int which = ios::out | ios::in) : iostream(&sb), sb(which)
|
||||
{
|
||||
}
|
||||
|
||||
explicit stringstream(const string &str, int which = ios::out | ios::in) : iostream(&sb), sb(str, which)
|
||||
{
|
||||
}
|
||||
|
||||
stringbuf *rdbuf() const
|
||||
{
|
||||
return const_cast<stringbuf *>(&sb);
|
||||
}
|
||||
|
||||
string str() const
|
||||
{
|
||||
return rdbuf()->str();
|
||||
}
|
||||
|
||||
void str(const string &s)
|
||||
{
|
||||
rdbuf()->str(s);
|
||||
}
|
||||
|
||||
private:
|
||||
stringbuf sb;
|
||||
};
|
||||
}; // namespace std
|
||||
|
||||
#else /* not g++ 2.95 and no <sstream> */
|
||||
|
||||
#error "Standard C++ library is missing required sstream header."
|
||||
|
||||
#endif /* not g++ 2.95 and no <sstream> */
|
||||
|
||||
#include "stdistream.h"
|
||||
|
||||
#include "stdpost.h"
|
||||
@ -49,8 +49,6 @@ endif()
|
||||
####################Start Making Library#########################
|
||||
set(lib_name app)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
# arch
|
||||
if(WIN32)
|
||||
set(PLATFORM_CODE
|
||||
@ -149,7 +147,6 @@ add_library(${lib_name} STATIC ${PLATFORM_CODE}
|
||||
ipc/DaemonIpcServer.h
|
||||
)
|
||||
|
||||
find_package(Qt6 COMPONENTS Core Network)
|
||||
target_link_libraries(${lib_name} PRIVATE Qt6::Core Qt6::Network)
|
||||
|
||||
if(WIN32)
|
||||
|
||||
@ -162,9 +162,11 @@ DaemonApp::InitResult DaemonApp::init(IEventQueue *events, int argc, char **argv
|
||||
string arg(argv[i]);
|
||||
|
||||
if (arg == "-h" || arg == "--help") {
|
||||
showConsole();
|
||||
showHelp(argc, argv);
|
||||
return ShowHelp;
|
||||
} else if (arg == "-f" || arg == "--foreground") {
|
||||
showConsole();
|
||||
m_foreground = true;
|
||||
}
|
||||
#if SYSAPI_WIN32
|
||||
@ -263,3 +265,16 @@ std::string DaemonApp::logFilename()
|
||||
|
||||
return logFilename;
|
||||
}
|
||||
|
||||
void DaemonApp::showConsole()
|
||||
{
|
||||
#if SYSAPI_WIN32
|
||||
// The daemon bin is compiled using the Win32 subsystem which works best for Windows services,
|
||||
// so when running as a foreground process we need to allocate a console (or we won't see output).
|
||||
// It is important to do this inside the arg check loop so that we can attach console ahead
|
||||
// of log output generated by handling other args.
|
||||
AllocConsole();
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
freopen("CONOUT$", "w", stderr);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -69,11 +69,12 @@ private:
|
||||
void handleError(const char *message);
|
||||
void handleIpcMessage(const Event &e, void *);
|
||||
|
||||
static void showConsole();
|
||||
|
||||
#if SYSAPI_WIN32
|
||||
std::unique_ptr<MSWindowsWatchdog> m_watchdog;
|
||||
#endif
|
||||
|
||||
private:
|
||||
IEventQueue *m_events = nullptr;
|
||||
FileLogOutputter *m_fileLogOutputter = nullptr;
|
||||
deskflow::core::ipc::DaemonIpcServer *m_ipcServer = nullptr;
|
||||
|
||||
@ -4,9 +4,6 @@
|
||||
|
||||
set(target gui)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
if(APPLE)
|
||||
|
||||
@ -39,7 +39,7 @@ const char *const AppConfig::m_SettingsName[] = {
|
||||
"logLevel2",
|
||||
"logToFile",
|
||||
"logFilename",
|
||||
"wizardLastRun",
|
||||
"", // 6 wizardLastRun, obsolete
|
||||
"startedBefore",
|
||||
"elevateMode",
|
||||
"elevateModeEnum",
|
||||
@ -105,8 +105,6 @@ void AppConfig::recall()
|
||||
void AppConfig::recallFromAllScopes()
|
||||
{
|
||||
using enum Setting;
|
||||
|
||||
m_WizardLastRun = findInAllScopes(kWizardLastRun, m_WizardLastRun).toInt();
|
||||
m_LoadFromSystemScope = findInAllScopes(kLoadSystemSettings, m_LoadFromSystemScope).toBool();
|
||||
}
|
||||
|
||||
@ -172,7 +170,6 @@ void AppConfig::commit()
|
||||
|
||||
qDebug("committing app config");
|
||||
|
||||
saveToAllScopes(kWizardLastRun, m_WizardLastRun);
|
||||
saveToAllScopes(kLoadSystemSettings, m_LoadFromSystemScope);
|
||||
saveToAllScopes(kClientGroupChecked, m_ClientGroupChecked);
|
||||
saveToAllScopes(kServerGroupChecked, m_ServerGroupChecked);
|
||||
@ -444,11 +441,6 @@ ProcessMode AppConfig::processMode() const
|
||||
return m_EnableService ? ProcessMode::kService : ProcessMode::kDesktop;
|
||||
}
|
||||
|
||||
bool AppConfig::wizardShouldRun() const
|
||||
{
|
||||
return m_WizardLastRun < kWizardVersion;
|
||||
}
|
||||
|
||||
bool AppConfig::startedBefore() const
|
||||
{
|
||||
return m_StartedBefore;
|
||||
@ -697,11 +689,6 @@ void AppConfig::setLogFilename(const QString &s)
|
||||
m_LogFilename = s;
|
||||
}
|
||||
|
||||
void AppConfig::setWizardHasRun()
|
||||
{
|
||||
m_WizardLastRun = kWizardVersion;
|
||||
}
|
||||
|
||||
void AppConfig::setStartedBefore(bool b)
|
||||
{
|
||||
m_StartedBefore = b;
|
||||
|
||||
@ -61,7 +61,7 @@ private:
|
||||
kLogLevel = 3,
|
||||
kLogToFile = 4,
|
||||
kLogFilename = 5,
|
||||
kWizardLastRun = 6,
|
||||
// 6 = show first run wizard, obsolete
|
||||
kStartedBefore = 7,
|
||||
kElevateModeLegacy = 8,
|
||||
kElevateMode = 9,
|
||||
@ -166,7 +166,6 @@ public:
|
||||
// Getters (new methods)
|
||||
//
|
||||
|
||||
bool wizardShouldRun() const;
|
||||
bool startedBefore() const;
|
||||
QString logDir() const;
|
||||
bool serverGroupChecked() const;
|
||||
@ -206,7 +205,6 @@ public:
|
||||
//
|
||||
|
||||
void setStartedBefore(bool b);
|
||||
void setWizardHasRun();
|
||||
void setServerGroupChecked(bool);
|
||||
void setUseExternalConfig(bool);
|
||||
void setConfigFile(const QString &);
|
||||
@ -301,7 +299,6 @@ private:
|
||||
int m_LogLevel = 0;
|
||||
bool m_LogToFile = false;
|
||||
QString m_LogFilename = logDir() + deskflow::gui::kDefaultLogFile;
|
||||
int m_WizardLastRun = 0;
|
||||
bool m_StartedBefore = false;
|
||||
ElevateMode m_ElevateMode = deskflow::gui::kDefaultElevateMode;
|
||||
bool m_TlsEnabled = true;
|
||||
|
||||
@ -3,6 +3,15 @@
|
||||
# SPDX-FileCopyrightText: 2009 - 2012 Nick Bolton
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
# Apple has to use static libraries because "Use of the Apple-provided OpenSSL
|
||||
# libraries by apps is strongly discouraged."
|
||||
# https://developer.apple.com/library/archive/documentation/Security/Conceptual/cryptoservices/SecureNetworkCommunicationAPIs/SecureNetworkCommunicationAPIs.html
|
||||
if(APPLE)
|
||||
set(OPENSSL_USE_STATIC_LIBS TRUE)
|
||||
endif()
|
||||
|
||||
find_package(OpenSSL ${REQUIRED_OPENSSL_VERSION} REQUIRED COMPONENTS SSL Crypto)
|
||||
|
||||
add_library(net STATIC
|
||||
FingerprintData.cpp
|
||||
FingerprintData.h
|
||||
@ -47,6 +56,6 @@ if(WIN32)
|
||||
target_link_libraries(
|
||||
net
|
||||
PUBLIC OpenSSL::applink
|
||||
PRIVATE Crypt32 ws2_32 OpenSSL::applink
|
||||
PRIVATE Crypt32 ws2_32
|
||||
)
|
||||
endif()
|
||||
|
||||
@ -184,7 +184,6 @@ if(UNIX)
|
||||
${libs})
|
||||
|
||||
if(NOT APPLE)
|
||||
find_package(Qt6 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS DBus)
|
||||
target_link_libraries(platform Qt6::DBus)
|
||||
|
||||
link_wayland_libs()
|
||||
|
||||
@ -16,9 +16,6 @@ FetchContent_MakeAvailable(googletest)
|
||||
|
||||
macro(config_all_tests)
|
||||
|
||||
# Required to load images from .qrc file.
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(base_dir ${PROJECT_SOURCE_DIR})
|
||||
set(src_dir ${base_dir}/src)
|
||||
set(test_base_dir ${src_dir}/test)
|
||||
|
||||
Reference in New Issue
Block a user