MCI Data Structures

The fields in the data structures used for the lParam2 parameter all have similar organizations. All the fields in these data structures are the size of DWORDs. Their first field is dwCallback and it is used for the window function associated with the MCI_NOTIFY flag. If the data structure is used to return data from the device driver, the data-return fields immediately follow the first field. If the data structure is used to pass data to the device driver from the application, the data-transfer fields immediately follow any return fields.

There are four possible arrangements for return fields:

If a command message does not have return data, the data structure does not have any return fields.

If a command message returns integer data, the second field of the data structure is reserved for the data.

If a command message returns string data, the second and third fields of the data structure are reserved. The second field is reserved for a pointer to the null-terminated return string. The third field is reserved for the size of return buffer. The application is responsible for creating the buffer for the return string.

If a command message returns RECT data, the data occupies the second and third fields of the data structure. The second field is reserved for the top-left values of the RECT data. The third field is reserved for the bottom-right values of the RECT data.

Any data passed to your device driver follows the return fields. Your device driver should not read data from a field in these data structures unless the field is validated with a flag. Without the flag, your device driver is not guaranteed of finding valid data in the structure. For example, the MCI_OPEN_ELEMENT flag validates the lpstrElementName field of the MCI_OPEN_PARMS data structure.

If an application does not use any of the fields of a data structure, it can specify NULL for lParam2.

Commands that extend the data structures will add new fields to the end of the existing data structures. The names used for extended structures add the device type to the name of the data type. For example, the extended MCI_OPEN_PARMS data structure for animation devices uses MCI_ANIM_OPEN_PARMS as the name.