WdfCollectionGetFirstItem function (wdfcollection.h)

[Applies to KMDF and UMDF]

The WdfCollectionGetFirstItem method returns a handle to the first object that is in an object collection.

Syntax

WDFOBJECT WdfCollectionGetFirstItem(
  [in] WDFCOLLECTION Collection
);

Parameters

[in] Collection

A handle to a collection object.

Return value

WdfCollectionGetFirstItem returns a handle to the object that is currently at the front of the specified collection's list of objects, or NULL if the list is empty.

A bug check occurs if the driver supplies an invalid object handle.

Remarks

For more information about object collections, see Framework Object Collections.

Examples

The following code example removes each item from a collection and deletes each item's object.

while ((subRequest = WdfCollectionGetFirstItem(hCollection)) != NULL) {
    WdfCollectionRemoveItem(
                            hCollection,
                            0
                            );
    WdfObjectDelete(subRequest);
}

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Minimum UMDF version 2.0
Header wdfcollection.h (include Wdf.h)
Library Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)
IRQL <= DISPATCH_LEVEL
DDI compliance rules DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf)

See also

WdfCollectionGetItem

WdfCollectionGetLastItem