home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / keyboard / ctrladel.asm < prev    next >
Assembly Source File  |  1994-03-04  |  7KB  |  176 lines

  1. Date: 4 December 89, 09:53:09 EDT
  2. From: Antonio@garcon.cso.uiuc.edu, Quezada-Duarte@garcon.cso.uiuc.edu,
  3. Subject: Disabling CTRL-ALT-DEL
  4.  
  5.    Marcelo H. Ang Jr in his letter dated Nov 11th 1989 asks for a program
  6.   to disable CTRl+ALT+DEL, well.., here it is, i've used it on my
  7.   TANDY 1000A with no problems and in PS/2's 25 and 50 and had no
  8.   problems at all either.
  9.  
  10.   To use it just type, from the dos prompt:
  11.  
  12.   MASM NOCAD; (of course you need MASM)
  13.   LINK NOCAD; (and of course you need a linker)
  14.   NOCAD
  15.  
  16.     If you type NOCAD once it has been loaded, it will tell you so.
  17.     I've used it with DOS 3.30, but it works just as well under DOS
  18.     2.00 and above.
  19.     If you have any comment of any kind please let me know.
  20.     And have a nice new decade everybody.
  21.  
  22. cut here: ************************************************************
  23. page 255,132                           ;just to get a nice list file
  24. comment   :
  25.          Program to prevent CTRL+ALT+DEL from restarting the system
  26.          WARNING: Once loaded, you only have three choices:
  27.              1) Turn power off
  28.              2) Use a reset button (not all the machines have one)
  29.              3) Generate INT 19h
  30.  
  31.          WARNING: If you have a program that uses INT 0CDh, change
  32.                   this value in the equates line below to the number
  33.                   of a not used INT. This method is used because
  34.                   there are too many programs that hook INT 9 Vector and
  35.                   we can't be sure it always points to the end of our
  36.                   notice (and start of our ISR).
  37.  
  38.          NOTE: For memory references i use parentheses instead of
  39.                square brackets because of ASCII-EBCDIC translations.
  40.                It works the same under Microsoft's MASM 4.0
  41.  
  42.          NOTE: NOCAD won't work if you press CTRL+ALT+DEL from
  43.                a program that hooked to INT 9 before NOCAD
  44.                (example: SideKick). Solution: Load NOCAD before
  45.                everything else.
  46.  
  47.   Author     Antonio Quezada-Duarte
  48.              Monterrey, Nuevo Leon, MEXICO
  49.              Monterrey's Technologic Institute
  50.              ID No 296641
  51.              Bitnet Address   AL296641@TECMTYVM
  52.                               BL296641@TECMTYVM
  53.  
  54.              Feel free to share this with anyone while
  55.              leaving the copyright notice intact.
  56.  
  57.              If you have any comment please let me know,thanks.   :
  58.  
  59.  
  60.  
  61. ctrl equ  0100b                        ;bit map for ctrl key
  62. alt  equ  1000b                        ;bit map for alt key
  63. free_vector equ 0CDh                   ;vector used to prevent double loading
  64.                                        ;change it if your system uses INT 0CDh
  65.    nocad segment byte 'CODE'
  66.     assume cs:nocad, ds:msgs, es:nothing, ss:stack
  67.       Copyright db 'Antonio Quezada-Duarte ITESM ISC 296641 Monterrey '
  68.                 db 'Nuevo Leon MEXICO'
  69.       Cright_Len equ $-Offset Copyright
  70.     new_int_9h proc near
  71.       push ax
  72.       push ds                          ;save registers
  73.       xor ax,ax
  74.       mov ds,ax                        ;point DS to BIOS data area
  75.                                        ;well, actually BIOS data area
  76.                                        ;starts at 0040:0000, but
  77.                                        ; XOR AX,AX is faster than MOV AX,40h
  78.       mov al,ds:(417h)                 ;get keyboard flags
  79.       and al,ctrl+alt                  ;clear non relevant bits
  80.       cmp al,ctrl+alt                  ;compare to our map
  81.       jne go_ahead                     ;NO CTRL+ALT keys pressed
  82.       and byte ptr ds:(417h),not alt   ;CTRL+ALT pressed
  83.                                        ;clear ALT key bit to simulate
  84.                                        ;ALT key is not pressed
  85. go_ahead:
  86.       pushf                            ;old ISR returns with IRET
  87.       COMMENT :
  88.          The Following code stands for
  89.  
  90.              CALL OLD_INT_9
  91.                 Where OLD_INT_9 is a FAR PROC
  92.                 this is faster than having the address of OLD_INT_9
  93.                 stored in memory and doing a
  94.                 CALL CS:(OLD_INT_9)
  95.                                                :
  96.       DB 9Ah
  97.          OLD_INT_9_OFS DW 0
  98.          OLD_INT_9_SEG DW 0            ;call old INT 9 ISR
  99.  
  100.       pop ds
  101.       pop ax                           ;restore registers
  102.       iret                             ;return to caller
  103.     new_int_9h endp
  104.        begin proc near
  105.           push es                      ;save psp base address
  106.           mov dx,seg msgs
  107.           mov ds,dx
  108.           mov dx,offset msg_0
  109.           mov ah,9
  110.           int 21h
  111.           mov ax,3500h + free_vector
  112.           int 21h
  113.           mov di,bx                    ;ES:DI ===> start of INT 0CDh ISR
  114.           mov si,offset copyright
  115.           mov ax,cs
  116.           mov ds,ax                    ;DS:SI ===> THIS code copyright notice
  117.           mov cx,cright_len
  118.           cld
  119.           repe cmpsb                   ;compare
  120.           je loaded                    ;if equal then already loaded
  121.           mov ax,2500h + free_vector
  122.           mov dx,cs
  123.           mov ds,dx
  124.           mov dx,offset copyright
  125.           int 21h                      ;point free_vector INT vector to
  126.                                        ;our copyright notice
  127.           mov ax,3509h
  128.           int 21h                      ;get pointer to INT 9 ISR
  129.           mov cs:old_int_9_ofs,bx
  130.           mov cs:old_int_9_seg,es      ;put it IN the new INT 9 ISR
  131.           mov ax,2509h
  132.           mov dx,offset new_int_9h
  133.           push cs
  134.           pop ds
  135.           int 21h                      ;point INT 9 vector to our ISR
  136.           mov dx,seg msgs
  137.           mov ds,dx
  138.           mov dx,offset msg_1
  139.           mov ah,9
  140.           int 21h                      ;print loaded msg
  141.           pop ds                       ;get saved psp base address
  142.           mov es,ds:(2Ch)
  143.           mov ah,49h
  144.           int 21h                      ;free environment's memory
  145.                                        ;assume no error
  146.           mov dx,offset begin          ;everything up to BEGIN
  147.           add dx,10Fh                  ;and all the bytes needed to
  148.           mov cl,4                     ;make a full paragraph ...
  149.           shr dx,cl
  150.           mov ax,3100h                 ;... stay resident
  151.           int 21h                      ;and return exit code = 0
  152. loaded:   pop ax                       ;get psp address out of stack
  153.                                        ;any register will do
  154.           mov dx,seg msgs
  155.           mov ds,dx                    ;point DS to our data area
  156.           mov dx,offset msg_2
  157.           mov ah,9
  158.           int 21h                      ;print already loaded msg
  159.           mov ax,4C01h
  160.           int 21h                      ;terminate with exit code = 1
  161.        begin endp
  162.        nocad ends
  163.        msgs segment word 'DATA'
  164.           msg_0 db 10,13,'NOCAD: Prevent CTRL+ALT+DEL from restarting the '
  165.                 db 'system',10,13,'Author: Antonio Quezada-Duarte',10,13,'$'
  166.           msg_1 db 10,13,'NOCAD Loaded OK.',10,13,'$'
  167.           msg_2 db 10,13,'NOCAD Already Loaded.',10,13,'$'
  168.        msgs ends
  169.        stack segment para stack 'STACK'
  170.           dw 1024 dup (?)
  171.        stack ends
  172.        end  begin
  173.  
  174. ------------------------------
  175.  
  176.