Support Device Interfaces (Compact 7)

3/12/2014

Device interfaces are the methods that applications use to access device driver capabilities. Because a device driver can implement any arbitrary set of commands in its IOControl function, it is useful to have a standard set of IOCTL commands that device drivers can implement for common operations. The existence of a standard set of IOCTL commands makes it possible for applications to use the same IOCTL command for an operation that is supported by multiple device drivers. For example, Windows Embedded Compact Power Manager uses a set of common device interfaces to issue power management commands to device drivers. For more information about power management, see Support Power Management.

Device interface classes are a way to organize and describe these common IOCTL commands. Device drivers use device interface classes to implement device interfaces, and a device driver can have zero or more device interface classes. Platform Builder includes files that uniquely identify each interface class with a GUID. The header (.h) file that declares the interface typically defines the GUID and associates the GUID with the interface. The following code example shows how a header file typically defines a device interface GUID.

#define DEVCLASS_IFCNAME_STRING \
        TEXT("{12345678-1234-1234-1234567887654321}")

#define DEVCLASS_IFCNAME_GUID \
        { 0x12345678, 0x1234, 0x1234, \
            { 0x12, 0x34, 0x56, 0x78, 0x87, 0x65, 0x43, 0x21 }}

The following table lists some of the predefined interfaces and the header file under %_WINCEROOT% that defines each interface.

Device Interfaces

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\sdk\inc\cardserv.h

DEVCLASS_DISPLAY_GUID

public\COMMON\sdk\inc\winddi.h

DEVCLASS_KEYBOARD_GUID

public\COMMON\sdk\inc\keybd.h

DEVCLASS_STREAM_GUID

public\COMMON\sdk\inc\pnp.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\storemgr.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

You are not restricted to this list of predefined interface classes. You can define your own interface classes.

When a device driver supports one or more device interfaces, it must notify the OS of the device interfaces that it supports. Your device driver should export a device interface only if it entirely implements that device interface. Any application or OS component that interacts with your driver expects full support of the device interfaces that you advertise.

You can advertise a device interface in one of two ways:

  1. By defining a registry subkey called IClass that specifies one or more GUIDs that represent the device interfaces that your driver supports
  2. By calling the Device Manager function AdvertiseInterface to announce the interfaces that your device driver exposes

Typically, you advertise with AdvertiseInterface when you want to explicitly send notifications for a removable-media storage device or when your device driver discovers which interfaces it is to expose to the OS and applications. When you call AdvertiseInterface, your announcement is available to any application or OS component that calls RequestDeviceNotifications. These announcement recipients can call StopDeviceNotifications to stop receiving device interface notifications.

For more information about device interface notifications and IClass, see Device Interface Notifications.

See Also

Concepts

Implement Your Device Driver