registry - 无法通过 Inno Setup Installer 更改注册表项

标签 registry inno-setup

我想为专为 x64 Windows 10 设计的应用程序编写安装程序。我已在 Inno Setup Script 中定义:

[Setup]
MinVersion=10.0.14393
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
AlwaysRestart=yes

我还希望在安装过程中,在 Windows 注册表中启用长路径。我添加了以下代码:

[Registry]
Root: HKLM64; Subkey: "System\CurrentcontrolSet\Control\FileSystem"; ValueType: dword; ValueName: "LongPathsEnabled"; ValueData: "1"; Flags: createvalueifdoesntexist; Permissions: users-modify
Root: HKLM64; Subkey: "System\ControlSet001\Control\FileSystem"; ValueType: dword; ValueName: "LongPathsEnabled"; ValueData: "1"; Flags: createvalueifdoesntexist; Permissions: users-modify

当我在个人计算机上运行安装程序并重新启动时,注册表项会更改,但当我的同事运行安装程序并重新启动时,注册表项不会更改。该应用程序本身可以在我们的两台计算机上运行。我们都有 x64 Windows 10 系统和管理员权限。该脚本在某些计算机上失败的原因可能是什么?

计算机的日志文件内容,其中条目更改:

2019-10-09 09:44:41.296   Key: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem
2019-10-09 09:44:41.296   Value name: LongPathsEnabled
2019-10-09 09:44:41.296   Setting permissions on key: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem
2019-10-09 09:44:41.296   Starting 64-bit helper process.
2019-10-09 09:44:41.328   Helper process PID: 3248
2019-10-09 09:44:41.343   Creating or opening the key.
2019-10-09 09:44:41.343   Successfully created the key.
2019-10-09 09:44:41.343   -- Registry entry --
2019-10-09 09:44:41.343   Key: HKEY_LOCAL_MACHINE\System\ControlSet001\Control\FileSystem
2019-10-09 09:44:41.343   Value name: LongPathsEnabled
2019-10-09 09:44:41.343   Setting permissions on key: HKEY_LOCAL_MACHINE\System\ControlSet001\Control\FileSystem
2019-10-09 09:44:41.343   Creating or opening the key.
2019-10-09 09:44:41.343   Successfully created the key.

最佳答案

只需删除 createvalueifdoesntexist flag .

这就是导致问题的原因,而您一开始就不希望出现这种情况。

关于registry - 无法通过 Inno Setup Installer 更改注册表项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58291967/

相关文章:

c - 使用 NtCreateKey/NtOpenKey 获取 key 句柄

installation - Inno Setup 默认安装文件夹更改

inno-setup - Inno Setup 检查文件是否存在于选定的目标位置

inno-setup - Inno Setup 在 [代码] 中检测所选语言

inno-setup - Inno Uninstaller 代码签名和名称

inno-setup - Inno Setup Exec 不等待 InstallShield 卸载完成

.net - 同一台机器上的多个应用程序使用的连接字符串存储在哪里?

Python _winreg key 路径不正确

jenkins - 如何使用命令行设置 Jenkins Slave 作为 Windows 服务运行?

php - 如何在 PHP 桌面/GTK 应用程序中访问系统注册表?