Results 1 to 10 of 10

Thread: Application Signing

  1. #1
    Join Date
    Oct 2012
    Posts
    27
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Application Signing

    How to run the exe.file automatically running with administrative priviledges?


    Added after 1 21 minutes:


    Sorry, maybe I was not so clear.

    I'm developing a software installable and I need some IO operations to detect devices(drives). I cannot detect without running as admin.

    So I have some option to run my application with administrator privileges?

    Thanks
    Last edited by kiboi; 11th October 2012 at 09:03.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Application Signing

    Assuming you mean Windows... then you want to set the
    Qt Code:
    1. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    2. <security>
    3. <requestedPrivileges>
    4. <requestedExecutionLevel
    5. level="asInvoker"
    6. uiAccess="false"/>
    7. </requestedPrivileges>
    8. </security>
    9. </trustInfo>
    To copy to clipboard, switch view to plain text mode 
    part of your application manifest to level="requireAdministrator"

  3. #3
    Join Date
    Oct 2012
    Posts
    27
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Application Signing

    Thanks Chris. Where can we find the application manifest?

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Application Signing

    A manifest is an XML file that is included in your program Windows resources.

    If you are using the Microsoft tools then one is generated, placed in the release/debug folder with your program, and merged into your executable using the Microsoft MT.exe program. You can influence its content with linker switches, so the easiest way to achieve what you want is this in your PRO file:
    Qt Code:
    1. win32-msvc* {
    2. CONFIG += embed_manifest_exe
    3. QMAKE_LFLAGS_WINDOWS += $$quote( /MANIFESTUAC:\"level=\'requireAdministrator\' uiAccess=\'false\'\" )
    4. # Yes! All the backslashes and quotes are required!
    5. }
    To copy to clipboard, switch view to plain text mode 

    If you are using MingW you have to provide the manifest XML file yourself, incorporate it in to your Windows RC file, and list that in the RC_FILES varaible in your PRO file.

  5. #5
    Join Date
    Oct 2012
    Posts
    27
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Application Signing

    Thanks chris. this helps. Btw, is there a difference if i'll be using a mingw compiler?

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Application Signing

    Look at last sentence of Chris's post.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Oct 2012
    Posts
    27
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Application Signing

    sorry for that. i missed that line. thanks!

  8. #8
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Application Signing

    A basic manifest looks like:
    Qt Code:
    1. <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    2. <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    3. <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="kiboi.coolapp" type="win32" />
    4. <description>Kiboi Cool Application</description>
    5.  
    6. <dependency />
    7.  
    8. <!-- Identify the application security requirements. -->
    9. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    10. <security>
    11. <requestedPrivileges>
    12. <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
    13. </requestedPrivileges>
    14. </security>
    15. </trustInfo>
    16. </assembly>
    To copy to clipboard, switch view to plain text mode 
    and it appears in your Windows resource (*.RC) file thus:
    Qt Code:
    1. #include <windows.h>
    2. ID_ICON ICON DISCARDABLE "coolapp.ico"
    3. CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "coolapp.exe.manifest"
    4. ...
    To copy to clipboard, switch view to plain text mode 
    and is incorporated through your PRO file thus:
    Qt Code:
    1. ...
    2. RC_FILE = coolapp.rc
    3. ...
    To copy to clipboard, switch view to plain text mode 

  9. #9
    Join Date
    Oct 2012
    Posts
    27
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Application Signing

    hi chris,

    I tried to add this on the PRO Files, cleaned and run qmake, when i open the application manifest,still the manifest level is "asInvoker". other than that, did i missed something?

    Thanks!

  10. #10
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Application Signing

    The manifest is written by you. Did you set the level to requireAdministrator or did you use the default one I gave you above?
    "We can't solve problems by using the same kind of thinking we used when we created them." -- Einstein
    If you are posting code then please use [code] [/code] tags around it - makes addressing the problem easier.

Similar Threads

  1. signing Qt apps for the Mac
    By AndyBrice in forum Installation and Deployment
    Replies: 0
    Last Post: 30th August 2012, 22:03
  2. Replies: 1
    Last Post: 30th May 2011, 13:46
  3. How to signing points on the graph
    By Roman Novoselov in forum Qwt
    Replies: 1
    Last Post: 11th February 2011, 13:57
  4. Digital Signing
    By DiamonDogX in forum Qt Programming
    Replies: 4
    Last Post: 21st May 2009, 22:09
  5. Replies: 0
    Last Post: 9th March 2009, 03:02

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.