如果是你的代码问题有两种方法:1.tool-debug options-下面的integrated debugging前面的钩取掉,这样就不能设断点调试了2.屏蔽NTDLL.DLL的DbgBreakPoint函数 procedure DbgBreakPoint; external 'NTDLL.DLL' name 'DbgBreakPoint'; procedure TForm1.Button1Click(Sender: TObject); begin PatchInt3; //asm int 3 end; DbgBreakPoint; end; //patchint3函数是从一段流行在bcb的代码来改写的 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;如果不是代码问题,你换台机器看看调试,没问题的话就把你的delphi重装看看
procedure DbgBreakPoint; external 'NTDLL.DLL' name 'DbgBreakPoint';
procedure TForm1.Button1Click(Sender: TObject);
begin
PatchInt3;
//asm int 3 end;
DbgBreakPoint;
end;
//patchint3函数是从一段流行在bcb的代码来改写的
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;如果不是代码问题,你换台机器看看调试,没问题的话就把你的delphi重装看看