Archive: Registry Search - How to end search ???


Registry Search - How to end search ???
  I am using Instructor's Registry NSIS plugin v3.1 to perform search for all registry keys containing "VC6MYKEY":


DeleteAllRegKeysContaining_VC6MYKEY

${registry::Open} "HKEY_LOCAL_MACHINE\\SYSTEM" "/K=1 /V=0 /S=0 /B=1 /NI='VC6MYKEY'" $0
StrCmp$0 0 0 L_LOOP
MessageBox MB_OK"Error" IDOK L_CLOSE

L_LOOP:
${
registry::Find} "$0" $1 $2 $3 $4 # path, value/key, string, type
StrCmp $2 "" 0 L_VERIFYSUBSTRING
MessageBox MB_OK"First registry::Find $0 empty??? ($1,$2,$3,$4)" IDOK L_CLOSE

L_VERIFYSUBSTRING:
Push $2 # (longer) string to be searched
Push "VC6MYKEY" # what to search for
Call un.StrStr
Pop $R0 # $R0 at this point starts with VC6MYKEY

StrCmp $R0 "" L_LOOP 0
DetailPrint "Delete registry key: $1\$2"
DeleteRegKey HKLM "$1\$2"
goto L_LOOP

L_CLOSE:
${registry::Close} "$0"
${registry::Unload}
>FunctionEnd
>
It does find those keys correctly, but if I want to end the search by the first return of an empty string ($2==""), I can't because... ${registry::Find} returns such empty string beore finding the first occurrence of "VC6MYKEY".

So... I may be able to understand how ${registry::Find} behaves ("every call returns, but if not found, it will return all for vars $1 $2 $3 $4 with empty strings"), but that doesn't help solve the problem that I am facing:

I need to find (and delete) all occurrences of "VC6MYKEY" under HKEY_LOCAL_MACHINE\SYSTEM.

To further clarify, all I really need is some indication that I reached "the end of the registry". For example, I tried the following test:


  L_LOOP:

${
registry::Find} "$0" $1 $2 $3 $4 # path, value/key, string, type
StrCmp $2 "" L_LOOP L_PRINTFOUND

L_PRINTFOUND:
DetailPrint "Delete registry key: $1\$2"
goto L_LOOP
>
but it gets stuck in endless loop.

Is there a solution to this problem?

Thanks,
Victor

http://forums.winamp.com/showthread....94#post2208894


Originally posted by Instructor
http://forums.winamp.com/showthread....94#post2208894
Instructor, thank you very much!

I wish version 3.2 was there a few weeks ago, when I downloaded the plugin.

At the moment, my project schedule takes me elsewhere. I will check the latest version and report back the results as soon as I can.

Thanks again,
Victor