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. startService from non-admin account

startService from non-admin account

Scheduled Pinned Locked Moved C / C++ / MFC
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.
  • M Offline
    M Offline
    Musen80
    wrote on last edited by
    #1

    Hi! I have an application that starts a service application when it starts. This works when I start the application in an admin account, but if I run the program in a non-admin account I'am not able to start the service with the method StartService(). Here is my code: void startmyService() { SC_HANDLE myManager; SC_HANDLE myService; myManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); myService = OpenService(myManager, "myService app", SERVICE_ALL_ACCESS); if (myService == NULL) { return false; } if (!StartService(myService,0,NULL)) { return false; } CloseServiceHandle(myService); return true; }

    B 1 Reply Last reply
    0
    • M Musen80

      Hi! I have an application that starts a service application when it starts. This works when I start the application in an admin account, but if I run the program in a non-admin account I'am not able to start the service with the method StartService(). Here is my code: void startmyService() { SC_HANDLE myManager; SC_HANDLE myService; myManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); myService = OpenService(myManager, "myService app", SERVICE_ALL_ACCESS); if (myService == NULL) { return false; } if (!StartService(myService,0,NULL)) { return false; } CloseServiceHandle(myService); return true; }

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

      Your account does not have the privilege to start a service. Impersonate an account that has the privilege and then RevertToSelf when done.

      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