I have a custom action that runs at the time of installation which is an exe written in C#. This exe grants permission to a User to a specific folder, if this task fails there is no use for the installation to continue. I need it to rollback, but only after displaying appropriate error message.
Now what I have tried is the following
- Edited the exe to update an entry in registry to denote if its execution was successful/failure.
- Added a second custom action to read the registry and display an error message. This is an install script.
My need
To rollback the installation on reading a failure entry from registry.
The script that I have written
function CheckRegistry(hMSI)
STRING keyValue;
NUMBER nType, nSize;
begin
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
if (RegDBGetKeyValueEx ("CSVExtraction", "AccessGranted", nType, keyValue,nSize) < 0) then
MessageBox ("RegDBGetKeyValueEx failed.", SEVERE);
abort;
else
if(keyValue != "true") then
MessageBox("Granting access to the Installation Folder failed; Hence exiting installation",SEVERE);
abort;
endif
endif
end;