Sub getvals(hkey As Long, strpath As String, sk As Variant)
Dim strkeypath As String, subkey As Variant, arrsubkeys As Variant, arrvalues As Variant
Dim strvalue As Variant, arrvals As Variant, i As Integer, arrtypes As Variant, v As Integer
DoEvents
strkeypath = strpath
If Not Len(sk) = 0 And Not Len(strpath) = 0 Then strkeypath = strpath & "\"
strkeypath = strkeypath & sk
oreg.enumvalues hkey, strkeypath, arrvalues, arrtypes
' Debug.Print strkeypath & "\" & subkey
If Not IsNull(arrvalues) Then
ReDim Preserve regd(UBound(regd) + UBound(arrvalues) + 2)
For i = 0 To UBound(arrvalues)
strvalue = vbNullString
Select Case arrtypes(i)
Case REG_SZ: oreg.getstringvalue hkey, strkeypath & "\" & subkey, arrvalues(i), strvalue
Case REG_DWORD: oreg.GetDWORDValue hkey, strkeypath & "\" & subkey, arrvalues(i), strvalue
Case REG_BINARY
oreg.getbinaryvalue hkey, strkeypath & "\" & subkey, arrvalues(i), strvalue
For v = 0 To UBound(strvalue)
strvalue(v) = Format(Hex(strvalue(v)), "00")
Next
strvalue = Join(strvalue, ",")
Case REG_EXPAND_SZ: oreg.GetExpandedStringValue hkey, strkeypath & "\" & subkey, arrvalues(i), strvalue
Case REG_MULTI_SZ
oreg.GetMultiStringValue hkey, strkeypath & "\" & subkey, arrvalues(i), arrvals
strvalue = Join(arrvals, vbNewLine & String(6, vbTab))
End Select
regd(j).strKeyName = strkeypath & "\" & subkey
regd(j).strValueName = arrvalues(i)
regd(j).strData = strvalue & ""
j = j + 1
' Debug.Print vbTab & vbTab & vbTab & arrvalues(i) & " = " & strvalue
' or print to form or whatever
' for speed considerations should be stored to memory (variable) and written to whatever in sections, trying to read the entire registry into memory may or may not be possible, depending on machine configuration
Next
Else
oreg.getstringvalue hkey, strkeypath & "\" & subkey, "", strvalue, arrtypes
If j > UBound(regd) Then ReDim Preserve regd(j)
regd(j).strKeyName = strkeypath & "\" & subkey
regd(j).strValueName = "@"
regd(j).strData = strvalue & ""
j = j + 1
End If
oreg.EnumKey hkey, strkeypath, arrsubkeys
If Not IsNull(arrsubkeys) Then
For Each subkey In arrsubkeys
getvals hkey, strkeypath, subkey
Next
End If
End Sub