将值写入 Inno Setup 中存储在数组中的所有注册表项

Writing values to all registry keys stored in an array in Inno Setup

我看过这个 https://jrsoftware.org/ishelp/index.php?topic=registrysection 但这不是动态的。

我阅读了在注册表中找到的值,它们可能是多种事物的组合。并非所有客户端都拥有所有组合,因此我需要根据他们系统中的内容创建注册表子项。我可以毫无问题地在子项下创建值:

for i := 0 to GetArrayLength(myArrayOfStrings) - 1 do
begin
  if myArrayOfStrings[i] = 'client has this item' then begin
    RegWriteStringValue(HKLM64 , 'SOFTWARE\SomeSubkey',
      'New Value', 'im in the registry');
  end;
end;

我想做的是根据变量 myArrayOfStrings.

中的值在注册表中创建一个新的子项
if not myArrayOfStrings[i] = 'client has this item' then begin
  //Create new subkey called the value in myArrayOfStrings[i]
  //then add values to the newly created subkey
end;

我该怎么做?谢谢

只需在关键路径中使用myArrayOfStrings[I]的值:

var
  Key: string;
  I: Integer;
begin
  // ...
  for I := 0 to GetArrayLength(myArrayOfStrings) - 1 do
  begin
    Key := 'SOFTWARE\SomeSubkey\' + myArrayOfStrings[I];
    RegWriteStringValue(HKLM64, Key, 'New Value 1', 'value 1');
    RegWriteStringValue(HKLM64, Key, 'New Value 2', 'value 2');
    // ...
  end;
end;