"试图读取或写入受保护的内存" ActiveX控件失败 - 对Win7的错误 [英] "Attempted to read or write protected memory" error on Win7 - activeX control failure

查看:384
本文介绍了"试图读取或写入受保护的内存" ActiveX控件失败 - 对Win7的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Windows应用程序(.NET,Visual Studio 2010),使用旧包装的ActiveX控件(VSPrinter 8从ComponentOne的,是precise。vsprint8.ocx)。这种处理我们所有的打印和打印previews。当我们部署和运行我们的应用程序的Win7的虚拟机(32位)的一个新的实例,并做一些尝试调用该控件,我们收到以下错误:

We have a windows application (.net, VS2010) that uses an old wrapped activeX control (VSPrinter 8 from ComponentOne, to be precise. vsprint8.ocx). This handles all of our printing and print previews. When we deploy and run our application to a fresh instance of Win7 on a VM (32 bit), and do something that attempts to invoke this control, we receive the following error:

尝试读取或写入受保护的内存。这通常指示其他内存已损坏。

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

它继续正常工作在Windows XP上。有趣的是,如果我们关闭DEP在目标VM(全系统,设置为AlwaysOff),应用程序的工作。但是,如果我们关闭DEP的只是使用OCX可执行文件,这是行不通的。

It continues to work fine on Windows XP. Interestingly, if we turn off DEP on the target VM (systemwide, set to AlwaysOff), the application works. But if we turn off DEP on just the executable that uses the ocx, it doesn't work.

任何想法?谢谢!

推荐答案

找到了解决办法。

我不能有效关闭DEP对有问题的可执行文件,所以我增加了以下行到VS2010生成后事件命令行,它固定我的问题:

I couldn't effectively turn off DEP on the executable in question, so I added the following lines to the post-build event command line in VS2010 and it fixed my problem:

call "$(DevEnvDir)\..\..\VC\bin\vcvars32.bat"
call "$(DevEnvDir)\..\..\VC\bin\editbin.exe" /NXCOMPAT:NO "$(TargetPath)"

在VS解决方案资源管理器中,用鼠标右键单击该项目的解决方案下,选择属性,然后单击生成事件。你会看到生成后事件命令行:文本框中这是你插在上面的东西

In the VS Solution Explorer, right click the project under the solution, select Properties, and click Build Events. You'll see the "Post-build event command line:" text box which is where you plug the above stuff in.

这有效地禁用DEP我的应用程序。这里的博客贴子,让我看到了光明。谢谢你,伙计随意!

This effectively disabled DEP for my app. Here's the blog post that helped me see the light. Thanks, random dude!

<一个href="http://jtstroup.net/post/Attempted-to-read-or-write-protected-memory-This-is-often-an-indication-that-other-memory-is-corrupt.aspx" rel="nofollow">http://jtstroup.net/post/Attempted-to-read-or-write-protected-memory-This-is-often-an-indication-that-other-memory-is-corrupt.aspx

这篇关于&QUOT;试图读取或写入受保护的内存&QUOT; ActiveX控件失败 - 对Win7的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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