Jump to content

Recommended Posts

nitron
Posted (edited)

Hy,

 

i am sorry, if my issue has allready been solved, but i can't seem to find the solution. 

I was allway reading the Registry for the uninstall Strings of Programs

 

For which i used to search

Within 

Software\Microsoft\Windows\CurrentVersion\Uninstall\

oftware\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\

 

which would look something like this

      $FileHandleLocal=FileOpen(@DesktopDir&"\test"&$Exten,10)

      For $ZaehlerLocal = 1 to 5200
         $RegKey = RegEnumKey("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall", $ZaehlerLocal)
          If @error then ExitLoop
         $RegKey2=RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\"&$RegKey,"DisplayName")
         $RegKey3=RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\"&$RegKey,"UninstallString")
         $RegKey4=RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\"&$RegKey,"QuietUninstallString")
         $RegKey5=RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\"&$RegKey,"(Standard)")

                     FileWrite($FileHandleLocal,$ZaehlerLocal&";")
                     FileWrite($FileHandleLocal,$RegKey&";")
                     FileWrite($FileHandleLocal,$RegKey2&";")
                     FileWrite($FileHandleLocal,$RegKey3&";")
                     FileWriteline($FileHandleLocal,$RegKey4&";")
      Next

      $FileHandleLocal=FileOpen(@DesktopDir&"\test2"&$Exten,10)

      For $ZaehlerLocal = 1 to 5200
         $RegKey = RegEnumKey("HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall", $ZaehlerLocal)
          If @error then ExitLoop
           $RegKey2=RegRead("HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"&$RegKey,"DisplayName")
           $RegKey3=RegRead("HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"&$RegKey,"UninstallString")
           $RegKey4=RegRead("HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"&$RegKey,"QuietUninstallString")
           $RegKey5=RegRead("HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"&$RegKey,"(Standard)")

                     FileWrite($FileHandleLocal,$ZaehlerLocal&";")
                     FileWrite($FileHandleLocal,$RegKey&";")
                     FileWrite($FileHandleLocal,$RegKey2&";")
                     FileWrite($FileHandleLocal,$RegKey3&";")
                     FileWriteline($FileHandleLocal,$RegKey4&";")
      Next

This was working fine for years, butz now, something changed.... No matter what... I only get the keys from \Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\ but i do need both 

What am I doing wrong?!?!

 

 

Edited by nitron

Share this post


Link to post
Share on other sites
Subz
Posted (edited)

You can use HKLM64 for 64 bit keys and HKLM for 32 bit keys

Please see the following post:

 

Edited by Subz

Share this post


Link to post
Share on other sites
nitron
6 minutes ago, Subz said:

You can use HKLM64 for 64 bit keys and HKLM for 32 bit keys

Please see the following post:

 

Yes, but the problem is, it doesn't matter. if  I use HKLM or HKEY_LOCAL_MACHINE for I allways get the Wow6432Node uninstall Keys... I don't get the 32 ones.

Share this post


Link to post
Share on other sites
Subz

So did you try my script from the previous post, it gets me all HKLM and HKLM64 keys.

Share this post


Link to post
Share on other sites
nitron
Just now, Subz said:

So did you try my script from the previous post, it gets me all HKLM and HKLM64 keys.

just tried... Still don't get the 32Bit Keys for what reason, what so ever.

Share this post


Link to post
Share on other sites
Subz

Please try the following script and send through a screenshot of the results.

#include <GuiListView.au3>
Opt("TrayAutoPause", 0)
Opt('GUIOnEventMode', 1)
Opt('GUICloseOnEsc' , 1)

Global $aSoftwareInfo[0][5]
    _SoftwareInfo("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")
    _SoftwareInfo("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")

Global $hGui = GUICreate('Currently Installed Software', 810, 650, -1, -1)
Global $idListView = GUICtrlCreateListView('Registry Key|Installed Software|Display Version|Publisher|Uninstall String', 5, 5, 800, 600)
_GUICtrlListView_AddArray($idListView, $aSoftwareInfo)

