Hello all,
I wrote a couple procedures to go through the registry to search for a keyword but its failing midway through saying "Requested registry access is not allowed". I am running as a user with admin privileges and opened the registry as read/write, so what am i missing here?
Thanks in advance
-0
I wrote a couple procedures to go through the registry to search for a keyword but its failing midway through saying "Requested registry access is not allowed". I am running as a user with admin privileges and opened the registry as read/write, so what am i missing here?
Code:
Private Sub GetSubKeys(ByVal SubKey As RegistryKey)
Dim SearchWord As String
SearchWord = "SYMANTEC"
For Each innerKey As String In SubKey.GetSubKeyNames
Dim local As RegistryKey = Registry.LocalMachine
' == line below is where it breaks ==
local = SubKey.OpenSubKey(innerKey, True)
If InStr(local.ToString.ToUpper, SearchWord) Then
sw.Write(local.ToString + Chr(13) + Chr(10))
Exit For
End If
GetSubKeys(local)
Next
End Sub
Private Sub btnGetKeysDemo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetKeysDemo.Click
Dim WhichRegKey As RegistryKey = Registry.LocalMachine
WhichRegKey = WhichRegKey.OpenSubKey("software", True)
GetSubKeys(WhichRegKey)
MsgBox("done")
End Sub
Thanks in advance
-0