ExInitializeWorkItem

VOID
    ExInitializeWorkItem(

        IN PWORK_QUEUE_ITEM  Item,
        IN PWORKER_THREAD_ROUTINE  Routine,
        IN PVOID  Context
        );

ExInitializeWorkItem initializes a work-queue item with a caller-supplied context and callback routine to be queued for execution when a system worker thread is given control.

Parameters

Item
Points to the caller-supplied storage to be initialized. The storage must be allocated from nonpaged pool.
Routine
Points to the routine that processes this work item when it is dequeued. This callback is declared as follows:
VOID
(*PWORKER_THREAD_ROUTINE)(
    IN PVOID Parameter
);
Context
Points to a caller-supplied context that is passed, uninterpreted, to Routine as its only parameter.

Comments

ExInitializeWorkItem initializes Item with pointers to Routine and Context and a NULL list pointer.

Highest-level drivers can call ExInitializeWorkItem.

The caller-supplied Routine is responsible for calling ExFreePool to release the storage for Item.

Callers of ExInitializeWorkItem must be running at IRQL <= DISPATCH_LEVEL.

See Also

ExFreePool, ExQueueWorkItem