Valentina problem with a limited user on Windows XP

Joakim Schramm joakim at astrocalc.com
Sat Dec 2 13:46:52 CST 2006


 
> 
> So it is not an issue of LOCATION of this file, but issue of 
> permission or a file.
> 

Actually I think it's both. On XP (and Vista probably) you can't (if it
should work)/shouldn't place files under C:\Program Files that the user will
write to, like configuration files, documents and probably database files
(as then need to be writable), they should be put in My Documents or
Aplication Data, either user specific or the Common (All User) variation of
them if files need to be shared.

It's easy to overlook this as a developer as you usually run either as Admin
or Power User. This is what can happen, if you as Admin or Super user touch
any of these files, the normal user can no longer write to them. So "moving"
them as Admin wont work, unless you afterwards also set permistion back.
Such operations should be done by installers only.

I use this scenarion, I install such files to Common Application Data, then
when user starts program I check if needed dirs/files exist in user area and
if not create and copy files from Common App to User App/Document folder
(under my branding name). This way you can safely install as admin and limed
user can then run w/o problem.

A way around this is of course to let user install from own account (not
admin), but you still need to install writable files to App data and
Documents folder to be safe. However, most programs need Admin to install,
for various reasons, and it's also how it's ment to be and layouted by
Microsoft. Similar thing apply to Registry. I think this sceenarion is even
worse in Vista. This  is from a forum in other developer product I am
registered with, as it's a private forum I have xxx/yyy any names:

/Joakim

    xxxx wrote 30 Nov 2006 2:59:07
    so does this mean that in Vista you DO need special rights to use the
HKLM keys?
    My software is being used on a per-computer basis: it is used at
university and different people login at that computer, so I chose to use
HKLM. Does this mean this won't work anymore in Vista?



I can't answer for xxxx but here's the general changes that are likely to
break your software on Vista....

All users are limited users. Those marked as Administrators run as limited
users until something says it needs admin rights. When this happens you get
an anoying box to click on and your access rights are temporarily raised.

Setup programs do this by default. So if you are setting HKLM values in your
setup script it will be OK.

HKLM can be read by all users, as before.

HKLM cannot be written to, as before, by limited users. But now, all users
are limited users.

Just to add to confusion, if you add a manifest to your software to say you
are Vista compatible, HKLM becomes virtualised. Now you CAN write to it from
a normal user, but not really. It gets written to a virtual area in HKCU
instead. So now all your users see a different value when reading and
writing to HKLM!

Regards,

yyyy



More information about the Valentina mailing list