0

我正在使用 InstallShield 2020 R3 SP1,并且我在 Installscript MSI 项目中创建了一个安装程序。

此安装程序已成功添加\设置 64 位 Windows 注册表项位置(即“HKEY_LOCAL_MACHINE\SOFTWARE\SungardePI”)中的注册表项,但无法在 32 位 Windows 注册表位置(即“HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\SungardePI”下添加\设置注册表项"

我的组件设置为 64 位,安装程序默认将注册表项设置为 64 位位置。我还编写了 installscript 代码以在 32 位位置设置注册表项,但它不起作用。

谁能帮助我了解如何通过 installscript 代码在 32 位位置设置注册表项?

下面的当前安装脚本代码 -

注意 - 首先,我调用了 SetRegistrykey() 函数,该函数默认更新 64 位注册表位置中的节点,然后我在 if 语句下添加代码并再次调用 SetRegistrykey() 函数以在 32 下执行相同的更改-位注册表位置,但它不会更新任何注册表节点,而是仅覆盖 64 位位置中的更改。

我还尝试替换REGDB_OPTIONS=REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;REGDB_OPTIONS=REGDB_OPTIONS | REGDB_OPTION_USE_DEFAULT_OPTIONS;但没有成功。

通常,Installshield 安装程序默认更新 32 位 Windows 注册表位置,但在我的情况下,它是在 64 位 Windows 注册表位置更新\设置值,我无法弄清楚原因。

function SetRegistryKeys()

STRING szSrcFile, szTargetFile, szPath, szFileName, szFileNameSave;
STRING szLine;
STRING szKeyName, szName;
NUMBER nResult, nFileHandle, rc;
OBJECT oEncrypt;
STRING szProgID, szKeyData;
begin
WriteLogAsInfo(TRUE, TRUE, "SetRegistryKeys", "Setting Keys in Registry.");

//Write some registry values
RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);

//For ConfigPath key
szKeyName = "Software\\" + @REG_COMPANY_NAME + "\\" + @REG_PRODUCT_NAME + "\\" + @REG_APP_ROOT_KEY + "\\Common";

szName = "CONFIGPATH";
szKeyData = TARGETDIR + "Configuration Files\\";
if(RegDBSetKeyValueEx (szKeyName, szName, REGDB_STRING, szKeyData, -1) <0) then goto Reg_Error;endif;

WriteLogAsInfo(FALSE, TRUE, "SetRegistryKeys", "Setting Keys in Registry.");

return 0;

Reg_Error:
WriteLogAsError(FALSE,"","Error: Unable to write properties to registry.");
MessageBox("Error: Unable to write properties to registry.",SEVERE);
abort;

return -1;

end;

#用于更新 32 位位置中的注册表项的代码。

if(SYSINFO.bIsWow64) then
RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);

REGDB_OPTIONS=REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;
SetAppServerObjectsRegistry();
SetRegistryKeys();

//Set the encryption key in the registry
SetEncryptionCommonKeyRegistry();
endif;
4

0 回答 0