[comp.sys.ibm.pc] How to change directory entries in DOS ?

mr@homxb.UUCP (mark) (01/21/88)

----------------------------------------------------------------------
DOS 3.2 Rel 2.02

I would like to change entries in the directory structure.
For example :

1) Change last modification date
2) Change mode (This has a sys call)

I know that a directory can't be opened in the traditional way, but
I would like to be able to read and write arbitrary areas on the disk
with knowledge of the directory structure. I know that I somehow have
to deal with the DTA (disk transfer address) but I have no idea how to
do it. The documentation doesn't help at all. Any ideas ??

mark
homxb!mr

johnl@ima.ISC.COM (John R. Levine) (01/25/88)

In article <1395@homxb.UUCP> mr@homxb.UUCP (mark) writes:
>I would like to change entries in the directory structure.
>For example :
>
>1) Change last modification date
>2) Change mode (This has a sys call)
>
>...

There are system calls to change almost every part of a directory entry.
System call 57h changes the modification date, and 43h changes the mode. You
can change the name with 56h, including moving a file from one directory to
another.

You can, as suggested, read and write the disk yourself which involves using
interrupts (not calls) 25h and 26h, but if you can possibly do it with the
calls, you'll be much better off. Someday, you'll want to run your program
over a network, on a DOS-unix-Unix system, or in some other strange
environment. If you use the calls, it'll probably work. If you munge the disk
yourself, it certainly won't.
-- 
John R. Levine, IECC, PO Box 349, Cambridge MA 02238-0349, +1 617 492 3869
{ ihnp4 | decvax | cbosgd | harvard | yale }!ima!johnl, Levine@YALE.something
Gary Hart for President -- Let's win one for the zipper.