I think I'm almost there, but can't figure out how to show the full path+name of each subkey.
For instance, instead of "220\NGen\Policy", I would like to get "SOFTWARE\Microsoft\.NETFramework\NGen\Policy"
Any ideas?
Code: Select all
; note: based on an old snippet by Fred
Procedure RegListKeysRecursive(StartKey, pKeyName$)
Result = ~#ERROR_SUCCESS
If pKeyName$
Result = RegOpenKeyEx_(StartKey, pKeyName$, 0, #KEY_ENUMERATE_SUB_KEYS , @Key )
If Result = #ERROR_SUCCESS
SubKeyName$ = Space(512)
While Result = #ERROR_SUCCESS And Quit = 0
SubKeyLength = 512
Result = RegEnumKeyEx_(Key, SubKeyIndex, SubKeyName$, @SubKeyLength, 0, 0, 0, 0)
SubKeyIndex+1
If Result = #ERROR_NO_MORE_ITEMS
If Len(Trim(SubKeyName$)) > 1
Debug Str(key) + "\"+ pKeyName$ + "\" + SubKeyName$
EndIf
Result = #ERROR_SUCCESS
Quit = 1
ElseIf Result = #ERROR_SUCCESS
If RegListKeysRecursive(Key, SubKeyName$)
Result = #ERROR_SUCCESS;
EndIf
EndIf
Wend
RegCloseKey_(Key)
EndIf
EndIf
If Result = #ERROR_SUCCESS
ProcedureReturn 1
Else
ProcedureReturn 0
EndIf
EndProcedure
; Test
;
RegListKeysRecursive(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\.NETFramework")