First, if your post really is just saying "I know how to do it but I'm
not sharing", which is how I'm reading it, then what are you doing
here? If that's your attitude about learing to write software and
helping others then you don't belong here.
Second, you can't really sell code that is so generic and easily
reproducible that it's a basic concept anyone working with the
registry in .net can do (see below).
Good bye,
Sam
Imports Microsoft.Win32
Public Class RegSearch
Public Shared Sub Search(ByVal text As String)
For Each key As RegistryKey In New RegistryKey() { _
Registry.ClassesRoot, _
Registry.CurrentConfig, _
Registry.CurrentUser, _
Registry.LocalMachine, _
Registry.Users _
}
SearchKey(text, key)
Next
Console.WriteLine("Done")
End Sub
Private Shared Sub SearchKey(ByVal text As String, ByVal key As
RegistryKey)
If key Is Nothing Then
Return
End If
If key.Name.IndexOf(text) > -1 Then
Console.WriteLine("Found in " + key.ToString())
End If
For Each valueName As String In key.GetValueNames()
If valueName.IndexOf(text) > -1 Then
Console.WriteLine("Found in " + key.ToString() + ", " +
valueName)
End If
Dim value As Object = key.GetValue(valueName)
If Not value Is Nothing AndAlso _
value.ToString().IndexOf(text) > -1 Then
Console.WriteLine("Found in " + key.ToString() + ", " +
valueName + ": " + value.ToString())
End If
Next
For Each subKeyName As String In key.GetSubKeyNames()
Try
SearchKey(text, key.OpenSubKey(subKeyName))
Catch ex As Security.SecurityException
' can't search this one, just skip it
End Try
Next
End Sub
End Class