home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Best Objectech Shareware Selections
/
UNTITLED.iso
/
boss
/
util
/
misc
/
012
/
pw.doc
< prev
next >
Wrap
Text File
|
1987-02-17
|
5KB
|
76 lines
PW.SYS by Bob Montgomery 1/5/87
This is a device driver to include in your CONFIG.SYS file to ask the
user for the password each time the machine is booted, or a calling
program (LOCK.COM) is run. It allows 3 tries, and then locks up the
machine if the incorrect password was given. It is a simplification
of PASSWRD5.SYS which was originally PWORD.SYS by an unknown author.
This was subsequently modified by John R. Petrocelli on 2/5/85 and
4/30/85, and by D. Drummond on 10/13/86 to produce the final
PASSWRD5.SYS, which included: limiting the number of tries, making
the password case insensitive, disabling Ctrl-Break, and making
provisions for another program (LOCK.COM) to invoke the password
request.
The program was completely redone to make it shorter and have a more
logical flow, while retaining all the features of PASSWRD5.SYS. The
companion program LOCK.COM was also redone, and is now only 4 bytes
long. Being a device driver, PW.SYS is loaded and run before
AUTOEXEC.BAT is run, and cannot be bypassed by pressing Ctrl-Break or
Ctrl-C, which will break out of a batch file. It is resident in
memory at all times, so length is important; the resident portion is
only 590 bytes long, and most of this is the fancy ANSI text. To get
the color display, PW.SYS should occur after ANSI.SYS in your
CONFIG.SYS file; if you don't use ANSI.SYS, delete all the ANSI
escape sequences in the message area of the program.
The source code for PW.SYS (in A86 assembler format-note the lack of
SEGMENT, ASSUME, ENDS, PROC, etc.) is included for those interested
in how it works, and is a good example of how to write a character
type device driver. It can be converted to MASM format by adding the
required ASSUMEs, SEGMENT, ENDS, END, etc. Basically, when DOS sees a
device in CONFIG.SYS, it loads it and then calls the Strategy routine
and passes the address of the Request Header (RH) for that device in
ES:BX. The Strategy routine must store the RH address in the program
data area, and then do a far return to DOS. Next, DOS calls the
Interrupt routine to allow the device to initialize itself; in this
case, the device installes the vector for Int 66h (an unused vector)
for the LOCK program, then disables Cntl-Break and asks for the
password. If the correct password is given within 3 tries, the
program enables Cntl-Break and then writes the address of the
first byte not required for the resident portion of the program
(generally the Strategy and installation code) in the RH Data area.
It then sets the done bit in the RH Status byte (thats why we had to
save the address of the Request Header), and returns (far) to DOS.
DOS then installs any other device drivers, and then runs
AUTOEXEC.BAT. This device was given a very weird name, unlikely to be
typed (even inadvertantly), which would trigger DOS to send info to
or try to get info from the device, and cause strange things to
happen.
The LOCK.COM program is included to use with PW.SYS to ask for the
password without rebooting. Remember that the vector for Int 66h was
pointed to the proper place in PW.SYS to do a password check when
PW.SYS was installed. So, all LOCK.COM has to do is call Int 66h and
then terminate if the correct password was given. If the wrong
password was given 3 times, the machine locks up and can only be
restarted by cycling power (or pressing the RESET button if you have
one). The source for LOCK.COM is:
Int 66h ; Do a password check
Int 20h ; and terminate thru DOS
If the correct password is not given, the program never returns from
Int 66h.
The password can be changed by changing the entry labeled 'Password'
in the source and reassembling, or use DEBUG. The first byte is the
number of characters in the password, followed by the ASCII
representation of the password; up to 16 characters are allowed. In
the supplied source, the password is PASSWORD and there are 8
characters. If you want to distinguish between upper and lower case
characters in the password, delete the 'Convup' subroutine and the
two 'call Convup' instructions.
If you have any comments or suggestions, I can be contacted at the
Black Hole BBS in Orlando, Fl. (305) 260-6397, 1200/2400 baud.
Enjoy the program. Bob Montgomery, voice (305) 869-6481.