InstallShield LE:RegOpenKeyEx 在自定义操作中失败
安装后我需要执行一些额外的配置,因此我创建了一个小型 PostInstall.exe 控制台应用程序来完成这项工作。我需要从注册表获取 winamp 安装路径。
如果我单独运行这个 PostInstall.exe 则工作正常。但是,如果我在自定义操作“注册产品后”中使用它,我会收到从函数返回的错误“系统找不到指定的文件”,
DWORD kres = RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Winamp",0, KEY_QUERY_VALUE, &hKey);
我 100% 确定该密钥存在 - 我在启动安装之前验证它。另外,当我在安装后手动运行 PostInstall.exe 时,它会成功。
我尝试设置“延迟执行”和“系统上下文中的延迟执行”,但是 没有帮助。
为什么 RegOpenKeyEx 在我的自定义操作中失败?
I need to execute some additional configuration after installation so I have created a smoll PostInstall.exe console application which should do the work. I need to get winamp install path from the registry.
This PostInstall.exe works fine if I run it alone. But if I use it in custom action "After Register Product", I get an error "The system cannot find the file specified" returned from the function
DWORD kres = RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Winamp",0, KEY_QUERY_VALUE, &hKey);
I am 100% sure that the key exists - I verify it before I launch installation. Also when I run PostInstall.exe manually after installation, it succeeds.
I have tried to set "Deferred Execution" and "Deferred execution in system context" but that
does not help.
Why does RegOpenKeyEx fail in my custom action?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保安装没有在另一个用户帐户下提升。这样,您的自定义操作过程将不会为具有不同 HKEY_CURRENT_USER 配置单元的其他用户执行。
另外,尝试让当前用户进入您的自定义代码并确定它是否是您期望的用户。
Make sure that the installation is not being elevated under another user account. This way your custom action process will not be executed for a different user which has a different HKEY_CURRENT_USER hive.
Also, try getting the current user inside your custom code and determine if it's the one you expect.