Share via


Device Interfaces (Windows CE 5.0)

Send Feedback

Device interface classes are the methods available to applications for accessing the capabilities of a device driver. They indicate to whatever receives notifications that a particular interface is present. A device driver can have multiple device interface classes, or it can have no device interface classes.

IClass registry subkeys reference device interfaces and their associated GUIDs. The header (.h) file that declares the interface typically defines the GUID and associates the GUID with the interface. The header file associates the interface with the GUID by defining the GUID. You must expose the interface classes through the IClass registry values or by calling AdvertiseInterface. You can also define your own interface classes.

There are no restrictions on the device interface. The means of accessing it is dependent on the interface.

The following code example shows how a header file typically defines a device interface GUIDs using a sample GUID.

#define DEVCLASS_IFCNAME_STRING TEXT("{12345678-1234-1234-1122334455667788}")
#define DEVCLASS_IFCNAME_GUID { 0x12345678, 0x1234, 0x1234, { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 } }

A driver in Device Manager that exposes an interface publicizes this by setting the IClass value set appropriately in the registry key passed into ActivateDeviceEx. With AdvertiseInterface, a device driver announces what device interfaces it exposes in the registry. This announcement is available to any application or driver that calls RequestDeviceNotifications. An application or driver can stop receiving device notifications by calling StopDeviceNotifications. These functions allow you to access the device interface's GUID and name. The GUID describes the device interface and the name disambiguates multiple instances of that device interface. For example, there is a GUID for the generic stream interface, and the names "COM1:" and "DSK1:" refer to two distinct instances of the generic stream interface.

It is possible for two different device interface classes GUIDs to have instances with the same name. The name has meaning only in the context of the access methods of the device interface named by the device interface class GUID.

A device driver should only export a device interface if it implements that device interface entirely. Any interaction with a driver will expect full support of the device interface it advertises.

By calling AdvertiseInterface, device drivers can explicitly send notifications. This is primarily for removable-media storage devices and other drivers that have not determined at load-time exactly which interfaces they will expose.

Device drivers should explicitly indicate that they can accept device handle access requests. If a device driver exposes a device handle-based interface, the driver should be able to accept an hOpenContext value of zero in the device driver's other functions. An hOpenContext value of zero indicates that the access is being requested on a device level and possibly with different OS level security. Device drivers that read AccessCode and ShareMode in their XXX_Open (Device Manager) function should treat device handle access requests appropriately. GUIDs are used to indicate support for device-based access and for individual device handle-based interfaces.

For information about finding interfaces exposes by name or file handle by a particular device, see Device File Names.

The following table shows the predefined interfaces and the header file under %_WINCEROOT% in which the interfaces are defined.

Interface Header file
BATTERY_DRIVER_CLASS Public\Common\OAK\Inc\Battery.h
BLOCK_DRIVER_GUID Public\Common\SDK\Inc\Storemgr.h
CDDA_MOUNT_GUID Public\Common\SDK\Inc\Storemgr.h
CDFS_MOUNT_GUID Public\Common\SDK\Inc\Storemgr.h
DEVCLASS_CARDSERV_GUID Public\Common\DDK\Inc\Cardserv.h

Public\Common\DDK\Inc\Cardsv2.h

DEVCLASS_DISPLAY_GUID Public\Common\OAK\Inc\Winddi.h
DEVCLASS_KEYBOARD_GUID Public\Common\SDK\Inc\Keybd.h
DEVCLASS_STREAM_GUID Public\Common\SDK\Inc\Pnp.h
DMCLASS_PROTECTEDBUSNAMESPACE Public\Common\DDK\Inc\Devload.h
FATFS_MOUNT_GUID Public\Common\SDK\Inc\Storemgr.h
FSD_MOUNT_GUID Public\Common\SDK\Inc\Storemgr.h
NLED_DRIVER_CLASS Public\Common\SDK\Inc\NLED.h
PMCLASS_BLOCK_DEVICE Public\Common\SDK\Inc\Pm.h
PMCLASS_DISPLAY Public\Common\SDK\Inc\Pm.h
PMCLASS_GENERIC_DEVICE Public\Common\SDK\Inc\Pm.h
PMCLASS_NDIS_MINIPORT Public\Common\SDK\Inc\Pm.h
STORE_MOUNT_GUID Public\Common\SDK\Inc\Storemgr.h
STOREMGR_DRIVER_GUID Public\Common\SDK\Inc\Storemgr.h
UDFS_MOUNT_GUID Public\Common\SDK\Inc\Storemgr.h

Note   Other predefined GUIDs for device interfaces are contained in various registry files. To find the other predefined GUIDs, search for the IClass values in the %_WINCEROOT%\Public\Common\OAK\Files\Common.reg file or in a driver-specific registry file. Driver-specific registry files are contained in the same directory as the device driver. For information about where drivers are in the source code, see Device Driver Source Code.

See Also

Loading Device Drivers | Bus Enumerator | Device Interface Notifications

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.