ntoskrnl.exe: Implement IoQueueWorkItem.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-05-01 17:54:23 +02:00 committed by Alexandre Julliard
parent 322f0b57a8
commit 43ba0a1bec
3 changed files with 40 additions and 1 deletions

View File

@ -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.@)
*/

View File

@ -428,7 +428,7 @@
@ stub IoQueryFileInformation
@ stub IoQueryVolumeInformation
@ stub IoQueueThreadIrp
@ stub IoQueueWorkItem
@ stdcall IoQueueWorkItem(ptr ptr long ptr)
@ stub IoRaiseHardError
@ stub IoRaiseInformationalHardError
@ stub IoReadDiskSignature

View File

@ -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);