Assembly Source series of Ctrladel

Source: Internet
Author: User
Tags exit

This is the past DOS era of the compilation of source code, although has passed, but for the study of the assembly is still helpful, assembly language is just a basic programmer language, most people can grasp, not necessarily in-depth research.

Date:4 December, 09:53:09 EDT
From:antonio@garcon.cso.uiuc.edu, Quezada-Duarte@garcon.cso.uiuc.edu,
Subject:disabling Ctrl-alt-del
Marcelo H. Ang Jr dated Nov 11th 1989 asks for a
To disable Ctrl+alt+del, it's, I ' ve used it in my
Tandy 1000A with no problems and PS/2 ' s and had no
Problems at all either.
To use it just type, from the DOS prompt:
MASM Nocad; (Of course you need MASM)
LINK Nocad; (And of course you need a linker)
Nocad
If you type Nocad once it has been loaded, it'll tell you.
I ' ve used it with the DOS 3.30, but it works just as a. Under DOS
2.00 and above.
If you are have any comment the any kind, let me know.
And have a nice new decade everybody.
Cut here: ************************************************************
Page 255,132 just to get a nice list file
Comment:
Program to prevent Ctrl+alt+del from restarting the system
Warning:once loaded, you have three choices:
1) Turn Power off
2 Use a reset button (not all the machines have one)
3) Generate INT 19h
Warning:if your have a program which uses INT 0CDh, change
This value is equates line below to the number
Of a not used INT. This is used because
There are too many programs that hook INT 9 Vector and
We can ' t be sure it always points to the end of our
Notice (and start of our ISR).
Note:for memory references I use parentheses instead of
Square brackets because of ascii-ebcdic translations.
It works the same under Microsoft ' s MASM 4.0
Note:nocad won ' t work if you press Ctrl+alt+del from
A program so hooked to INT 9 before Nocad
(Example:sidekick). Solution:load Nocad before
everything else.
Author Antonio Quezada-duarte
Monterrey, Nuevo Leon, MEXICO
Monterrey ' s technologic Institute
ID No 296641
Bitnet Address AL296641@TECMTYVM
Bl296641@tecmtyvm
Feel free to share this and anyone while
Leaving the copyright notice intact.
If you are have any comment please let me know,thanks. :
CTRL equ 0100B; bit map for CTRL key
alt equ 1000b; bit map for Alt key
Free_vector equ 0CDh; vector used to prevent double loading
; change it if your system uses INT 0CDh
NOCAD segment byte ' CODE '
Assume Cs:nocad, Ds:msgs, es:nothing, Ss:stack
Copyright db ' Antonio quezada-duarte itesm ISC 296641 Monterrey '
DB ' Nuevo Leon MEXICO '
Cright_len equ $-offset Copyright
new_int_9h proc Near
Push AX
Push DS; Save registers
XOR Ax,ax
mov ds,ax;p oint ds to BIOS data area
;, actually BIOS data area
; starts at 0040:0000, but
; XOR Ax,ax is faster than MOV ax,40h
mov al,ds: (417h); Get keyboard flags
and Al,ctrl+alt clear non relevant BITS
CMP Al,ctrl+alt compare to our map
Jne go_ahead NO ctrl+alt Keys pressed
and byte ptr ds: (417h), not alt; Ctrl+alt pressed
; Clear ALT key bit to simulate
; ALT key is not pressed
Go_ahead:
PUSHF old ISR returns with IRET
COMMENT:
The following code stands for
Call Old_int_9
Where Old_int_9 is a FAR PROC
This is faster than has the address of old_int_9
stored in memory and doing a
Call CS: (old_int_9)
:
DB 9Ah
Old_int_9_ofs DW 0
Old_int_9_seg DW 0; call Old INT 9 ISR
Pop ds
Pop Ax Restore Registers
Iret return to Caller
new_int_9h ENDP
BEGIN proc Near
Push es; save PSP Base Address
MOV dx,seg msgs
MOV ds,dx
MOV Dx,offset msg_0
MOV ah,9
int 21h
MOV ax,3500h + free_vector
int 21h
mov di,bx es:di ===> start of INT 0CDh ISR
MOV si,offset Copyright
MOV Ax,cs
mov ds,ax;D s:si ===> This code copyright notice
MOV Cx,cright_len
Cld
Repe CMPSB; compare
Je loaded; if equal then already loaded
MOV ax,2500h + free_vector
MOV Dx,cs
MOV ds,dx
MOV dx,offset Copyright
int 21h;p oint free_vector int vector to
; Our copyright notice
MOV ax,3509h
int 21h; get pointer to int 9 ISR
MOV cs:old_int_9_ofs,bx
MOV cs:old_int_9_seg,es;p ut it in the new int 9 ISR
MOV ax,2509h
MOV Dx,offset new_int_9h
Push CS
Pop ds
int 21h;p oint int 9 vector to our ISR
MOV dx,seg msgs
MOV ds,dx
MOV Dx,offset msg_1
MOV ah,9
int 21h;p rint loaded msg
Pop ds; Get saved PSP base Address
mov es,ds: (2Ch)
MOV ah,49h
int 21h; free environment ' s memory
; Assume no error
MOV dx,offset begin; everything up to begin
Add dx,10fh and all of the bytes needed to
MOV cl,4 make a full paragraph ...
SHR DX,CL
mov ax,3100h; Stay resident
int 21h; and return exit code = 0
Loaded:pop ax; Get PSP address out of Stack
; Any register would do
MOV dx,seg msgs
mov ds,dx;p oint ds to We data area
MOV Dx,offset msg_2
MOV ah,9
int 21h;p rint already loaded msg
MOV ax,4c01h
int 21h; terminate with exit code = 1
Begin ENDP
Nocad ends
Msgs segment word ' DATA '
Msg_0 db 10,13, ' nocad:prevent Ctrl+alt+del from restarting '
DB ' System ', 10,13, ' Author:antonio quezada-duarte ', 10, 13, ' $ '
Msg_1 db 10,13, ' Nocad Loaded OK. ', 10, 13, ' $ '
Msg_2 db 10,13, ' Nocad already Loaded. ', 10, 13, ' $ '
Msgs ends
Stack segment para stack ' stack '
DW 1024 dup (?)
Stack ends
End begin
------------------------------

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.