delphi 7 winxp sp2 de ntdll.DbgBreakPoint hatası

Yazdığınız makaleleri ve üyelerimizin işine yarayacağını düşündüğünüz kodlarınızı gönderebilirsiniz. Bu foruma soru sormayın!
Cevapla
Kullanıcı avatarı
mege
Admin
Mesajlar: 2360
Kayıt: 05 Şub 2004 04:32
Konum: Beşiktaş
İletişim:

delphi 7 winxp sp2 de ntdll.DbgBreakPoint hatası

Mesaj gönderen mege »

win xp altında delphi 7 de debug halinde programı kapatırken, assembly window açılıp ntdll.DbgBreakPoint satırında duruyordu, epey bi uğraştırdı. bu problemle karşılaşan biri şu kodu hazırlamış, problem düzeldi şimdilik nedenini araştıramadım ama lazım olan olursa

uzun süredir aynı delphiyi kullanıyorum, sorun sp2 ye geçince başladı :? :kup: bu olay başına gelen varmı :?:

Kod: Tümünü seç

//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
// D7 win XP hatası patch i
//////////////////////////////////////////////////////
{$ifopt D+}  {If compiled with "project / options / compiler / debug info off"
the PatchINT3 code disappears. After changing the option, I had to go "project
/ build" to make it "take".}

procedure PatchINT3;
var
NOP: Byte;
NTDLL: THandle;
BytesWritten: DWORD;
ADDRESS: Pointer;
begin
  if DebugHook=0 then
  exit;


  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 emergency panic if you lake at EAccessViolation here, it is
      // perfectly harmless!
    on EAccessViolation DO;
  else raise;
  end;

end ;
{$endif}

initialization
{$ifopt D+} {only compiled if debug info on.}
PatchInt3;
{$endif}

:kup: :kup: :kup: :kup: :kup: :kup: :kup: :kup: :kup: :kup: :kup: :kup:
.-.-.-.-.-.-.-. ^_^
Kullanıcı avatarı
mege
Admin
Mesajlar: 2360
Kayıt: 05 Şub 2004 04:32
Konum: Beşiktaş
İletişim:

Mesaj gönderen mege »

{****************************************************************************
Wed 4/06/2005 6:25 pm. This is a do-nothing program that fixes
NTDLL.DbgBreakPoint in Delphi 5 running under XP (SP2 although I think it's
all the XPs and NTs and who knows). Seems Microsoft left a breakpoint in a
DLL, so when you run a Delphi 5 program in the Delphi environment, it
starts-off by opening the CPU (assembly-language) window at a "ret". If you
use the arrow to up a bit you'll see you're at this code:

ntdll.DbgBreakPoint:
7C901230 int 3
7C901231 ret <---- you are here.

This is fairly frightening the first time it happens, but it was really quite
harmless although fairly annoying. Note that the program won't do this unless
it's in the IDE. To stop it, you can run PatchINT3 below from initialization
as shown -- written by a kindly german I found at
http://www.delphipraxis.net/post164845.html (I used google xlation). I fixed the
numerous punctuation errors -- and there are other copies of this thing in
slightly different forms and languages around the web, so who knows who wrote
the original. ...

Sadly this has to be in the program you're debugging; i.e., after you run
this, some *other* Delphi 5 debug IDE session will still break with the
breakpoint -- or who knows....

I still suspect there's some way to do this "normally"; I had high hopes for
EXCEPTION_BREAKPOINT $80000003 -- but I "added" it to the Delphi 5 exceptions
(tools / debugger options / OS exceptions / add button, with every combination
of the check boxes) with absolutely no effect.

Note the "$ifopt D+" will suppress the code if you compile a release version
with the debug info off, as the comment indicates. This will run outside the
IDE without annoyances.

RANDOM MUSINGS

Finally note that very simple programs -- like this one for instance -- will
*never* invoke the ntdll.dbgbreakpoint; I assume it has something to do with
particular controls, which are wrappers of / call Microsoft controls, which in
turn call the ntdll.dbgbreakpoint which is, I gather, an entry point
specifically for the purpose of invoking the debugger. Perhaps the usux code
does this under provocation from the Borland code; more likely, it's "just
normal" and the usux tools handle the thing properly, as do later Borland
tools (Delphi 6, 7) after sacrifice of first child presumably....

****************************************************************************}
.-.-.-.-.-.-.-. ^_^
fduman
Moderator
Mesajlar: 2749
Kayıt: 17 Ara 2004 12:02
Konum: Ankara

Mesaj gönderen fduman »

Böyle birşeyle hiç karşılaşmadım mege. İlk defa senden duydum. Neyse başımıza gelirse böyle yaparız. :D
Kullanıcı avatarı
veliadiguzel
Üye
Mesajlar: 197
Kayıt: 09 Tem 2003 02:11
Konum: Gebze/Kocaeli
İletişim:

Re: delphi 7 winxp sp2 de ntdll.DbgBreakPoint hatası

Mesaj gönderen veliadiguzel »

benim şu anda başıma geldi

[img=http://img329.imageshack.us/img329/9660/ntdllzt1.th.png]

bu kodu nasıl kullanıyoruz pek çıkaramadımda
Veli ADIGÜZEL
Kullanıcı avatarı
veliadiguzel
Üye
Mesajlar: 197
Kayıt: 09 Tem 2003 02:11
Konum: Gebze/Kocaeli
İletişim:

Re: delphi 7 winxp sp2 de ntdll.DbgBreakPoint hatası

Mesaj gönderen veliadiguzel »

hatayı buldum ama hatamıdır bilemem aynı isimde farklı formlarda SIBfibEventAlerter bileşeni kullanmıştım birini kaldırınca hatada kalktı ortadan.
Veli ADIGÜZEL
Kullanıcı avatarı
G.Arkas
Üye
Mesajlar: 829
Kayıt: 01 Eki 2007 07:16
Konum: İstanbul
İletişim:

Re: delphi 7 winxp sp2 de ntdll.DbgBreakPoint hatası

Mesaj gönderen G.Arkas »

çok başarılı bir kod bende acaba kullandığım bişleşenlerde mi hata var diyordum ama her zaman kullandığım araçlar olduğu için sorunu çözememiştim kod çalışıyor..

bu arada bende socket programlama yaparken ve "ServicePack 3" e geçtiğimde aldım bu hatayı...
teşekkürler..iyi çalışmalar...
Resim
Cevapla