app data in HKEY_LOCAL_MACHINE

  • Thread starter =?iso-8859-15?Q?Jens_M=FCller?=
  • Start date
?

=?iso-8859-15?Q?Jens_M=FCller?=

Hell,

I write an app that stores data for all users into the
HKEY_LOCAL_MACHINE\Software\... path. In Vista, somehow the data is
stored but not visible in regedit under this path. What happens to it?

Also, I used to let it run for all users with the
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run entry.
This seems not to work any more. What can I do here to start an app for
all users?

Thanks,
Jens
 
G

Guest

You will need to inspect the token used to launch the app. Specificallly, you
need to enumerate token groups and find out if the Administrator's group is
present and not set to deny only. If so, you can write to HKLM. If not, you
need to write elsewhere.
 
P

Phil Wilson

IIRC, the IsUserAnAdmin API returns the right answer, true if you're
elevated, false otherwise. In .NET, I suspect that WindowsPrincipal.IsInRole
("Administrators") does the right thing, although I haven't tested that one.
 
G

Guest

I don't think that will work. The problem is that in Vista you have admins
that are currently admins, and admins that can become admins by accepting a
UAC dialog. The IsUserAnAdmin API does not distinguish between the two.

Phil Wilson said:
IIRC, the IsUserAnAdmin API returns the right answer, true if you're
elevated, false otherwise. In .NET, I suspect that WindowsPrincipal.IsInRole
("Administrators") does the right thing, although I haven't tested that one.
--
Phil Wilson
[Microsoft MVP Windows Installer]

Jens Müller said:
Hello,


Ok thanks. Now I have the problem that sometimes my app is run as
administrator and sometimes not. Both times, the values that are read from
the registry are different.

How can I find out if my app has full rights or not?

Thanks,
Jens
 
G

Guest

I don't think that will work. The problem is that in Vista you have
admins that are currently admins, and admins that can become admins
by accepting a UAC dialog. The IsUserAnAdmin API does not distinguish
between the two.

That's ecactly the issue. Thanks anyway.
Jens
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top