Jesus 'n Jim

A mainly PC (some Mac) site w/Software, Computer Repair Info, How-To's on Using Computers
Technical Support 1-360-521-2060 (my business line cell)

XML Manifests



I am still learning about windows 8 manifests. things that work for 7 may not necessarily work for 8.

articles - adding a manifest for vista/7/8 compatibility

I have written a batch file for adding a manifest resource to the compilation for the mingw compiler. I have not yet figured out how to do this for the Borland compiler because I was having a hard time figuring out how to put in the resource into the EXE. I later learned that you compile the .rc file and link in the resulting .res file like it was a library.

check out these articles:
manifest 1.0 XML Schema (THE reference, O'Reilly has an XML Schema book if you have trouble reading it)
manifest xml reference
[BUG] Vista doesn't start application called "install" w/o being elevated.
how to embed a manifest into an exe with mingw tools only
article on using microsoft's manifest tool mt (documents the 1 or 2 thing)
article about manifest, clickonce, and elevated UAC levels like admin
the processorArchitecture post, mentions that the values are x86, MSIL, IA64, and AMD64 but I have seen elsewhere in manifests that it is X86 not x86. case insensitive?
excellent delphi article example on manifest XML assembly and .rc file contents, and
2000+ manifest (wikipedia) amanifest like this is the only one that works, I will show you what I use
The XP Theme Manifest
msdn article on resource assembly numbers
adding DLL's and other dependent files to your manifest
Visual Styles (more on manifests)
manifest 1.0 specification
<trustinfo> element documentation
designing apps for windows 7 UAC
Fixing an app using Private Assembly
system32 msvcrt.dll and manifests
msvcrt.dll in <dependency> enlightening - shows you both the mscrt.dll maniferst and the exe manifest section you should have (this only works IF yours is not an older one and has a manifest, VC++2010 does not)
VC++2010 no longer requires manifests (see related post) What does this all mean for windows developers? NOTHING! windows 2008 R2, 7, vista, 2008 still require a manifest. sorry guys and gals.
troubleshooting manifest-related issues
compatibility manifest (by the way, this doesn't work).
find out why your external manifest is being blocked
Step & Create and Embed an Application Manifest (UAC)

the only manifest that works. period. (windows 9x+)

I have tried many article's advice on how to get a manifest to work. no advice works except for this manifest.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <ms_asmv2:trustInfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
                <ms_asmv2:requestedExecutionLevel level="asInvoker">

the UTF-8 (upper-case) is the only proper way to write UTF-8. most people ()including Adobe Dreamweaver) incorrectly use utf-8 lower-case. this is not valid for XML, HTML, or XHTML.

symptoms that you have done something wrong with your manifest in XP:

in this case, cross-platform manifest not coded properly.  
unless it is PERFECT, it will not execute.

Sun 02/12/2012 16:41:45.26|C:\prj\df\df-3.13\win\32|>df -unit 512
The system cannot execute the specified program.

Sun 02/12/2012 16:41:45.27|C:\prj\df\df-3.13\win\32|>

If you:

  • try to add features like <dependency> or <compatibility> to a cross-platform manifest
  • try to execute a 64-bit .exe on a 32-bit machine

you will get "_____ is not a valid win32 application" error dialog.

If you forgot a manifest and you try to run an console app on a 2008 R2 system or windows 7, UAC will require you to run as administrator or give you errors in your program.

XML Manifests can be:

  • a normal windows resource
  • a .ocx.manifest or .exe.manifest or .dll.manifest file alongside the .exe or .dll or .ocx

cross-platform manifest (9x+)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <ms_asmv2:trustInfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
                <ms_asmv2:requestedExecutionLevel level="asInvoker">

You need to know that this is XML. you can use whatever identifier you want for the code items above as long as its all the same (it's a namespace). you can even use a namespace for assembly if you want, just put an :identifier after xmlns and use the identifier in front of assembly like identifier:assembly and it should work just fine. this works because in the namespace certain elements and attributes work. I am not sure, but I think this is because there is some sort of XML Schema attached to the namespace (an .xsd file) somehow, I don't understand that much of XML yet.

Apparently on XP SP3, <description> element and having the uiAccess="true|false" (false being the default if uiAccess not specified) attribute on the <requestedExecutionLevel> element is allowed. both are open/close tags. But I DON'T know if <description> works on other platforms. <compatibility> and <dependency> cause interesting errors in this cross-platform manifest on XP. XP SP3 bucks anything else you try. Windows 9x also works with uiAccess="false" (the default).

how to create an XML Manifest with mingw/mingw-w64

  1. Create some xml file containing your manifest, e.g. app.dll.manifest
  2. 1 for exe, 2 for dll. #include "winuser.h"
    2 RT_MANIFEST "app.dll.manifest"
    should be added to your .rc file, compiled to a .o (.obj for borland). I have seen 1 24 "app.exe.manifest", but all it does is cause windres to crash/GPF.
  3. Using windres you compile the .rc into an object file (.o)
  4. link the object file (.o) together with all the other object files to your final executable using gcc or g++. if you are compiling a dll, use the -shared switch
windres --input=app.rc --input-format=rc --output=app.res --output-format=coff
g++ -shared -o app.dll app.cpp app.res -lmsvcr90


windres --input=app.rc --input-format=rc --output=app.res --output-format=coff
g++ -o app.exe app.cpp app.res -lmsvcr90

the msvcr90 microsoft runtime I don't know about, it seems to be only needed for the python language, from what I have seen on google. It is probably best to leave it out (it does not come with mingw).

The filesystem hooks will query the virtual store first (And only read the "real" location [c:\program files\whatever] if the file is not found in the virtual store) for applications without a manifest. (quote from someone in bug tracker in