I am trying to retrieve an environment variable during installation using RegQueryStringValue,
I am using the following code
[Setup]
DefaultGroupName="{code:GetPath}"
[Code]
function GetPath(Value: String): String;
var
OrigPath: string;
begin
if RegQueryStringValue(HKLM, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'GCC', OrigPath) then
Result := OrigPath;
end;
But the installer gives me an error during installation,
Can someone tell me why or what I can use instead?
In the case of this question, you're trying to use DefaultGroupName
instead of DefaultDirName
which is causing the errors.