Propagating the FILE_DEVICE_SECURE_OPEN Flag

Note

For optimal reliability and performance, use file system minifilter drivers with Filter Manager support instead of legacy file system filter drivers. To port your legacy driver to a minifilter driver, see Guidelines for Porting Legacy Filter Drivers.

After attaching a legacy filter device object to a file system (but not to a volume), always set the FILE_DEVICE_SECURE_OPEN flag on the filter device object such that it matches the value of the next-lower device object on the driver stack. For more information about this flag, see Specifying Device Characteristics and DEVICE_OBJECT. An example follows, where DeviceObject is a pointer to the device object to which the filter device object has been attached; myLegacyFilterDeviceObject is a pointer to the filter device object itself.

if (FlagOn( DeviceObject->Characteristics, FILE_DEVICE_SECURE_OPEN )) {
    SetFlag(myLegacyFilterDeviceObject->Characteristics, FILE_DEVICE_SECURE_OPEN );
}