[net.micro.pc] accessing DOS disk directory

marcus@wanginst.UUCP (Bob Marcus) (04/23/86)

I would like to access the DOS disk directory from a C program.  The
technical reference manual for DOS (3.1) gives the format for directory
entries, but I can't figure out how to access the information.  Can
anyone help, please?  
-- 
Bob Marcus                               marcus@wanginst        (Csnet)
Wang Institute of Graduate Studies       wanginst!marcus        (UUCP)
Tyng Road, Tyngsboro, MA 01879           (617) 649-9731

brown@nicmad.UUCP (04/26/86)

In article <1882@wanginst.UUCP> marcus@wanginst.UUCP (Bob Marcus) writes:
>I would like to access the DOS disk directory from a C program.  The
>technical reference manual for DOS (3.1) gives the format for directory
>entries, but I can't figure out how to access the information.  Can
>anyone help, please?  

Basically you just read the sectors that contain the information and then
use what is there, according the format you mentioned.

Word of caution, don't write to said sectors.  Why?  When the diskette is
read, DOS reads in the directory information.  When you change any of the 
sectors, DOS won't know about them, as the copy in memory isn't changed.

When I use Norton's Utilities to play with hard disk directories, I make
the DOS read a different sub-directory and then read the one I changed,
so DOS will know about the changes.
-- 

              ihnp4------\
            harvard-\     \
Mr. Video      seismo!uwvax!nicmad!brown
              topaz-/     /
             decvax------/

coulter@hplabsc (05/01/86)

The only way I could find to do it was to use DOS routines to read absolute
sectors off of the disk.  A real pain.  I had to write an assembly language
routine to allow me to invoke an arbitrary interrupt and to pass register
values back and forth.  My PC doesn't talk to this machine yet, so I can't
give you the sources here.

I started with reading sector zero to find out how the disk is
layed out.  I recommend Norton's Programmer's Guide as a good reference.
Good luck.

-- Michael Coulter, ...ucbvax!hplabs!coulter