Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Where to learn about impersonation

Where to learn about impersonation

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++comquestionlearning
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BambooMoon
    wrote on last edited by
    #1

    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

    B 1 Reply Last reply
    0
    • B BambooMoon

      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

      B Offline
      B Offline
      Blake Miller
      wrote on last edited by
      #2

      Any information... Call LogonUser to get token handle. Call ImpersonateLoggedOnUser using the token handle. ...Do your special stuff... Call RevertToSelf to go back to your original identity.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups