Board index » delphi » NT administrator vs power user

NT administrator vs power user

hi,

my application needs to write into the HKLM, as far as I know this is only
allowed under NT when the current user who runs the application has
administrator level.

howerver when my application is run by a user who has Power User level
he/she gets this error:

Failed to set data for event message file

my question is:

I don't mind that this data is not written to the registry when a power user
uses it, but how do I find out if the current user running the program as
Administrator level access ?

so my could would have to look something like this:

If userlevel=administrator level then
begin
  <code writting to HKLM>
end;

but how do I get the user level ?

Regards, Alex

--

Please remove .nospam if you reply by e-mail
----------------------------------------------------------------------
For long you live and high you fly,
And smiles you'll give and tears you'll cry,
And all you touch and all you see,
Is all your life will ever be.
----------------------------------------------------------------------

 

Re:NT administrator vs power user


On 25 May 1999 07:40:11 GMT, "Alex van Kaam"

Quote
<darks...@euronet.nl.nospam> wrote:
>my application needs to write into the HKLM, as far as I know this is only
>allowed under NT when the current user who runs the application has
>administrator level.

>howerver when my application is run by a user who has Power User level
>he/she gets this error:

>Failed to set data for event message file

>my question is:

>I don't mind that this data is not written to the registry when a power user
>uses it, but how do I find out if the current user running the program as
>Administrator level access ?

>so my could would have to look something like this:

>If userlevel=administrator level then
>begin
>  <code writting to HKLM>
>end;

>but how do I get the user level ?

Best approach is to try to write to the registry, and catch the
exception if it fails.  "Only an administrator can write to HKLM" is not
a fast rule in NT, it's just the way the registry permissions are set up
by default.  They can be changed.  The only way to be sure is to try it.

--
"Generally speaking, things have gone about as far as they can possibly
go when things have got about as bad as they reasonably get."

Other Threads