清单在mingw应用程序中被忽略 [英] Manifest being ignored in mingw app

查看:125
本文介绍了清单在mingw应用程序中被忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用C编写的老式Windows GDI应用程序,正在使用Mingw工具链进行编译.

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

我的一些用户一直在抱怨Windows Vista和Windows 7的虚拟商店,这些地方会虹吸掉写入应用程序不应该访问的目录的文件,并将其存储在其他位置.他们说这让他们感到困惑,他们宁愿有一个错误.根据Microsoft的文档,防止这种情况发生的方法是添加应用程序清单.

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.

我的清单是

<?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"

(不复杂,如您所见.)资源文件使用windres进行编译,并以通常的方式链接到我的应用程序.该图标显示出来,因此我确信至少这一点是正确的.

(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?

推荐答案

已解决:我从资源文件中丢失了这一行:

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.

我在这里使用清单清单提取工具解决了这个问题: http://weblogs.asp.net/kennykerr/archive/2007/07/10/manifest-view-1-0.aspx

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

这篇关于清单在mingw应用程序中被忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