Difference between revisions of "ADO Tools"

From AutoIt Wiki
Jump to navigation Jump to search
m
m
Line 8: Line 8:
 
; Count the number of keys
 
; Count the number of keys
 
While 1
 
While 1
RegEnumKey($sKey, $iCurrent)
+
    RegEnumKey($sKey, $iCurrent)
If @error = -1 Then ; Requested subkey (key instance) out of range
+
    If @error = -1 Then ; Requested subkey (key instance) out of range
$iMax = $iCurrent
+
        $iMax = $iCurrent
$iCurrent = Int(($iMin + $iMax) / 2)
+
        $iCurrent = Int(($iMin + $iMax) / 2)
$iPrevious = $iMax
+
        $iPrevious = $iMax
Else
+
    Else
If $iPrevious <= ($iCurrent + 1) And $iPrevious >= ($iCurrent - 1) Then ExitLoop
+
        If $iPrevious <= ($iCurrent + 1) And $iPrevious >= ($iCurrent - 1) Then ExitLoop
$iMin = $iCurrent
+
        $iMin = $iCurrent
$iCurrent = Int(($iMin + $iMax) / 2)
+
        $iCurrent = Int(($iMin + $iMax) / 2)
$iPrevious = $iMin
+
        $iPrevious = $iMin
EndIf
+
    EndIf
 
WEnd
 
WEnd
 
; Process registry
 
; Process registry

Revision as of 16:00, 9 January 2014

List all installed OLE DB providers

#include <Constants.au3>
#include <Array.au3>
Global $sOutput, $oRegistry, $oKey, $sKey = "HKCR\CLSID", $iIndexReg = 1, $iIndexResult = 0
Global $aResult[200][3], $sTitle = "OLE DB Providers", $iMax = 100000, $iMin = 1, $iPrevious = $iMin, $iCurrent = $iMax/2, $iTemp
ProgressOn($sTitle, "Processing the Registry", "", Default, Default, $DLG_MOVEABLE)
; Count the number of keys
While 1
    RegEnumKey($sKey, $iCurrent)
    If @error = -1 Then ; Requested subkey (key instance) out of range
        $iMax = $iCurrent
        $iCurrent = Int(($iMin + $iMax) / 2)
        $iPrevious = $iMax
    Else
        If $iPrevious <= ($iCurrent + 1) And $iPrevious >= ($iCurrent - 1) Then ExitLoop
        $iMin = $iCurrent
        $iCurrent = Int(($iMin + $iMax) / 2)
        $iPrevious = $iMin
    EndIf
WEnd
; Process registry
While 1
    If Mod($iIndexReg, 10) = 0 Then
        $iPercent = Int($iIndexReg * 100 / $iCurrent)
        ProgressSet($iPercent, $iIndexReg & " keys of " & $iCurrent & " processed (" & $iPercent & "%)")
    EndIf
    $sSubKey = RegEnumKey($sKey, $iIndexReg)
    If @error Then ExitLoop
    $sKeyValue = RegRead($sKey & "\" & $sSubKey, "OLEDB_SERVICES")
    If @error = 0 Then
        $aResult[$iIndexResult][0] = $sKey & "\" & $sSubKey
        $aResult[$iIndexResult][1] = RegRead($sKey & "\" & $sSubKey, "")
        $aResult[$iIndexResult][2] = RegRead($sKey & "\" & $sSubKey & "\OLE DB Provider", "")
        $iIndexResult = $iIndexResult + 1
    EndIf
    $iIndexReg = $iIndexReg + 1
WEnd
ProgressOff()
ReDim $aResult[$iIndexResult][3]
_ArrayDisplay($aResult, $sTitle, "", 0, Default, "Registry key|OLE DB Provider|Description")

Result:

OLE DB Providers