Microsoft KB Archive/39534

From BetaArchive Wiki

SHARE.EXE Required to Support Removable Media Device Drivers ID Number: Q39534

3.x 4.00 4.01 MS-DOS


When writing a block device driver that supports the Open, Close, and Removable Media abilities new to MS-DOS Versions 3.x and later, the driver should set bit 11 of the Attribute Field word to 1.

For block devices that enable this bit 11, MS-DOS will be able to use the following command codes in the device-driver request packet:

Code Function

13    Device Open
14    Device Close
15    Removable Media

When these device-driver calls are requested by MS-DOS, the driver will be able to maintain a reference count of opens and closes for the media.

Note, however, that the installation of the MS-DOS utility SHARE.EXE is REQUIRED in order for MS-DOS to call the removable-media device driver calls.

More Information:

Correct semantics of file handle opens and closes are not guaranteed to be enforced without SHARE.EXE installed. There are many early applications that perform ill-behaved FCB file I/O, such as the following:

400 opens with no closes 200 opens with 100 closes 100 opens with 400 closes delete an open file rename an open file

With SHARE.EXE installed, such strange I/O behavior is not tolerated. Thus, since proper file I/O semantics are being enforced, MS-DOS will then be able to call the device-driver command codes listed above. Since such semantics are not being enforced, MS-DOS does NOT make the calls to these command codes to prevent the device driver from being confused.