How to add Assembly Manifest file to .exe file created with NetBeans IDE using MinGW, C++? The file looks like (just an example):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="7.0.0.0"
processorArchitecture="X86"
name="nbexec.exe"
type="win32"/>
<description>nbexec Process.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
<!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
How can I include this information in EXE file?
The problem is that in Windows Vista the file is marked with UAC sign, but it is digitally signed. And I'm asked to confirm to let it execute every time I launch it..
I found such explanation here: "Firstly, you must create an XML manifest specifying that version 6 of the Windows common controls library must be loaded by Windows, and embed it into your application as a resource with type “RT_MANIFEST” (actually, if you prefer you can name the manifest “[application name].exe.manifest” and include it in the same directory as the exe, rather than embedding it as a resource, but that does have the disadvantage that it can become accidentally deleted or corrupted)."
Found the answer myself, maybe it will be useful for others too.
Actions:
#ifndef RESOURCE_H #define RESOURCE_H #ifdef __cplusplus extern "C" { #endif #define IDI_ICON_128 101 #ifdef __cplusplus } #endif #endif /* RESOURCE_H */ #define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 /*Defined manifest file*/ #define RT_MANIFEST 24
#include "ids.h" CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "Some.exe.manifest" IDI_ICON_128 ICON "SomeIcon.ico" 1 VERSIONINFO FILEVERSION 1,0,0,0 PRODUCTVERSION 1,0,0,0 BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "080904E4" BEGIN VALUE "CompanyName", "Some company" VALUE "FileDescription", "Some description" VALUE "FileVersion", "1.0" VALUE "InternalName", "Some file name" VALUE "LegalCopyright", "Some copyright" VALUE "OriginalFilename", "Some.exe" VALUE "ProductName", "Some product name" VALUE "ProductVersion", "1.0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x809, 1252 END END
You can see "Some.exe.manifest" assembly manifest file name This file (XML file, as you can see in my question above) should be in project class path.
Now here are resource.rc properties:
You can see "Additional Dependencies" - resource.o
And that's all - .exe file contains assembly manifest file (also icon and description) after compiling it.
Project view:
Project files view:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With