Inno Setup RegKeyExists在64位系统上 [英] Inno Setup RegKeyExists on 64 bit systems

查看:293
本文介绍了Inno Setup RegKeyExists在64位系统上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Inno Setup创建了一个安装程序,并想使用Pascal Script查询注册表

I created a setup with Inno Setup and wanted to query the registry using Pascal Script

 if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Classes\\Installer\UpgradeCodes\342603A924F08FA4B95B5C283FC13D13') then

我的设置是32位的(就像我要安装的软件一样),但是在64位系统上,查询被重定向到HKCR\Wow6432Node\\Installer\UpgradeCodes

My setup is 32bit (as is my Software I want to install), but on 64bit systems, the query is redirected to HKCR\Wow6432Node\\Installer\UpgradeCodes

当然,即使找到了密钥也没有找到.即使我的设置仍然为32位,如何检测密钥?

Of course, the key is not found, even though it is there. How can I detect the key even though my setup remains 32bit?

推荐答案

我知道了.您可以在脚本中创建如下帮助函数:

I figured it out. You can make a helper function like this in your script:

function GetHKLM: Integer;
begin
  if IsWin64 then
    Result := HKLM64
  else
    Result := HKLM32;
end;

然后您像使用它一样:

RegQueryStringValue(
  GetHKLM, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'XYZ', Variable);

这篇关于Inno Setup RegKeyExists在64位系统上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