Share via


AddDevice Routine for AVStream Minidrivers routine

The vast majority of AVStream minidrivers do not supply their own AddDevice routines. Instead, they use KsAddDevice, the default AddDevice handler installed by KsInitializeDriver. Minidrivers that nonetheless wish to provide their own AddDevice handler should follow the guidelines on this reference page.

Syntax

NTSTATUS AddDevice(
   PDRIVER_OBJECT DriverObject,
   PDEVICE_OBJECT PhysicalDeviceObject
);

Parameters

  • DriverObject
    Caller-supplied pointer to a DRIVER_OBJECT structure. This is the driver's driver object.

  • PhysicalDeviceObject
    Caller-supplied pointer to a DEVICE_OBJECT structure representing a physical device object (PDO) created by a lower-level driver.

Return value

Returns STATUS_SUCCESS or the error code that was returned from the attempt to perform the operation.

Remarks

If the driver calls KsInitializeDriver during DriverEntry and later replaces the AddDevice handler, the minidriver can call KsAddDevice from within this routine, to perform the default add handling.

The minidriver may call KsCreateDevice from this routine, passing in a nominally optional KSDEVICE_DESCRIPTOR. If KsInitializeDriver is not called, this is the highest level call that will create an AVStream device described by a descriptor.

If the minidriver creates its own FDO and manually attaches itself to the device stack, it should call KsInitializeDevice to create the AVStream device.

If the driver does not provide a KSDEVICE_DESCRIPTOR and yet still creates a device, AVStream creates a default AVStream device. This device contains no filter factories and never dispatches to the minidriver. The minidriver can still instantiate KSFILTERFACTORY structures on the device by calling KsCreateFilterFactory.

To install your own AddDevice handler:

DriverObject->DriverExtension->AddDevice=MyAddDevice();

It is highly recommended that AVStream minidrivers use the functionality provided by KsInitializeDriver, rather than override the default AddDevice routine supplied by the class driver.

Requirements

Target platform

Desktop

Version

Available in Microsoft Windows XP and later operating systems and DirectX 8.0 and later DirectX versions.

Header

Ks.h (include Ks.h)

See also

KsAddDevice

KsCreateDevice

KSDEVICE

KsDispatchIrp

KsInitializeDevice

KsInitializeDriver

 

 

Send comments about this topic to Microsoft