home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / alt / msdos / programm / 2706 < prev    next >
Encoding:
Text File  |  1992-11-10  |  2.4 KB  |  65 lines

  1. Newsgroups: alt.msdos.programmer
  2. Path: 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
  3. From: russ1066@sage.cc.purdue.edu (Russell J Mellon)
  4. Subject: Re: Stat-ing a Directory file
  5. Message-ID: <BxJ93H.Io6@mentor.cc.purdue.edu>
  6. Sender: news@mentor.cc.purdue.edu (USENET News)
  7. Organization: Purdue University Computing Center
  8. References: <BxGsCA.Lnu@fang.att.com>
  9. Date: Wed, 11 Nov 1992 03:45:16 GMT
  10. Lines: 53
  11.  
  12. In article <BxGsCA.Lnu@fang.att.com> pheffner@fang.att.com (Paul Heffner) writes:
  13. >
  14. >Anyone out there know a way of obtaining the size and time/date
  15. >information of a MS-DOS directory file using standard DOS calls
  16. >under MASM? For a regular file, you can use Int 21, function 5700
  17. >to get the time and date of an open file using its handle, likewise
  18. >you can use the old seek-to-end trick to get the file size, but both 
  19. >of these require an open file handle to work, and you can't open a
  20. >directory file like in Unix (or can you?). The MS C stat function
  21. >goes as far as returning what seems to be a good set of timestamp
  22. >information, so I guess it's there for using if you know how to get
  23. >it. (Or does that function resort to sneaky non-standard methods
  24. >to get the info?) All input would be appreciated!
  25. >
  26. >Thanks!
  27. >
  28. >Heff
  29.  
  30. Supprised that you know about the Int 21h function 5700 and don't know about
  31. the Int 21h function 11h and function 12h.  Function 11h Finds the first file
  32. matching the file specifications, and function 12h finds the next.
  33.  
  34. for both, DX = offset of a File Control Block ( you fill in the info )
  35.           DS = segment for the same FCB
  36.  
  37. These are for DOS Ver 1.0 or better.  for DOS ver 2.0 and better there are
  38. functions 4Eh and 4Fh.
  39.  
  40. for 4Eh ( find first ):
  41.    ah = 4eh
  42.    cx = file attributes to search for
  43.        0 - Read-Only
  44.        1 - Hidden
  45.        2 - System
  46.        3 - Volume label
  47.        4 - Reserved ( should be 0 )
  48.        5 - Archive
  49.        and bits 6 through 15 are reserved also
  50.    dx = Offset of ASCII string specifing filename ( and optionally a path )
  51.    ds = Segment of above string.  string must be terminated with a nul byte
  52.  
  53. for 4Fh ( find next )
  54.    ax = 4Fh
  55.  
  56.  
  57. before using 4Eh, call service 1Ah to set the address of the current DTA
  58.    ah = 1Ah
  59.    dx = offset
  60.    ds = segment
  61.  
  62. the DTA is 128 bytes long and is used by service 4Eh and 4Fh.
  63.  
  64. Hope I helped. 
  65.