diff --git a/src/platform/windows.rs b/src/platform/windows.rs index b009dfb20..6d50b8633 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -962,6 +962,9 @@ pub fn update_me() -> ResultType<()> { fn get_after_install(exe: &str) -> String { let app_name = crate::get_app_name(); let ext = app_name.to_lowercase(); + // reg delete HKEY_CURRENT_USER\Software\Classes for + // https://github.com/rustdesk/rustdesk/commit/f4bdfb6936ae4804fc8ab1cf560db192622ad01a + // and https://github.com/leanflutter/uni_links_desktop/blob/1b72b0226cec9943ca8a84e244c149773f384e46/lib/src/protocol_registrar_impl_windows.dart#L30 format!(" chcp 65001 reg add HKEY_CLASSES_ROOT\\.{ext} /f @@ -971,6 +974,13 @@ fn get_after_install(exe: &str) -> String { reg add HKEY_CLASSES_ROOT\\.{ext}\\shell\\open /f reg add HKEY_CLASSES_ROOT\\.{ext}\\shell\\open\\command /f reg add HKEY_CLASSES_ROOT\\.{ext}\\shell\\open\\command /f /ve /t REG_SZ /d \"\\\"{exe}\\\" --play \\\"%%1\\\"\" + reg delete HKEY_CURRENT_USER\Software\Classes\\{exe} /f + reg add HKEY_CLASSES_ROOT\\{ext} /f + reg add HKEY_CLASSES_ROOT\\{ext} /f /v \"URL Protocol\" /t REG_SZ /d \"\" + reg add HKEY_CLASSES_ROOT\\{ext}\\shell /f + reg add HKEY_CLASSES_ROOT\\{ext}\\shell\\open /f + reg add HKEY_CLASSES_ROOT\\{ext}\\shell\\open\\command /f + reg add HKEY_CLASSES_ROOT\\{ext}\\shell\\open\\command /f /ve /t REG_SZ /d \"\\\"{exe}\\\" \\\"%%1\\\"\" sc create {app_name} binpath= \"\\\"{exe}\\\" --service\" start= auto DisplayName= \"{app_name} Service\" netsh advfirewall firewall add rule name=\"{app_name} Service\" dir=in action=allow program=\"{exe}\" enable=yes sc start {app_name}