Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,10 @@ piet = "0.6"
piet-coregraphics = "0.6"
foreign-types = "0.3"

[target.'cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))'.dependencies]
[target.'cfg(any(target_os = "macos", target_os = "linux"))'.dependencies]
tray-icon = { git = "https://github.com/tauri-apps/tray-icon", version = "0.21.3" }
tao = { git = "https://github.com/rustdesk-org/tao", branch = "dev" }
image = "0.24"

[target.'cfg(any(target_os = "macos", target_os = "linux"))'.dependencies]
keepawake = { git = "https://github.com/rustdesk-org/keepawake-rs" }

[target.'cfg(any(target_os = "windows", target_os = "linux"))'.dependencies]
Expand Down
36 changes: 1 addition & 35 deletions res/msi/CustomActions/CustomActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ UINT __stdcall TryStopDeleteService(__in MSIHANDLE hInstall)

// It's really strange that we need sleep here.
// But the upgrading may be stuck at "copying new files" because the file is in using.
// Steps to reproduce: Install -> stop service in tray --> start service -> upgrade
// Steps to reproduce: Install -> stop service --> start service -> upgrade
// Sleep(300);

// Or we can terminate the process
Expand All @@ -650,40 +650,6 @@ UINT __stdcall TryStopDeleteService(__in MSIHANDLE hInstall)
return WcaFinalize(er);
}

UINT __stdcall TryDeleteStartupShortcut(__in MSIHANDLE hInstall)
{
HRESULT hr = S_OK;
DWORD er = ERROR_SUCCESS;

wchar_t szShortcut[500] = { 0 };
DWORD cchShortcut = sizeof(szShortcut) / sizeof(szShortcut[0]);
wchar_t szStartupDir[500] = { 0 };
DWORD cchStartupDir = sizeof(szStartupDir) / sizeof(szStartupDir[0]);
WCHAR pwszTemp[1024] = L"";

hr = WcaInitialize(hInstall, "DeleteStartupShortcut");
ExitOnFailure(hr, "Failed to initialize");

MsiGetPropertyW(hInstall, L"StartupFolder", szStartupDir, &cchStartupDir);

MsiGetPropertyW(hInstall, L"ShortcutName", szShortcut, &cchShortcut);
WcaLog(LOGMSG_STANDARD, "Try delete startup shortcut of : \"%ls\"", szShortcut);

hr = StringCchPrintfW(pwszTemp, 1024, L"%ls%ls.lnk", szStartupDir, szShortcut);
ExitOnFailure(hr, "Failed to compose a resource identifier string");

if (DeleteFileW(pwszTemp)) {
WcaLog(LOGMSG_STANDARD, "Failed to delete startup shortcut of : \"%ls\"", pwszTemp);
}
else {
WcaLog(LOGMSG_STANDARD, "Startup shortcut is deleted : \"%ls\"", pwszTemp);
}

LExit:
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}

