|Windows Installer Basics: Resource Life Cycle|
Files, registry or similar items have a life cycle and its important to be aware of your requirements.
For installation you need to consider whether the new file, registry value or other resource should (partial list):
For the above consider both installation of older and newer versions of your package.
You also need to consider what you want to have happen during any repair:
For uninstallation you need to consider whether the new file or registry value should:
Note that the restoration of the "previous" value can be done (you'd need to have "stored" it) but the previous value you stored may no longer be the correct one to return to (unless someone installed then uninstalled soon after (without any other installations/changes in between).