From 322f0b57a81badd218c1a5f6d8d03d951f2689ac Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 1 May 2019 17:54:14 +0200 Subject: [PATCH] ntoskrnl.exe: Implement IoAllocateWorkItem and IoFreeWorkItem. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/ntoskrnl.exe/ntoskrnl.c | 26 +++++++++++++++++++++++--- dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- include/ddk/wdm.h | 2 ++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 1a2a6d1ba04..cf053ca9eae 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -1232,13 +1232,33 @@ void WINAPI IoFreeMdl(PMDL mdl) } +struct _IO_WORKITEM +{ + DEVICE_OBJECT *device; +}; + /*********************************************************************** * IoAllocateWorkItem (NTOSKRNL.EXE.@) */ -PIO_WORKITEM WINAPI IoAllocateWorkItem( PDEVICE_OBJECT DeviceObject ) +PIO_WORKITEM WINAPI IoAllocateWorkItem( PDEVICE_OBJECT device ) { - FIXME( "stub: %p\n", DeviceObject ); - return NULL; + PIO_WORKITEM work_item; + + TRACE( "%p\n", device ); + + if (!(work_item = ExAllocatePool( PagedPool, sizeof(*work_item) ))) return NULL; + work_item->device = device; + return work_item; +} + + +/*********************************************************************** + * IoFreeWorkItem (NTOSKRNL.EXE.@) + */ +void WINAPI IoFreeWorkItem( PIO_WORKITEM work_item ) +{ + TRACE( "%p\n", work_item ); + ExFreePool( work_item ); } diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 1e46de38fdb..31031595fc8 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -383,7 +383,7 @@ @ stub IoFreeErrorLogEntry @ stdcall IoFreeIrp(ptr) @ stdcall IoFreeMdl(ptr) -@ stub IoFreeWorkItem +@ stdcall IoFreeWorkItem(ptr) @ stdcall IoGetAttachedDevice(ptr) @ stdcall IoGetAttachedDeviceReference(ptr) @ stub IoGetBaseFileSystemDeviceObject diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 57a53573f8b..47727935c08 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1543,6 +1543,7 @@ NTSTATUS WINAPI IoAllocateDriverObjectExtension(PDRIVER_OBJECT,PVOID,ULONG,PVOI PVOID WINAPI IoAllocateErrorLogEntry(PVOID,UCHAR); PIRP WINAPI IoAllocateIrp(CCHAR,BOOLEAN); PMDL WINAPI IoAllocateMdl(PVOID,ULONG,BOOLEAN,BOOLEAN,IRP*); +PIO_WORKITEM WINAPI IoAllocateWorkItem(PDEVICE_OBJECT); PDEVICE_OBJECT WINAPI IoAttachDeviceToDeviceStack(PDEVICE_OBJECT,PDEVICE_OBJECT); PIRP WINAPI IoBuildDeviceIoControlRequest(ULONG,DEVICE_OBJECT*,PVOID,ULONG,PVOID,ULONG,BOOLEAN,PKEVENT,IO_STATUS_BLOCK*); PIRP WINAPI IoBuildSynchronousFsdRequest(ULONG,DEVICE_OBJECT*,PVOID,ULONG,PLARGE_INTEGER,PKEVENT,IO_STATUS_BLOCK*); @@ -1557,6 +1558,7 @@ void WINAPI IoDeleteDriver(DRIVER_OBJECT*); NTSTATUS WINAPI IoDeleteSymbolicLink(UNICODE_STRING*); void WINAPI IoFreeIrp(IRP*); void WINAPI IoFreeMdl(MDL*); +void WINAPI IoFreeWorkItem(PIO_WORKITEM); PEPROCESS WINAPI IoGetCurrentProcess(void); NTSTATUS WINAPI IoGetDeviceInterfaces(const GUID*,PDEVICE_OBJECT,ULONG,PWSTR*); NTSTATUS WINAPI IoGetDeviceObjectPointer(UNICODE_STRING*,ACCESS_MASK,PFILE_OBJECT*,PDEVICE_OBJECT*);