Bewerken

Delen via


KsRecalculateStackDepth function (ks.h)

The KsRecalculateStackDepth function recalculates the maximum stack depth required by the underlying device object based on all of the objects that have set a target device (they have added themselves to the object list on the underlying device object using the KsSetTargetDeviceObject function). If the PnP device object has been set on the underlying device header using KsSetDevicePnpAndBaseObject, that device is also taken into account when calculating the maximum stack depth.

Syntax

KSDDKAPI VOID KsRecalculateStackDepth(
  [in] KSDEVICE_HEADER Header,
  [in] BOOLEAN         ReuseStackLocation
);

Parameters

[in] Header

Points to a header previously allocated by KsAllocateDeviceHeader.

[in] ReuseStackLocation

If this is set to TRUE, the current stack location is reused when any IRP is forwarded. This means that this object does not require its own stack location when forwarding IRPs and an extra location is not added to the maximum stack size. If set to FALSE, the calculated stack size is incremented by one. If the Pnp object stack is set, the reuse parameter also applies to that stack. Note that KsDefaultDispatchPnp always reuses the current stack location. The minimum stack depth is 1.

Return value

None

Remarks

The KsRecalculateStackDepth function assumes that KsSetDevicePnpAndBaseObject has been called on this device header and has assigned a base object whose stack depth is to be recalculated.

This function allows IRPs to be forwarded through an object by ensuring that any IRP allocated on this device will have sufficient stack locations to allow it to be forwarded. Stack depth must be recalculated on a streaming device when the device transitions out of a Stop state. It can also be recalculated when an object is freed in order to conserve resources.

Requirements

Requirement Value
Target Platform Universal
Header ks.h (include Ks.h)
Library Ks.lib

See also

KsAllocateDeviceHeader

KsDefaultDispatchPnp

KsSetDevicePnpAndBaseObject

KsSetTargetDeviceObject