PFLT_INSTANCE_SETUP_CALLBACK routine

A minifilter driver can register a routine of type PFLT_INSTANCE_SETUP_CALLBACK as the minifilter driver's InstanceSetupCallback routine.

Syntax


PFLT_INSTANCE_SETUP_CALLBACK InstanceSetupCallback;

NTSTATUS InstanceSetupCallback(
  _In_  PCFLT_RELATED_OBJECTS FltObjects,
  _In_  FLT_INSTANCE_SETUP_FLAGS Flags,
  _In_  DEVICE_TYPE VolumeDeviceType,
  _In_  FLT_FILESYSTEM_TYPE VolumeFilesystemType
)
{ ... }

Parameters

FltObjects [in]

Pointer to an FLT_RELATED_OBJECTS structure that contains opaque pointers for the objects related to the current operation.

Flags [in]

Bitmask of flags that indicate why the instance is being attached. One or more of the following:

FlagMeaning

FLTFL_INSTANCE_SETUP_AUTOMATIC_ATTACHMENT

The instance is being attached automatically. Either the minifilter driver was just loaded and is being attached to all existing volumes, or it is being attached to a newly mounted volume.

FLTFL_INSTANCE_SETUP_MANUAL_ATTACHMENT

The instance is being attached manually because a user-mode application has called FilterAttach or FilterAttachAtAltitude or because a kernel-mode component has called FltAttachVolume or FltAttachVolumeAtAltitude.

FLTFL_INSTANCE_SETUP_NEWLY_MOUNTED_VOLUME

The instance is being attached automatically to a newly mounted volume.

FLTFL_INSTANCE_SETUP_DETACHED_VOLUME

The instance is being attached to a detached volume. It is possible, on some filesystems (such as FAT and CDFS), to reattach a volume after it has detached. A volume is detached if it has no associated storage stack. A volume in this state is usually a dismounted volume that still has open files.

 

VolumeDeviceType [in]

Device type of the file system volume. Must be one of the following:

FILE_DEVICE_CD_ROM_FILE_SYSTEM

FILE_DEVICE_DISK_FILE_SYSTEM

FILE_DEVICE_NETWORK_FILE_SYSTEM

VolumeFilesystemType [in]

File system type of the volume. The possible values are listed in FLT_FILESYSTEM_TYPE.

Return value

This callback routine returns STATUS_SUCCESS or an NTSTATUS value such as the following:

Return codeDescription
STATUS_FLT_DO_NOT_ATTACH

Returning this value prevents the minifilter driver instance from being attached to the given volume. This is an error code.

 

Remarks

When a minifilter driver registers itself by calling FltRegisterFilter from its DriverEntry routine, it can register a routine of type PFLT_INSTANCE_SETUP_CALLBACK as the minifilter driver's InstanceSetupCallback routine.

To register the InstanceSetupCallback routine, the minifilter driver stores the address of a routine of type PFLT_INSTANCE_SETUP_CALLBACK in the InstanceSetupCallback member of the FLT_REGISTRATION structure that the minifilter driver passes as the Registration parameter of FltRegisterFilter.

The filter manager calls this routine on the first operation after a new volume is mounted.

The filter manager calls this routine to allow the minifilter driver to respond to an automatic or manual attachment request. If this routine returns an error or warning NTSTATUS code, the minifilter driver instance is not attached to the given volume. Otherwise, the minifilter driver instance is attached to the given volume.

Requirements

Header

Fltkernel.h (include Fltkernel.h)

IRQL

PASSIVE_LEVEL

See also

FilterAttach
FilterAttachAtAltitude
FLT_REGISTRATION
FLT_RELATED_OBJECTS
FltAttachVolume
FltAttachVolumeAtAltitude
FltRegisterFilter
PFLT_INSTANCE_QUERY_TEARDOWN_CALLBACK
PFLT_INSTANCE_TEARDOWN_CALLBACK

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.