【问题标题】:Why execution of a portion of code loaded from an external file is not halted by DEP?为什么 DEP 不会停止执行从外部文件加载的部分代码?
【发布时间】:2012-04-15 06:26:34
【问题描述】:

我很久以前在互联网上发布了一个项目。细节来了,为了简洁明了,所有不相关的东西都被剥离了。


一个二进制文件,其内容如下所述

十六进制转储:

55 89 E5 83 EC 08 C7 45 FC 00 00 00 00 8B 45 FC 
3B 45 10 72 02 EB 19 8B 45 FC 8B 55 0C 01 C2 8B 
45 FC 03 45 08 8A 00 88 02 8D 45 FC FF 00 EB DD 
C6 45 FA 00 83 7D 10 01 76 6C 80 7D FA 00 74 02 
EB 64 C6 45 FA 01 C7 45 FC 00 00 00 00 8B 45 10 
48 39 45 FC 72 02 EB E2 8B 45 FC 8B 4D 0C 01 C1 
8B 45 FC 03 45 0C 8D 50 01 8A 01 3A 02 73 30 8B 
45 FC 03 45 0C 8A 00 88 45 FB 8B 45 FC 8B 55 0C 
01 C2 8B 45 FC 03 45 0C 40 8A 00 88 02 8B 45 FC 
03 45 0C 8D 50 01 8A 45 FB 88 02 C6 45 FA 00 8D 
45 FC FF 00 EB A7 C9 C2 0C 00 90 90 90 90 90 90

被加载到内存中并使用以下方法 sn-p

执行
var
  MySrcArray,
  MyDestArray: array [1 .. 15] of Byte;

  // ...

  MyBuffer: Pointer;

  TheProc: procedure;
  SortIt: procedure(ASrc, ADest: Pointer; ASize: LongWord); stdcall;
begin
  // Initialization of MySrcArray with random Bytes and display here ...

  // Instructions of loading of the binary file into MyBuffer using merely **GetMem** here ...

  @SortIt := MyBuffer;

  try
      SortIt(@MySrcArray, @MyDestArray, 15);

      // Display of MyDestArray (The outcome of the processing !)
  except
    // Invalid code error handling
  end;

  // Cleaning code here ...  
end;

在我的盒子上就像一个魅力。


我的问题:

不使用VirtualAlloc 和/或VirtualProtect 怎么办?

【问题讨论】:

    标签: delphi windows-7 32-bit dep


    【解决方案1】:

    我假设您在问为什么它没有被Data Execute Prevention 阻止而有效?对于 32 位程序,DEP 默认是可选的,这意味着应用程序必须显式启用它。

    如果您将 DEP 设置更改为“为除我选择的程序和服务之外的所有程序和服务启用 DEP”,那么您的应用程序将触发 DEP 警告并崩溃。

    【讨论】:

    • 是的,确实与 DEP 有关。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-26
    • 1970-01-01
    • 1970-01-01
    • 2014-04-26
    • 2017-06-17
    • 1970-01-01
    • 2016-11-26
    相关资源
    最近更新 更多