ntdll.dbgUserBreakpoint

How to remove that annoying CPU window.

In the initialization section of one of your app's units call PatchINT3.



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;

 

Share this article!

Follow us!

Find more helpful articles: