[comp.binaries.ibm.pc] Write protect hard disk in software

cgs@umd5.umd.edu (Chris Sylvain) (05/16/88)

[I'm told that PC magazine allows noncommercial distribution of programs
published in it. -- R.D.]

Summary: PROTECT.COM simulates a write-protect tab by allowing read access
	but not write access to the hard-disk (floppy drives A:, and B: are
	not affected).

This is a "User-to-User" Hard-Disk protection program from the January issue
of PC Magazine. As submitted, the program only checks for AH = 03h (Write
Sector from memory) and AH = 05h (Format Track) of the BIOS interrupt service
13h. I have added an additional check for AH = 0Bh (Write Long).

The checks are by no means a complete set of all those ways I am aware of
writing to the hard-disk.

This program is a replacement for the INT 13h vector, and toggles on and off
each time the program is invoked. The program functions as a "write-protect"
tab for a hard-disk. The program monitors the requests for disk I/O. If a
"write" operation is requested, and the selected device is "C:" (or greater),
the write protection error is returned to DOS. Any other disk I/O request
proceeds as before this program was installed.

The program will have to be modified if you intend to use this when you also
use devices that are not partitions of the hard-disk and have identifiers
greater than "C:". Add:
	CMP	DL, <dev. no. [00h = A:, 01h = B:, etc.]>H
	JZ	CONTINUE
in the code section labelled "CHECKSTAT:" to skip disk I/O checking for the
other devices.

[Archive listing follows.

Name          Length    Stowage    SF   Size now  Date       Time    CRC
============  ========  ========  ====  ========  =========  ======  ====
PROTECT.ASM       3677  Crunched   43%      2126  11 May 88   9:12p  0469
PROTECT.COM        250  Crunched    8%       231  11 May 88   9:19p  d10d
PROTECT.DOC       1391  Crunched   33%       940  11 May 88   7:56p  96f7
        ====  ========            ====  ========
Total      3      5318             39%      3297  
-- R.D.]

--- cut here --- UUencoded PKarc -oct file ---
section 1 of uuencode 2.13 of file protect.arc    by R.E.M.

begin 644 protect.arc
M&@A04D]414-4+D%330``3@@``*L0EJEI!%T.```,.QHHV`$"BI0G5(H,H>(BH
MR)0F(%J`N"(G#9TR(.#(>7-Q#!T0=,*(`3$G39LZ;,+02?/&#0@S;^2`0!-&M
M#AD09-+,62,PH((A4XH<21#T2),B3J@(3.!P2I6C((#J`"ITZ1,I0V/`@(&DS
MI\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