Specifying Device Characteristics

Each device object can have one or more device characteristics. Device characteristics are stored as flags in the Characteristics member of the device object's DEVICE_OBJECT structure.

Most drivers specify only the FILE_DEVICE_SECURE_OPEN characteristic. This ensures that the same security settings are applied to any open request into the device's namespace. For more information, see Controlling Device Namespace Access.

The FILE_AUTOGENERATED_DEVICE_NAME is only used for PDOs. The FILE_FLOPPY_DISKETTE, FILE_REMOVABLE_MEDIA, and FILE_WRITE_ONCE_MEDIA characteristics are specific to storage devices. For a description of the possible device characteristic flags, see the description of the Characteristics member of DEVICE_OBJECT.

Certain device characteristics, such as FILE_AUTOGENERATED_DEVICE_NAME, only apply to individual device objects. Drivers can specify a setting for the device characteristics for individual device objects when they create the device object by calling IoCreateDevice or IoCreateDeviceSecure.

The following characteristics apply to the entire device stack:

FILE_DEVICE_SECURE_OPEN

FILE_FLOPPY_DISKETTE

FILE_READ_ONLY_DEVICE

FILE_REMOVABLE_MEDIA

FILE_WRITE_ONCE_MEDIA

Drivers can set device characteristics that apply to the entire device stack by calling IoCreateDevice or IoCreateDeviceSecure. Alternatively, device characteristics that apply to the entire device stack can be set in the registry, for either the device or for the device's setup class. (For more information, see Setting Device Object Properties in the Registry.)

The PnP manager determines the registry setting for device characteristics as follows.

  • If a value is specified for the individual device, the PnP manager uses that value;

  • Otherwise, if a value is specified for the device setup class, the PnP manager uses that value;

  • Otherwise, the PnP manager uses a value of zero as the registry setting.

If a device characteristic that applies to the entire device stack is set in the registry, or if it is set for any FDO or filter DO in the stack, then the PnP manager sets it for every device object in the stack. (If the device is raw mode capable, and thus does not have an FDO, then the PnP manager uses the PDO instead.)