UINT __stdcall SetPropertyFromConfig(__in MSIHANDLE hInstall)
{
HRESULT hr = S_OK;
Expand Down
1 change: 0 additions & 1 deletion res/msi/CustomActions/CustomActions.def
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ EXPORTS
SetPropertyIsServiceRunning
TryStopDeleteService
CreateStartService
TryDeleteStartupShortcut
SetPropertyFromConfig
AddRegSoftwareSASGeneration
RemoveAmyuniIdd
Expand Down
14 changes: 0 additions & 14 deletions res/msi/Package/Components/RustDesk.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<CustomAction Id="TryStopDeleteService.SetParam" Return="check" Property="TryStopDeleteService" Value="$(var.Product)" />

<CustomAction Id="LaunchApp" ExeCommand="" Return="asyncNoWait" FileRef="App.exe" />
<CustomAction Id="LaunchAppTray" ExeCommand=" --tray" Return="asyncNoWait" FileRef="App.exe" />
<Property Id="TerminateProcesses" Value="AppTest.exe" />
<CustomAction Id="TerminateProcesses.SetParam" Return="check" Property="TerminateProcesses" Value="$(var.Product).exe" />
<CustomAction Id="TerminateBrokers.SetParam" Return="check" Property="TerminateProcesses" Value="RuntimeBroker_rustdesk.exe" />
Expand All @@ -28,7 +27,6 @@
<CustomAction Id="SetPropertyServiceStop.SetParam.ConfigFile" Return="check" Property="ConfigFile" Value="[AppDataFolder]$(var.Product)\config\$(var.Product)2.toml" />
<CustomAction Id="SetPropertyServiceStop.SetParam.ConfigKey" Return="check" Property="ConfigKey" Value="stop-service" />
<CustomAction Id="SetPropertyServiceStop.SetParam.PropertyName" Return="check" Property="PropertyName" Value="STOP_SERVICE" />
<CustomAction Id="TryDeleteStartupShortcut.SetParam" Return="check" Property="ShortcutName" Value="$(var.Product) Tray" />
<CustomAction Id="RemoveAmyuniIdd.SetParam" Return="check" Property="RemoveAmyuniIdd" Value="[INSTALLFOLDER_INNER]" />
<CustomAction Id="InstallPrinter.SetParam" Return="check" Property="InstallPrinter" Value="[INSTALLFOLDER_INNER]" />
<InstallExecuteSequence>
Expand All @@ -49,14 +47,9 @@

<Custom Action="CustomActionHello" Before="InstallFinalize" />

<!--Shortcut is in InstallValidate section. So we just let it be created, then try delete if stopping service.-->
<Custom Action="TryDeleteStartupShortcut" After="InstallFinalize" Condition="STOP_SERVICE=&quot;&apos;Y&apos;&quot;" />
<Custom Action="TryDeleteStartupShortcut.SetParam" Before="SetPropertyIsServiceRunning" Condition="STOP_SERVICE=&quot;&apos;Y&apos;&quot;" />

<!-- Launch ClientLauncher if installing or already installed and not uninstalling -->
<!-- https://learn.microsoft.com/en-us/windows/win32/msi/uilevel -->
<Custom Action="LaunchApp" After="InstallFinalize" Condition="(NOT UILevel=2) AND (NOT (Installed AND REMOVE AND NOT UPGRADINGPRODUCTCODE)) "/>
<Custom Action="LaunchAppTray" After="InstallFinalize" Condition="(LAUNCH_TRAY_APP=&quot;Y&quot; OR LAUNCH_TRAY_APP=&quot;1&quot;) AND (NOT (Installed AND REMOVE AND NOT UPGRADINGPRODUCTCODE)) AND (NOT STOP_SERVICE=&quot;&apos;Y&apos;&quot;) AND (NOT CC_CONNECTION_TYPE=&quot;outgoing&quot;)"/>

<!-- https://learn.microsoft.com/en-us/windows/win32/msi/operating-system-property-values -->
<!-- We have to use `VersionNT` to instead of `IsWindows10OrGreater()` in the custom action.
Expand Down Expand Up @@ -124,12 +117,6 @@
<RegistryValue Root="HKCU" Key="Software\$(var.Product)" Name="App.Desktop.Shortcut" Type="string" Value="1" KeyPath="yes" />
</Component>
</StandardDirectory>
<StandardDirectory Id="StartupFolder">
<Component Id="App.StartupFolder.ShortcutTray" Guid="B1D1E2BB-E53E-E159-DB7C-744D5C726A8C" Condition="STARTUPSHORTCUTS = 1 AND (NOT CC_CONNECTION_TYPE=&quot;outgoing&quot;)">
<Shortcut Id="App.StartupFolder.ShortcutTray" Name="!(loc.SC_Client_Tray)" Description="!(loc.SC_Client_Tray_Desc)" Target="[!App.exe]" Arguments="--tray" Icon="AppIcon" WorkingDirectory="INSTALLFOLDER_INNER" />
<RegistryValue Root="HKCU" Key="Software\$(var.Product)" Name="App.StartupFolder.ShortcutTray" Type="string" Value="1" KeyPath="yes" />
</Component>
</StandardDirectory>

<!--<DirectoryRef Id="INSTALLFOLDER_INNER">
<Component Id="App.UninstallShortcut" Guid="FB0F2AC7-2AE5-4C54-B860-5E472620B6B1">
Expand All @@ -143,7 +130,6 @@
<!--<ComponentRef Id="App.UninstallShortcut" />-->
<ComponentRef Id="App.StartMenu.Shortcut" />
<ComponentRef Id="App.StartMenu.ShortcutUninstall" />
<ComponentRef Id="App.StartupFolder.ShortcutTray" />

<!--$AutoComonentStart$-->
<!--$AutoComponentEnd$-->
Expand Down
2 changes: 0 additions & 2 deletions res/msi/Package/Fragments/AddRemoveProperties.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
<!--STOP_SERVICE is set to 'Y'. Because the config value may be empty or 'Y'-->
<Property Id="STOP_SERVICE" Value="&apos;Y&apos;" />

<Property Id="LAUNCH_TRAY_APP" Value="Y" />

<!--
Support entries shown when clicking "Click here for support information"
in Control Panel's Add/Remove Programs https://learn.microsoft.com/en-us/windows/win32/msi/property-reference
Expand Down
3 changes: 1 addition & 2 deletions res/msi/Package/Fragments/CustomActions.wxs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Fragment>
<?include ../Includes.wxi?>

Expand All @@ -13,7 +13,6 @@
<CustomAction Id="SetPropertyIsServiceRunning" DllEntry="SetPropertyIsServiceRunning" Impersonate="yes" Execute="immediate" Return="ignore" BinaryRef="Custom_Actions_Dll"/>
<CustomAction Id="CreateStartService" DllEntry="CreateStartService" Impersonate="no" Execute="deferred" Return="ignore" BinaryRef="Custom_Actions_Dll"/>
<CustomAction Id="TryStopDeleteService" DllEntry="TryStopDeleteService" Impersonate="no" Execute="deferred" Return="ignore" BinaryRef="Custom_Actions_Dll"/>
<CustomAction Id="TryDeleteStartupShortcut" DllEntry="TryDeleteStartupShortcut" Impersonate="yes" Execute="immediate" Return="ignore" BinaryRef="Custom_Actions_Dll"/>
<CustomAction Id="SetPropertyServiceStop" DllEntry="SetPropertyFromConfig" Impersonate="yes" Execute="immediate" Return="ignore" BinaryRef="Custom_Actions_Dll"/>
<CustomAction Id="AddRegSoftwareSASGeneration" DllEntry="AddRegSoftwareSASGeneration" Impersonate="no" Execute="deferred" Return="ignore" BinaryRef="Custom_Actions_Dll"/>
<CustomAction Id="RemoveAmyuniIdd" DllEntry="RemoveAmyuniIdd" Impersonate="no" Execute="deferred" Return="ignore" BinaryRef="Custom_Actions_Dll"/>
Expand Down
3 changes: 1 addition & 2 deletions res/msi/Package/Fragments/ShortcutProperties.wxs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Fragment>

<?include ..\Includes.wxi?>
Expand All @@ -13,7 +13,6 @@
below should be set, then they will update these properties with their values only if set. -->
<Property Id="STARTMENUSHORTCUTS" Value="1" Secure="yes"></Property>
<Property Id="DESKTOPSHORTCUTS" Value="1" Secure="yes"></Property>
<Property Id="STARTUPSHORTCUTS" Value="1" Secure="yes"></Property>
<Property Id="PRINTER" Value="1" Secure="yes"></Property>

<!-- These properties get set from either the command line, bundle or registry value,
Expand Down
5 changes: 1 addition & 4 deletions res/msi/Package/Language/Package.en-us.wxl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
This file contains the declaration of all the localizable strings.
-->
<WixLocalization Culture="en-us" Codepage="1252"
Expand Down Expand Up @@ -29,9 +29,6 @@ This file contains the declaration of all the localizable strings.
<String Id="SC_Client" Value="RustDesk" />
<String Id="SC_Client_Desc" Value="Start RustDesk." />

<String Id="SC_Client_Tray" Value="RustDesk Tray" />
<String Id="SC_Client_Tray_Desc" Value="Start RustDesk tray." />

<!-- Server related strings -->
<String Id="F_Server" Value="Server" />
<String Id="F_Server_Desc" Value="The server part of RustDesk. Provides the MediaLibrary and other services." />
Expand Down
11 changes: 2 additions & 9 deletions src/core_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,10 @@ pub fn core_main() -> Option<Vec<String>> {
}
i += 1;
}
#[cfg(any(target_os = "linux", target_os = "windows"))]
#[cfg(target_os = "linux")]
if args.is_empty() {
#[cfg(target_os = "linux")]
let should_check_start_tray = crate::check_process("--server", false);
// We can use `crate::check_process("--server", false)` on Windows.
// Because `--server` process is the System user's process. We can't get the arguments in `check_process()`.
// We can assume that self service running means the server is also running on Windows.
#[cfg(target_os = "windows")]
let should_check_start_tray = crate::platform::is_self_service_running()
&& crate::platform::is_cur_exe_the_installed();
if should_check_start_tray && !crate::check_process("--tray", true) {
#[cfg(target_os = "linux")]
hbb_common::allow_err!(crate::platform::check_autostart_config());
hbb_common::allow_err!(crate::run_me(vec!["--tray"]));
}
Expand Down Expand Up @@ -375,6 +367,7 @@ pub fn core_main() -> Option<Vec<String>> {
return None;
}
} else if args[0] == "--tray" {
#[cfg(not(target_os = "windows"))]
if !crate::check_process("--tray", true) {
crate::tray::start_tray();
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ mod port_forward;
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub mod plugin;

#[cfg(not(any(target_os = "android", target_os = "ios")))]
#[cfg(not(any(target_os = "android", target_os = "ios", target_os = "windows")))]
mod tray;

#[cfg(not(any(target_os = "android", target_os = "ios")))]
Expand Down
Loading
Loading