How does my delete process handle the restoration of registry entries correctly?

Sometimes it is necessary to change the Windows registry settings during application installation. I was recently disappointed with apps that do not restore these settings when I uninstall them. As I thought about it more, it occurs to me that there cannot be a good (or valid) way to save and restore registry settings. Take the following sequence of events, for example:

  • Application A owns the Open action for the file extension .abc

    .
  • Appendix B is installed and captures the Open action for the file extension .abc

    .
  • Appendix A has been removed.
  • Appendix B has been removed.

In step 3, if application A is smart enough, it will find that it no longer owns the Open action and therefore will skip any attempt to restore it.

In step 4, is there any valid action that application B can take?

  • Executing nothing leaves an Open action pointing to the remote executable.
  • Restoring the pointer to application A is also a deleted executable file.
  • Asking the user is not allowed, as this is usually considered outside the technical skills of the typical user. If you disagree, replace with another registry change in steps 1 and 2 that you think will not be available to the user.
  • Deleting an action will also require the user to make an uninformed decision later, or make some functions unavailable to the user.

This is just one of the many bad situations I can imagine when there is no obvious "one" right solution. My next project will require registry changes during installation and I would like to know the best or recommended practice to uninstall. Unfortunately, I've been burned out by poor deletion practices in modern commercial packages, so I know there is no consensus on best practice here, and it's either a lot of work to get it right, or a design flaw in the registry, or both. other.

This is a very real programming problem for me. I'm tagging it Subjectively because I'm not sure if any question can be answered. Please don't hesitate.

0


source to share


1 answer


If you are writing Application B, I would say don't drag the Open action for the .abc extension in the first place. During installation, ask the user if they want to associate the .abc files with your program. Check if your program is connected during uninstallation. If so, disable the file extension, otherwise leave it alone.



If there is another application that wants to still be associated with the .abc files after removing B, it's tough to force the user to fix it. In the end, he agreed to associate the .abc files with your application and then uninstalled your application.

+1


source







All Articles