Change a value in registry (hklm/system) as user

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hey Huys, I developed and simply application that just change a key in the
HKLM/System . Its a correction of a software we use here. We put it to run in
the login of all users, but the users that do not have adminstrator
privileges, the software cannot change the key in the registry. I would like
to know if is there a way of run my application as another user... but
automatically...not using "run as.." option, machine by machine...

Thanks..


André.
 
Maximus-br said:
Hey Huys, I developed and simply application that just change a key in the
HKLM/System . Its a correction of a software we use here. We put it to run
in
the login of all users, but the users that do not have adminstrator
privileges, the software cannot change the key in the registry. I would
like
to know if is there a way of run my application as another user... but
automatically...not using "run as.." option, machine by machine...

Do all the machines have the same password for an account with
administrative privileges?

If so, on XP, you can use the sequence

LogonUser();
ImpersonateLoggedOnUser();

// do what you gotta do here

RevertToSelf();

to make the changes in the context of the more privileged account.

Prior to XP, the function LogonUser() required the SE_TCB_NAME privilege
which is typically granted only to administrators so it is not an option
there. You can use SSPI to accomplish the same thing albeit with quite a lot
more work. The technique is described here:

http://support.microsoft.com/?kbid=180548

Regards,
Will
 

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

Back
Top