diff --git a/wfassoc/src/highlevel.rs b/wfassoc/src/highlevel.rs index 6589882..6b3834c 100644 --- a/wfassoc/src/highlevel.rs +++ b/wfassoc/src/highlevel.rs @@ -485,7 +485,31 @@ impl Program { /// No matter whether there is registration of this application, /// this function always make sure that there is no registration after running this function. pub fn unregister(&mut self, scope: Scope) -> Result<(), ProgramError> { - todo!() + // Delete App Paths subkey + debug_println!("Deleting App Paths subkey..."); + self.app_paths_key.delete(scope)?; + + // Delete Applications subkey + debug_println!("Deleting Applications subkey..."); + self.applications_key.delete(scope)?; + + // According to Microsoft document, when uninstalling application, + // it is enough that only delete ProgId keys. + // Programmer doesn't need to edit something in Ext keys. + // So we delete ProgId subkeys one by one in there. + debug_println!("Adding ProgId subkey..."); + for program_progid_key in &mut self.ext_keys { + let progid_key = &mut program_progid_key.progid_key; + + // Delete ProgId subkey + debug_println!("Deleting ProgId \"{0}\" subkey...", progid_key.inner().to_string()); + progid_key.delete(scope)?; + } + + // Everything is okey. + // Notify changes and return + win32::utilities::notify_assoc_changed(); + Ok(()) } /// Check whether this application has been registered in given view.