帮助读取远程注册表值 [英] help reading a remote registry value

查看:119
本文介绍了帮助读取远程注册表值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我一直用于从具有64位操作系统的Windows 7席位获取远程注册表信息的代码.我的问题是扩大我们的公司,我们刚刚得到的小组有Windows XP席位,这很好,他们将得到升级,但与此同时,有netframework 3.5,因此我可以声明注册表视图,我需要它们能够读取Windows 7 64位注册表.如果有人可以帮助我改进我的代码,使其在操作系统和/或体系结构(x86或x64)中更通用,那就太好了.

Below is the code i have been using to get remote registry information from windows 7 seats that have a 64 bit os. My issue is were expanding our company and a group that we just got has windows xp seats which is fine they will get upgraded but in the mean time the have netframework 3.5 and with that i can declare the registry view and i need them to beable to read a windows 7 64 bit registry. If someone can help me improve my code to make it more universal to use from in operating system and or architecture(x86 or x64) that would be great.

Dim value
Dim localKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, strComputer, RegistryView.Registry64)
localKey = localKey.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI")
Dim value64 = localKey.GetValue("LastLoggedOnUser")

Dim localKey32 = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, strComputer, RegistryView.Registry32)
localKey32 = localKey32.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI")
Dim value32 = localKey32.GetValue("LastLoggedOnUser")

If value64 = Nothing Then
    value = value32
Else
    value = value64
End If

MsgBox(value.ToString)

推荐答案

在60秒钟的搜索中找到了从32位进程中读取64位注册表":

http://www.rhyous.com/2011/01/24/how-read-the-64-bit-registry-from-a-32-bit-application-or-vice-versa/ [ ^ ]

...包含示例.
Found in 60 seconds Googling for "read 64-bit registry from 32-bit process":

http://www.rhyous.com/2011/01/24/how-read-the-64-bit-registry-from-a-32-bit-application-or-vice-versa/[^]

...complete with examples.


这篇关于帮助读取远程注册表值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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