Device driver function 0Dh      Open Device             b   c

Open Device informs the device driver that a file device or a
character device is being opened or created.

This function can be used for both block and character device
drivers.

──────────────────────────────────────────────────────────────────

DOS calls this function only if bit 11 is set in the dhAttributes
field of the DeviceHeader structure for the driver.

DOS calls this function whenever an application opens or creates a
file or opens a device. This function can be used in conjunction
with Close Device (device driver function 0Eh) to manage internal
buffers and device initialization. To manage internal buffers,
this function, when used in a block device driver, should
increment the count of open files on the specified drive; Close
Device decrements this count and flushes internal buffers when all
files are closed. Keeping this count can also help the driver
determine whether the medium in the drive has been removed before
all files have been closed.
To help manage device initialization, this function, when used
in a character device driver, can reset the device and send it
control strings to prepare it for subsequent input. If a character
device driver offers this feature, it should also provide IOCTL
Read and IOCTL Write (device driver functions 03h and 0Ch) to let
programs get and set the current control strings.

──────────────────────────────────────────────────────────────────

ocrUnit
Specifies which device contains the file being opened or created.
This field is used with block device drivers only.


ocrStatus
Specifies the status of the completed function. If the function
was successful, the driver must set the done bit (bit 8).
Otherwise, the driver must set both the error and done bits (bits
15 and 8) and copy an error value to the low-order byte.