An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
Rust androidanydeskdartflatpakflutterflutter-appsioslinuxmacosp2prdpremote-controlremote-desktoprustrust-langteamviewervncwaylandwindows
Fix. Msi, reg add SoftwareSASGeneration (#7708)
fufesou516608340616
diff --git a/res/msi/CustomActions/CustomActions.cpp b/res/msi/CustomActions/CustomActions.cppindex 7f7f24eee..37a728a4b 100644--- a/res/msi/CustomActions/CustomActions.cpp+++ b/res/msi/CustomActions/CustomActions.cpp@@ -287,7 +287,7 @@ UINT __stdcall AddFirewallRules(LPWSTR pwzData = NULL;size_t szNameLen = 0;- hr = WcaInitialize(hInstall, "AddFirewallExceptions");+ hr = WcaInitialize(hInstall, "AddFirewallRules");ExitOnFailure(hr, "Failed to initialize");hr = WcaGetProperty(L"CustomActionData", &pwzData);@@ -541,3 +541,53 @@ LExit:er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;return WcaFinalize(er);}++UINT __stdcall AddRegSoftwareSASGeneration(__in MSIHANDLE hInstall)+{+ HRESULT hr = S_OK;+ DWORD er = ERROR_SUCCESS;++ LSTATUS result = 0;+ HKEY hKey;+ LPCWSTR subKey = L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System";+ LPCWSTR valueName = L"SoftwareSASGeneration";+ DWORD valueType = REG_DWORD;+ DWORD valueData = 1;+ DWORD valueDataSize = sizeof(DWORD);++ HINSTANCE hi = 0;++ hr = WcaInitialize(hInstall, "AddRegSoftwareSASGeneration");+ ExitOnFailure(hr, "Failed to initialize");++ hi = ShellExecuteW(NULL, L"open", L"reg", L" add HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System /f /v SoftwareSASGeneration /t REG_DWORD /d 1", NULL, SW_HIDE);+ // https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutew+ if ((int)hi <= 32) {+ WcaLog(LOGMSG_STANDARD, "Failed to add registry name \"%ls\", %d, %d", valueName, (int)hi, GetLastError());+ }+ else {+ WcaLog(LOGMSG_STANDARD, "Registry name \"%ls\" is added", valueName);+ }++ // Why RegSetValueExW always return 998?+ //+ result = RegCreateKeyExW(HKEY_LOCAL_MACHINE, subKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL);+ if (result != ERROR_SUCCESS) {+ WcaLog(LOGMSG_STANDARD, "Failed to create or open registry key: %d", result);+ goto LExit;+ }++ result = RegSetValueExW(hKey, valueName, 0, valueType, reinterpret_cast<const BYTE*>(valueData), valueDataSize);+ if (result != ERROR_SUCCESS) {+ WcaLog(LOGMSG_STANDARD, "Failed to set registry value: %d", result);+ RegCloseKey(hKey);+ goto LExit;+ }++ WcaLog(LOGMSG_STANDARD, "Registry value has been successfully set.");+ RegCloseKey(hKey);++LExit:+ er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;+ return WcaFinalize(er);+}diff --git a/res/msi/CustomActions/CustomActions.def b/res/msi/CustomActions/CustomActions.defindex a089c583e..a73ecda26 100644--- a/res/msi/CustomActions/CustomActions.def+++ b/res/msi/CustomActions/CustomActions.def@@ -10,3 +10,4 @@ EXPORTSCreateStartServiceTryDeleteStartupShortcutSetPropertyFromConfig+ AddRegSoftwareSASGenerationdiff --git a/res/msi/Package/Components/RustDesk.wxs b/res/msi/Package/Components/RustDesk.wxsindex a44d8bb73..df9463fe8 100644--- a/res/msi/Package/Components/RustDesk.wxs+++ b/res/msi/Package/Components/RustDesk.wxs@@ -58,6 +58,8 @@<Custom Action="AddFirewallRules" Before="InstallFinalize"/><Custom Action="AddFirewallRules.SetParam" Before="AddFirewallRules" Condition="NOT Installed"/>+ <Custom Action="AddRegSoftwareSASGeneration" Before="InstallFinalize" />+<Custom Action="RemoveInstallFolder" Before="RemoveFiles" Condition="Installed AND NOT UPGRADINGPRODUCTCODE AND REMOVE"/><Custom Action="RemoveInstallFolder.SetParam" Before="RemoveInstallFolder" Condition="Installed AND NOT UPGRADINGPRODUCTCODE AND REMOVE"/><Custom Action="TryStopDeleteService" Before="RemoveInstallFolder.SetParam" />diff --git a/res/msi/Package/Fragments/CustomActions.wxs b/res/msi/Package/Fragments/CustomActions.wxsindex 0454a6731..e064b188e 100644--- a/res/msi/Package/Fragments/CustomActions.wxs+++ b/res/msi/Package/Fragments/CustomActions.wxs@@ -15,5 +15,6 @@<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"/></Fragment></Wix>