CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Location
    MD
    Posts
    44

    running/debugging console app that needs admin privileges

    I see there's something called a manifest file but VS C++ EXPRESS seems different than non-express. The solutions I've seen show applets/tabs that I don't have in Express.

    In one of my physical DEBUG folders are some .manifest. files and some a .res and .rc file.

    I know you need to edit the XML and change asInvoker to requiredAdministrator (or something like that).

    The confusing part is if I go into Project Properties, MANIFEST TOOL caret/tree, under INPUT AND OUTPUT, it shows this .manifest file is OUTPUT. It's as if it rewrites it every time with some defaults? I have edited it, but I see it's back to asInvoker. There is a spot to put in a ADDITIONAL manifest file (or .res file).

    Does a manifest somehow affect the physical .exe file (something is imbedded in it??)?

    How do I change my project to make sure that the .exe always runs as Admin? Will doing this ALSO allow me to DEBUG it in VS C++ EXPRESS without having to do anything different (play with manifest or run VS outright with Admin level)?

  2. #2
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: running/debugging console app that needs admin privileges

    the manifest is indeed created as part of the build process with VS2010/VS2012 this wasn't always the case.

    If you need explicit settings in the manifest, you either use the UI to change the required settings, or you provide your manifest fragment for inclusion a handfull of settings can be arranged via a compile time #pragma.

    In rare cases you need to disable the manifest builder and just do it all yourself.




    changing the UAC level can be done from the UI.
    Open the project properties. Configuration Properties > Linker > Manifest File.
    Change UAC Execution level to the desired value.
    Last edited by OReubens; November 5th, 2012 at 09:10 AM.

  3. #3
    Join Date
    Feb 2012
    Location
    MD
    Posts
    44

    Re: running/debugging console app that needs admin privileges

    Quote Originally Posted by OReubens View Post
    the manifest is indeed created as part of the build process with VS2010/VS2012 this wasn't always the case.

    If you need explicit settings in the manifest, you either use the UI to change the required settings, or you provide your manifest fragment for inclusion a handfull of settings can be arranged via a compile time #pragma.

    In rare cases you need to disable the manifest builder and just do it all yourself.




    changing the UAC level can be done from the UI.
    Open the project properties. Configuration Properties > Linker > Manifest File.
    Change UAC Execution level to the desired value.
    Wicked. So, if I change the Linker > Manifest file to be the privilege level I desire, does that get imbeded in the .exe?

    OK. Yes and no. If I now open a non-admin CMD prompt and run the .exe, I get the UAC popup and it opens a NEW CMD window (elevated) which closes out as soon as the program is done. Not totally useful to me to be able to see the output. Also, if I try to debug it now, I get a popup to restart VS Express as admin. Kind of defeats the purpose to some degree.
    Last edited by jlewand61; November 6th, 2012 at 07:53 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured