Calling VideoPortInitialize

A miniport driver might have a set of bus-type-specific HwVidFindAdapter functions if its adapter can be connected on various types of I/O bus, or it can call VideoPortInitialize with the same HwVidFindAdapter function for each type of bus and possibly use driver-supplied HwVid..Callback functions to get adapter configuration information from the registry.

A miniport driver must modify the AdapterInterfaceType member in  VIDEO_HW_INITIALIZATION_DATA after each call to VideoPortInitialize, possibly modify the context data (and HwFindAdapter member, if the driver writer implements separate HwVidFindAdapter functions) for the new bus type, and call VideoPortInitialize once for each type of I/O bus on which a supported adapter could be connected.

VideoPortInitialize does the following:

·Checks the validity of the miniport’s VIDEO_HW_INITIALIZATION_DATA specifications

·Collects and stores pertinent information in the device extension of a device object that it creates to represent the adapter

·Allocates memory for and zeros a VIDEO_PORT_CONFIG_INFO-type buffer

·Fills in as much configuration information as it can in this buffer

·Allocates memory for a device extension to contain the miniport’s per-adapter state information

·Calls the miniport driver’s HwVidFindAdapter function, described later in HwVidFindAdapter Functionality.

If the miniport driver sets an AdapterInterfaceType value in VIDEO_HW_INITIALIZATION_DATA but there is no I/O bus of that type in the machine, the port driver returns STATUS_NO_SUCH_DEVICE. VideoPortInitialize does not call the miniport-supplied HwVidFindAdapter function for that bus type. The miniport driver does not remain loaded if there are no I/O buses of the corresponding AdapterInterfaceType(s) for its adapter(s) in the machine.

Note that VideoPortInitialize also is responsible for the following before it calls the miniport’s HwFindAdapter routine:

·Setting up all necessary NT objects for the miniport driver

·Getting requested configuration information from and setting configuration information in the registry

·Allocating system resources on behalf of the miniport driver, including memory of the miniport-specified HwDeviceExtensionSize for the miniport’s device extension

·Initializing the miniport’s device extension with zeros before it calls HwVidFindAdapter with a pointer to the device extension it allocated.

VideoPortInitialize can be called only from a miniport driver’s DriverEntry function.