kernelbase: Implement CreateThreadpoolIo.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-04-15 02:00:18 +02:00 committed by Alexandre Julliard
parent 1da0d17419
commit b66e13ef24
3 changed files with 14 additions and 6 deletions

View File

@ -1187,14 +1187,23 @@ PTP_CLEANUP_GROUP WINAPI DECLSPEC_HOTPATCH CreateThreadpoolCleanupGroup(void)
}
static void WINAPI tp_io_callback( TP_CALLBACK_INSTANCE *instance, void *userdata, void *cvalue, IO_STATUS_BLOCK *iosb, TP_IO *io )
{
PTP_WIN32_IO_CALLBACK callback = *(void **)io;
callback( instance, userdata, cvalue, RtlNtStatusToDosError( iosb->u.Status ), iosb->Information, io );
}
/***********************************************************************
* CreateThreadpoolIo (kernelbase.@)
*/
PTP_IO WINAPI /* DECLSPEC_HOTPATCH */ CreateThreadpoolIo( HANDLE handle, PTP_WIN32_IO_CALLBACK callback,
PTP_IO WINAPI DECLSPEC_HOTPATCH CreateThreadpoolIo( HANDLE handle, PTP_WIN32_IO_CALLBACK callback,
PVOID userdata, TP_CALLBACK_ENVIRON *environment )
{
FIXME( "(%p, %p, %p, %p): stub\n", handle, callback, userdata, environment );
return FALSE;
TP_IO *io;
if (!set_ntstatus( TpAllocIoCompletion( &io, handle, tp_io_callback, userdata, environment ))) return NULL;
*(void **)io = callback; /* ntdll leaves us space to store our callback at the beginning of TP_IO struct */
return io;
}

View File

@ -2130,9 +2130,7 @@ static void test_kernel32_tp_io(void)
environment.Pool = pool;
io = NULL;
io = pCreateThreadpoolIo(server, kernel32_io_cb, &userdata, &environment);
todo_wine ok(!!io, "expected non-NULL TP_IO\n");
if (!io)
return;
ok(!!io, "expected non-NULL TP_IO\n");
pWaitForThreadpoolIoCallbacks(io, FALSE);

View File

@ -153,6 +153,7 @@ struct io_completion
/* internal threadpool object representation */
struct threadpool_object
{
void *win32_callback; /* leave space for kernelbase to store win32 callback */
LONG refcount;
BOOL shutdown;
/* read-only information */