Jump to content

MCI_SYSINFO

From EDM2

This message returns information about media control devices, device instances, and system configuration. It is primarily used to query the quantity or names of devices, or to manage device drivers in the MMPM2.INI file.

Syntax

param1
ULONG ulParam1; /* Message flags. */

param2
PMCI_SYSINFO_PARMS pParam2; /* Pointer to sysinfo structure. */

Parameters

ulParam1 (ULONG) - input
Only one MCI_SYSINFO_xxxxx flag can be used per message. MCI_SYSINFO_NAME and MCI_SYSINFO_QUANTITY are mutually exclusive.
* MCI_WAIT — Control is not returned until the action completes.
* MCI_SYSINFO_INSTALLNAME — Returns the name used to install the device.
* MCI_SYSINFO_QUANTITY — Returns the number of devices of the type specified in `usDeviceType`. If MCI_SYSINFO_OPEN is also set, it returns the number of open devices.
* MCI_SYSINFO_NAME — Returns the name(s) of devices satisfying the query. Multiple names are separated by spaces and null-terminated.
* MCI_SYSINFO_OPEN — Returns information specifically about open devices.
* MCI_SYSINFO_ITEM — Indicates that the `ulItem` field contains one of the following specific action constants:
* MCI_SYSINFO_INSTALL_DRIVER — Creates or updates a logical device entry in the INI file. (Takes effect after restart).
* MCI_SYSINFO_QUERY_DRIVER — Queries information for a specific driver.
* MCI_SYSINFO_INI_LOCK — Flushes and locks the `MMPM2.INI` file from updates.
* MCI_SYSINFO_DELETE_DRIVER — Removes a driver from the INI file. (Takes effect after restart).
* MCI_SYSINFO_SET_PARAMS / QUERY_PARAMS — Manages device-specific ASCII parameters.
* MCI_SYSINFO_SET_CONNECTORS / QUERY_CONNECTORS — Manages logical connector information.
* MCI_SYSINFO_SET_EXTENSIONS / QUERY_EXTENSIONS — Manages file extensions associated with a device.
* MCI_SYSINFO_SET_TYPES / QUERY_TYPES — Manages extended type attributes.
* MCI_SYSINFO_SET_ALIAS — Associates an alias with a device.
* MCI_SYSINFO_QUERY_NAMES — Queries names associated with a device using ID, type, or ordinal.
* MCI_SYSINFO_SET_DEFAULT / QUERY_DEFAULT — Manages the default device for a specific device type.
pParam2 (PMCI_SYSINFO_PARMS) - input/output
A pointer to the MCI_SYSINFO_PARMS structure.

Return Value

rc (ULONG)
* MCIERR_SUCCESS — Success.
* MCIERR_INVALID_BUFFER — The buffer is too small. `ulRetSize` will contain the required size.
* MCIERR_DEVICE_NOT_FOUND — No device matched the query.
* MCIERR_DUPLICATE_ALIAS / EXTENSION / EA — The specified item already exists.
* MCIERR_NODEFAULT_DEVICE — No device of the requested type exists.
* MCIERR_FLAGS_NOT_COMPATIBLE — Incompatible flags were used together.

Remarks

  • **Device Types:** Use `usDeviceType` to filter the query. Specifying `MCI_ALL_DEVICE_ID` returns information on all devices open by the current process.
  • **INI Updates:** MCI_SYSINFO_ITEM actions are typically used by installation and setup programs. Driver installation or deletion requires a system restart to take effect.
  • **Default Devices:** If MCI_SYSINFO_QUERY_DEFAULT is called and no explicit default is set, the system implicitly treats the first installed device of that type as the default.

Example Code

The following example determines the number of installed waveform audio devices.

   #define  RETBUFSIZE 128

   MCI_SYSINFO_PARMS  SysInfo;
   CHAR  SysInfoRet[RETBUFSIZE];

   /* Set unused fields to zero */
   memset(&SysInfo, 0x00, sizeof(MCI_SYSINFO_PARMS));
   
   SysInfo.usDeviceType  = MCI_DEVTYPE_WAVEFORM_AUDIO;
   SysInfo.pszReturn = (PSZ) &SysInfoRet;
   SysInfo.ulRetSize = RETBUFSIZE;

   /* Determine the number of waveform audio devices installed */
   mciSendCommand (0,                         /* Don't know device ID yet     */
    MCI_SYSINFO,                               /* MCI sysinfo message          */
    MCI_SYSINFO_QUANTITY | MCI_WAIT,           /* Flags for this message       */
    (PVOID)&SysInfo,                           /* Data structure               */
    0);                                        /* No user parm                 */

   /* SysInfoRet now contains the count as a string (e.g., "1") */