[alt.msdos.programmer] Opening a directory table via FCB or file handle open interrupt

pmaniac@walt.cc.utexas.edu (Noah Friedman) (07/03/90)

  What I have been trying to do is use the aforementioned OPEN calls
in MS-DOS 3.10 to open a directory table, so that I can read directly
from, and hopefully write to, the table. There are several reasons for
doing this, as opposed to using the silly findfirst and findnext
calls. The first reason is that no interrupts return anything about
beginning cluster numbers for files, nor do they return the file size
of a directory. (this is not stored in the parent directory table, but
the beginning cluster number is, and I can then go hunt through the
FAT). These calls open any other sort of file, but not directories.
Why? I wish to be able to do what some people would consider nasty 
operations on file tables, like set and unset the directory bit in 
the attribute byte, something that the chmod interrupt (int 0x21,
function 0x43) won't let you do either. 

   Admittedly, this can be pretty dangerous, which is probably why
those crazy guys at MicroSoft decided that the open calls should not
be allowed to open directories as if they were normal files, even by
experienced programmers who know what they're doing.

   I find this offensive. First of all, DOS is not supposed to be a
"secure system," where certain operations are not allowed to be
executed by the user. Obviously, in one of those undocumented
interrupts, or in the kernel itself, the attribute for directories is
checked and is deliberately choked on.

   Secondly, it doesn't really protect against anything. It just makes
getting my hands on the directory table more frustrating, since I have
to go look up FAT information, do absolute disk reads off the root
directory and trace through the desired path, read in the relevent
records, change them, and write back out!

   By restricting read/write access to directory tables, all the
designers at MicroSoft have accomplished is to make it more
inefficient to do what it is I'm presently trying (and succeeding) 
to do.

   You might ask why I'm doing this. Well, without having to go and
rewrite the entire operating system, and so that old MS-DOS
applications and any future programs will be perfectly compatible, I
am writing new interfaces, and providing UNIX-like extensions such as
symbolic/hard links, more powerful utilities for moving files and
such, and, of course, a C-shell with directory stacks, command
aliasing, pipes, limited multitasking, and a few other neat things. 
Being able to directly read directory tables would very much improve
the performance of the linking/unlinking process, as well as the ls
and chmod utilities.

   Can anyone help me here, or am I basically stuck with an inferior
operating system whose designers tried to be as unhelpful as possible
with nothing to do about it?

   Please direct all replies, flames, or other comments to me via email,
as I don't read these newsgroups on a regular basis.

Thanks in advance!

---
Noah Friedman
pmaniac@ccwf.cc.utexas.edu

The above opinions are not necessarily representative of those held by
my employer or the corporation I work for. Of course, we don't use DOS
at work, thank god. :-)