Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 24th May 2001, 09:05   #1
petersa
Senior Member
 
petersa's Avatar
 
Join Date: Apr 2001
Location: Melbourne, Australia
Posts: 207
Is there a way to remove a certain registry key on the condition that it's completely empty?

Say I have this layout:

HKCU\Software\Alex\Program

which is createed on install.

On uninstall, I will DeleteRegKey that key, but I can't delete Alex just in case other programs by this particular author are installed.

And I'd prefer not to leave it there. I personally hate empty keys under Software.
petersa is offline   Reply With Quote
Old 24th May 2001, 16:00   #2
Koen van de Sande
Senior Member
 
Join Date: Mar 2001
Location: Holland
Posts: 269
Don't think so, because DeleteRegKey is recursive nowadays... Don't really like that, there should be an option /r or something which controls this.

Koen van de Sande
Van de Sande Productions
TibEd.net | VPatch
Koen van de Sande is offline   Reply With Quote
Old 24th May 2001, 16:52   #3
snowbird
Junior Member
 
Join Date: Apr 2001
Posts: 13
Hi guys,

I actually suggest such modifications for a few times but never got a response. What is really needed are methods to 1. check if a key contains
a) any values
b) any subkeys
2. retrieve the names of
a) the values
b) the subkeys

Snowbird
snowbird is offline   Reply With Quote
Old 24th May 2001, 18:51   #4
yazno
Member
 
Join Date: Oct 2000
Posts: 92
Send a message via ICQ to yazno
hi,

why don't you just read the keys (ReadRegKey), compare them (StrCmp)and if they aren't empty remove them (DeleteRegKey).

what has that to do with recursive?
if you don't want do delete a special key you don't have to, do you?

cu yzo
yazno is offline   Reply With Quote
Old 25th May 2001, 07:58   #5
petersa
Senior Member
 
petersa's Avatar
 
Join Date: Apr 2001
Location: Melbourne, Australia
Posts: 207
Thanks, yzo, but is there a way to just check if any stuff exists under the key? I couldn't see if something specific is there, because if that specific something isn't there and other stuff is, boom.
petersa is offline   Reply With Quote
Old 25th May 2001, 13:02   #6
yazno
Member
 
Join Date: Oct 2000
Posts: 92
Send a message via ICQ to yazno
hi,

when i remove a key i know what i delete, because i wrote it there, so i know which value i have to read and compare before deleting.

if you aren't sure, why would you want to delete a regkey
which you don't know if it is empty or usefull with your installer?

why don't you use DeleteRegValue instead?

cu yzo
yazno is offline   Reply With Quote
Old 25th May 2001, 13:10   #7
petersa
Senior Member
 
petersa's Avatar
 
Join Date: Apr 2001
Location: Melbourne, Australia
Posts: 207
Okay, well, I install to

HKCU\Software\Alex\ProgramA

and on uninstall, I delete

HKCU\Software\Alex\ProgramA

I would like to be able to also delete

HKCU\Software\Alex

but I can't just in case this user has installed another program:

HKCU\Software\Alex\ProgramB

And I don't particularly wish to leave an empty Alex key behind. I'd prefer a completely clean install.

Snowbird, I agree with you on 1. a) b). But I believe 2. a) b) can be done now.
petersa is offline   Reply With Quote
Old 25th May 2001, 13:18   #8
yazno
Member
 
Join Date: Oct 2000
Posts: 92
Send a message via ICQ to yazno
hi,

if you write a key to HKCU\Software\Alex\ProgramA

you should know other possible keys under HKCU\Software\Alex\ ( 'cause it seems like you were Alex )

HKCU\Software\Alex\ProgramB
HKCU\Software\Alex\ProgramC
HKCU\Software\Alex\ProgramD

so you could check for them, couldn't you?

cu yzo

yazno is offline   Reply With Quote
Old 25th May 2001, 13:29   #9
Koen van de Sande
Senior Member
 
Join Date: Mar 2001
Location: Holland
Posts: 269
But you don't know right now which programs you are going to write in the future, so you don't know the names of ProgramC and ProgramD

Just my idea.

Koen van de Sande
Van de Sande Productions
TibEd.net | VPatch
Koen van de Sande is offline   Reply With Quote
Old 25th May 2001, 13:41   #10
yazno
Member
 
Join Date: Oct 2000
Posts: 92
Send a message via ICQ to yazno
hi,

LOL .. sure.
yeah koen you are right, i didn't think of that .. uhh ..

so ReadRegValues would be quite useful!

cu yzo

yazno is offline   Reply With Quote
Old 26th May 2001, 07:38   #11
snowbird
Junior Member
 
Join Date: Apr 2001
Posts: 13
How do you think it is possible now to discover the names of the values? I don't think this is possible. Maybe I have to be more precise: I want to obtain a list containing all the names of the values/subkeys.

A problem I see here with respect to the implementation is that NSIS doesn't know any list data type. However, the following should be possible to implement:
1. FirstRegValueName HKEY SUBKEY $x
Will retrieve the name of the first value in SUBKEY and write it to $x or throw an error if there is none.
2. NextRegValueName HKEY SUBKEY $x
Will retrieve the next name and write it to $x or throw an error if there is none.

I implemented some C functions to do this, however I never had a look at the NSIS source code, so I don't feel fit to hack this into NSIS. Anyone feeling fit to do so who wants the code, please let me know.

Snowbird
snowbird is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump