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. Running a process as Administrator in Vista, Windows 2008?

Running a process as Administrator in Vista, Windows 2008?

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 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.
  • K Offline
    K Offline
    Kushagra Tiwari
    wrote on last edited by
    #1

    Hello all , As windows Vista and windows 2008 have all come with an option of "Run as Administrator", Is there some way to programmatically invoke some executable so as it could be invoked as 'Administrator' ? Regards, Kushagra

    L 1 Reply Last reply
    0
    • K Kushagra Tiwari

      Hello all , As windows Vista and windows 2008 have all come with an option of "Run as Administrator", Is there some way to programmatically invoke some executable so as it could be invoked as 'Administrator' ? Regards, Kushagra

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Hi Kushagra, You should investigate the CreateProcessAsUser Function[^]. You may also be interested in this Microsoft help and support article: CreateProcessAsUser() windowstations and desktops[^] P.S. Have you finally decided to follow my recommendations[^] for delaying the windows shutdown? [Update] I based my answer on prior knowledge of the windows service project you have been working on. For the sake of completeness a process can also be elevated by adding the _T("runas") verb. Redesign for UAC Compatibility (UAC)[^] Best Wishes, -David Delaune

      K 1 Reply Last reply
      0
      • L Lost User

        Hi Kushagra, You should investigate the CreateProcessAsUser Function[^]. You may also be interested in this Microsoft help and support article: CreateProcessAsUser() windowstations and desktops[^] P.S. Have you finally decided to follow my recommendations[^] for delaying the windows shutdown? [Update] I based my answer on prior knowledge of the windows service project you have been working on. For the sake of completeness a process can also be elevated by adding the _T("runas") verb. Redesign for UAC Compatibility (UAC)[^] Best Wishes, -David Delaune

        K Offline
        K Offline
        Kushagra Tiwari
        wrote on last edited by
        #3

        Randor wrote:

        support article: CreateProcessAsUser() windowstations and desktops[^] P.S. Have you finally decided to follow my recommendations[^] for delaying the windows shutdown?

        Hey Randor, Its gr8 to hear from u again, CreateProcessAsUser is what I am looking into, but what I need is some way to elevate permissions of my executable as soon as it is invoked. and yes I was successful in delaying shutdown by creating a service and handling SERVICE_CONTROL_SHUTDOWN . Your suggestion helped me a lot :). Thanks for always showing the way. Kushagra

        L 1 Reply Last reply
        0
        • K Kushagra Tiwari

          Randor wrote:

          support article: CreateProcessAsUser() windowstations and desktops[^] P.S. Have you finally decided to follow my recommendations[^] for delaying the windows shutdown?

          Hey Randor, Its gr8 to hear from u again, CreateProcessAsUser is what I am looking into, but what I need is some way to elevate permissions of my executable as soon as it is invoked. and yes I was successful in delaying shutdown by creating a service and handling SERVICE_CONTROL_SHUTDOWN . Your suggestion helped me a lot :). Thanks for always showing the way. Kushagra

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Hi Kushagra, I should have given a more complete answer. I assumed that you were still working on that windows service. The following MSDN article addresses elevation from a standard windows application. Redesign for UAC Compatibility (UAC)[^] Best Wishes, -David Delaune

          K 1 Reply Last reply
          0
          • L Lost User

            Hi Kushagra, I should have given a more complete answer. I assumed that you were still working on that windows service. The following MSDN article addresses elevation from a standard windows application. Redesign for UAC Compatibility (UAC)[^] Best Wishes, -David Delaune

            K Offline
            K Offline
            Kushagra Tiwari
            wrote on last edited by
            #5

            Thank you :) I am now looking at it

            K 1 Reply Last reply
            0
            • K Kushagra Tiwari

              Thank you :) I am now looking at it

              K Offline
              K Offline
              Kushagra Tiwari
              wrote on last edited by
              #6

              Can I include some thing in my code to make the application run as Administrator every time when it starts ? Or could I make any other application which when invoked starts my executable to runas Administrator ???All this I have to do in VISTA and WINDOWS 2008 as UAC always comes into picture .. :( Kushagra

              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