共用方式為


DriverEntry of Video Miniport Driver function

DriverEntry is the initial entry point into the video miniport driver.

Syntax

ULONG DriverEntry(
  _In_ PVOID Context1,
  _In_ PVOID Context2
);

Parameters

Context1 [in] Pointer to a context value with which the miniport driver must call VideoPortInitialize. This context value identifies the driver object created by the system for this miniport driver.

Context2 [in] Pointer to a second context value with which the miniport driver must call VideoPortInitialize. This context value identifies the registry path for this miniport driver.

Return value

DriverEntry returns the value returned by VideoPortInitialize.

Remarks

Each miniport driver must have a function explicitly named DriverEntry in order to be loaded. DriverEntry is called directly by the I/O system.

DriverEntry must perform the following steps:

  • Allocate memory on the stack for a VIDEO_HW_INITIALIZATION_DATA structure, and call VideoPortZeroMemory to zero-initialize it.

  • Fill in driver-specific and adapter-specific values in the VIDEO_HW_INITIALIZATION_DATA members, including the miniport driver's entry points. The following entry points must be set to a miniport driver-supplied routine:

    HwVidFindAdapter

    HwVidInitialize

    HwVidStartIO

    HwVidInterrupt

    HwVidQueryInterface

    HwVidGetVideoChildDescriptor

    HwVidGetPowerState

    HwVidSetPowerState

  • If the driver's hardware supports legacy resources, the driver must report them. DriverEntry should do the following if the resource list is known at driver compile time:

    • Claim and report all such resources in the HwLegacyResourceList and HwLegacyResourceCount members of the VIDEO_HW_INITIALIZATION_DATA structure. Legacy resources are those resources not listed in the device's PCI configuration space but that are decoded by the device.
    • Fill in the RangePassive field accordingly for each VIDEO_ACCESS_RANGE structure defined in the miniport driver.

    If the legacy resource list cannot be determined until run time, the driver should instead implement a HwVidLegacyResources function to report them.

  • Call VideoPortInitialize, passing Context1 and Context2 as the first two parameters, a pointer to the VIDEO_HW_INITIALIZATION_DATA structure as the third parameter, and NULL as the fourth parameter.

DriverEntry should propagate the value returned by VideoPortInitialize back to the caller.

If DriverEntry does claim resources, it should include only those resources that the hardware decodes but that are not claimed by PCI. The miniport driver can "reclaim" these legacy resources again in subsequent call(s) to VideoPortVerifyAccessRanges; however, the video port driver will just ignore requests for any such previously claimed resources. Power management and docking will be disabled in the system if the miniport driver attempts to claim a legacy access range in VideoPortVerifyAccessRanges that was not previously claimed in the HwLegacyResourceList member of the VIDEO_HW_INITIALIZATION_DATA structure during DriverEntry (or in HwVidLegacyResources, if implemented).

For Microsoft Windows 2000 and later drivers that also support computers running Windows NT 4.0, hardware configuration constants are defined in video.h. These constants are described in the following table.

Constant Meaning

SIZE_OF_NT4_VIDEO_PORT_CONFIG_INFO

The size, in bytes, of the Windows NT 4.0 VIDEO_PORT_CONFIG_INFO structure.

SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA

The size, in bytes, of the Windows NT 4.0 VIDEO_HW_INITIALIZATION_DATA structure. If VideoPortInitialize fails, the video miniport driver should set the HwInitDataSize member of the VIDEO_HW_INITIALIZATION_DATA structure to the size of either the Windows 2000 (and later) version of this structure or the Windows NT 4.0 version. Choose the appropriate structure size to match the operating system version on which the miniport driver will run. The video miniport driver should then call VideoPortInitialize again. For an example of use, please see the video miniport driver samples that were included in the Windows Driver Development Kit (DDK).

SIZE_OF_W2K_VIDEO_HW_INITIALIZATION_DATA

The size, in bytes, of the Windows 2000 and later VIDEO_HW_INITIALIZATION_DATA structure.

SIZE_OF_WXP_VIDEO_HW_INITIALIZATION_DATA

The size, in bytes, of the Windows Vista and later VIDEO_HW_INITIALIZATION_DATA structure.

SIZE_OF_WXP_VIDEO_PORT_CONFIG_INFO

The size, in bytes, of the Windows Vista VIDEO_PORT_CONFIG_INFO structure.

DriverEntry should be made pageable.

Requirements

Target platform

Desktop

Header

Video.h (include Video.h)

Library

NtosKrnl.lib

DLL

NtosKrnl.exe

See also

HwVidFindAdapter

HwVidLegacyResources

VIDEO_HW_INITIALIZATION_DATA

VideoPortInitialize

VideoPortVerifyAccessRanges

VideoPortZeroMemory