PDA

View Full Version : How to add "UAC execution level" for VC++ project using qmake ?



vsthakur1
24th October 2012, 00:13
I am new to Qt.
In windows environment, I am generating a .vcproj file using “qmake” (qmake -tp vc abc.proj). Once the project file is created, using Visual Studio, I need to change the configuration for “UAC Execution Level” in the Linker option of “Manifest File”. I tried various options but none worked.
[1]win32 {
CONFIG += embed_manifest_exe
QMAKE_LFLAGS_WINDOWS += /MANIFESTUAC:level=\'requireAdministrator\'
}

[2]QMAKE_LFLAGS_WINDOWS += /MANIFESTUAC:\"level=\'requireAdministrator\' uiAccess=\'false\'\"
[3]QMAKE_LFLAGS_WINDOWS += "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\""
[4]QMAKE_LFLAGS_WINDOWS += /MANIFESTUAC:level=\'requireAdministrator\' uiAccess=\'false\'


I am using Qt 4.8.3

ChrisW67
24th October 2012, 06:46
http://www.qtcentre.org/threads/51502-Application-Signing?p=231019#post231019

vsthakur1
25th October 2012, 00:54
Thanks Chris,
For some strange reason, it did not work for me.
I am using Qt library 4.8.3. Does it make any difference ? I am using Visual Studio 2008.
Let me tell you what I did.
I added the following lines in my ".pro" file (at the end of the file) and build it with "qmake -tp cp abc.pro"
******
win32-msvc* {
CONFIG += embed_manifest_exe
QMAKE_LFLAGS_WINDOWS += $$quote( /MANIFESTUAC:\"level=\'requireAdministrator\' uiAccess=\'false\'\" )
}

******
When it did not work, I tried using the manifest file. I created one manifest file, added it in ".rc" file (as mentioned as another solution in the same post)and added the RC file entry in ".proj" file. The content of the manifest files was as follows -
****
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="abc" type="win32" />
<description>Test Application</description>
<dependency />
<!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
******

Am I missing something ? Is the Qt version 4.8.3 having some problem ?

ChrisW67
25th October 2012, 01:23
What is the actual link command that is being executed after you rerun qmake and run nmake?