title: ExpandConstant functions seems not to work on Windows 7
body: <p>I'm trying to use this function in order to translate {app} variable during run-time. It works good on Windows 2008 (64 bit) but does not work on Windows 7 (64bit).</p>
  
  <p>This is the code I use:</p>
  
  <pre><code>[Registry]
      Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}"; Check: ExpandConstant(NeedsAddPath('{app}'))
  
  
  
  function NeedsAddPath(Param: string): boolean;
  var
    OrigPath: string;
  begin
    if not RegQueryStringValue(HKEY_LOCAL_MACHINE,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', OrigPath)
    then begin
      Result := True;
      exit;
    end;
    // look for the path with leading and trailing semicolon
    // Pos() returns 0 if not found
    Result := Pos(';' + UpperCase(Param) + ';', ';' + UpperCase(OrigPath) + ';') = 0;  
    if Result = True then
       Result := Pos(';' + UpperCase(Param) + '\;', ';' + UpperCase(OrigPath) + ';') = 0; 
  end;
  </code></pre>
  
  <p>Do you know the reason?</p>
  
  <p>THANK YOU!</p>