Archive: My function (restore file assoc when uninstall) not work well in Win9x


My function (restore file assoc when uninstall) not work well in Win9x
These is my function called in Uninstall section

Function un.Restore
Push $R0
Push $R1
Push $R2
StrCpy $R0 0
loop:
EnumRegKey $R1 HKCR "" $R0
StrCmp $R1 "" loop2_quit
StrCpy $R2 $R1 1
StrCmp $R2 "." loop2
IntOp $R0 $R0 + 1
Goto loop
loop2:
EnumRegKey $R1 HKCR "" $R0
StrCmp $R1 "" loop2_quit
StrCpy $R2 $R1 1
StrCmp $R2 "." 0 loop2_quit
ReadRegStr $R2 HKCR "$R1" "Winamp_Back"
StrCmp $R2 "" +3
WriteRegStr HKCR "$R1" "" "$R2"
DeleteRegValue HKCR "$R1" "Winamp_Back"
IntOp $R0 $R0 + 1
Goto loop2
loop2_quit:
DeleteRegKey HKCR "Winamp.File"
DeleteRegKey HKCR "Winamp.Playlist"
DeleteRegKey HKCR "Winamp.SkinZip"
Pop $R2
Pop $R1
Pop $R0
FunctionEnd

It work well in 2k/xp/2k3,but always lost some key in Win98/me. What wrong for me? or it is a bug?


EnumRegKey can give back keys in a random order. It looks like your function expects them to be sorted.


Check out my File Association page on the archive. It shows how to backup and restore file associations and it works with all Windows versions AFAIK.

Vytautas


Hi Vytautas£¬I have read your File Association ,but Winamp have associated a lots of files,so I want to make a loop to check if Winamp_Back value exist.And then restore the value to default key.
In my function it alwaya lost some key (not check). How can I use a loop to restore file association?

to:eccles
Why EnumRegKey give back keys in a random order?And EnumRegValue?


Because Microsoft says so :)

The NSIS function just uses the following Windows function:

http://msdn.microsoft.com/library/de...regenumkey.asp

Look at the description of dwIndex.