The InstallFinalize
action is when the installation transaction is committed to the machine. Anything that happens after that point (or before InstallInitialize
) happen outside the transaction. That means they cannot be rolled back.
Instead, you'll need to schedule your custom action sometime after InstallInitialize
and before InstallFinalize
in order for it to error and cause rollback. Additionally, a custom action that modifies machine state should be deferred
. This topic in the MSI SDK is a good place to start and then read topics around it.
If you'd like to see examples of the way to write custom actions, I'd recommend looking at some examples in the WiX toolset in src\ca\wixca\dll
. Lots of different kinds of custom actions doing things in a way I hope is "correct" according to the MSI SDK.