如何禁用 DEP [英] How to disable DEP

查看:41
本文介绍了如何禁用 DEP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个应用程序,其中堆的某些部分作为汇编指令执行/用于测试目的 - 我们将程序下载到 PLC,但允许用户在下载到 PLC 之前通过执行他们的代码来模拟运行他们的应用程序.在我们总是从存储指令的堆中执行这些程序之前,这工作正常,但我们现在已转换为 VS2012,现在似乎关闭 DEP 并不那么容易.我想知道是否有可能以某种方式关闭 DEP,而不管 GetProcessDEPPolicy 返回什么,或者是否有其他一些技术可以在不涉及 DEP 的情况下从堆执行汇编指令?

We have an app where some parts of the heap are executed as assembly instructions / for testing purposes - we download programs to PLCs but allow users to simulate running their applications by executing their code before downloading to the PLC. Before we always executed these programs from the heap where the instructions are stored and this worked fine but we have now converted to VS2012 and now it seems that turning off DEP is not so easy. I was wondering if it is somehow possible to turn off the DEP regardless of what GetProcessDEPPolicy returns or if there is some other technique to execute assembly instructions from heap without involving DEP?

推荐答案

您不想禁用 DEP;您想修改您的应用以在其中运行.

You don't want to disable DEP; you want to modify your app to work within it.

根据 http://msdn.microsoft.com/en-us/library/windows/desktop/aa366553%28v=vs.85%29.aspx

If your application must run code from a memory page, it must allocate and set the proper
virtual memory protection attributes. The allocated memory must be marked PAGE_EXECUTE,
PAGE_EXECUTE_READ, PAGE_EXECUTE_READWRITE, or PAGE_EXECUTE_WRITECOPY when allocating memory.

遵循这些简单的说明,您的代码可以与 DEP 共存.

Follow these simple directions and your code can coexist with DEP.

这篇关于如何禁用 DEP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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