I need to check a value within the registry. The application (Cisco VPN) is a 32bit app so uses Wow6432Node when installed on 64bit operating systems.
What would be the best method of selecting which string to use? Checking the OS for x64, attempting to read one and then the other if the first fails? Or is there a better method?
Dim keyName64 As String = "HKEY_LOCAL_MACHINE\Software\Wow6432Node\Cisco Systems\VPN Client"
Dim keyName32 As String = "HKEY_LOCAL_MACHINE\Software\Cisco Systems\VPN Client"
Using .net 4.0 framework?:
Dim registryKey As RegistryKey
If Environment.Is64BitOperatingSystem = True Then
registryKey = registryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64)
Else
registryKey = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry32)
End If