解决Delphi7 CPU窗口老出现NTDLL.DbgBreakPoint断点问题

 今天调试园刚EZCapture878采集卡,运行其Delphi Demo只出现CPU窗口,不出现程序窗口,在网上找方法,终于找到这个方法

procedure PatchInt3;
var
  NOP: Byte;
  NTDLL: THandle;
  BytesWritten: DWORD;
  Address: Pointer;
begin
  if Win32Platform <> VER_PLATFORM_WIN32_NT then
    Exit;
  NTDLL := GetModuleHandle('NTDLL.DLL');
  if NTDLL = 0 then
    Exit;
  Address := GetProcAddress(NTDLL, 'DbgBreakPoint');
  if Address = nil then
    Exit;
  try
    if Char(Address^) <> #$CC then
      Exit;

    NOP := $90;
    if WriteProcessMemory(GetCurrentProcess, Address, @NOP, 1, BytesWritten) and
      (BytesWritten = 1) then
      FlushInstructionCache(GetCurrentProcess, Address, 1);
  except
    // Do not panic if you see an EAccessViolation here, it is perfectly harmless!
    on EAccessViolation do
      ;
  else
    raise;
  end;
end;

你可能感兴趣的:(byte,Delphi)