Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inno Setup: Is there any way to set a registry key value when uninstalling?

Tags:

inno-setup

I know how to have Inno Setup create/manipulate registry keys and/or values on install and I know that you can delete a value, a key, etc when uninstalling. But is there any way to have Inno Setup actually change the value of a key when the uninstall process is done?

The setup I'm creating changes the value of a dword key that another application uses to a value to 1, indicating it's installed, and when this application is removed I need the value to be restored to 0, indicating it's removal. Is this possible, without deleting the actual key/value?

like image 216
jmwhitman Avatar asked Oct 29 '12 18:10

jmwhitman


1 Answers

You can use specific RegWrite function (for DWord, Binary, StringValue, etc) in procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); with usPostUninstall or usDone

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usPostUninstall then
    RegWriteStringValue(HKEY_CURRENT_USER, 'Software\My Company\My Program',
      'UserName', ExpandConstant('{sysuserinfoname}'));
end;
like image 189
RobeN Avatar answered Oct 03 '22 13:10

RobeN