INT 21 - DOS 2+ - "OPEN" - OPEN EXISTING FILE
AH = 3Dh
AL = access and sharing modes
bits 2-0: access mode
000 read only
001 write only
010 read/write
bit 3: reserved (0)
bits 6-4: sharing mode (DOS 3+)
000 compatibility mode
001 "DENYALL" prohibit both read and write access by others
010 "DENYWRITE" prohibit write access by others
011 "DENYREAD" prohibit read access by others
100 "DENYNONE" allow full access by others
bit 7: inheritance
if set, file is private to current process and will not be
inherited by child processes
DS:DX -> ASCIZ filename
CL = attribute mask of files to look for (server call only)
Return: CF clear if successful
AX = file handle
CF set on error
AX = error code (01h,02h,03h,04h,05h,0Ch) (see AH=59h)
Notes:  file pointer is set to start of file
file handles which are inherited from a parent also inherit sharing
and access restrictions
files may be opened even if given the hidden or system attributes
under the FlashTek X-32 DOS extender, the pointer is in DS:EDX
SeeAlso: AH=3Ch,AX=4301h,AX=5D00h,INT 2F/AX=1226h

File sharing behavior:
|     Second and subsequent Opens
First    |Compat  Deny   Deny   Deny   Deny
Open     |        All    Write  Read   None
|R W RW R W RW R W RW R W RW R W RW
- - - - -| - - - - - - - - - - - - - - - - -
Compat R |Y Y Y  N N N  1 N N  N N N  1 N N
W |Y Y Y  N N N  N N N  N N N  N N N
RW|Y Y Y  N N N  N N N  N N N  N N N
- - - - -|
Deny   R |C C C  N N N  N N N  N N N  N N N
All    W |C C C  N N N  N N N  N N N  N N N
RW|C C C  N N N  N N N  N N N  N N N
- - - - -|
Deny   R |2 C C  N N N  Y N N  N N N  Y N N
Write  W |C C C  N N N  N N N  Y N N  Y N N
RW|C C C  N N N  N N N  N N N  Y N N
- - - - -|
Deny   R |C C C  N N N  N Y N  N N N  N Y N
Read   W |C C C  N N N  N N N  N Y N  N Y N
RW|C C C  N N N  N N N  N N N  N Y N
- - - - -|
Deny   R |2 C C  N N N  Y Y Y  N N N  Y Y Y
None   W |C C C  N N N  N N N  Y Y Y  Y Y Y
RW|C C C  N N N  N N N  N N N  Y Y Y
Legend: Y = open succeeds, N = open fails with error code 05h
C = open fails, INT 24 generated
1 = open succeeds if file read-only, else fails with error code
2 = open succeeds if file read-only, else fails with INT 24

See also: 210F

213D - DOS 2+ - "OPEN" - OPEN EXISTING FILE