Category : System Diagnostics for your computer
Archive   : PASSWRD4.ZIP
Filename : PASSWRD4.ASM

 
Output of file : PASSWRD4.ASM contained in archive : PASSWRD4.ZIP
PAGE 60,132
TITLE PASSWRD4.ASM - PASSWRD4.SYS DEVICE DRIVER
;------------------------------------------------------------
;PASSWRD4.ASM (CREATES PASSWRD4.SYS, DEVICE DRIVER)
;DOS 2.00 DEVICE DRIVER FORCES USER TO ENTER PASSWORD ON BOOTING UP
;AND DISABLES Ctrl-Break.
;
; REV by JOHN R. PETROCELLI 02/25/85
; REV by JOHN R. PETROCELLI 04/30/85
;
; ADDITIONAL CODE HAS BEEN ADDED TO INITIALIZE INT 66h WITH THE
; SEGMENT AND OFFSET OF THE "RECALL" CODE (ASK_OFF). USING THE
; PROGRAM "LOCK.COM" WILL ENABLE THE USER TO DISBLE THE USE OF THE
; PC UNTIL THE CORRECT PASSWORD IS SUPPLIED.
;
;AFTER ASSEMBLY: LINK PASSWRD4 (ignore "no STACK" error)
; EXE2BIN PASSWRD4 PASSWRD4.SYS
; PLACE DEVICE=PASSWRD4.SYS IN CONFIG.SYS FILE
; REBOOT SYSTEM WITH Ctrl-Alt-Del
; ANSWER PROMPT WITH: Password
; **** BEWARE OF UPPER VS LOWER CASE ****
;

DEV_SEG SEGMENT
PWORD_DEVICE PROC FAR
ASSUME CS:DEV_SEG, DS:DEV_SEG, ES:DEV_SEG

;---------------------------------------------------------------
;The following lines are the device header, which must exist for
;every device. This file has only one device, and it works with
;character I/O. It doesn't actually handle any I/O services,
;but it's easier to create a character device.

PWORD_DEV_HEADER: ;label for the start of the device driver

NEXT_DEV_PTR DD -1 ;only 1 device is defined in this file
DEV_ATTRIBUTE DW 1000000000000000B
STRATEGY_PTR DW STRATEGY ;the installation procedure
INTERUPT_PTR DW INTERUPT ;the proc that handles all services
DEVICE_NAME DB 'PWORD' ;8-byte string of device name

; -- This is the storage area for the password --
; -- The first byte is the length (0-16) --------
; -- The following characters are the password --
; -- Only an exact match will allow the system --
; -- to continue the boot process ---------------

PASSWORD_STORE DB 4,'plan'
DB $-PASSWORD_STORE DUP(' ') ;leave room for a
;16-character password

IN_BUF_MAX DB 16
IN_BUF_LEN DB ?
IN_BUF DB 16 DUP(?)

BREAK_SEG DW
BREAK_OFF DW

; -- The STRATEGY proc stores ES:BX request header pointer here
; -- The INTERUPT proc retrieves it

REQUEST_PTR LABEL DWORD
REQ_PTR_OFF DW
REQ_PTR_SEG DW ?

DUMMY_IRET DB 207 ;Ctrl-Break vector is pointed here, so it
;does nothing. Break is not recognized!

;---------------------- Messages ----------------------------------
;These messages are expected to be output via the ANSI.SYS device,
;so it should be installed (named in the CONFIG.SYS file) before
;this PWORD device.
;If you don't want to use ANSI.SYS, remove the ESC sequences in the
;messages.

LF EQU 0AH
CR EQU 0DH
ESC EQU 1BH

MSG_1 DB CR,LF,ESC,'[0m' ;make output visible
DB 'Enter '
DB ESC,'[5m' ;make output blink
DB 'Password: '
DB ESC,'[8m$' ;make input invisible

MSG_2 DB CR,LF,ESC,'[0m' ;make output visible
DB 'Password accepted.',CR,LF,'$'

;====================================================================
;STRATEGY procedure
;Just saves the request header pointer for the INTERUPT proc

STRATEGY PROC FAR
ASSUME CS:DEV_SEG
MOV CS:REQ_PTR_OFF,BX
MOV CS:REQ_PTR_SEG,ES
RET
STRATEGY ENDP

