Windows 7 中可能存在数据执行保护 (DEP) 问题
我的 .Net 程序有严重问题。它调用本机 dll,然后立即崩溃,因为它找不到本机方法。这是我们之前见过的行为,C# 编译器以其无限的智慧设置了程序兼容 DEP 的标志,即使它调用了显然不兼容的本机 dll。
我们对此有标准的解决方法,其中在构建后步骤中将标志设置为“不兼容 DEP”,并且效果很好。除了我的机器上以外的任何地方。我有 Windows 7 32 位,该程序在我们拥有的 Win 7 64 位计算机以及 Vista 和 XP 上运行良好。
然而,在我的机器上,DataExecutionPolicy_SupportPolicy 为 0,即我们已成功关闭 DEP。有谁知道在什么情况下它仍然可以行动吗?或者任何其他机制可以产生相同的效果?
我们现在还检查了另一台新安装的Win7 32位机器(也是像我这样的Thinkpad),它也在那里工作。我们比较了所有的BIOS设置,它们是相似的(我的是T61,另一个是R60)。
当从本机程序调用时,有问题的 dll 在我的机器上也可以正常工作。我们的想法已经用完了……任何帮助将不胜感激!
I have a serious problem with my .Net program. It calls a native dll, and then crashes instantly because it can't find a native method. This is behaviour we have seen before, whereby the C# compiler, in its infinite wisdom, sets the flag that the program is DEP compatible, even if it calls a native dll which patently is not.
We have the standard workaround for this, where the flag is set to Not DEP Compatible in a post-build step, and this works fine. Everywhere except on my machine. I have Windows 7 32bit, and the program works fine on the Win 7 64bit machines that we have, as well as on Vista and XP.
However, on my machine the DataExecutionPolicy_SupportPolicy is 0, i.e. we have successfully switched DEP off. Does anyone know whether there is some situation in which it can still act? Or any other mechanism which could have the same effect?
We have now also checked on another newly installed Win7 32bit machine (also a Thinkpad like mine), and it also works there. We have compared all the bios settings, and they are similar (mine is a T61, the other an R60).
The dll in question also works fine on my machine when called from a native program. We are running out of ideas... any help would be much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,问题毕竟是完全不同的。我的机器是唯一一台未正确设置本机 dll 路径的机器;这导致 Win7 立即崩溃,而 XP 中曾经有一个消息框(非常神秘)给出发生了什么情况的信息。
因此我们可以免除 DEP 的任何责任。我把它留在标题中,以便其他有同样怀疑的人记得检查他们的文件路径!
OK, the problem was after all something completely different. My machine was the only one where the path for the native dlls was not set correctly; this led to an instant crash in Win7, while in XP there used to be a message box giving a (highly cryptic) idea of what had happened.
So we can absolve DEP of any blame. I am leaving it in the title so that other people who have the same suspicion remember to check their file paths!