Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
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)
Posted 15-Jun-12 6:17am
Comments
ledtech3 at 15-Jun-12 23:39pm
   
From the Code you posted, it Looks Like they are Getting the Exact same Registry key If it is 32 or 64 bit. Are you trying to find out if the system you are trying to connect is 32 or 64 bit ? I have written programs for getting information from the registry that work on both 32 and 64 bit systems, but I have not done remote Registry. Is there something Different about remote than local ?

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Shai Vashdi 319
1 OriginalGriff 280
2 Sergey Alexandrovich Kryukov 250
3 Peter Leow 171
4 Abhinav S 168
0 Sergey Alexandrovich Kryukov 8,944
1 OriginalGriff 5,280
2 Peter Leow 3,985
3 Maciej Los 3,535
4 Abhinav S 3,218


Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 15 Jun 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid