registry issue

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,
i've a requirement to scan the registry keys programatically in a console
application and read the data of the keys..
given a registry key, say,"HKEY_USERS". user should be able to scan the
subkeys of the given key recursively(i.e. all the subkeys of the given
subkeys etcc..) till the last indent level....

i've used a recursion to do so..but it's taking lot of time..
is there any efficient way to acheive it.....
 
Recursion isn't inefficient. It uses more stack than non-recursive methods.
You can always write a recursive method non-recursively. You just have to
store anything that you need to 'recurse' into later somehow. Something
like the following pseudocode:

place rootKey in work queue
while items in work queue
{
extract top item from queue into currentKey and open it

for each subkey of currentKey
add subkey to work queue

for each value under currentKey
display value

close currentKey
}

Paul T.
 
Back
Top