Device Interface Notifications (Compact 2013)
3/26/2014
Device interface notifications are messages that the Windows Embedded Compact Device Manager uses to alert applications, services, and device drivers to the availability and removal of device interfaces. Device interface notifications enable an event system in Windows Embedded Compact that is similar to the Plug and Play event system on Windows-based desktop platforms. You can use device interface notifications in your device drivers to make applications, services, and device drivers aware that your device is present or removed, and of what interfaces your device driver supports.
Device Manager generates the following notifications.
- WM_DEVICECHANGE messages
Notifies recipients of a change in device status. Send these messages using the SendNotifyMessage function.
- Message queue messages
Includes notifications that the AdvertiseInterface function explicitly advertises, and notifications that the device driver's IClass registry key value specifies to advertise. GUIDs in the IClass value may have a name associated with them in the form of "{GUID}=GUID_friendly_name".
You can cause Device Manager APIs to send notifications for all of a driver's defined interfaces after the driver is loaded and initialized, and again after the driver is unloaded, in any of the following ways.
- Define the interface in the IClass value of the registry key used to activate the device.
- Define the IClass value in the Active key by using the Init function of a device driver.
- Define the IClass value in the REGINI parameter passed to the ActivateDeviceEx function.
- To define the IClass value you must have advance access to the instance information for the driver that is about to be loaded. The driver should also indicate whether it can accept device handle access requests. For more information see XXX_Open (Device Manager).
- Call AdvertiseInterface for the interfaces that your device driver supports.
- The following rules ensure that recipients of WM_DEVICECHANGE messages can process a non-legacy device name.
- IClass GUIDs without friendly names generate WM_DEVICECHANGE messages only if the device has a legacy name, such as "COM1:".
- If a legacy name for the device exists, IClass GUIDs without friendly names use the device's legacy name.
- If a legacy name for the device does not exist, IClass GUIDs without friendly names use the device's full name (for example, "\$device\COM11").
- Names sent using the AdvertiseInterface function are transmitted unmodified.
- IClass GUIDs with friendly names are transmitted unmodified.
If a message queue does not include sufficient space for a non-legacy device name, the attempt to transmit the message fails and the message queue consumer will not receive a message that it cannot process.
To add this feature to your OS, see Core OS Services Catalog Items and Sysgen Variables.
Use the RequestDeviceNotifications function to register for device interface notifications. To stop receiving device interface notifications, call the StopDeviceNotifications functions and then close the message queue by calling the CloseMsgQueue function. For more information about message queue functions, see Message Queue Point-to-Point Reference.
For reference information, see Device Interface Notifications Reference.