MCI_OPEN is the first message received by the MCD. This message instructs the driver to create and initialize an instance of a particular device. The MCD must allocate and initialize the instance structure. Note that the MCI_OPEN message does not make the instances active.
Because the MDM needs to pass additional information to the drivers, the open structure for MCDs is different from the MCI_OPEN_PARMS structure. In addition, the MCDs need to return information to the MDM. If the application requests a NOTIFY on the MCI_OPEN message, the MCD sends back the open NOTIFY on the MCIDRV_RESTORE message. This is transparent to the application. The MCD does not receive any of the following flags on an MCI_OPEN:
On the MCI_OPEN message, pParam2 points to the MMDRV_OPEN_PARM structure located in the MMDRVOS2.H file. This structure contains information for the MCD.
┌────────────────────────┬────────┬──────────────────────────────────────────┐│Field │In/Out │Description │ ├────────────────────────┼────────┼──────────────────────────────────────────┤ │HWND hwndCallback │In │Window handle used for mciDriverNotify. │ ├────────────────────────┼────────┼──────────────────────────────────────────┤ │USHORT usDeviceID │In │Device ID assigned to this instance. This│ │ │ │field is filled in by MDM. │ ├────────────────────────┼────────┼──────────────────────────────────────────┤ │USHORT usDeviceType │In │Device type number for this instance. │ ├────────────────────────┼────────┼──────────────────────────────────────────┤ │USHORT usDeviceOrd │In │Device ordinal number for this instance. │ ├────────────────────────┼────────┼──────────────────────────────────────────┤ │PVOID pInstance │InOut │Pointer to instance structure initialized │ │ │ │by driver. The driver fills in this │ │ │ │parameter. │ ├────────────────────────┼────────┼──────────────────────────────────────────┤ │CHAR szDevDLLName[260]│In │Character string containing │ │ │ │device-specific DLL name to call for the │ │ │ │open. │ ├────────────────────────┼────────┼──────────────────────────────────────────┤ │PSZ pszElementName │In │Typically a file name. If OPEN_PLAYLIST │ │ │ │is specified, this is a pointer to a │ │ │ │memory playlist. If OPEN_MMIO is │ │ │ │specified, this is a MMIO handle. │ ├────────────────────────┼────────┼──────────────────────────────────────────┤ │USHORT usDevParmLen │In │Device parameters data block length. │ ├────────────────────────┼────────┼──────────────────────────────────────────┤ │PVOID pDevParm │In │Device parameters data block. This data is│ │ │ │unique to each type of device and is │ │ │ │retrieved from the MMPM2.INI file. (for │ │ │ │example, LVD "PORT=COM1 SPEED=9600N71"). │ ├────────────────────────┼────────┼──────────────────────────────────────────┤ │USHORT │InOut │Number of resource units this instance │ │usResourceUnitsRequired │ │requires. See Resource Units and Classes. │ ├────────────────────────┼────────┼──────────────────────────────────────────┤ │USHORT usResourceClass │InOut │Resource class this instance belongs to. │ │ │ │See Resource Units and Classes. │ ├────────────────────────┼────────┼──────────────────────────────────────────┤ │USHORT │InOut │Resource priority for this instance. │ │usResourcePriority │ │ │ ├────────────────────────┼────────┼──────────────────────────────────────────┤ │ULONG ulParam2 │In │Pointer to MCI_OPEN structure. │ └────────────────────────┴────────┴──────────────────────────────────────────┘