Archive: Registery key rights


Registery key rights
I have a problem when creating file associations. If I am in admin user, all the registery keys what NSIS creates gets onlya admin rights. When I go to users with lower user rights the associations doesn't work, because the user doesn't have the rights to read the necessary registery keys.

Is there anyway to get NSIS create those keys with read rights for all useres?


Hi!

Could you post an example?

-Bruno.


This code should be enough. Just do the necessary changes


StrCpy $R0 "jp2" ; file extension
StrCpy $R1 "JP2FILE" ; file type key in registery
StrCpy $R2 "JPEG-2000 Format" ; file type name
StrCpy $R3 '"C:\Program Files\whatever\aplication.exe" "%1"' ; commandline
StrCpy $R4 '"C:\Program Files\whatever\aplication.exe",0' ; icon file and index

WriteRegStr HKLM ".$R0" "" "$R1"
WriteRegStr HKLM "$R1" "" "$R2"
WriteRegStr HKLM "$R1\shell" "" "open"
WriteRegStr HKLM "$R1\shell\open\command" "" '$R3'
WriteRegStr HKLM "$R1\DefaultIcon" "" '$R4'

I also attached the original thingy meant to create XnView association.

Ok. I made some tests with the script.

This was ok. I could create the associations correctly and my guest user on the same system could also use those associations. I use Windows xp.

What's your OS? Did you open your regedit and inspect the keys? Are there only admin rights on the keys? There should be at least administrators with full access and users with read (and some others...).

-Bruno.


I use windows 2000 pro. And I used Sysinternals AccessEnum and regedt32 (regedit doesn't have a function to check the rights in win2k) to check those keys. And the keys haves only admin / system rights for read and write.


Ok, I tried this also with Windows 2000. The behaviour is the same. It works.

It seems, that these rights are not correctly inherited from the parent keys. (On the key "Classes" the group "Users" should give the read permission to the child keys.)

Do you have a virtual maschine or something like that with a fresh Windows 2000 installation?

-Bruno.


I just notice that in my sample above I used HKLM instead of HKCR.

In the thingy, I used first the "HKCR" key for the associations, but when I notice that the associations doesn't work on other users I changed it to "HKLM\SOFTWARE\Classes\", but as you can see that didn't help either. :(

But normally "HKCR" key should be the right place for the associations right?

Do you have a virtual maschine or something like that with a fresh Windows 2000 installation?
No, but I could but I could install the VMware if it even is suitable for tests like this. It will take some time though.

Edit: I tried the thingy in XP and indeed in XP it works, keys gets the rights from the parent keys. I start to think more and more that there is something wrong in my system. :tinfoil:

I just notice that in my sample above I used HKLM instead of HKCR.
Well, it's the same! HKCR is the short way to get into HKLM\Software\Classes.

No, but I could but I could install the VMware if it even is suitable for tests like this. It will take some time though.
You will see: VMWare is great for tests of a setup. You can always get to the original state and can be sure, that the conditions are equal. Every time.

You could use VMWare-Player and the sample of this page: http://www.vmaschinen.de/cgi-bin/vmw...n-100000082815
(Altough the Workstation version is great and worth to consider...)

Edit: I tried the thingy in XP and indeed in XP it works, keys gets the rights from the parent keys. I start to think more and more that there is something wrong in my system. :tinfoil:
Mmmh. Maybe there's something wrong.

Good luck.

-Bruno.

I finally got around this problem. And apparently there was something seriously wrong in my system and NSIS had nothing to do with the problem.

For some wierd reason the permissions just didn't inherited from the parent keys at all, even though there was nothing wrong in the HKCR key permissions or inheriting options. I didn't find out what was causing it until now. Apparently these problems was the first sign of corrupted registery. This week, I got bigger problems with my system and I found out that the registery is corrupted. So I reinstalled the whole system and now the problem is gone along with some other problems I have experienced lately. :)

ps. I tried the VMWare-Player, but I never got into it and I end up to test with another win2k and what didn't have the problem.