;====================================================================

NO_BREAK PROC NEAR

;The following 8 lines eliminate Ctrl-Break from having any effect
;on the system, unless another program KEYBOARD_BREAK vector is
;altered (BASIC does that).
; OLD BREAK VECTOR IS STORED SO THAT IT MAY BE RESET

MOV AX,0
MOV ES,AX
MOV AX,WORD PTR ES:[1Bh*4]
MOV BREAK_SEG,AX
MOV AX,WORD PTR ES:[1Bh*4+2]
MOV BREAK_OFF,AX
MOV WORD PTR ES:[1Bh*4],OFFSET DUMMY_IRET
MOV WORD PTR ES:[1Bh*4+2],CS
RET

NO_BREAK ENDP


BREAK_ON PROC NEAR

; THE FOLLOWING 6 LINES RESTORE THE CTL-BREAK VECTOR

MOV AX,0
MOV ES,AX
MOV AX,BREAK_SEG
MOV WORD PTR ES:[1Bh*4],AX
MOV AX,BREAK_OFF
MOV WORD PTR ES:[1Bh*4+2],AX
RET

BREAK_ON ENDP

;====================================================================
ASK_PWRD PROC NEAR
;
; This code prompts the user for the correct password
;

JMP SHORT NO_BEEP
TRY_AGAIN:
MOV AL,7
MOV AH,0EH
INT 10H
NO_BEEP:
MOV DX,OFFSET MSG_1 ;"Enter Password: "
MOV AH,9
INT 21H

MOV DX,OFFSET IN_BUF_MAX
MOV AH,0CH
MOV AL,0AH
INT 21H
MOV AX,CS
MOV ES,AX

MOV SI,OFFSET IN_BUF_LEN
MOV DI,OFFSET PASSWORD_STORE
MOV CH,0
MOV CL,[SI]
CMP CL,[DI]
JNE TRY_AGAIN
INC DI
INC SI
REP CMPSB
JNE TRY_AGAIN

MOV DX,OFFSET MSG_2 ;"Password acceped"
MOV AH,9
INT 21H

RET

ASK_PWRD ENDP

;=====================================================================
;INTERUPT procedure
;Processes the command indicated in the request header.

INTERUPT PROC FAR
ASSUME CS:DEV_SEG, DS:NOTHING, ES:NOTHING
PUSH DS
PUSH ES
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH DI
PUSH SI
MOV AX,CS
MOV DS,AX

LES BX,REQUEST_PTR
MOV AL,ES:[BX+2]
CMP AL,0
JNE ERROR_EXIT
JMP INIT_FN
ERROR_EXIT:
OR WORD PTR ES:[BX+3],8003H
JMP EXIT
COMMON_EXIT:
OR WORD PTR ES:[BX+3],100H

; THE FOLLOWING 6 LINES SET THE REFERENCE FOR RECALL.
; LOCATION AT INT 66H IS USED FOR ADDRESS STORE

MOV AX,0
MOV ES,AX
MOV AX,CS
MOV DS,AX
MOV AX,OFFSET ASK_OFF
MOV WORD PTR ES:[66H*4],AX
MOV AX,CS
MOV WORD PTR ES:[66H*4+2],AX
EXIT:
POP SI
POP DI
POP DX
POP CX
POP BX
POP AX
POP ES
POP DS
RET
ASK_OFF:
PUSH DS
PUSH ES
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH DI
PUSH SI
MOV AX,CS
MOV DS,AX

CALL ASK_PWRD

JMP EXIT

INIT_FN PROC NEAR
PUSH ES

CLI
CALL NO_BREAK
STI

CALL ASK_PWRD

CLI
CALL BREAK_ON
STI

POP ES
MOV WORD PTR ES:[BX+0EH],OFFSET INIT_FN
MOV WORD PTR ES:[BX+10H],CS

JMP COMMON_EXIT
INIT_FN ENDP
INTERUPT ENDP
PWORD_DEVICE ENDP
DEV_SEG ENDS
END PWORD_DEV_HEADER



  3 Responses to “Category : System Diagnostics for your computer
Archive   : PASSWRD4.ZIP
Filename : PASSWRD4.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/