Elevating UAC privileges within a process in Vista RRS feed

  • Question

  • Hello,

    I have an application that requires admin privileges for a single operation (a write to HKLM\Software once at launch).  From the documentation I've read it seems I have two options:

    1.  specify requireAdministrator in the manifest

    2.  Move the function that requires admin rights to a separate .exe or COM and call it from within the main app via ShellExecuteEx()

    I've tried option 1 and it works, but I don't want to require the entire app to be run as administrator for an operation that happens once at launch. Before I go down the option 2 path I wanted to know if there is any way to programatically elevate an application's privileges after it's already running and then revert them once the admin operation is complete.

    Thanks in advance for any info.

    Friday, July 13, 2007 11:36 PM