#Include <Array.au3>
Dim $aSoftwareInfo, $aSoftwareInfo2, $aSoftwareInfo3
If @OSArch = 'x64' Then
Global $Path1 = 'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall'
Global $Path2 = 'HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
Global $PathUser = 'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall'
Else
Global $Path1 = 'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall'
Global $PathUser = 'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall'
EndIf
If @OSArch = 'x64' Then
_ComputerGetSoftware($aSoftwareInfo)
_ComputerGetSoftware2($aSoftwareInfo2)
_ComputerGetSoftware3($aSoftwareInfo3)
_ArrayDisplay($aSoftwareInfo)
_ArrayDisplay($aSoftwareInfo2)
_ArrayDisplay($aSoftwareInfo3)
Else
_ComputerGetSoftware($aSoftwareInfo)
_ComputerGetSoftware3($aSoftwareInfo3)
_ArrayDisplay($aSoftwareInfo)
_ArrayDisplay($aSoftwareInfo3)
EndIf
Func _ComputerGetSoftware(ByRef $aSoftwareInfo)
Local Const $UnInstKey = $Path1
Local $i = 1
Dim $aSoftwareInfo[1][4]
While 1
$AppKey = RegEnumKey($UnInstKey, $i)
If @error <> 0 Then ExitLoop
ReDim $aSoftwareInfo[UBound($aSoftwareInfo) + 1][4]
$aSoftwareInfo[$i][0] = StringStripWS(StringReplace(RegRead($UnInstKey & "\" & $AppKey, "DisplayName"), " (remove only)", ""), 3)
$aSoftwareInfo[$i][1] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "DisplayVersion"), 3)
$aSoftwareInfo[$i][2] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "Publisher"), 3)
$aSoftwareInfo[$i][3] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "UninstallString"), 3)
$i += 1
WEnd
$aSoftwareInfo[0][0] = UBound($aSoftwareInfo, 1) - 1
If $aSoftwareInfo[0][0] < 1 Then
SetError(1, 1, 0)
EndIf
EndFunc
Func _ComputerGetSoftware2(ByRef $aSoftwareInfo2)
Local Const $UnInstKey = $Path2
Local $i = 1
Dim $aSoftwareInfo2[1][4]
While 1
$AppKey = RegEnumKey($UnInstKey, $i)
If @error <> 0 Then ExitLoop
ReDim $aSoftwareInfo2[UBound($aSoftwareInfo2) + 1][4]
$aSoftwareInfo2[$i][0] = StringStripWS(StringReplace(RegRead($UnInstKey & "\" & $AppKey, "DisplayName"), " (remove only)", ""), 3)
$aSoftwareInfo2[$i][1] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "DisplayVersion"), 3)
$aSoftwareInfo2[$i][2] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "Publisher"), 3)
$aSoftwareInfo2[$i][3] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "UninstallString"), 3)
$i += 1
WEnd
$aSoftwareInfo2[0][0] = UBound($aSoftwareInfo2, 1) - 1
If $aSoftwareInfo2[0][0] < 1 Then
SetError(1, 1, 0)
EndIf
EndFunc
Func _ComputerGetSoftware3(ByRef $aSoftwareInfo3)
Local Const $UnInstKey = $PathUser
Local $i = 1
Dim $aSoftwareInfo3[1][4]
While 1
$AppKey = RegEnumKey($UnInstKey, $i)
If @error <> 0 Then ExitLoop
ReDim $aSoftwareInfo3[UBound($aSoftwareInfo3) + 1][4]
$aSoftwareInfo3[$i][0] = StringStripWS(StringReplace(RegRead($UnInstKey & "\" & $AppKey, "DisplayName"), " (remove only)", ""), 3)
$aSoftwareInfo3[$i][1] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "DisplayVersion"), 3)
$aSoftwareInfo3[$i][2] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "Publisher"), 3)
$aSoftwareInfo3[$i][3] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "UninstallString"), 3)
$i += 1
WEnd
$aSoftwareInfo3[0][0] = UBound($aSoftwareInfo3, 1) - 1
If $aSoftwareInfo3[0][0] < 1 Then
SetError(1, 1, 0)
EndIf
EndFunc
If @OSArch = 'x64' Then
Global $Path1 = 'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall'
Global $Path2 = 'HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
Global $PathUser = 'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall'
If @OSArch = "X64" Then
Local $sKey = 'HKLM64\Software\Microsoft\Windows\CurrentVersion\Uninstall\'
Local $iAccess = BitOR($KEY_READ, $KEY_WOW64_64KEY)
Local $hKey = _WinAPI_RegOpenKey($HKEY_LOCAL_MACHINE, 'Software\Microsoft\Windows\CurrentVersion\Uninstall', $iAccess)
Else
Local $sKey = 'HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\'
Local $hKey = _WinAPI_RegOpenKey($HKEY_LOCAL_MACHINE, 'Software\Microsoft\Windows\CurrentVersion\Uninstall')
EndIf
#Include <Array.au3>
Dim $aSoftwareInfo, $aSoftwareInfo2, $aSoftwareInfo3
If @OSArch = 'x64' Then
Global $Path1 = 'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall'
Global $Path2 = 'HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
Global $PathUser = 'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall'
Else
Global $Path1 = 'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall'
Global $PathUser = 'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall'
EndIf
If @OSArch = 'x64' Then
_ComputerGetSoftware($aSoftwareInfo)
_ComputerGetSoftware2($aSoftwareInfo2)
_ComputerGetSoftware3($aSoftwareInfo3)
While 1
$StringZero = _ArrayFindAll($aSoftwareInfo, '')
If _ArrayFindAll($aSoftwareInfo, '') = @error Then
ExitLoop
EndIf
_ArrayDelete($aSoftwareInfo, _ArrayMax($StringZero))
If _ArrayMax($StringZero) = 0 Then
ExitLoop
EndIf
WEnd
While 1
$StringZero2 = _ArrayFindAll($aSoftwareInfo2, '')
If _ArrayFindAll($aSoftwareInfo2, '') = @error Then
ExitLoop
EndIf
_ArrayDelete($aSoftwareInfo2, _ArrayMax($StringZero2))
If _ArrayMax($StringZero2) = 0 Then
ExitLoop
EndIf
WEnd
While 1
$StringZero3 = _ArrayFindAll($aSoftwareInfo3, '')
If _ArrayFindAll($aSoftwareInfo3, '') = @error Then
ExitLoop
EndIf
_ArrayDelete($aSoftwareInfo3, _ArrayMax($StringZero3))
If _ArrayMax($StringZero3) = 0 Then
ExitLoop
EndIf
WEnd
_ArraySort($aSoftwareInfo)
_ArraySort($aSoftwareInfo2)
_ArraySort($aSoftwareInfo3)
_ArrayUnique($aSoftwareInfo)
_ArrayUnique($aSoftwareInfo2)
_ArrayUnique($aSoftwareInfo3)
_ArrayDisplay($aSoftwareInfo, 'Основное для установленных x32 приложений')
_ArrayDisplay($aSoftwareInfo, 'Основное для установленных x64 приложений')
_ArrayDisplay($aSoftwareInfo3, 'Пользовательское')
_ArrayDisplay($aSoftwareInfo)
_ArrayDisplay($aSoftwareInfo2)
_ArrayDisplay($aSoftwareInfo3)
Exit
Else
_ComputerGetSoftware($aSoftwareInfo)
_ComputerGetSoftware3($aSoftwareInfo3)
While 1
$StringZero = _ArrayFindAll($aSoftwareInfo, '')
If _ArrayFindAll($aSoftwareInfo, '') = @error Then
ExitLoop
EndIf
_ArrayDelete($aSoftwareInfo, _ArrayMax($StringZero))
If _ArrayMax($StringZero) = 0 Then
ExitLoop
EndIf
WEnd
While 1
$StringZero3 = _ArrayFindAll($aSoftwareInfo3, '')
If _ArrayFindAll($aSoftwareInfo3, '') = @error Then
ExitLoop
EndIf
_ArrayDelete($aSoftwareInfo3, _ArrayMax($StringZero3))
If _ArrayMax($StringZero3) = 0 Then
ExitLoop
EndIf
WEnd
_ArraySort($aSoftwareInfo)
_ArraySort($aSoftwareInfo3)
_ArrayUnique($aSoftwareInfo)
_ArrayUnique($aSoftwareInfo3)
_ArrayDisplay($aSoftwareInfo, 'Основное')
_ArrayDisplay($aSoftwareInfo3, 'Пользовательское')
Exit
EndIf
Func _ComputerGetSoftware(ByRef $aSoftwareInfo)
Local Const $UnInstKey = $Path1
Local $i = 1
Dim $aSoftwareInfo[1][4]
While 1
$AppKey = RegEnumKey($UnInstKey, $i)
If @error <> 0 Then ExitLoop
ReDim $aSoftwareInfo[UBound($aSoftwareInfo) + 1][4]
$aSoftwareInfo[$i][0] = StringStripWS(StringReplace(RegRead($UnInstKey & "\" & $AppKey, "DisplayName"), " (remove only)", ""), 3)
$aSoftwareInfo[$i][1] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "DisplayVersion"), 3)
$aSoftwareInfo[$i][2] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "Publisher"), 3)
$aSoftwareInfo[$i][3] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "UninstallString"), 3)
$i += 1
WEnd
$aSoftwareInfo[0][0] = UBound($aSoftwareInfo, 1) - 1
If $aSoftwareInfo[0][0] < 1 Then
SetError(1, 1, 0)
EndIf
EndFunc
Func _ComputerGetSoftware2(ByRef $aSoftwareInfo2)
Local Const $UnInstKey = $Path2
Local $i = 1
Dim $aSoftwareInfo2[1][4]
While 1
$AppKey = RegEnumKey($UnInstKey, $i)
If @error <> 0 Then ExitLoop
ReDim $aSoftwareInfo2[UBound($aSoftwareInfo2) + 1][4]
$aSoftwareInfo2[$i][0] = StringStripWS(StringReplace(RegRead($UnInstKey & "\" & $AppKey, "DisplayName"), " (remove only)", ""), 3)
$aSoftwareInfo2[$i][1] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "DisplayVersion"), 3)
$aSoftwareInfo2[$i][2] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "Publisher"), 3)
$aSoftwareInfo2[$i][3] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "UninstallString"), 3)
$i += 1
WEnd
$aSoftwareInfo2[0][0] = UBound($aSoftwareInfo2, 1) - 1
If $aSoftwareInfo2[0][0] < 1 Then
SetError(1, 1, 0)
EndIf
EndFunc
Func _ComputerGetSoftware3(ByRef $aSoftwareInfo3)
Local Const $UnInstKey = $PathUser
Local $i = 1
Dim $aSoftwareInfo3[1][4]
While 1
$AppKey = RegEnumKey($UnInstKey, $i)
If @error <> 0 Then ExitLoop
ReDim $aSoftwareInfo3[UBound($aSoftwareInfo3) + 1][4]
$aSoftwareInfo3[$i][0] = StringStripWS(StringReplace(RegRead($UnInstKey & "\" & $AppKey, "DisplayName"), " (remove only)", ""), 3)
$aSoftwareInfo3[$i][1] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "DisplayVersion"), 3)
$aSoftwareInfo3[$i][2] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "Publisher"), 3)
$aSoftwareInfo3[$i][3] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "UninstallString"), 3)
$i += 1
WEnd
$aSoftwareInfo3[0][0] = UBound($aSoftwareInfo3, 1) - 1
If $aSoftwareInfo3[0][0] < 1 Then
SetError(1, 1, 0)
EndIf
EndFunc
#include <Array.au3>
Global $HKCU = 'HKCU', $HKLM = 'HKLM'
Global $sKeyUn
Dim $aProgram[1][3]
$aProgram[0][0] = 0
If @OSArch = "X64" Then
$HKCU = 'HKCU64'
$HKLM = 'HKLM64'
EndIf
$sKeyUn = $HKLM & '\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
GetInstallProg($sKeyUn)
$sKeyUn = $HKCU & '\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
GetInstallProg($sKeyUn)
If @OSArch = "X64" Then
$sKeyUn = $HKLM & '\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
GetInstallProg($sKeyUn)
EndIf
_ArrayDisplay($aProgram, "InstallProg")
; Функция получения установленных программ
Func GetInstallProg($sKey)
Local $errReg = 0
Local $i = 0
Local $sDisplayName
Local $sDisplayVersion
Local $sUninstallString
Local $aKey = _RegReadKeyValueToArray($sKey)
$errReg = @error
If $errReg Or UBound($aKey) = 0 Then Return SetError(1, 0, "")
If Not $aKey[0] Then Return SetError(2, 0, "") ; Если раздел $sKey есть, но он пустой
ReDim $aProgram[$aKey[0] + 1 + $aProgram[0][0]][3]
For $i = 1 To UBound($aKey) - 1
$sDisplayName = RegRead($aKey[$i], 'DisplayName')
$sDisplayVersion = RegRead($aKey[$i], 'DisplayVersion')
$sUninstallString = RegRead($aKey[$i], 'UninstallString')
;If $sDisplayName And $sUninstallString Then
If $sDisplayName Then
; Пропускаем повторяющиеся
For $j = 1 To $aProgram[0][0]
If $aProgram[$j][0] = "" Then ContinueLoop
If StringCompare($aProgram[$j][0], $sDisplayName) = 0 Then
ContinueLoop 2
EndIf
Next
$aProgram[0][0] += 1
$aProgram[$aProgram[0][0]][0] = $sDisplayName
$aProgram[$aProgram[0][0]][1] = $sDisplayVersion
$aProgram[$aProgram[0][0]][2] = $sUninstallString
EndIf
Next
ReDim $aProgram[$aProgram[0][0] + 1][3]
EndFunc ;==>GetInstallProg
;function from Registry_UDFs.au3
Func _RegReadKeyValueToArray($s_Key, $iKey_Value_Mode = 0)
Local $aKeysListArr[1], $aSubKeysListArr, $iInstance = 0, $sEnum_KeyVal, $sCurrentKeyPath
If Not _RegKeyExists($s_Key) Then Return SetError(1, 0, $aKeysListArr)
While 1
$iInstance += 1
If $iKey_Value_Mode = 0 Then
$sEnum_KeyVal = RegEnumKey($s_Key, $iInstance)
Else
$sEnum_KeyVal = RegEnumVal($s_Key, $iInstance)
EndIf
If @error <> 0 Then ExitLoop
$sCurrentKeyPath = $s_Key & "\" & $sEnum_KeyVal
$aKeysListArr[0] += 1
ReDim $aKeysListArr[$aKeysListArr[0] + 1]
$aKeysListArr[$aKeysListArr[0]] = $sCurrentKeyPath
$aSubKeysListArr = _RegReadKeyValueToArray($sCurrentKeyPath)
For $j = 1 To $aSubKeysListArr[0]
$aKeysListArr[0] += 1
ReDim $aKeysListArr[$aKeysListArr[0] + 1]
$aKeysListArr[$aKeysListArr[0]] = $aSubKeysListArr[$j]
Next
WEnd
Return $aKeysListArr
EndFunc ;==>_RegReadKeyValueToArray
;function from Registry_UDFs.au3
Func _RegKeyExists($s_Key)
RegRead($s_Key, "")
If @error <= 0 Then Return 1 ; Key exists
Return 0
EndFunc ;==>_RegKeyExists