在VB.NET中从32位应用程序中读取64位注册表 [英] Read 64bit registry from 32bit app, in VB.NET

查看:276
本文介绍了在VB.NET中从32位应用程序中读取64位注册表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

海派。



我有一个严重的问题。我正在做一个项目,我需要明天完成它。



问题是我需要获得一个注册表值,如下所示:



(32位)HKEY_LOCAL_MACHINE\SOFTWARE \Wow6432Node\TeamSpeak 3客户



(64位)HKEY_LOCAL_MACHINE\SOFTWARE \TeamSpeak 3客户




我阅读了大量的论坛主题,博客,教程,我不能找到答案。我的想法是,我需要从注册表中获取TeamSpeak3的安装路径,并将其存储在SOFTWARE \ Wow6432Node \TeamSpeak 3 Client中的32位应用程序,但是当我尝试从SOFTWARE \TeamSpeak 3获取64位应用程序路径时客户端我获得与32位应用程序相同的路径。



我知道我可以通过定位64位CPU来绕过这一点。但我需要使用我的32位应用程序从HKEY_LOCAL_MACHINE \ SOFTWARE \ TeamSpeak 3客户端获取64位应用程序路径。



我该怎么做, IN VB.NET



请帮忙!谢谢...

解决方案

64位Windows使用注册表重定向,可以在打开访问密钥时覆盖。

http://msdn.microsoft.com/en-us/library/ windows / desktop / aa384129(v = vs.85).aspx [ ^ ]

不幸的是你.NET隐藏了这个你必须回到WIN32 API ...


我发了!!! :)



  Dim  TS__x64 作为 Microsoft.Win32.RegistryKey = Microsoft.Win32.RegistryKey.OpenBaseKey _ 
(Microsoft.Win32.RegistryHive.LocalMachine,Microsoft.Win32.RegistryView.Registry64)
Dim CALE_TS__x64 As String = TS__x64.OpenSubKey( SOFTWARE \TeamSpeak 3 Client)。GetValue( Nothing

Dim TS__x32 As Microsoft.Win32.RegistryKey = Microsoft。 Win32.RegistryKey.OpenBaseKey _
(Microsoft.Win32.RegistryHive.LocalMachine,Microsoft.Win32.RegistryView.Registry32)
Dim CALE_TS__x32 作为 字符串 = TS__x32.OpenSubKey( SOFTWARE \Wow6432Node\TeamSpeak 3 Client)。GetValue( Nothing


TextBox1 .Text = CALE_TS__x64
TextBox2.Text = CALE_TS__x32


Hy guys.

I have a serious problem. I'm working on a project and i need to finish it tomorrow.

The problem is that i need to get a registry value, like this:

(32 bit) HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\TeamSpeak 3 Client

(64 bit) HKEY_LOCAL_MACHINE\SOFTWARE\TeamSpeak 3 Client


I read tons of forum topics, blogs, tutorials, and i can't find the answer. The idea is that i need to get the install path for TeamSpeak3 from registry, and for the 32bit app its stored in SOFTWARE\Wow6432Node\TeamSpeak 3 Client, but when i try to get the 64bit app path from SOFTWARE\TeamSpeak 3 Client i get the same path as the 32bit app.

I know i can bypass this by targeting 64bit CPUs. But I NEED to get the 64bit app path from HKEY_LOCAL_MACHINE\SOFTWARE\TeamSpeak 3 Client with my 32bit app.

How can i do that, IN VB.NET?

Please help! Thanks...

解决方案

64 bit Windows uses registry redirection, that can be override while opening the key for access.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa384129(v=vs.85).aspx[^]
Unfortunately for you .NET hides this so you have to go back to WIN32 API...


I DID IT!!! :)

Dim TS__x64 As Microsoft.Win32.RegistryKey = Microsoft.Win32.RegistryKey.OpenBaseKey _
                                        (Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry64)
Dim CALE_TS__x64 As String = TS__x64.OpenSubKey("SOFTWARE\TeamSpeak 3 Client").GetValue(Nothing)

Dim TS__x32 As Microsoft.Win32.RegistryKey = Microsoft.Win32.RegistryKey.OpenBaseKey _
                                (Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry32)
Dim CALE_TS__x32 As String = TS__x32.OpenSubKey("SOFTWARE\Wow6432Node\TeamSpeak 3 Client").GetValue(Nothing)


TextBox1.Text = CALE_TS__x64
TextBox2.Text = CALE_TS__x32


这篇关于在VB.NET中从32位应用程序中读取64位注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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