CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2010
    Posts
    172

    Post temporarily gaining admin rights

    Hi

    Codeing Gurus

    Is there any sort of code that can temporarily gain admin rights in a exe

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: temporarily gaining admin rights

    Quote Originally Posted by gaar321 View Post
    Is there any sort of code that can temporarily gain admin rights in a exe
    I hope not, because that would kill the idea behind admin-mode. Right-click the application and use 'run as...' and run it under admin privileges.

  3. #3
    Join Date
    Apr 2010
    Posts
    172

    Re: temporarily gaining admin rights

    i hope so

  4. #4
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: temporarily gaining admin rights

    Presumably if there's a way to do it, a prompt of some kind would be required to get an admin username/password.

  5. #5
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: temporarily gaining admin rights

    Quote Originally Posted by gaar321 View Post
    Is there any sort of code that can temporarily gain admin rights in a exe
    What for?

  6. #6
    Join Date
    Apr 1999
    Posts
    27,449

    Re: temporarily gaining admin rights

    Quote Originally Posted by Andreas Masur View Post
    What for?
    On that note, it seems to be always the ones with little to no posting history that ask these questions.

    Regards,

    Paul McKenzie

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

    Re: temporarily gaining admin rights

    the answer is no.

    an exe cannot elevate itself to admin priviliges

    it can only launch a new exe and request admin priviliges (which will cause the UAC prompt).
    OR
    it can launch a COM component and create this component with elevated priviliges (which will also cause the UAC prompt). The code in the COM component can then use admin stuff, the code in the application using the COM component still can't do admin stuff itself. it can only do so through the interfaces available in the com component.

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