dcsimg
Results 1 to 3 of 3

Thread: Help searching Windows' registry keys, display results with enough info for proper ID

  1. #1

    Thread Starter
    Hyperactive Member Peter Porter's Avatar
    Join Date
    Jul 2013
    Posts
    258

    Help searching Windows' registry keys, display results with enough info for proper ID

    I made a mistake of installing the latest version of Avira Free antivirus. I took a break from my PC once I got the installation process started for Avira, but when I returned an half hour later it wasn't done. It was frozen with an animated buffer wheel stating above it "Preparing Installation". Canceling wouldn't work, so I stopped the process via Task Manager where I noticed it left cripple processes of the antivirus behind. I had to go into safe mode to delete the executables and junk files, and now I have around a ton of registry keys left behind (I'm guessing because I've been manually deleting these keys forever, but there are still a ton left over! I keep finding them!) Avira Registry Cleaner can't fix this!

    So I decided to create my own registry cleaner, where I find the Avira keys, list them in a listview, ensure they're owned by Avira (manually removing keys from the listview that are not), then select the junk to be deleted in one shot.

    I found the below code just for searching the registry, but I can't get it to work:

    Function for searching:
    Code:
    Imports Microsoft.Win32
    Imports System.Runtime.CompilerServices
    
    Public Module Extensions
        <Extension()> _
        Public Function ContainsValue(ByVal RegKey As RegistryKey, ByVal Value As Object) As Boolean
            For Each ValueName As String In RegKey.GetValueNames()
                If RegKey.GetValue(ValueName) = Value Then
                    Return True
                End If
            Next
    
            Return False
        End Function
    End Module

    Usage:
    Code:
    Using MyKey As RegistryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE").OpenSubKey("HomeApp")
        If MyKey.ContainsValue("KG65326") = True Then
            'Do your stuff here.
        End If
    End Using
    Could someone please help me get all of the above to work in an app? Also how to show enough info from the results in a listview so I can verify the keys.

    Thanks!
    Last edited by Peter Porter; Oct 9th, 2019 at 04:18 AM.

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    5,575

    Re: Help searching Windows' registry keys, display results with enough info for prope

    Noting that it is not a good idea going through the registry and especially here as you need to go in every subkey of subkey of subkey etc.
    Here is an examle on finding a value on CyberLink software


    Code:
      Using MyKey As RegistryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE").OpenSubKey("CyberLink")
                If MyKey.ContainsValue("APBurnImageProgress") = True Then
                    'Do your stuff here.
                End If
            End Using
    Code:
    Imports Microsoft.Win32
    Imports System.Runtime.CompilerServices
    
    Public Module Extensions
        <Extension()> _
        Public Function ContainsValue(ByVal RegKey As RegistryKey, ByVal Value As Object) As Boolean
    
    
    
            For Each ValueName As String In RegKey.GetSubKeyNames
                For Each strvlalue In RegKey.OpenSubKey(ValueName).GetValueNames()
                    If strvlalue = "APBurnImageProgress" Then
                        'do stuff                
                    End If
                Next
            Next
            Return False
        End Function
    End Module
    Slow as hell.

  3. #3

    Thread Starter
    Hyperactive Member Peter Porter's Avatar
    Join Date
    Jul 2013
    Posts
    258

    Re: Help searching Windows' registry keys, display results with enough info for prope

    I'm gettin' old!

    I forgot Windows' System Restore in Safe Mode can fix this problem. All traces of Avira has been removed.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width