Manifest being ignored in mingw app

懵懂的女人 提交于 2019-12-06 03:37:44

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/20255591/manifest-being-ignored-in-mingw-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!