Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manifest being ignored in mingw app

I have an old-fashioned Windows GDI application, written in C, which is being compiled with the Mingw toolchain.

Some of my users have been complaining about Windows Vista and Windows 7's Virtual Store, where files which are written to directories the app shouldn't have access to are siphoned off and stored elsewhere. They say it's confusing them, and they'd much rather have an error. According to Microsoft's documentation, the way to prevent this from happening is to add an application manifest.

Unfortunately this doesn't seem to do anything.

My manifest is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <description>WordGrinder</description>
  <assemblyIdentity version="1.0.0.0" name="WordGrinder"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="asInvoker"
          uiAccess="false"/>
        </requestedPrivileges>
       </security>
  </trustInfo>
</assembly>

...and the resource file which refers to it is:

CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "src/c/arch/win32/manifest.xml"
101 ICON DISCARDABLE "src/c/arch/win32/icon.ico"

(Not complicated, as you can see.) The resource file is compiled with windres and linked to my application in the usual way. The icon shows up, so I'm confident that this bit, at least, is correct.

Is there anything else I need to be doing to have the manifest be honoured?

like image 308
David Given Avatar asked Nov 28 '13 00:11

David Given


1 Answers

Solved: I was missing this line from the resource file:

#include "winuser.h"

Without it, you don't get any diagnostics or indication that it hasn't worked; you just don't get a manifest. Sigh.

I figured this out using the manifest extraction tool here: http://weblogs.asp.net/kennykerr/archive/2007/07/10/manifest-view-1-0.aspx

like image 122
David Given Avatar answered Sep 23 '22 15:09

David Given