|
|
|
|
#1 |
|
Member
Join Date: Jul 2015
Posts: 62
|
Enumeration weird behaviour
Hi everyone!
I am seeing this really weird behavior when using an enumeration. Maybe a second pair of eyes will see what wrong I am doing. So I am basically looping through a registry and if I find the key I am looking for I delete it. When I run the below script to just show me what keys match(say there are 2), it works perfectly fine. The message box shows up twice with the correct key that I am looking for. Now when I uncomment the line where it actually deletes the key, it only deletes one of the keys and exits out. I have tried all sorts of debugging with message boxes, but I am not able to figure out why it would not delete both the keys. loop: EnumRegKey $1 HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall $0 StrCmp $1 "" done ${StrContains} $R1 "MyString" "$1" StrCmp $R1 "" notfound StrCpy $regKeyDelete $1 MessageBox MB_OK 'Found string $regKeyDelete' ;DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$regKeyDelete" notfound: IntOp $0 $0 + 1 goto loop done: |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
Reset the index $0 to 0 every time you delete a key. The order of enumerated keys is not documented in Windows.
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#3 |
|
Member
Join Date: Jul 2015
Posts: 62
|
Awesome!! thanks Anders!!
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|