[comp.os.msdos.misc] Hiding a DOS drive

dsew@uhura.cc.rochester.edu (David Sewell) (09/12/90)

    I'm about to start sharing my office computer with another user.
I have a hard disk with two partitions, C: and D:.  I would like to
make the D: drive invisible or inaccessible to the sharee because it
contains personal data and files.  Since the sharee is not a
DOS-sophisticated person I thought it ought to be sufficient to
create the following batch file, give it a DOS-like name, store it
as a hidden file in a directory in my PATH, and put it in
AUTOEXEC.BAT:
              @ECHO OFF
              ATTR +H D:\*.* > NUL
              SUBST D: E:\
[where "attr" is a PC mag utility to change file attributes, in this
case to hidden, and where E:\ is a RAM disk, empty on bootup of
course].
    The SUBST command will fool my word processor and PC-Tools,
while hiding all the root files and directories on D: will make D:
look empty to Lotus Magellan (which ignores the SUBST redefinition).
All I have to do when I'm using the machine is reverse the two
commands to get my drive back.
    I'm aware that there are password-protect programs that will do
similar things, but I'd rather not make it obnoxiously obvious that
I'm locking something away (the sharee is also a personal friend).
    Does this hack seem good enough, or can anyone think of a simple
but more elegant way of hiding a drive?
----------------------
David Sewell, English Dep't, University of Rochester, New York USA 
dsew@uhura.cc.rochester.edu || dsew%uhura.cc.rochester.edu@uorvm.BITNET 

Ralf.Brown@B.GP.CS.CMU.EDU (09/12/90)

In article <9461@ur-cc.UUCP>, dsew@uhura.cc.rochester.edu (David Sewell) wrote:
}
}    I'm about to start sharing my office computer with another user.
}I have a hard disk with two partitions, C: and D:.  I would like to
}make the D: drive invisible or inaccessible to the sharee because it
}contains personal data and files.  Since the sharee is not a

The fastest way of temporarily making a drive inaccessible under DOS 3+
would be to diddle the "drive exists" bit in the current directory
structure for the drive.  It's anything other than elegant, though,
since it involves various undocumented data structures inside DOS.

INT 21 - DOS 2+ internal - GET LIST OF LISTS
	AH = 52h
Return: ES:BX -> DOS list of lists

Format of List of Lists:
Offset	Size	Description
---DOS 3.0---
 17h	DWORD	pointer to array of current directory structures (see below)
---DOS 3.1-3.3---
 16h	DWORD	pointer to array of current directory structures (see below)
---DOS 4.x---
 16h	DWORD	pointer to array of current directory structures (see below)

Format of current directory structure (array, 51h bytes [58h for DOS 4.x] per
drive):
Offset	Size	Description
 00h 67 BYTEs	current path as ASCIZ, starting with 'x:\'
 43h	WORD	bit flags
		bit 15: network drive	\ installable file system if both set
		bit 14: physical drive	/ invalid drive if neither bit set
		bit 13: JOIN'ed, current path is actual path without JOIN
			drive letter in path may differ from logical drive name
		bit 12: SUBST'ed, current path is actual path without SUBST
			drive letter in path may differ from logical drive name
[rest omitted, see the Interrupt List]


--
UUCP: {ucbvax,harvard}!cs.cmu.edu!ralf -=- 412-268-3053 (school) -=- FAX: ask
ARPA: ralf@cs.cmu.edu  BIT: ralf%cs.cmu.edu@CMUCCVMA  FIDO: 1:129/3.1
Disclaimer?    |   I was gratified to be able to answer promptly, and I did.
What's that?   |   I said I didn't know.  --Mark Twain