The MCI_SYSINFO message obtains system information about MCI devices. MCI handles this message without relaying it to any MCI device. MCI returns the system information in the MCI_SYSINFO_PARMS data structure. The MCI_SYSINFO_PARMS data structure has the following fields:
typedef struct {
DWORD dwCallback; /* callback for MCI_NOTIFY */
LPSTR lpstrReturn; /* pointer to buffer for return information */
DWORD dwRetSize; /* size of buffer */
DWORD dwNumber; /* index number */
WORD wDeviceType; /* device type */
WORD wReserved0; /* reserved */
} MCI_SYSINFO_PARMS;
The MCI_SYSINFO command message has the following flags.
Flag | Description |
MCI_SYSINFO_QUANTITY | Specifies that MCI will return the number of devices of a given type listed in the [mci] section of SYSTEM.INI. When used with the MCI_SYSINFO_OPEN flag, the number of open devices will be returned. |
MCI_SYSINFO_NAME | Specifies that MCI will return the name of a device that satisfies the query. When used with the MCI_SYSINFO_OPEN flag, only the names of open devices will be returned. |
MCI_SYSINFO_OPEN | Specifies that MCI will return the number or names of open devices. |
MCI_SYSINFO_INSTALLNAME | Specifies that MCI will return the name listed in the SYSTEM.INI file used to install the device. |
You use the MCI_SYSINFO_QUANTITY flag to determine the number of devices for a particular type listed in the [mci] section of the SYSTEM.INI file. For this flag, set the wDeviceType field of the data structure to the device type. When requesting the number of devices, set the wDeviceID parameter to NULL. MCI returns the number of devices as a DWORD in the lpstrReturn field of the data structure. If you combine the MCI_SYSINFO_QUANTITY flag with the MCI_SYSINFO_OPEN flag, MCI returns the number of devices opened by the task of that type.
Once you have the number of devices, you can enumerate the names of the devices using the MCI_SYSINFO_NAME flag. To get information using this flag, you must create a buffer for the return name. In the data structure, specify a pointer to the buffer, the size of the buffer, the index number corresponding to the device (1 is the first device), and the device type. This information is entered in the lpstrReturn, dwRetSize, dwNumber, and wDeviceType fields. MCI returns the device name in the buffer. When requesting a name of a particular device, set the wDeviceID parameter to NULL. To restrict the names to open devices, use the MCI_SYSINFO_OPEN flag with MCI_SYSINFO_NAME.
To obtain information on all devices in the system, you can assign MCI_ALL_DEVICE_ID to the wDeviceID parameter. When you use this identifier, MCI ignores the contents of the wDeviceType field and returns information on all MCI devices listed in the SYSTEM.INI file. When you use the MCI_SYSINFO_OPEN flag with the MCI_ALL_DEVICE_ID identifier, MCI returns information on the devices opened by the task.
You can obtain the installation name of an open device with the MCI_SYSINFO_INSTALLNAME flag. To get the installation name you must create a buffer for the return name. In the data structure, specify a pointer to the buffer and the size of the buffer in the lpstrReturn and dwRetSize fields. MCI places the device that corresponds to the wDeviceID parameter name in the buffer.