home *** CD-ROM | disk | FTP | other *** search
/ The Programmer Disk / The Programmer Disk (Microforum).iso / xpro / vc / pro3 / ctrlad1.asm < prev    next >
Encoding:
Assembly Source File  |  1993-02-27  |  2.8 KB  |  78 lines

  1. ===========================================================================
  2.  BBS: The Abacus * HST/DS * Potterville, MI
  3. Date: 02-24-93 (17:35)             Number: 112
  4. From: LEO VILDOSOLA                Refer#: 6
  5.   To: KEVIN LAM                     Recvd: NO  
  6. Subj: DISABLING CTRL-ALT-DEL?        Conf: (36) C Language
  7. ---------------------------------------------------------------------------
  8. KL>(Fragment of code to disable CTRL-ALT-DEL)
  9.  
  10. KL>Anyways, do you know if there is a similar function to intercept the soft
  11. KL>reboot? Say, something that would let me close files and do a graceful exit
  12. KL>before rebooting...
  13.  
  14. KL>If anybody can find anything it would be appreciated.
  15.  
  16. I just saw your message with interest.  I have been writing interceptors
  17. for a little bit now so I decided to give this one a try.  I wrote it in
  18. assembler and I am posting the assembler code for this ISR.  If you are
  19. not familiar with ASM code I will be happy to rewrite it in C.  It was
  20. just easier to test it in ASM since I already had routines for writing
  21. interceptors in ASM.
  22.  
  23. ISR starts here, in C you would use the interrupt keyword ----
  24.  
  25.         push    es
  26.         push    ax
  27.                 ; read scan code
  28.         in      al,60h
  29.                 ; is it the DEL key?
  30.         cmp     al,53h
  31.                 ;   no: call old interrupt
  32.         jnz     old_kbd_ISR
  33.                 ;   yes: read shift status from BIOS data area
  34.         xor     ax,ax
  35.         mov     es,ax
  36.         mov     al,es:[417h]
  37.                 ; mask out Ctrl-Alt keys
  38.         and     al,00001100b
  39.                 ; were they pressed?
  40.         cmp     al,12
  41.                 ;   no: call old interrupt
  42.         jnz     old_kdb_ISR
  43.                 ;   yes: eat key and acknowledge hardware interrupt
  44.         in      al,61h
  45.         mov     ah,al
  46.         or      al,80h
  47.         out     61h,al
  48.         mov     ah,al
  49.         out     61h,al
  50.         mov     al,20h
  51.         out     20h,al
  52.                 ; return
  53.         pop     ax
  54.         pop     es
  55.         iret
  56. old_kdb_ISR:
  57.                 ; chain to old interrupt
  58.         pop     ax
  59.         pop     es
  60.         jmp     ORIG_INT09h
  61.  
  62. ISR stops here ----
  63.  
  64. All you have to do is use in-line assembly in your C program to hook to
  65. INT 09h and that's it.  Again, if you do prefer C code for this let me
  66. know.  I'll be glad to set it up for you but you will have to do the
  67. testing.
  68.  
  69. G'd day!
  70. Leo Vildosola
  71.  
  72.  * OLX 2.1 TD * Chicken heads are the chief food of captive alligators.
  73. --- FidoPCB v1.4 beta
  74.  * Origin: XON/XOFF Information Service - Montreal - USENET! (1:167/159)
  75. SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
  76. SEEN-BY: 153/752 154/40 77 157/2 159/100 125 430 575 950 203/23 209/209
  77. SEEN-BY: 239/1004 280/1 390/1 396/1 5 15 730/6 2270/1 3603/20
  78.