Thursday, June 16, 2016

BffDeviceWdmGetAttachedDevice

Description


Retrieve the next lower WDM device object in the device stack of the specified WDF object. Never call this function in EvtDestroyCallback of BffDevice.

Declaration

PDEVICE_OBJECT BffDeviceWdmGetAttachedDevice(BFFDEVICE BffDevice);

Parameter


BffDeviceThe WDF object as a bus filter device object.

Return value


The next lower WDM device object for success; NULL otherwise.

BffDeviceWdmGetDeviceObject

Description


Retrieve the WDM bus filter device object that is associated with the specified WDF object. Never call this function in EvtDestroyCallback of BffDevice.

Declaration

PDEVICE_OBJECT BffDeviceWdmGetDeviceObject(BFFDEVICE BffDevice);

Parameter


BffDeviceThe WDF object as a bus filter device object.

Return value


The WDM bus filter device object for success; NULL otherwise.

BffPreprocessQueryBusRelations

Description


The callback function for an upper filter driver to preprocess IRP_MN_QUERY_DEVICE_RELATIONS/BusRelations before KMDF. This routine can be passed as EvtDeviceWdmIrpPreprocess into WdfDeviceInitAssignWdmIrpPreprocessCallback for IRP_MJ_PNP/IRP_MN_QUERY_DEVICE_RELATIONS, or be invoked in an upper filter driver's EvtDeviceWdmIrpPreprocess callback function. In the latter case, the upper filter driver must return the value that this routine returns.

Declaration

NTSTATUS BffPreprocessQueryBusRelations(WDFDEVICE Device, PIRP Irp);

Parameters


DeviceThe WDF device object representing an upper filter device object.
IrpThe IRP_MN_QUERY_DEVICE_RELATIONS I/O request packet.

Return value


The value that WdfDeviceWdmDispatchPreprocessedIrp returns.

BffAllocateContext

Description


Allocate context space for an upper filter device object on behalf of Bus Filter Framework. This routine is typically called in the EvtDriverDeviceAdd callback function.

Declaration

NTSTATUS BffAllocateContext(WDFDEVICE Device);

Parameters


DeviceThe WDF device object representing an upper filter device object.

Return value


The value that WdfObjectAllocateContext returns.

BffInitialize

Description


Initialize Bus Filter Framework with the initialization data. This routine must be invoked in DriverEntry after a call to WdfDriverCreate.

Declaration

NTSTATUS BffInitialize(PDRIVER_OBJECT DriverObject,
PUNICODE_STRING RegistryPath,
PBFF_INITIALIZATION_DATA InitData,
 WDFDRIVER Driver);

Parameters


DriverObjectThe same as DriverEntry's first parameter.
RegistryPathThe same as DriverEntry's second parameter.
InitDataThe initialization data previously prepared by a call to BffSetInitializationData.
DriverThe WDF driver object.

Return value


One of the following values:
  1. Zero or any positive value for success;
  2. STATUS_NOT_SUPPORTED if the driver has not called WdfDriverCreate, or if this routine is called for a second time;
  3. STATUS_INVALID_PARAMEER if an invalid parameter is specified; or
  4. Any other negative value for failure.

BffSetInitializationData

Description


Prepare the initialization data for BFF. Obviously, this routine must be called before BffInitialize. After this call, InitData->PnPMinorFunction[IRP_MN_*] will be NULL-initialized. You may selectively re-initialize InitData->PnPMinorFunction[IRP_MN_*] with your own handlers before calling BffInitialize.

Declaration

VOID BffSetInitializationData(PBFF_INITIALIZATION_DATA InitData,
        DEVICE_TYPE Type, ULONG Characteristics,
        PBFF_DEVICE_ADD DeviceAdd, PBFF_DEVICE_REMOVE DeviceRemove);

Parameters


InitDataThe pointer to the initialization data, typically declared as a local variable.
TypeThe device type for creation of a bus filter device object.
CharacteristicsThe device characteristics for creation of a bus filter device object.
DeviceAddThe callback function for creation of a bus filter device object.
DeviceRemoveThe callback function for removal of a bus filter device object.

Return value


None.

BFF_INITIALIZATION_DATA / PBFF_INITIALIZATION_DATA

Desciprtion


Data structure for initialization of Bus Filter Framework. Typically, you declare a local variable of this type, and call BffSetInitializationData to initialize it. Then, you selectively re-initialize PnPMinorFunction[IRP_MN_*] with your own handlers before calling BffInitialize.

Declaration

typedef struct _BFF_INITIALIZATION_DATA {
 ULONG Size;
 BFF_DEVICE_CONFIG DeviceConfig;
 PBFF_DISPATCH_PNP PnPMinorFunction[IRP_MN_DEVICE_ENUMERATED+1];
} BFF_INITIALIZATION_DATA, *PBFF_INITIALIZATION_DATA;

Members


SizeMust be the size of this data structure. (Mandatory)
DeviceConfigConfiguration data for a bus filter device object.
PnPMinorFunctionThe array of function pointers to PnP minor function handlers.