WdfCollectionGetCount method

[Applies to KMDF and UMDF]

The WdfCollectionGetCount method returns the number of objects that are currently in an object collection.

Syntax


ULONG WdfCollectionGetCount(
  [in] WDFCOLLECTION Collection
);

Parameters

Collection [in]

A handle to a collection object.

Return value

WdfCollectionGetCount returns the number of objects that are in the collection.

A system 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 obtains the number of objects in a specified collection and uses the number to examine all objects in the collection.


ULONG count;

count = WdfCollectionGetCount(CollectionHandle);
for (i = 0; i < count; i++) {
    ObjectHandle = WdfCollectionGetItem(
                                        CollectionHandle,
                                        i
                                        );
    // 
    // Perform object-specific operations.
    // 
}

Requirements

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, KmdfIrql, KmdfIrql2

See also

WdfCollectionGetItem

 

 

Send comments about this topic to Microsoft

Show: