You have to make a custom function for a {code:}
scripted constant, e.g. this way:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; ValueName: "APP_HOME"; ValueData: {code:GetRegistryData}; Flags: preservestringtype
[Code]
function GetRegistryData(Value: string): string;
begin
Result := ExpandConstant('{app}');
StringChangeEx(Result, '\', '/', True);
end;