How to disable DEP

会有一股神秘感。 提交于 2019-12-10 10:19:28

问题


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?


回答1:


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

Per 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.

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



来源:https://stackoverflow.com/questions/15581581/how-to-disable-dep

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