Article View: alt.msdos.programmer
Article #620Re: Stat-ing a Directory file
From: Russell J Mellon
Date: Wed, 11 Nov 1992 03:45
Date: Wed, 11 Nov 1992 03:45
53 lines
2497 bytes
2497 bytes
In article <BxGsCA.Lnu@fang.att.com> pheffner@fang.att.com (Paul Heffner) writes:
>
>Anyone out there know a way of obtaining the size and time/date
>information of a MS-DOS directory file using standard DOS calls
>under MASM? For a regular file, you can use Int 21, function 5700
>to get the time and date of an open file using its handle, likewise
>you can use the old seek-to-end trick to get the file size, but both
>of these require an open file handle to work, and you can't open a
>directory file like in Unix (or can you?). The MS C stat function
>goes as far as returning what seems to be a good set of timestamp
>information, so I guess it's there for using if you know how to get
>it. (Or does that function resort to sneaky non-standard methods
>to get the info?) All input would be appreciated!
>
>Thanks!
>
>Heff
Supprised that you know about the Int 21h function 5700 and don't know about
the Int 21h function 11h and function 12h. Function 11h Finds the first file
matching the file specifications, and function 12h finds the next.
for both, DX = offset of a File Control Block ( you fill in the info )
DS = segment for the same FCB
These are for DOS Ver 1.0 or better. for DOS ver 2.0 and better there are
functions 4Eh and 4Fh.
for 4Eh ( find first ):
ah = 4eh
cx = file attributes to search for
0 - Read-Only
1 - Hidden
2 - System
3 - Volume label
4 - Reserved ( should be 0 )
5 - Archive
and bits 6 through 15 are reserved also
dx = Offset of ASCII string specifing filename ( and optionally a path )
ds = Segment of above string. string must be terminated with a nul byte
for 4Fh ( find next )
ax = 4Fh
before using 4Eh, call service 1Ah to set the address of the current DTA
ah = 1Ah
dx = offset
ds = segment
the DTA is 128 bytes long and is used by service 4Eh and 4Fh.
Hope I helped.
Technical Details
Message-ID:
<BxJ93H.Io6@mentor.cc.purdue.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!elroy.jpl.nasa.gov!usc!cs.utexas.edu!uwm.edu!spool.mu.edu!news.nd.edu!mentor.cc.purdue.edu!sage.cc.purdue.edu!russ1066References:
<BxGsCA.Lnu@fang.att.com>Show Full Headers
Complete Article Headers
Newsgroups: alt.msdos.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!elroy.jpl.nasa.gov!usc!cs.utexas.edu!uwm.edu!spool.mu.edu!news.nd.edu!mentor.cc.purdue.edu!sage.cc.purdue.edu!russ1066 From: russ1066@sage.cc.purdue.edu (Russell J Mellon) Subject: Re: Stat-ing a Directory file Message-ID: <BxJ93H.Io6@mentor.cc.purdue.edu> Sender: news@mentor.cc.purdue.edu (USENET News) Organization: Purdue University Computing Center References: <BxGsCA.Lnu@fang.att.com> Date: Wed, 11 Nov 1992 03:45:16 GMT Lines: 53