registry issue

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.....
 
P

Paul G. Tobey [eMVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top