Commit b66e13ef authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

kernelbase: Implement CreateThreadpoolIo.

parent 1da0d174
......@@ -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;
}
......
......@@ -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);
......
......@@ -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 */
......
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