KsSetPowerDispatch function (ks.h)

Sets the power dispatch function to be called when the driver object receives an IRP_MJ_POWER IRP. This is only effective if KsDefaultDispatchPower is called to dispatch or complete power IRPs.

This has the effect of adding this object header to a list of object headers that have power dispatch routines to execute. The head of this list is kept by the device header. Assumes that the caller has previously allocated a device header on the underlying Device Object with KsAllocateDeviceHeader.

Syntax

KSDDKAPI VOID KsSetPowerDispatch(
  [in]           KSOBJECT_HEADER       Header,
  [in, optional] PFNKSCONTEXT_DISPATCH PowerDispatch,
  [in, optional] PVOID                 PowerContext
);

Parameters

[in] Header

Points to a header previously allocated by KsAllocateObjectHeader.

[in, optional] PowerDispatch

Optionally contains the power dispatch function that will be called, or NULL if the function is to be removed from the list of functions being called. This function must not complete the power IRP sent. The return value of this function must be STATUS_SUCCESS. KsSetPowerDispatch can be called while executing this power dispatch routine if the purpose is to manipulate this list entry only. Manipulating other list entries may confuse the current enumeration.

[in, optional] PowerContext

Optionally contains the context parameter to pass to the power dispatch function.

Return value

None

Requirements

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

See also

KStrContextDispatch