// wdffdo.h
NTSTATUS WdfFdoAddStaticChild(
[in] WDFDEVICE Fdo,
[in] WDFDEVICE Child
);
View the official Windows Driver Kit DDI reference
No description available.
[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.
Fdo
[in]A handle to a framework device object that represents the parent device.
Child
[in]A handle to a framework device object that represents the child device.
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.
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.
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;
}
WdfChildListAddOrUpdateChildDescriptionAsPresent