How to automatically determine the path of a previous installation using Inno Setup

I am trying to create an inno setup installer that fixes a previous installation, but I cannot force the installer to determine the path where my previous installation was. I tried to use the function DefaultDirName={reg:HKxx\SubkeyName,ValueName|DefaultValue} from inno, but I'm not sure what to add to the place of DefaultValue. How can i do this?

Edit: I also tried this part:

 [Setup] DefaultDirName={code:GetPathInstalled} [Code] function GetPathInstalled (Param: String): String; var Country: String; begin RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\JoWooD\Painkiller Resurrection', 'Install', Country); end; 

But when I run the installer, the path is empty.

+4
source share
1 answer

Your code should look like this:

 [Code] function GetPathInstalled (Param: String): String; var Country: String; begin RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\JoWooD\Painkiller Resurrection', 'Install', Country); Result:= Country; end; 

The return value from RegQueryStringValue was not returned as a result of the GetPathInstalled function.

+6
source

Source: https://habr.com/ru/post/1340305/


All Articles