title: How to automatically determine the path of previous installation using Inno Setup
body: <p>I'm trying to create a inno setup installer that patches a previous installation but i can't manage to force my installer determine the path where my previous installation is.
  I tried using the <code>DefaultDirName={reg:HKxx\SubkeyName,ValueName|DefaultValue}</code> feature from inno but i'm not sure what to put in the DefaultValue's place.
  How can i do that?</p>
  
  <p>Edit:
  i tried also this part:</p>
  
  <pre><code>[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;
  </code></pre>
  
  <p>But when i run the installer the path is empty.</p>