Jump to content
Sign in to follow this  
vatobeto

How To Get Inaccessible Uninstall Strings?

Recommended Posts

vatobeto

When I use RegEnumKey on the Uninstall Key in:

"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", I can't get it to list the 'curly bracket' (binary) uninstall entries, which I can see and access from Regedit. Does anyone have a suggestion other than just using RegEdit. I'd like to use AutoIt, naturally...

My code:

CODE
$UninstallKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"

FindUninstallStrings($UninstallKey)

Exit

Func FindUninstallStrings($KeyString)

Dim $UninstallKeys[1]

$UninstallKeys = FindAllKeysStringEnd($UninstallKey,$KeyString, 1)

Dim $regValues[uBound($UninstallKeys)]

ShowArray($UninstallKeys)

For $j = 1 To UBound($UninstallKeys) - 1

$val = RegRead($UninstallKey & "\" & $UninstallKeys[$j], "UninstallString")

$regValues[$j] = $val

Next

ShowArray($regValues)

EndFunc

Func StringEndsKey($Key, $String, $Flag)

If $Flag == 1 Then

Local $pattern = "^.*\\" & StringUpper($String) & "[^\\]*$"

Else

Local $pattern = "^.*\\" & StringUpper($String) & "$"

EndIf

If StringRegExp(StringUpper($Key), $pattern) == 1 Then

Return 1

Else

Return 0

EndIf

EndFunc

Func FindAllKeysStringEnd($Key, $String, $Flag)

Dim $allKeys[1]

Dim $keyStringArray[1]

Local $i

$allKeys = MakeKeyArray($Key)

For $i = 1 To _ArrayMaxIndex($allKeys)

If StringEndsKey($Key & "\" & $allKeys[$i], $String, $Flag) Then

_ArrayAdd($keyStringArray, $allKeys[$i])

EndIf

Next

Return $keyStringArray

EndFunc

Func MakeKeyArray($Key)

Local $i = 1

Local $var = ""

Dim $retArray[1]

While 1

$var = RegEnumKey($Key, $i)

If @error <> 0 Then ExitLoop

_ArrayAdd($retArray, $var)

$i += 1

WEnd

Return $retArray

EndFunc

Func ShowArray($arr)

Local $i

MsgBox(0,"Array Size",_ArrayMaxIndex($arr))

For $i = 1 To _ArrayMaxIndex($arr)

ConsoleWrite($arr[$i] & @CRLF)

Next

EndFunc

Thanks - VatoBeto.

Edited by vatobeto

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.