Get environment variable using RegQueryStringValue in Inno Setup

I am trying to get 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?

0
source share
1 answer

In this question, you are trying to use DefaultGroupNameinstead DefaultDirName, which causes errors.

+3
source

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


All Articles