Where to learn about impersonation
-
I have a service that runs under the system account, not interacting with the desktop. I want it to be able to do something (use the Service Manager to stop a service on another computer) that apparently requires me to be Administrator. I could run my service as Administrator, but I'd rather not do that since it prevents me from changing my mind and making it interact with the desktop, at least for debugging. Where can I go to learn how my service can impersonate Administrator (the service has access to the login information) while interacting with the Service Manager? I'd appreciate any information. This service is implemented in MFC. Using C# is not an option, nor is learning a lot of COM. Thanks
-
I have a service that runs under the system account, not interacting with the desktop. I want it to be able to do something (use the Service Manager to stop a service on another computer) that apparently requires me to be Administrator. I could run my service as Administrator, but I'd rather not do that since it prevents me from changing my mind and making it interact with the desktop, at least for debugging. Where can I go to learn how my service can impersonate Administrator (the service has access to the login information) while interacting with the Service Manager? I'd appreciate any information. This service is implemented in MFC. Using C# is not an option, nor is learning a lot of COM. Thanks
Any information... Call
LogonUser
to get token handle. CallImpersonateLoggedOnUser
using the token handle. ...Do your special stuff... CallRevertToSelf
to go back to your original identity.