Jump to content

Recommended Posts

Posted

I have a script that is reading through several locations in the reg using RegEnumKey. On the second For loop (nested, For in For), I'm getting an error. The Value of $HKCRProductsName = RegEnumKey($HKCRProducts, $x) is "Insufficient system resources exist to complete the requested service".

Both $HKCRProducts and $x are valid values (or so they looked with a MsgBox). Any ideas?

Full Code below:

#include <String.au3>
#include <array.au3>


_UninstallSearch("Office 2007 Help")
;_UninstallSearch("help")


Func _UninstallSearch($unSearch)
    $HKLMUninstall = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
    $HKCRProducts = "HKEY_CLASSES_ROOT\Installer\Products"
    
    For $i= 1 to 1000
        $HKLMUuninstallName = RegEnumKey($HKLMUninstall, $i)
        ;If @error <> 0 then ExitLoop
        
        $name = RegRead($HKLMUninstall & "\" & $HKLMUuninstallName, "DisplayName")
        ;msgbox(0, "name", $name)
        
        if StringInStr($name, $unSearch) Then
            $UninstallString = RegRead($HKLMUninstall & "\" & $HKLMUuninstallName, "UninstallString")
            $ModifyPath = RegRead($HKLMUninstall & "\" & $HKLMUuninstallName, "ModifyPath")
            
            if $uninstallString = "" Then
                $uninstallString = $ModifyPath
            Else
                $uninstallString = $ModifyPath
            EndIf
            
            if $unSearch <> "" and StringInStr($uninstallString, "msiexec") > 0 Then
                $guidRead = _StringBetween($uninstallString, "{", "}")
                $guid = $guidRead[0]
                $guidSplit = StringSplit($guid, "-")

                $g1 = _StringReverse($guidSplit[1])
                $g2 = _StringReverse($guidSplit[2])
                $g3 = _StringReverse($guidSplit[3])
                $g4 = _StringReverse($guidSplit[4])
                $g51 = _StringReverse(StringLeft($guidSplit[5], 2))
                $g52 = _StringReverse(StringLeft(StringRight($guidSplit[5], 10), 2))
                $g53 = _StringReverse(StringLeft(StringRight($guidSplit[5], 8), 2))
                $g54 = _StringReverse(StringLeft(StringRight($guidSplit[5], 6), 2))
                $g55 = _StringReverse(StringLeft(StringRight($guidSplit[5], 4), 2))
                $g56 = _StringReverse(StringLeft(StringRight($guidSplit[5], 2), 2))

                $g5 = $g51 & $g52 & $g53 & $g54 & $g55 & $g56

                $GuidFull = $guidSplit[1] & $guidSplit[2] & $guidSplit[3] & $guidSplit[4] & $guidSplit[5]

                ;"key of feature found in HKEY_CLASSES_ROOT\Installer\Features\" & $guidReverse
                $guidReverse = $g1 & $g2 & $g3 & $g4 & $g5

                ;RegDelete("HKEY_CLASSES_ROOT\Installer\Features\" & $guidReverse)
                MsgBox(0, $name, $HKLMUuninstallName & @CR & "FG: " & $GuidFull & @cr & "RG: " & $guidReverse)
                
                ;MsgBox(0, "$unSearch", $unSearch)
                For $x= 1 to 10000
                    $HKCRProductsName = RegEnumKey($HKCRProducts, $x)
                    MsgBox(0, $x, $HKCRProductsName)
                    $HKCRProductsProductName = RegRead($HKCRProducts & "\" & $HKCRProductsName, "ProductName")
                    if $HKCRProductsProductName <> "" Then MsgBox(0, $HKCRProducts & "\" & $HKCRProductsName, $name & @CR & $HKCRProductsProductName, .5)
                    if $name = $HKCRProductsProductName > 0 Then
                        msgbox(0, "", $HKCRProducts & "\" & $HKCRProductsName & " = " & $HKCRProductsProductName)
                        ;RegDelete($HKCRProducts & "\" & $HKCRProductsName)
                    EndIf
                Next
                
            EndIf
        EndIf
    Next
EndFunc

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...