Re: Privileges
From: Allen Jones (agj_at_bigfoot.com)
Date: 07/15/03
- Next message: Luca Caruso: "client certificate"
- Previous message: joe: "Privileges"
- In reply to: joe: "Privileges"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Tue, 15 Jul 2003 07:02:07 +0100
Joe,
The obvious answer that springs to mind is to run the app as a user that has
the necessary privilege. If you havent got privilege to shutdown, you are
unlikely to have the privilege to start messing with privilegese at runtime.
Right?
If you dont want to run as the correct user permenantly, you can impersonate
the correct user in order to shutdown, but you would need to provide some
mechanism of supplying the user's password to the framework. Check out
WindowsIdentity.Impersonate().
Regards
Allen
"joe" <j_sm2000@hotmail.com> wrote in message
news:0bc701c34a66$df567250$a001280a@phx.gbl...
> Hi,
>
> I wanted to reboot the system (WinXP, administrator
> rights) from my .NET app(C#) so I tried first to do it
> with Win API-InitiateSystemShutdown (it looked
> straightforward). But I got an error "Access denied". To
> be able to execute this function I have to call
> AdjustPrivileges from .NET to adjust the access token. But
> this is rather messy because this function's parameters
> are not simple DWORDs or HANDLEs. So I was wondering if
> there was an easier way to do it from the framework.
>
> Thank you
- Next message: Luca Caruso: "client certificate"
- Previous message: joe: "Privileges"
- In reply to: joe: "Privileges"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]