VideoPortGetAccessRanges function

The VideoPortGetAccessRanges function retrieves bus-relative configuration information and, if possible, claims these hardware resources in the registry for the caller.


  PVOID                   HwDeviceExtension,
  ULONG                   NumRequestedResources,
  ULONG                   NumAccessRanges,
  PVIDEO_ACCESS_RANGE     AccessRanges,
  PVOID                   VendorId,
  PVOID                   DeviceId,
  PULONG                  Slot



Pointer to the miniport driver's device extension.


Specifies the number of elements in the RequestedResources array.



Specifies the number of elements in the AccessRanges array.


Pointer to an area on the stack or to a static structure in the miniport driver to which VideoPortGetAccessRanges returns an array of VIDEO_ACCESS_RANGE elements filled with the bus-relative device memory ranges for the adapter.


Should be set to NULL.


Should be set to NULL.


Pointer to a memory location in which the video port driver stores the slot number for the device, or is NULL.

For Plug and Play devices, if this is a valid pointer, the video port driver stores the slot number at the memory location specified by the pointer. If a NULL value is passed in the call, the video port driver does not store a value in the location.

Return Value

VideoPortGetAccessRanges returns NO_ERROR if it successfully filled in the AccessRanges information or returned configuration information at RequestedResources.


Every video miniport driver either must use access ranges returned by VideoPortGetAccessRanges, or must call VideoPortVerifyAccessRanges before attempting to access a video adapter during the driver (and system) initialization process.

VideoPortGetAccessRanges can be called only from a miniport driver's HwVidFindAdapter function.

For most miniport drivers, VideoPortGetAccessRanges can retrieve, verify, and claim the bus-relative access ranges and any interrupt and/or DMA channel/port used by a particular video adapter, while VideoPortVerifyAccessRanges can only verify and claim miniport driver-specified resources. That is, for all configuration information that it returns, VideoPortGetAccessRanges claims the corresponding hardware resources in the registry for the caller. A miniport driver need not call VideoPortVerifyAccessRanges with the returned bus-relative configuration information, unless the miniport driver attempts to modify any of the returned values.

Each successful call to VideoPortGetAccessRanges or VideoPortVerifyAccessRanges for a particular adapter overwrites the miniport driver's preceding claim on hardware resources in the registry.

After a successful call to VideoPortGetAccessRanges, the miniport driver must map the returned bus-relative ranges to logical ranges with VideoPortGetDeviceBase before calling the appropriate VideoPortRead/WriteXxx function to communicate with the adapter.

Generally, the miniport driver of a PCI device should have its HwVidFindAdapter function call VideoPortGetAccessRanges, rather than attempt to manipulate the nondevice-specific PCI_COMMON_CONFIG information returned by a call to VideoPortGetBusData. This miniport driver can typically call VideoPortGetAccessRanges with a NULLRequestedResources pointer. The video port driver then uses the configuration space of the PCI bus to determine the resources for the video adapter. The miniport driver can call VideoPortGetAccessRanges, using a set of driver-supplied RequestedResources specifications, if its original call fails to return valid configuration data for the adapter.

Note that miniport drivers of adapters on other types of I/O buses also can call VideoPortGetAccessRanges. These drivers should call VideoPortGetAccessRanges using a RequestedResources pointer to a driver-supplied array of I/O resource descriptors.

If the HwVidFindAdapter function claims bus-relative access ranges and possibly other hardware resources for an adapter, but then determines that it does not support the adapter, then the miniport driver must relinquish its claims on hardware resources in the registry by calling VideoPortGetAccessRanges or VideoPortVerifyAccessRanges with the NumAccessRanges parameter set to zero.


Minimum supported client Available in Windows 2000 and later versions of the Windows operating systems.
Target Platform Desktop
Header video.h (include Video.h)
Library Videoprt.lib
DLL Videoprt.sys

See Also