Results 1 to 7 of 7

Thread: QProcess and Vista UAC

  1. #1
    Join Date
    Jan 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QProcess and Vista UAC

    Has anyone got any experience with using QProcess to launch secondary processes under Vista?

    Our app uses QProcess to manage the launching of some installer executables on Windows. I was hoping that it would be possible to run the app as a standard user, and then at the point of launching the installer, have Vista pop up the UAC elevation dialog so that the program can continue. However, this isn't working. The installer launch just fails with Access Denied.

    The installer exe does have the correct manifest embedded which specifies that it needs administrator rights to run.

    Thanks.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess and Vista UAC

    Vista won't launch the UAC elevation dlg automatically. You'll have to tell it in the application manifest.

    Check the attached file. I downloaded it from Microsoft some time ago( Vista fever ).
    Attached Files Attached Files

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess and Vista UAC

    Also check this out. It's not mine, I got it from codeproject. I never used it but it may be of some help to you.

    Here's the link too: http://www.codeproject.com/useritems/VistaElevator.asp
    Attached Files Attached Files
    Last edited by marcel; 16th April 2007 at 12:12.

  4. #4
    Join Date
    Jan 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QProcess and Vista UAC

    Thanks for your answer. I have been through the voluminous MS documentation on the subject and I have embedded the correct manifest requesting admin privileges.

    However, the second link you posted was really useful! I didn't know about the "runas" parameter to ShellExecuteEx. So now I guess the question is whether it's possible to get that behaviour through QProcess or whether I have to drop down to a platform-specific ShellExecuteEx at this point?

  5. #5
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess and Vista UAC

    However, the second link you posted was really useful! I didn't know about the "runas" parameter to ShellExecuteEx. So now I guess the question is whether it's possible to get that behaviour through QProcess or whether I have to drop down to a platform-specific ShellExecuteEx at this point?
    You'll have to use ShellExecuteEx. QProcess is more generic and it does not provide the details of ShellExecuteEx. At least in 4.2.2 - 4.2.3 it doesn't.

    Maybe in 4.3. I didn't get the chance to take a look at 4.3 yet.

    Is your app meant to run on Mac or Linux also? Because if it is, you'll have to use QProcess for Linux/Mac and the Win API on Windows.

    regards

  6. #6
    Join Date
    Jan 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QProcess and Vista UAC

    Actually, I just tried it and it seems I don't even have to use "runas" with ShellExecute. "open" is enough, presumably because I've already embedded a manifest requesting elevation. That makes me wonder why launching it through QProcess doesn't display the elevation dialog too...

  7. #7
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess and Vista UAC

    because QProcess uses CreateProcessW.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.