IoAllocateWorkItem function (wdm.h)

The IoAllocateWorkItem routine allocates a work item.

Syntax

PIO_WORKITEM IoAllocateWorkItem(
  [in] PDEVICE_OBJECT DeviceObject
);

Parameters

[in] DeviceObject

Pointer to the caller's driver object or to one of the caller's device objects. If the caller will later pass the work item to IoQueueWorkItem, DeviceObject must point to a device object.

Return value

IoAllocateWorkItem returns a pointer to the allocated IO_WORKITEM structure. The routine returns NULL if sufficient resources do not exist.

Remarks

The driver must free the work item that is returned by IoAllocateWorkItem by calling IoFreeWorkItem.

IoAllocateWorkItem both allocates and initializes a work item. A related routine, IoInitializeWorkItem, initializes a work item in storage that the driver has previously allocated. Do not call IoInitializeWorkItem to initialize a work item that was allocated by IoAllocateWorkItem.

For more information about work items, see System Worker Threads.

Requirements

Requirement Value
Minimum supported client Available in Windows 2000 and later versions of the Windows operating system, and in Windows Me. This routine is not available in Windows 98.
Target Platform Universal
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL <= DISPATCH_LEVEL

See also

IO_WORKITEM

IoFreeWorkItem

IoInitializeWorkItem

IoQueueWorkItem

IoQueueWorkItemEx