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. Process privileges elevation on runtime with Win7 UAC?

Process privileges elevation on runtime with Win7 UAC?

Scheduled Pinned Locked Moved C / C++ / MFC
csharpjavacomsecurityjson
6 Posts 4 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
    Moak
    wrote on last edited by
    #1

    Hi, I have a manifest with "asInvoker" privileges, the application will then run under a non-privileged token and no UAC dialog pops up at start. But there is one functionality where the application needs higher privileges later, right now this API call fails with ERROR_ACCESS_DENIED. I would like to change the application so that only for this functionality the UAC dialog pops up.... elevate process privileges for a short time. Apparently you have to create a new process, then perform administrative tasks and return to your first process (MSDN, Stackoverflow). I am new to UAC, there isn't any simpler way? Cheers :)

    Chat in Europe :java: Now with 24% more Twitter

    L _ E 3 Replies Last reply
    0
    • M Moak

      Hi, I have a manifest with "asInvoker" privileges, the application will then run under a non-privileged token and no UAC dialog pops up at start. But there is one functionality where the application needs higher privileges later, right now this API call fails with ERROR_ACCESS_DENIED. I would like to change the application so that only for this functionality the UAC dialog pops up.... elevate process privileges for a short time. Apparently you have to create a new process, then perform administrative tasks and return to your first process (MSDN, Stackoverflow). I am new to UAC, there isn't any simpler way? Cheers :)

      Chat in Europe :java: Now with 24% more Twitter

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

      Moak wrote:

      I am new to UAC, there isn't any simpler way?

      AFAIK, no; not unless you want to run the entire app with admin privileges.

      L u n a t i c F r i n g e

      M 1 Reply Last reply
      0
      • M Moak

        Hi, I have a manifest with "asInvoker" privileges, the application will then run under a non-privileged token and no UAC dialog pops up at start. But there is one functionality where the application needs higher privileges later, right now this API call fails with ERROR_ACCESS_DENIED. I would like to change the application so that only for this functionality the UAC dialog pops up.... elevate process privileges for a short time. Apparently you have to create a new process, then perform administrative tasks and return to your first process (MSDN, Stackoverflow). I am new to UAC, there isn't any simpler way? Cheers :)

        Chat in Europe :java: Now with 24% more Twitter

        _ Offline
        _ Offline
        _Superman_
        wrote on last edited by
        #3

        The execution privilege is associated with a process token. This is the reason why the manifest property is ignored if given to a DLL. So you will either need to run the first process entirely with admin privileges or use a second program like you said.

        «_Superman_»
        I love work. It gives me something to do between weekends.

        Microsoft MVP (Visual C++)

        Polymorphism in C

        1 Reply Last reply
        0
        • M Moak

          Hi, I have a manifest with "asInvoker" privileges, the application will then run under a non-privileged token and no UAC dialog pops up at start. But there is one functionality where the application needs higher privileges later, right now this API call fails with ERROR_ACCESS_DENIED. I would like to change the application so that only for this functionality the UAC dialog pops up.... elevate process privileges for a short time. Apparently you have to create a new process, then perform administrative tasks and return to your first process (MSDN, Stackoverflow). I am new to UAC, there isn't any simpler way? Cheers :)

          Chat in Europe :java: Now with 24% more Twitter

          E Offline
          E Offline
          Eugen Podsypalnikov
          wrote on last edited by
          #4

          It is very comfortable, to let an app run "asInvoker" :) However, it needs a service helper (started by SYSTEM) for the admin calls... Not before (only there) you can call, for example, ::AdjustTokenPrivileges(..) :)

          virtual void BeHappy() = 0;

          M 1 Reply Last reply
          0
          • L Lost User

            Moak wrote:

            I am new to UAC, there isn't any simpler way?

            AFAIK, no; not unless you want to run the entire app with admin privileges.

            L u n a t i c F r i n g e

            M Offline
            M Offline
            Moak
            wrote on last edited by
            #5

            Thanks everyone for their feedback! :)

            Chat in Europe :java: Now with 24% more Twitter

            1 Reply Last reply
            0
            • E Eugen Podsypalnikov

              It is very comfortable, to let an app run "asInvoker" :) However, it needs a service helper (started by SYSTEM) for the admin calls... Not before (only there) you can call, for example, ::AdjustTokenPrivileges(..) :)

              virtual void BeHappy() = 0;

              M Offline
              M Offline
              Moak
              wrote on last edited by
              #6

              I haven't coded my test program yet, from what I read creating another process with ShellExecuteEx and "runas" should do the runtime elevation. Can I ask, what for would I use AdjustTokenPrivileges() in an elevated process?

              Chat in Europe :java: Now with 24% more Twitter

              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