GUICtrlSendMsg($idListView, 0x101E, 1, 175)
GUICtrlSendMsg($idListView, 0x101E, 2, 65)
GUICtrlSendMsg($idListView, 0x101E, 3, 150)
GUICtrlSendMsg($idListView, 0x101E, 4, 350)
Local $mMen = GUICtrlCreateContextMenu($idListView)
Local $Uninstall = GUICtrlCreateMenuItem('Proceed to Software uninstallation', $mMen)
GUICtrlSetOnEvent($Uninstall, '_Uninstall')
Local $exp = GUICtrlCreateButton('  Expand  ', 720, 615)
GUICtrlSetOnEvent($exp, '_Expand')
GUISetOnEvent(-3, '_AllExit')
GUISetState(@SW_SHOW, $hGui)

While 1
    Sleep(10)
WEnd
;
Func _AllExit()
    GUIDelete($hGui)
    Exit
EndFunc

Func _Uninstall()
   Local $proc = StringSplit(GUICtrlRead(GUICtrlRead($idListView)), '|', 1)
   If $proc[1] == 0 Then Return -1
   ShellExecuteWait ($proc[5])
EndFunc

Func _SoftwareInfo($_sHKLMUninstall)
    Local $i = 1
    While 1
        $sRegKey = RegEnumKey($_sHKLMUninstall, $i)
        If @error Then Exitloop
        If RegRead($_sHKLMUninstall & "\" & $sRegKey, "DisplayName") = '' Then
            $i += 1
            ContinueLoop
        EndIf
        $sDisplayName = StringStripWS(StringReplace(RegRead($_sHKLMUninstall & "\" & $sRegKey, "DisplayName"), " (remove only)", ""), 3)
        $sDisplayVersion = StringStripWS(RegRead($_sHKLMUninstall & "\" & $sRegKey, "DisplayVersion"), 3)
        $sPublisher = StringStripWS(RegRead($_sHKLMUninstall & "\" & $sRegKey, "Publisher"), 3)
        $sUninstallString = StringStripWS(RegRead($_sHKLMUninstall & "\" & $sRegKey, "UninstallString"), 3)
        _ArrayAdd($aSoftwareInfo, $_sHKLMUninstall & "\" & $sRegKey & "|" & $sDisplayName & "|" & $sDisplayVersion & "|" & $sPublisher & "|" & $sUninstallString)
        $i += 1
    WEnd
    _ArraySort($aSoftwareInfo,0,1)
EndFunc
;
Func _Expand()
    _GUICtrlListView_SetColumnWidth($idListView, 0, $LVSCW_AUTOSIZE)
    _GUICtrlListView_SetColumnWidth($idListView, 1, $LVSCW_AUTOSIZE)
    _GUICtrlListView_SetColumnWidth($idListView, 2, $LVSCW_AUTOSIZE)
    _GUICtrlListView_SetColumnWidth($idListView, 3, $LVSCW_AUTOSIZE)
    _GUICtrlListView_SetColumnWidth($idListView, 4, $LVSCW_AUTOSIZE)
EndFunc

 

  • Thanks 1

Share this post


Link to post
Share on other sites
nitron
16 minutes ago, nitron said:

just tried... Still don't get the 32Bit Keys for what reason, what so ever.

Ok, I have to reject my answer, I am getting difrent Uninstall strings. Some i didn't get before, but now i am missing others, which i got before.

Share this post


Link to post
Share on other sites
nitron
21 minutes ago, Subz said:

Please try the following script and send through a screenshot of the results.

#include <GuiListView.au3>
Opt("TrayAutoPause", 0)
Opt('GUIOnEventMode', 1)
Opt('GUICloseOnEsc' , 1)

Global $aSoftwareInfo[0][5]
    _SoftwareInfo("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")
    _SoftwareInfo("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")

Global $hGui = GUICreate('Currently Installed Software', 810, 650, -1, -1)
Global $idListView = GUICtrlCreateListView('Registry Key|Installed Software|Display Version|Publisher|Uninstall String', 5, 5, 800, 600)
_GUICtrlListView_AddArray($idListView, $aSoftwareInfo)

GUICtrlSendMsg($idListView, 0x101E, 1, 175)
GUICtrlSendMsg($idListView, 0x101E, 2, 65)
GUICtrlSendMsg($idListView, 0x101E, 3, 150)
GUICtrlSendMsg($idListView, 0x101E, 4, 350)
Local $mMen = GUICtrlCreateContextMenu($idListView)
Local $Uninstall = GUICtrlCreateMenuItem('Proceed to Software uninstallation', $mMen)
GUICtrlSetOnEvent($Uninstall, '_Uninstall')
Local $exp = GUICtrlCreateButton('  Expand  ', 720, 615)
GUICtrlSetOnEvent($exp, '_Expand')
GUISetOnEvent(-3, '_AllExit')
GUISetState(@SW_SHOW, $hGui)

While 1
    Sleep(10)
WEnd
;
Func _AllExit()
    GUIDelete($hGui)
    Exit
EndFunc

Func _Uninstall()
   Local $proc = StringSplit(GUICtrlRead(GUICtrlRead($idListView)), '|', 1)
   If $proc[1] == 0 Then Return -1
   ShellExecuteWait ($proc[5])
EndFunc

Func _SoftwareInfo($_sHKLMUninstall)
    Local $i = 1
    While 1
        $sRegKey = RegEnumKey($_sHKLMUninstall, $i)
        If @error Then Exitloop
        If RegRead($_sHKLMUninstall & "\" & $sRegKey, "DisplayName") = '' Then
            $i += 1
            ContinueLoop
        EndIf
        $sDisplayName = StringStripWS(StringReplace(RegRead($_sHKLMUninstall & "\" & $sRegKey, "DisplayName"), " (remove only)", ""), 3)
        $sDisplayVersion = StringStripWS(RegRead($_sHKLMUninstall & "\" & $sRegKey, "DisplayVersion"), 3)
        $sPublisher = StringStripWS(RegRead($_sHKLMUninstall & "\" & $sRegKey, "Publisher"), 3)
        $sUninstallString = StringStripWS(RegRead($_sHKLMUninstall & "\" & $sRegKey, "UninstallString"), 3)
        _ArrayAdd($aSoftwareInfo, $_sHKLMUninstall & "\" & $sRegKey & "|" & $sDisplayName & "|" & $sDisplayVersion & "|" & $sPublisher & "|" & $sUninstallString)
        $i += 1
    WEnd
    _ArraySort($aSoftwareInfo,0,1)
EndFunc
;
Func _Expand()
    _GUICtrlListView_SetColumnWidth($idListView, 0, $LVSCW_AUTOSIZE)
    _GUICtrlListView_SetColumnWidth($idListView, 1, $LVSCW_AUTOSIZE)
    _GUICtrlListView_SetColumnWidth($idListView, 2, $LVSCW_AUTOSIZE)
    _GUICtrlListView_SetColumnWidth($idListView, 3, $LVSCW_AUTOSIZE)
    _GUICtrlListView_SetColumnWidth($idListView, 4, $LVSCW_AUTOSIZE)
EndFunc

 

Ok, that does the trick! 

Now I see all keys.

You are great, even though i have to admite, i don't see the big difrence, except for your Program can do obiusly much more!

Thanks

Share this post


Link to post
Share on other sites
Subz

Here is a broken down version of the script which will write it file name, you can change the separator at the top of the script if you want to use semi-colon:

#include <Array.au3>

Local $iCount = 1 ;~ Count number of entries found
Local $sSeparator = "," ;~ Change to semi-colon if you wish
Local $sFileName = @DesktopDir & "\test.csv"
Local $hFileOpen = FileOpen($sFileName, 10)

;~ Gets All 32-Bit Uninstall Keys
_RegReadUninstall("HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\")
;~ Gets All 64-Bit Uninstall Keys
_RegReadUninstall("HKLM64\Software\Microsoft\Windows\CurrentVersion\Uninstall\")

FileClose($hFileOpen)
ShellExecute($sFileName) ;~ Open the File afterwards

Func _RegReadUninstall($_sRegKeyHive = "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\")
    $_sRegKeyHive = StringRight($_sRegKeyHive, 1) = "\" ? $_sRegKeyHive : $_sRegKeyHive & "\" ;~ Makes sure last entry is backslash
    Local $a_RegReadUninstall[1][6] = [["Count", "Registry Key", "DisplayName", "UninstallString", "QuietUninstallString", "(Standard"]]
    Local $i = 1
    While 1
        $sRegKeyName = RegEnumKey($_sRegKeyHive, $i)
            If @error then ExitLoop
        $sRegResults =  _
        RegRead($_sRegKeyHive & $sRegKeyName,"DisplayName") & "|" & _
        RegRead($_sRegKeyHive & $sRegKeyName, "UninstallString") & "|" & _
        RegRead($_sRegKeyHive & $sRegKeyName, "QuietUninstallString") & "|" & _
        RegRead($_sRegKeyHive & $sRegKeyName, "(Standard)")
        If StringStripWS(StringReplace($sRegResults, "|", ""), 8) = "" Then
            $i += 1
            ContinueLoop
        EndIf
        _ArrayAdd($a_RegReadUninstall, $iCount & "|" & $_sRegKeyHive & $sRegKeyName & "|" & $sRegResults)
        $i += 1
        $iCount += 1
    WEnd
    FileWrite($hFileOpen, _ArrayToString($a_RegReadUninstall, $sSeparator) & @CRLF)
EndFunc

 

Share this post


Link to post
Share on other sites
nitron
22 minutes ago, Subz said:

Here is a broken down version of the script which will write it file name, you can change the separator at the top of the script if you want to use semi-colon:

#include <Array.au3>

Local $iCount = 1 ;~ Count number of entries found
Local $sSeparator = "," ;~ Change to semi-colon if you wish
Local $sFileName = @DesktopDir & "\test.csv"
Local $hFileOpen = FileOpen($sFileName, 10)

;~ Gets All 32-Bit Uninstall Keys
_RegReadUninstall("HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\")
;~ Gets All 64-Bit Uninstall Keys
_RegReadUninstall("HKLM64\Software\Microsoft\Windows\CurrentVersion\Uninstall\")

FileClose($hFileOpen)
ShellExecute($sFileName) ;~ Open the File afterwards

Func _RegReadUninstall($_sRegKeyHive = "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\")
    $_sRegKeyHive = StringRight($_sRegKeyHive, 1) = "\" ? $_sRegKeyHive : $_sRegKeyHive & "\" ;~ Makes sure last entry is backslash
    Local $a_RegReadUninstall[1][6] = [["Count", "Registry Key", "DisplayName", "UninstallString", "QuietUninstallString", "(Standard"]]
    Local $i = 1
    While 1
        $sRegKeyName = RegEnumKey($_sRegKeyHive, $i)
            If @error then ExitLoop
        $sRegResults =  _
        RegRead($_sRegKeyHive & $sRegKeyName,"DisplayName") & "|" & _
        RegRead($_sRegKeyHive & $sRegKeyName, "UninstallString") & "|" & _
        RegRead($_sRegKeyHive & $sRegKeyName, "QuietUninstallString") & "|" & _
        RegRead($_sRegKeyHive & $sRegKeyName, "(Standard)")
        If StringStripWS(StringReplace($sRegResults, "|", ""), 8) = "" Then
            $i += 1
            ContinueLoop
        EndIf
        _ArrayAdd($a_RegReadUninstall, $iCount & "|" & $_sRegKeyHive & $sRegKeyName & "|" & $sRegResults)
        $i += 1
        $iCount += 1
    WEnd
    FileWrite($hFileOpen, _ArrayToString($a_RegReadUninstall, $sSeparator) & @CRLF)
EndFunc

 

I allready found the Problem maker even though i don't understand it. If you use HKLM it will work, if you use HKey_local_Machine it won't work. 

But the Idea of your script is great. 

Thanks for your help.

Share this post


Link to post
Share on other sites
Earthshine
Posted (edited)

really? because this works fine from the help file regarding using HKEY_LOCAL_MACHINE

#include <MsgBoxConstants.au3>
Local $sFilePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir")
MsgBox($MB_SYSTEMMODAL, "", "Program files are located at: " & $sFilePath)

I wonder why it didn't work for you. this example can work with HKey_local_Machine or HKLM

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
Subz

@Earthshine that will return the wrong key if script is compiled as 32-bit, it returns 32-bit version of the Hive not the 64-bit version, which is why we need to use HKLM for 32-bit and HKLM64 for 64-bit within 32-bit compiled scripts.

  • Thanks 1

Share this post


Link to post
Share on other sites
Earthshine
Posted (edited)

ah, thank you. I usually always use the HKLM and HKLM64 myself so I've never had a problem when patching our apps and stuff using autoit

Edited by Earthshine

My resources are limited. You must ask the right questions

 

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

×