[comp.sys.ibm.pc] ...INT 21 ...

dono@killer.DALLAS.TX.US (Don OConnell) (01/15/89)

>From allbery@ncoast.UUCP Sat Jan 14 23:28:32 1989
>invoking it on the pathname \DEV\CON -- and, to my surprise, it returned
>with an attribute byte of 40H!  In playing with it, I discovered that
>\DEV\CON was the *only* device that produced this behavior; other devices,
>and \DEV\*.*, returned AX=3 (path not found).
               SHOULD BE 2-^
>This was done in a Turbo Pascal 3.01 program running under MS-DOS 3.21.

>Anyone know if I hit a fluke or if this actually happens?  Does it have to
>do with the device being open by the program (i.e. \DEV\CON is
>stdin/stdout/stderr -- but then, \DEV\CON1 should be open as stdaux and
>\DEV\LPT1 as stdprn)?

Yes DOS does have some /dev files, though they are not the standard UNIX 
names, ie.:
	/dev/con	console
	/dev/prn	printer
	/dev/com?	communications dev [1/2]
    I don't know about /dev/con1 but I doubt that it exists. Nor do I know 
    what stdaux would be called.

>From allbery@ncoast.UUCP Sat Jan 14 23:34:04 1989
>
>The only copy of the Interrupt List I can find on ncoast and my almost
>useless DOS manual agree that the structureset by INT 21, AH=4EH/4FH
>contains one 16-bit entity each for file date and time.  Question:  does
>anyone know the format of these numbers?

INT 21 - DOS 2+ - FIND FIRST ASCIZ (FIND FIRST)
        AH = 4Eh
        CX = search attributes
        DS:DX -> ASCIZ filename
Return: CF set on error
            AX = error code
        [DTA] = data block
              undocumented fields
                  PC-DOS 3.10
                     byte  00h:     drive letter
                     bytes 01h-0Bh: search template
                     byte  0Ch:     search attributes
                  DOS 2.x (and DOS 3.x except 3.1???)
                     byte  00h:     search attributes
                     byte  01h:     drive letter
                     bytes 02h-0Ch: search template
                  bytes 0Dh-0Eh: entry count within directory
                  bytes 0Fh-12h: reserved
                  bytes 13h-14h: cluster number of parent directory
              byte  15h:     attribute of file found
              bytes 16h-17h: file time
              bytes 18h-19h: file date
              bytes 1Ah-1Dh: file size
              bytes 1Eh-3Ah: ASCIZ filename+extension
--------------------------------------------------
INT 21 - DOS 2+ - FIND NEXT ASCIZ (FIND NEXT)
        AH = 4Fh
        [DTA] = data block from last AH = 4Eh/4Fh call
Return: CF set on error
            AX = error code
        [DTA] = data block, see AH = 4Eh above
--------------------------------------------------

allbery@ncoast.UUCP (Brandon S. Allbery) (01/22/89)

As quoted from <6798@killer.DALLAS.TX.US> by dono@killer.DALLAS.TX.US (Don OConnell):
+---------------
| >From allbery@ncoast.UUCP Sat Jan 14 23:28:32 1989
| >invoking it on the pathname \DEV\CON -- and, to my surprise, it returned
| >with an attribute byte of 40H!  In playing with it, I discovered that
| >\DEV\CON was the *only* device that produced this behavior; other devices,
| >and \DEV\*.*, returned AX=3 (path not found).
|                SHOULD BE 2-^
+---------------

(1) The actual return was AX=3.  Use of actual nonexistent paths returned
    AX=2, as expected.  And my DOS manual seemed to be saying that AX=3 means
    the same thing as AX=2.  Anyone know what it was *really* trying to tell
    me?

+---------------
| >Anyone know if I hit a fluke or if this actually happens?  Does it have to
| >do with the device being open by the program (i.e. \DEV\CON is
| >stdin/stdout/stderr -- but then, \DEV\CON1 should be open as stdaux and
| >\DEV\LPT1 as stdprn)?
| 
| Yes DOS does have some /dev files, though they are not the standard UNIX 
| names, ie.:
+---------------

I obviously should have been more clear; although the fact that I explicitly
mentioned some of the other pathnames *should* have given people a clue.
THIS WAS NOT THE QUESTION -- I'm quite aware of the "virtual" \DEV\*
pathnames.  My question was:  why does "find first" on \DEV\CON work, but
"find first" of \DEV\NUL, etc. fail?  After all, DOS recognizes them in e.g.
"open".  (Oh, \DEV\CON1 was a typo, I meant \DEV\COM1.)  [Sorry for the
tone, I seem to be getting lots of responses of this type.]

The surprise came from the fact that I thought "open" did something special
with \DEV\*, and that other DOS calls didn't recognize it; after all, my HD
doesn't *have* a \DEV directory.  And yet at least one device path was
recognized by "find first".  I would have expected either all of them or
none of them -- *not* just \DEV\CON and nothing else.

+---------------
| >From allbery@ncoast.UUCP Sat Jan 14 23:34:04 1989
| >The only copy of the Interrupt List I can find on ncoast and my almost
| >useless DOS manual agree that the structure set by INT 21, AH=4EH/4FH
| >contains one 16-bit entity each for file date and time.  Question:  does
| >anyone know the format of these numbers?
| 
| INT 21 - DOS 2+ - FIND FIRST ASCIZ (FIND FIRST)
> ...
|               bytes 18h-19h: file date
|               bytes 1Ah-1Dh: file size
+---------------

Please note I said "numbers", *not* "structures".  I was after the format of
the date and time, not of the "find first/next" buffer which I already have.
I've already received this information from others; thanks to all who
responded.

++Brandon
-- 
Brandon S. Allbery, moderator of comp.sources.misc    allbery@ncoast.org (soon)
uunet!hal.cwru.edu!ncoast!allbery		    ncoast!allbery@hal.cwru.edu
      Send comp.sources.misc submissions to comp-sources-misc@<backbone>
NCoast Public Access UN*X - (216) 781-6201, 300/1200/2400 baud, login: makeuser

leonard@bucket.UUCP (Leonard Erickson) (01/24/89)

[Why does findfirst/findnext work for \DEV\CON, but not for \DEV\COM1?]

Just a thought... try the call *after* opening COM1. Maybe it works on
CON because CON maps uses two of the 5 handles DOS assigns by default?
-- 
Leonard Erickson		...!tektronix!reed!percival!bucket!leonard
CIS: [70465,203]
"I used to be a hacker. Now I'm a 'microcomputer specialist'.
You know... I'd rather be a hacker."