Commit 43ba0a1b authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ntoskrnl.exe: Implement IoQueueWorkItem.

parent 322f0b57
......@@ -1235,6 +1235,8 @@ void WINAPI IoFreeMdl(PMDL mdl)
struct _IO_WORKITEM
{
DEVICE_OBJECT *device;
PIO_WORKITEM_ROUTINE worker;
void *context;
};
/***********************************************************************
......@@ -1262,6 +1264,33 @@ void WINAPI IoFreeWorkItem( PIO_WORKITEM work_item )
}
void WINAPI run_work_item_worker(TP_CALLBACK_INSTANCE *instance, void *context)
{
PIO_WORKITEM work_item = context;
DEVICE_OBJECT *device = work_item->device;
TRACE( "%p: calling %p(%p %p)\n", work_item, work_item->worker, device, work_item->context );
work_item->worker( device, work_item->context );
TRACE( "done\n" );
ObDereferenceObject( device );
}
/***********************************************************************
* IoQueueWorkItem (NTOSKRNL.EXE.@)
*/
void WINAPI IoQueueWorkItem( PIO_WORKITEM work_item, PIO_WORKITEM_ROUTINE worker,
WORK_QUEUE_TYPE type, void *context )
{
TRACE( "%p %p %u %p\n", work_item, worker, type, context );
ObReferenceObject( work_item->device );
work_item->worker = worker;
work_item->context = context;
TrySubmitThreadpoolCallback( run_work_item_worker, work_item, NULL );
}
/***********************************************************************
* IoAttachDeviceToDeviceStack (NTOSKRNL.EXE.@)
*/
......
......@@ -428,7 +428,7 @@
@ stub IoQueryFileInformation
@ stub IoQueryVolumeInformation
@ stub IoQueueThreadIrp
@ stub IoQueueWorkItem
@ stdcall IoQueueWorkItem(ptr ptr long ptr)
@ stub IoRaiseHardError
@ stub IoRaiseInformationalHardError
@ stub IoReadDiskSignature
......
......@@ -1460,6 +1460,15 @@ typedef enum _DIRECTORY_NOTIFY_INFORMATION_CLASS {
DirectoryNotifyExtendedInformation
} DIRECTORY_NOTIFY_INFORMATION_CLASS, *PDIRECTORY_NOTIFY_INFORMATION_CLASS;
typedef enum _WORK_QUEUE_TYPE {
CriticalWorkQueue,
DelayedWorkQueue,
HyperCriticalWorkQueue,
MaximumWorkQueue
} WORK_QUEUE_TYPE;
typedef void (WINAPI *PIO_WORKITEM_ROUTINE)(PDEVICE_OBJECT,void*);
NTSTATUS WINAPI ObCloseHandle(IN HANDLE handle);
#ifdef NONAMELESSUNION
......@@ -1568,6 +1577,7 @@ PDEVICE_OBJECT WINAPI IoGetRelatedDeviceObject(PFILE_OBJECT);
void WINAPI IoInitializeIrp(IRP*,USHORT,CCHAR);
VOID WINAPI IoInitializeRemoveLockEx(PIO_REMOVE_LOCK,ULONG,ULONG,ULONG,ULONG);
void WINAPI IoInvalidateDeviceRelations(PDEVICE_OBJECT,DEVICE_RELATION_TYPE);
void WINAPI IoQueueWorkItem(PIO_WORKITEM,PIO_WORKITEM_ROUTINE,WORK_QUEUE_TYPE,void*);
NTSTATUS WINAPI IoRegisterDeviceInterface(PDEVICE_OBJECT,const GUID*,PUNICODE_STRING,PUNICODE_STRING);
void WINAPI IoReleaseCancelSpinLock(KIRQL);
NTSTATUS WINAPI IoSetDeviceInterfaceState(UNICODE_STRING*,BOOLEAN);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment