delphi编写的插件,关闭IE时出现runtime error 216的解决方法

五迷三道 提交于 2019-11-27 03:30:27
一、EXE的情况,把代码放在工程文件
procedure Halt0;
begin
Halt;
end;
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
asm
    xor edx, edx
    push ebp
    push OFFSET @@safecode
    push dword ptr fs:[edx]
    mov fs:[edx],esp
    call Halt0
    jmp @@exit;
    @@safecode:
      call Halt0;
    @@exit:
end;
end.
二、DLL的情况,把代码放在工程文件里
procedure Halt0;
begin
Halt;
end;
var
OldProc: Pointer;
procedure DLLEntryPoint(dwReason: DWord);
begin
if (dwReason = DLL_PROCESS_DETACH) Then
Begin
    asm
      xor edx, edx
      push ebp
      push OFFSET @@safecode
      push dword ptr fs:[edx]
      mov fs:[edx],esp
      call Halt0
      jmp @@exit;
      @@safecode:
        call Halt0;
      @@exit:
    end;
end;
end;
begin
DllProc := @DLLEntryPoint;
DllProcEX := @DLLEntryPoint;
end.

 

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