home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / dskutl / passwrd6.arc / PW.DOC < prev    next >
Text File  |  1987-02-17  |  5KB  |  76 lines

  1.                      PW.SYS by Bob Montgomery 1/5/87
  2.  
  3.      This is a device driver to include in your CONFIG.SYS file to ask the 
  4.      user for the password each time the machine is booted, or a calling 
  5.      program (LOCK.COM) is run. It allows 3 tries, and then locks up the 
  6.      machine if the incorrect password was given. It is a simplification 
  7.      of PASSWRD5.SYS which was originally PWORD.SYS by an unknown author. 
  8.      This was subsequently modified by John R. Petrocelli on 2/5/85 and 
  9.      4/30/85, and by D. Drummond on 10/13/86 to produce the final 
  10.      PASSWRD5.SYS, which included: limiting the number of tries, making 
  11.      the password case insensitive, disabling Ctrl-Break, and making 
  12.      provisions for another program (LOCK.COM) to invoke the password 
  13.      request.
  14.      
  15.      The program was completely redone to make it shorter and have a more 
  16.      logical flow, while retaining all the features of PASSWRD5.SYS. The 
  17.      companion program LOCK.COM was also redone, and is now only 4 bytes 
  18.      long. Being a device driver, PW.SYS is loaded and run before 
  19.      AUTOEXEC.BAT is run, and cannot be bypassed by pressing Ctrl-Break or 
  20.      Ctrl-C, which will break out of a batch file. It is resident in 
  21.      memory at all times, so length is important; the resident portion is 
  22.      only 590 bytes long, and most of this is the fancy ANSI text. To get 
  23.      the color display, PW.SYS should occur after ANSI.SYS in your 
  24.      CONFIG.SYS file; if you don't use ANSI.SYS, delete all the ANSI 
  25.      escape sequences in the message area of the program.
  26.      
  27.      The source code for PW.SYS (in A86 assembler format-note the lack of 
  28.      SEGMENT, ASSUME, ENDS, PROC, etc.) is included for those interested 
  29.      in how it works, and is a good example of how to write a character 
  30.      type device driver. It can be converted to MASM format by adding the 
  31.      required ASSUMEs, SEGMENT, ENDS, END, etc. Basically, when DOS sees a 
  32.      device in CONFIG.SYS, it loads it and then calls the Strategy routine 
  33.      and passes the address of the Request Header (RH) for that device in 
  34.      ES:BX. The Strategy routine must store the RH address in the program 
  35.      data area, and then do a far return to DOS. Next, DOS calls the 
  36.      Interrupt routine to allow the device to initialize itself; in this 
  37.      case, the device installes the vector for Int 66h (an unused vector) 
  38.      for the LOCK program, then disables Cntl-Break and asks for the 
  39.      password. If the correct password is given within 3 tries, the 
  40.      program enables Cntl-Break and then writes the address of the 
  41.      first byte not required for the resident portion of the program 
  42.      (generally the Strategy and installation code) in the RH Data area. 
  43.      It then sets the done bit in the RH Status byte (thats why we had to 
  44.      save the address of the Request Header), and returns (far) to DOS. 
  45.      DOS then installs any other device drivers, and then runs 
  46.      AUTOEXEC.BAT. This device was given a very weird name, unlikely to be 
  47.      typed (even inadvertantly), which would trigger DOS to send info to 
  48.      or try to get info from the device, and cause strange things to 
  49.      happen.
  50.      
  51.      The LOCK.COM program is included to use with PW.SYS to ask for the 
  52.      password without rebooting. Remember that the vector for Int 66h was 
  53.      pointed to the proper place in PW.SYS to do a password check when 
  54.      PW.SYS was installed. So, all LOCK.COM has to do is call Int 66h and 
  55.      then terminate if the correct password was given. If the wrong 
  56.      password was given 3 times, the machine locks up and can only be 
  57.      restarted by cycling power (or pressing the RESET button if you have 
  58.      one). The source for LOCK.COM is:
  59.                Int  66h  ; Do a password check
  60.                Int  20h  ; and terminate thru DOS
  61.      If the correct password is not given, the program never returns from 
  62.      Int 66h.
  63.      
  64.      The password can be changed by changing the entry labeled 'Password' 
  65.      in the source and reassembling, or use DEBUG. The first byte is the 
  66.      number of characters in the password, followed by the ASCII 
  67.      representation of the password; up to 16 characters are allowed. In 
  68.      the supplied source, the password is PASSWORD and there are 8 
  69.      characters. If you want to distinguish between upper and lower case 
  70.      characters in the password, delete the 'Convup' subroutine and the 
  71.      two 'call Convup' instructions.
  72.      
  73.      If you have any comments or suggestions, I can be contacted at the 
  74.      Black Hole BBS in Orlando, Fl. (305) 260-6397, 1200/2400 baud.
  75.      Enjoy the program. Bob Montgomery, voice (305) 869-6481.
  76.