KsCreateBusEnumObject function

This function is intended for internal use only.

The KsCreateBusEnumObject function creates a demand-load bus enumerator object and initializes it for use with the demand-load bus enumerator services.


NTSTATUS KsCreateBusEnumObject(
  _In_     PWSTR          BusIdentifier,
  _In_     PDEVICE_OBJECT BusDeviceObject,
  _In_     PDEVICE_OBJECT PhysicalDeviceObject,
  _In_opt_ PDEVICE_OBJECT PnpDeviceObject,
  _In_opt_ REFGUID        InterfaceGuid,
  _In_opt_ PWSTR          ServiceRelativePath


BusIdentifier [in]

Pointer to a wide-charachter string prefix identifier for the bus, such as L"SW" or L"KSDSP". This prefix is used to create the unique hardware identifier for the device, such as: SW\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.

BusDeviceObject [in]

Pointer to the FDO for the bus. The device object must have been previously created and must have been attached to the PDO for the device.

PhysicalDeviceObject [in]

Pointer to the Plug and Play-supplied PDO for the device.

PnpDeviceObject [in, optional]

Pointer to the driver stack to forward Plug and Play IRPs to. This parameter is optional. If this parameter is not specified, then the device object pointed to by the BusDeviceObject parameter is attached to the device object pointed to by the PhysicalDeviceObject parameter, and the resulting device object from that operation is used to forward IRPs.

InterfaceGuid [in, optional]

Specifies the interface GUID with which the demand-load bus enumeration object is associated. This parameter associates the bus with a device interface that is enumerable through IoXxx or SetupApi functions for device interfaces. This allows a driver to expose an interface with which either user-mode or kernel-mode clients can register new demand-load devices.

ServiceRelativePath [in, optional]

Pointer to a path to store a hierarchy of interfaces and device identifiers. This parameter is optional. For example, "Devices" will store the list of supported interfaces and devices in a path relative to the services key for this bus, such as:


Return value

Returns STATUS_SUCCESS if successful, or a memory error if unsuccessful.


The demand-load bus enumerator object extends a Plug and Play device by servicing bus enumerator queries through the KsServiceBusEnumPnpRequest function for the given functional device object.

Note  : The first PVOID of the device extension of the FDO pointed to in BusDeviceObject must be reserved for the resultant demand-load bus enumerator object.


Target platform



Swenum.h (include Swenum.h)



See also




Send comments about this topic to Microsoft