|
|
|
|
#1 |
|
Junior Member
|
Hkey_current_user
In my app, I store registry values in HKEY_CURRENT_USER. When I uninstall my app, how do I make sure to delete all those values? If the user uninstalls under a different username than he ran the app, then some registry values would be left behind. Putting values in HKEY_CURRENT_USER is common enough, so NSIS must have some easy way to delete them
|
|
|
|
|
|
#2 |
|
Member
Join Date: Nov 2001
Location: Dresden, Germany
Posts: 97
|
I think HKCU is intended to be for the current user and as far as I know the current user do not have any access to the registry tree of the others (maybe by HKU but I don't know how).
To give all users the opportunity to uninstall your app properly you could write your registry settings to HKLM like NSIS does it. ~ Florian |
|
|
|
|
|
#3 |
|
Junior Member
|
Using HKCU makes things easier for me
![]() Here's how I fixed it: I just put the following in my app's (WulframPoller) Uninstall section: IntOp $0 0 + 0 EnumStart: EnumRegKey $R1 HKEY_USERS "" $0 IntOp $0 $0 + 1 StrCmp $R1 ".DEFAULT" EnumStart StrCmp $R1 "" EnumEnd DeleteRegValue HKU "$R1\Software\Microsoft\Windows\CurrentVersion\Run" "WulframPoller" DeleteRegKey HKU "$R1\Software\Wulfram Poller" Goto EnumStart EnumEnd: Probably could be done in a more efficient way, but it gets the job done
|
|
|
|
|
|
#4 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
I don't know of any way to delete for every CU there is... What I have done in my app was to create an uninsatller for every user.
This code is located in my user installer. It causes two uninsallers to display in the Add/Remove control panel, one of the program it self, and one for the user's settings. code: KiCHiK |
|
|
|
|
|
#5 |
|
Junior Member
|
The way I did *should* delete for every user, if I'm understanding the Registry correctly
|
|
|
|
|
|
#6 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
I must say your way is much better than mine!
Good work. Live and learn
|
|
|
|
|
|
#7 |
|
Registered User
Join Date: Jan 2002
Posts: 30
|
Thanks for the info. IGx89 - this is a very useful registry tip/scriptlet.
![]() I never would have guessed this would work since when I fire up my registry editor I only see data for the current user in HKEY_USERS... Just to clarify though: even though I can't see the data (via regedit) for the other profiles, I can still delete it? And it'll work in 9x and NT? (I'll test it out when I can, but external affirmation is soooo comforting )
|
|
|
|
|
|
#8 |
|
Junior Member
|
HKEY_CURRENT_USER (HKCU) is only the info for the current user. HKEY_USERS has a list of username keys, under which is the contents of HKCU. Basically, HKCU is a quick, no-hassle shortcut to the current user's info under HKEY_USERS. Hope I'm clear enough
![]() As for working under W9x/NT, it's worked fine for me under W98. I tested NT4, and it seemed to work fine, though I didn't test it too much. It *should* work just fine, since it seems to use HKCU and HKU the same way as W98. |
|
|
|
|
|
#9 |
|
Registered User
Join Date: Jan 2002
Posts: 30
|
Thanks for the info. - I thought HKCU was kind of a shortcut/minor of info. for the current user that's stored elsewhere in the registry. I think a fair bit of the registry keys are linked/mirrored in that fashion.
Glad to hear it works on 98 and NT4 - I can't wait to wrap up upgrading to 1.95 myself and begin testing my installer. ![]() Ahh, the soothing tedium of repetitive installation testing... ![]() Thanks again IGx89.
|
|
|
|
|
|
#10 | |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
I am not sure about Windows 9x but on NT HKEY_USERS only holds the logged on users and the default user.
Quote:
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
|
#11 |
|
Junior Member
|
It took you that long to reply?
![]()
|
|
|
|
|
|
#12 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
Someone refered to this post, from another post and when I read it again I saw that it's wrong. Better late than never
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#13 |
|
Registered User
Join Date: Jan 2002
Posts: 30
|
It certainly makes sense from a 'security' point of view that other user's registry entries are unavailable under HKEY_USERS in NT.
![]() I don't have 9x anymore, but I think I tested it on there and managed to delete keys from other profiles. |
|
|
|
|
|
#14 | |
|
Junior Member
Join Date: Oct 2005
Posts: 19
|
Quote:
But on my systems (2000/XP) I see only the ".DEFAULT" key and the key (SID?) for the current user on the hive "HKEY_USERS". No matter if I logged on as admin or user. So for this reason the enumeration stops after deleting the keys for the current user. Any idea about what's wrong with my system? BTW: Writing application settings to the ".DEFAULT" key to prepare the system for new users has no effect. If I add a new user he never gets this setting. I am completely helpless
|
|
|
|
|
|
|
#15 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
Nothing is wrong on your computer, that's how it works. You can use EnumUsersReg to load the users' hives manually.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#16 | |
|
Junior Member
Join Date: Oct 2005
Posts: 19
|
Quote:
That's what I was looking for. Allow me still two further questions: Is there an easy way to call this functions in uninstall section without copying them and adding the un. prefix to the function name? The hive "HKU\.DEFAULT" does not work as I had expected. If I add a new user to my system he does not get the settings I wrote to "HKU\.DEFAULT" at installation time. Any suggestion how to ad this for new users? Mikesch |
|
|
|
|
|
|
#17 |
|
Junior Member
Join Date: Nov 2005
Posts: 13
|
Has anybody thought about the fact that, if the user who is running the uninstaller doesn't have administrative rights, the installer won't be able to delete the registry values of the other users?
Greetings, Fretje |
|
|
|
|
|
#18 | |
|
Junior Member
Join Date: Oct 2005
Posts: 19
|
Quote:
I need the above behaviour for the case of installing my application as an administrator for all users. If a normal user installs my application he does this only for itself and does not affects any other user settings. In this moment I work on my uninstaller section to prevent uninstalling by the user if the application was installed by an administrator. Mikesch |
|
|
|
|
|
|
#19 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
You can put the functions in a macro and insert once for the installer and once for the uninstaller.
I don't know why HKU\.DEFAULT doesn't work.code: NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#20 |
|
Senior Member
Join Date: Mar 2004
Location: Germany, Paderborn
Posts: 177
|
IIRC: HKEY_CURRENT_USER can be roaming in Windows networks using a domain controller. Therefore I think it's a bad idea to delete those data for all/other users. HKEY_CURRENT_USER should only contain user settings. Because you cannot know how many network computers (0 or more) have your software installed I would let that data alone. Giving some option to uninstall user settings for the current user may be ok. Or you may give each user the possibility to remove that data by some small uninstall_userdata.exe/regclean.exe separately (an admin could push this to something logon.bat if he wants to clear the whole network).
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|