如何让我的32位的Perl读取64位Windows注册表? [英] How do I make the 32-bit Perl read the 64-bit Windows registry?

查看:307
本文介绍了如何让我的32位的Perl读取64位Windows注册表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个32位的perl的安装程序。使用这个我需要能够安装和卸载32位和64位应用程序。

I have a 32-bit perl installer. Using this I need to be able to install and uninstall both 32- and 64-bit applications.

安装32位和64位是好的。卸载32位的也行。

Installing 32- and 64-bit is fine. Uninstalling 32-bit is also ok.

不过,我有一个问题,同时卸载64位应用程序。

However, I have a problem while uninstalling 64-bit applications.

应用程序才知道在添加删除看到在控制面板程序的应用程序的名称。比如,它可能是的Winzip 14.0,这是的Winzip的显示名称。

The application just knows the name of the application as seen in Add Remove programs in control panel. For instance it could be "Winzip 14.0" which is the display name for Winzip.

我用下面的方法来卸载:我遍历到 HKLM /软件/微软/视窗/ CURRENTVERSION /卸载并解析键present那里,如果看到WinZip是匹配的。如果是这样,我从那里得到卸载字符串。

I use the following approach for uninstallation : I traverse to HKLM/Software/Microsoft/Windows/CurrentVersion/Uninstall and parse the keys present there to see if Winzip is matching. If so i get the uninstall string from there.

    my $register = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
    $HKEY_LOCAL_MACHINE->Open($register,$hKey)|| die $!;
    #Then parse all the nodes and fetch the uninstall string

如果应用程序是64位安装,然后卸载信息将驻留在 HKLM /软件/微软/视窗/ CURRENTVERSION /卸载

If the application is a 64-bit installation, then the uninstallation information will reside in HKLM/Software/Microsoft/Windows/CurrentVersion/Uninstall.

然而,上面给出的perl安装code试图从读取 HKLM /软件/ WOW6432Node /微软/视窗/ CURRENTVERSION /卸载
和它不找到安装有

However the above given perl installer code is trying to read from HKLM/Software/WOW6432Node/Microsoft/Windows/CurrentVersion/Uninstall
and it does not find the installation there.

那么,如何让我的Perl的code运行在一个32_bit进程读取64位配置单元中的注册表值?我知道了 RegOpenKey() API,它采用 KEY_WOW64_64KEY 参数。但由于它是Windows API,我不知道这是否会有所帮助。即使这样,还有什么其他的选择吗?

So how do I make the Perl code running in a 32_bit process to read the registry value found in 64-bit hive? I am aware of the RegOpenKey() API that takes KEY_WOW64_64KEY parameter. But since it is a Windows API, I dont know if that will help. Even then, is there any other alternative?

推荐答案

是的,你必须使用KEY_WOW64_64KEY,没有其他解决方法对于32位进程。直接从Perl中调用Win32 API的出现可能,从此网页

Yes, you have to use KEY_WOW64_64KEY, there is no other workaround for a 32-bit process. Calling the Win32 API directly from Perl appears possible, judging from this web page.

这篇关于如何让我的32位的Perl读取64位Windows注册表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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