home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / share / Dos / VARIOS / pascal / MISC.SWG / 0004_Debugger Trap.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1996-02-21  |  1.5 KB  |  64 lines

  1. {
  2. RH>I am looking for source to catch someone who is debugging my program.
  3.  
  4. What do you think about this ...
  5.  
  6. I don't write it and sorry for the German, but it works OK.
  7. Just include it into your included units, when someone tries to debug your
  8. program, it reboots.
  9. }
  10.  
  11. UNIT NoDebug;
  12.  
  13. { ************************* }
  14. { Aus c't 2/90 Seite 186    }
  15. { (c) by Karl Heinz Kremer  }
  16. { ************************* }
  17.  
  18. INTERFACE
  19.  
  20. { Hier gibt's nichts zu exportieren }
  21.  
  22. IMPLEMENTATION
  23.  
  24. USES DOS,CRT;
  25.  
  26. VAR
  27.   OldInt1, OldInt3,        { Die alten Interruptvektoren }
  28.   ExitSave : POINTER;      { Speicher für die alte Exit-Prozedur }
  29.  
  30.  
  31. PROCEDURE REBOOT;
  32. BEGIN
  33.   Inline($b8/$00/$f0/
  34.          $50/
  35.          $b8/$5b/$e0/
  36.          $50/
  37.          $b8/$40/$00/
  38.          $8e/$d8/
  39.          $c7/$06/$72/$00/$34/$12/$cb);
  40. END;
  41.  
  42. PROCEDURE DoNotDebug; INTERRUPT;       { neue Int1 und Int3 Prozedur }
  43. BEGIN
  44.   reboot;
  45. END;
  46.  
  47. {$F+}
  48. PROCEDURE ResetNoDebug;
  49. {$F-}
  50. BEGIN                           { Neue Exit-Prozedur }
  51.   SetIntVec(1,OldInt1);         { Interruptvektoren zurücksetzen }
  52.   SetIntVec(3,OldInt3);
  53.   ExitProc:=ExitSave;           { Zeiger auf alte Exit-Prozedur }
  54. END;
  55.  
  56. BEGIN
  57.   ExitSave:=ExitProc;           { alte Exit Prozedur speichern }
  58.   ExitProc:=@ResetNoDebug;      { neue Exit Prozedur setzen }
  59.   GetIntVec(1,OldInt1);         { Int-Vektoren speichern }
  60.   GetIntVec(3,OldInt3);
  61.   SetIntVec(3,@DoNotdebug);     { Int-Vektoren neu setzen }
  62.   SetIntVec(1,@DoNotdebug);
  63. END.
  64.