WdfFdoAddStaticChild function (wdffdo.h)

[Applies to KMDF only]

The WdfFdoAddStaticChild method adds a specified device to a function driver's list of child devices that have been identified by static enumeration.

Syntax

NTSTATUS WdfFdoAddStaticChild(
  [in] WDFDEVICE Fdo,
  [in] WDFDEVICE Child
);

Parameters

[in] Fdo

A handle to a framework device object that represents the parent device.

[in] Child

A handle to a framework device object that represents the child device.

Return value

If the operation succeeds, the method returns STATUS_SUCCESS. Additional return values include:

Return code Description
STATUS_INVALID_PARAMETER
Fdo is not a handle to a function driver's device object.
 

The method might also return other NTSTATUS values.

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

Remarks

Drivers that use static bus enumeration can call WdfFdoAddStaticChild. For more information about static child lists, see Enumerating the Devices on a Bus.

If WdfFdoAddStaticChild returns an NTSTATUS value that NT_SUCCESS evaluates as FALSE, the driver must call WdfObjectDelete to delete the framework device object that represents the child device. The driver must not delete the framework device object after WdfFdoAddStaticChild returns STATUS_SUCCESS.

Examples

The following code example creates a framework device object that represents a new child device and adds the child device to the parent device's list of children. For the complete code example, see the KbFiltr sample driver.

NTSTATUS  status;
PWDFDEVICE_INIT  pDeviceInit = NULL;
WDFDEVICE  hChild = NULL;
WDF_OBJECT_ATTRIBUTES  pdoAttributes;

pDeviceInit = WdfPdoInitAllocate(Device);
if (pDeviceInit == NULL) {
    status = STATUS_INSUFFICIENT_RESOURCES;
    goto Cleanup;
}
...
status = WdfDeviceCreate(
                         &pDeviceInit,
                         &pdoAttributes,
                         &hChild
                         );
if (!NT_SUCCESS(status)) {
    WdfDeviceInitFree(pDeviceInit);
    pDeviceInit = NULL;
    goto Cleanup;
}
...
status = WdfFdoAddStaticChild(
                              Device,
                              hChild
                              );
if (!NT_SUCCESS(status)) {
    goto Cleanup;
}

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Header wdffdo.h (include Wdf.h)
Library Wdf01000.sys (see Framework Library Versioning.)
IRQL <= DISPATCH_LEVEL
DDI compliance rules AddPdoToStaticChildList(kmdf), DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf)

See also

WdfChildListAddOrUpdateChildDescriptionAsPresent

WdfDeviceCreate

WdfPdoInitAllocate