Hello David,
Thank you for the explanation on this.
One thing worth mentioning here is the fact that only the deferred (and also commit) actions are rolled back. The rollback
is done automatically by Windows Installer. For instance, if you press the "Cancel" button during the immediate stages of the installation process, the following dialog will be shown:

- ImmediateCancel.PNG (72.3 KiB) Viewed 8168 times
This is done because the Immediate actions (both Standard and Custom) should not alter(modify) the system.
The other case is when the installation process is interrupted during the deferred stage. When this happens, the standard actions are rolled back automatically. However, if you have a custom action that does modify the system, you will need to create another custom action that will undo these changes and schedule it before the deferred action in the installation sequence as it follows:

- Schedule.PNG (14.68 KiB) Viewed 8168 times
Where the
"Deferred" custom action is your custom action that has its
"Execution Time" of
"When the system is being modified (deferred)" and the
"Rollback_action" has its
"Execution Time" of
"During installation rollback".
Attached you can find a project which I have created for you reference.
It only contains two custom actions, one that creates a directory called "Test" on the drive "C:\", pops a message box that lets the user know that the directory was created (I've added this message box mainly so you can see that the modifications were made, i.e. the folder was created) and then forces an exit code of "3" (which means failure). After that happens, the rollback action is triggered, which removes the earlier created folder.
Hope this helps.
All the best,
Catalin
FOLLOW US
Get the latest news in Application Packaging