64#define GET_PROC(func) \
67 p ## func = (void *)GetProcAddress(module, #func); \
68 if (!p ## func) trace("Failed to get address for %s\n", #func); \
111 GET_PROC(WaitForThreadpoolIoCallbacks);
115 win_skip(
"Threadpool functions not supported, skipping tests\n");
190 if (
info->semaphore2)
215 ok(semaphores[0] !=
NULL,
"failed to create semaphore\n");
217 ok(semaphores[1] !=
NULL,
"failed to create semaphore\n");
218 info.semaphore1 = semaphores[0];
229 ok(wait1 !=
NULL,
"expected wait1 != NULL\n");
231 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
232 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
241 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
245 ok(
info.userdata == 2,
"expected info.userdata = 2, got %lu\n",
info.userdata);
250 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
259 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
263 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
268 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
276 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
279 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
284 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
292 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
296 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
301 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
311 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
318 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
327 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
328 ok(
info.threadid ==
threadid,
"unexpected different wait thread id %lx\n",
info.threadid);
333 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
342 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
343 ok(
info.threadid ==
threadid,
"unexpected different wait thread id %lx\n",
info.threadid);
348 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
358 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
359 ok(
info.threadid ==
threadid,
"unexpected different wait thread id %lx\n",
info.threadid);
364 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
374 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
375 ok(
info.threadid != 0,
"expected info.threadid != 0, got %lu\n",
info.threadid);
388 ok(
info.userdata == 2,
"expected info.userdata = 2, got %lu\n",
info.userdata);
391 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
400 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
401 ok(
info.threadid != 0,
"expected info.threadid != 0, got %lu\n",
info.threadid);
409 "WaitForSingleObject returned %lu\n",
result);
415 ok(
info.userdata == 2,
"expected info.userdata = 2, got %lu\n",
info.userdata);
418 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
425 ok(!
status,
"RtlDeregisterWaitEx failed with status %lx\n",
status);
426 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
432 ok(!
status,
"RtlDeregisterWaitEx failed with status %lx\n",
status);
433 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
439 ok(!
status,
"RtlDeregisterWaitEx failed with status %lx\n",
status);
440 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
450 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
453 ok(!
status,
"RtlDeregisterWaitEx failed with status %lx\n",
status);
454 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
461 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
464 ok(!
status,
"RtlDeregisterWaitEx failed with status %lx\n",
status);
465 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
472 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
475 ok(!
status,
"RtlDeregisterWaitEx failed with status %lx\n",
status);
476 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
481 info.semaphore2 = semaphores[1];
490 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
503 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
516 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
530 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
532 ok(!
status,
"RtlDeregisterWaitEx failed with status %lx\n",
status);
543 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
545 ok(!
status,
"RtlDeregisterWaitEx failed with status %lx\n",
status);
556 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
602 memset(&environment, 0,
sizeof(environment));
617 memset(&environment, 0,
sizeof(environment));
627 memset(&environment3, 0,
sizeof(environment3));
630 environment3.
Size =
sizeof(environment3);
632 for (
i = 0;
i < 3; ++
i)
644 "TpSimpleTryPost failed with status %lx\n",
status);
648 memset(&environment, 0,
sizeof(environment));
654 "TpSimpleTryPost unexpectedly returned status %lx\n",
status);
664 ok(!
status,
"TpAllocCleanupGroup failed with status %lx\n",
status);
669 memset(&environment, 0,
sizeof(environment));
680 pTpSetPoolMaxThreads(
pool, 10);
681 memset(&environment, 0,
sizeof(environment));
685 for (
i = 0;
i < 100;
i++)
694 status = pTpQueryPoolStackInformation(
pool, &stack_info);
701 status = pTpSetPoolStackInformation(
pool, &stack_info);
704 status = pTpQueryPoolStackInformation(
pool, &stack_info);
710 pTpReleaseCleanupGroup(
group);
711 pTpReleasePool(
pool);
741 pTpSetPoolMaxThreads(
pool, 1);
745 memset(&environment, 0,
sizeof(environment));
750 ok(work !=
NULL,
"expected work != NULL\n");
754 for (
i = 0;
i < 5;
i++)
756 pTpWaitForWork(work,
FALSE);
761 for (
i = 0;
i < 10;
i++)
763 pTpWaitForWork(work,
TRUE);
767 pTpReleaseWork(work);
768 pTpReleasePool(
pool);
786 pTpSetPoolMaxThreads(
pool, 1);
791 ok(!
status,
"TpAllocCleanupGroup failed with status %lx\n",
status);
796 memset(&environment, 0,
sizeof(environment));
801 ok(work !=
NULL,
"expected work != NULL\n");
805 memset(&environment, 0,
sizeof(environment));
811 ok(work2 !=
NULL,
"expected work2 != NULL\n");
815 for (
i = 0;
i < 10;
i++)
817 for (
i = 0;
i < 10;
i++)
820 pTpWaitForWork(work,
TRUE);
821 pTpWaitForWork(work2,
TRUE);
822 ok(
userdata & 0xffff,
"expected userdata & 0xffff != 0, got %lu\n",
userdata & 0xffff);
827 for (
i = 0;
i < 10;
i++)
829 for (
i = 0;
i < 3;
i++)
832 pTpWaitForWork(work,
TRUE);
833 ok((
userdata & 0xffff) < 10,
"expected userdata & 0xffff < 10, got %lu\n",
userdata & 0xffff);
837 pTpReleaseWork(work);
838 pTpReleaseCleanupGroup(
group);
839 pTpReleasePool(
pool);
854 pTpReleaseWork(work);
862 pTpReleaseTimer(timer);
871 pTpReleaseWait(wait);
899 ok(!
status,
"TpAllocCleanupGroup failed with status %lx\n",
status);
904 memset(&environment, 0,
sizeof(environment));
910 ok(work !=
NULL,
"expected work != NULL\n");
918 memset(&environment, 0,
sizeof(environment));
924 ok(timer !=
NULL,
"expected timer != NULL\n");
926 pTpSetTimer(timer, &when, 0, 0);
933 memset(&environment, 0,
sizeof(environment));
939 ok(wait !=
NULL,
"expected wait != NULL\n");
947 pTpReleaseCleanupGroup(
group);
948 pTpReleasePool(
pool);
963 "expected STATUS_TOO_MANY_THREADS, got %08lx\n",
status);
966 for (
i = 0;
i < 4;
i++)
988 ok(
object == (
void *)0xdeadbeef,
"expected 0xdeadbeef, got %p\n",
object);
1008 ok(0,
"Unexpected callback\n");
1013 ok(0,
"Unexpected callback\n");
1018 ok(0,
"Unexpected callback\n");
1024 ok(0,
"Unexpected callback\n");
1029 ok(0,
"Unexpected callback\n");
1056 pTpSetPoolMaxThreads(
pool, 1);
1061 ok(!
status,
"TpAllocCleanupGroup failed with status %lx\n",
status);
1065 memset(&environment, 0,
sizeof(environment));
1073 memset(&environment, 0,
sizeof(environment));
1084 ok(work !=
NULL,
"expected work != NULL\n");
1089 ok(timer !=
NULL,
"expected timer != NULL\n");
1094 ok(wait !=
NULL,
"expected wait != NULL\n");
1097 pTpReleaseCleanupGroupMembers(
group,
TRUE, semaphores);
1105 memset(&environment, 0,
sizeof(environment));
1112 ok(work !=
NULL,
"expected work != NULL\n");
1120 pTpReleaseCleanupGroupMembers(
group,
TRUE, semaphores);
1128 memset(&environment, 0,
sizeof(environment));
1135 ok(work !=
NULL,
"expected work != NULL\n");
1143 memset(&environment, 0,
sizeof(environment));
1152 pTpReleaseCleanupGroupMembers(
group,
TRUE, semaphores);
1156 memset(&environment, 0,
sizeof(environment));
1163 ok(work !=
NULL,
"expected work != NULL\n");
1167 for (
i = 0;
i < 10;
i++)
1172 pTpReleaseCleanupGroupMembers(
group,
TRUE, &userdata2);
1174 ok(userdata2 == 1,
"expected only one cancellation callback, got %lu\n", userdata2);
1179 pTpReleaseCleanupGroup(
group);
1180 pTpReleasePool(
pool);
1188 pTpCallbackReleaseSemaphoreOnCompletion(
instance, semaphores[0], 1);
1206 ok(semaphores[0] !=
NULL,
"failed to create semaphore\n");
1208 ok(semaphores[1] !=
NULL,
"failed to create semaphore\n");
1217 memset(&environment, 0,
sizeof(environment));
1226 memset(&environment, 0,
sizeof(environment));
1238 pTpReleasePool(
pool);
1287 ok(semaphores[0] !=
NULL,
"failed to create semaphore\n");
1289 ok(semaphores[1] !=
NULL,
"failed to create semaphore\n");
1299 ok(!
status,
"TpAllocCleanupGroup failed with status %lx\n",
status);
1304 memset(&environment, 0,
sizeof(environment));
1309 ok(work !=
NULL,
"expected work != NULL\n");
1312 pTpWaitForWork(work,
FALSE);
1319 pTpReleaseWork(work);
1323 memset(&environment, 0,
sizeof(environment));
1329 ok(work !=
NULL,
"expected work != NULL\n");
1332 pTpWaitForWork(work,
FALSE);
1343 memset(&environment, 0,
sizeof(environment));
1349 ok(work !=
NULL,
"expected work != NULL\n");
1361 memset(&environment, 0,
sizeof(environment));
1377 pTpReleaseCleanupGroup(
group);
1378 pTpReleasePool(
pool);
1412 memset(&environment, 0,
sizeof(environment));
1417 ok(timer !=
NULL,
"expected timer != NULL\n");
1419 success = pTpIsTimerSet(timer);
1420 ok(!
success,
"TpIsTimerSet returned TRUE\n");
1424 pTpSetTimer(timer, &when, 0, 0);
1425 success = pTpIsTimerSet(timer);
1426 ok(
success,
"TpIsTimerSet returned FALSE\n");
1428 pTpWaitForTimer(timer,
FALSE);
1434 success = pTpIsTimerSet(timer);
1435 ok(
success,
"TpIsTimerSet returned FALSE\n");
1440 pTpSetTimer(timer, &when, 0, 0);
1441 success = pTpIsTimerSet(timer);
1442 ok(
success,
"TpIsTimerSet returned FALSE\n");
1444 pTpWaitForTimer(timer,
FALSE);
1450 success = pTpIsTimerSet(timer);
1451 ok(
success,
"TpIsTimerSet returned FALSE\n");
1455 pTpSetTimer(timer, &when, 0, 0);
1456 success = pTpIsTimerSet(timer);
1457 ok(
success,
"TpIsTimerSet returned FALSE\n");
1459 pTpWaitForTimer(timer,
FALSE);
1463 success = pTpIsTimerSet(timer);
1464 ok(
success,
"TpIsTimerSet returned FALSE\n");
1467 pTpSetTimer(timer,
NULL, 0, 0);
1468 success = pTpIsTimerSet(timer);
1469 ok(!
success,
"TpIsTimerSet returned TRUE\n");
1470 pTpWaitForTimer(timer,
TRUE);
1472 pTpReleaseTimer(timer);
1480 memset(&environment, 0,
sizeof(environment));
1485 ok(timer !=
NULL,
"expected timer != NULL\n");
1489 pTpSetTimer(timer, &when, 200, 0);
1490 success = pTpIsTimerSet(timer);
1491 ok(
success,
"TpIsTimerSet returned FALSE\n");
1495 for (
i = 0;
i < 3;
i++)
1501 ok(ticks >= 500 && (ticks <= 700 ||
broken(ticks <= 750)) ,
1502 "expected approximately 600 ticks, got %lu\n", ticks);
1505 pTpSetTimer(timer,
NULL, 0, 0);
1506 success = pTpIsTimerSet(timer);
1507 ok(!
success,
"TpIsTimerSet returned TRUE\n");
1508 pTpWaitForTimer(timer,
TRUE);
1511 pTpReleaseTimer(timer);
1512 pTpReleasePool(
pool);
1551 memset(&environment, 0,
sizeof(environment));
1552 environment.Version = 1;
1553 environment.Pool =
pool;
1559 ok(timer1 !=
NULL,
"expected timer1 != NULL\n");
1565 ok(timer2 !=
NULL,
"expected timer2 != NULL\n");
1573 pTpSetTimer(timer2, &when, 0, 0);
1576 pTpSetTimer(timer1, &when, 0, 75);
1582 ok(info1.
ticks != 0 && info2.
ticks != 0,
"expected that ticks are nonzero\n");
1584 "expected that timers are not merged\n");
1592 pTpSetTimer(timer2, &when, 0, 0);
1595 pTpSetTimer(timer1, &when, 0, 200);
1601 ok(info1.
ticks != 0 && info2.
ticks != 0,
"expected that ticks are nonzero\n");
1603 ok(merged ||
broken(!merged) ,
"expected that timers are merged\n");
1611 pTpSetTimer(timer1, &when, 0, 200);
1614 pTpSetTimer(timer2, &when, 0, 0);
1620 ok(info1.
ticks != 0 && info2.
ticks != 0,
"expected that ticks are nonzero\n");
1623 ok(merged ||
broken(!merged) ,
"expected that timers are merged\n");
1626 pTpReleaseTimer(timer1);
1627 pTpReleaseTimer(timer2);
1628 pTpReleasePool(
pool);
1647 ok(0,
"unexpected result %lu\n",
result);
1663 ok(semaphores[0] !=
NULL,
"failed to create semaphore\n");
1665 ok(semaphores[1] !=
NULL,
"failed to create semaphore\n");
1666 info.semaphore = semaphores[0];
1675 memset(&environment, 0,
sizeof(environment));
1682 ok(wait1 !=
NULL,
"expected wait1 != NULL\n");
1687 ok(wait2 !=
NULL,
"expected wait2 != NULL\n");
1691 pTpSetWait(wait1, semaphores[1],
NULL);
1695 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
1702 pTpSetWait(wait1, semaphores[1], &when);
1705 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
1708 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
1715 pTpSetWait(wait1, semaphores[1], &when);
1718 pTpWaitForWait(wait1,
TRUE);
1719 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
1722 "WaitForSingleObject returned %lu\n",
result);
1724 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
1726 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
1733 pTpSetWait(wait1, semaphores[1], &when);
1736 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
1740 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
1747 pTpSetWait(wait1, semaphores[1], &when);
1750 pTpWaitForWait(wait1,
TRUE);
1751 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
1755 "WaitForSingleObject returned %lu\n",
result);
1758 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
1764 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
1773 pTpSetWait(wait1, semaphores[1], &when);
1776 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
1779 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
1787 pTpSetWait(wait1, semaphores[1], &when);
1790 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
1794 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
1801 pTpSetWait(wait1, semaphores[1], &when);
1804 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
1811 pTpSetWait(wait1, semaphores[1], &when);
1814 pTpSetWait(wait1,
NULL, (
void *)0xdeadbeef);
1819 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
1829 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
1834 pTpSetWait(wait1, semaphores[1], &when);
1843 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
1849 ok(semaphores[1] !=
NULL,
"failed to create semaphore\n");
1853 pTpSetWait(wait1, semaphores[1],
NULL);
1854 pTpSetWait(wait2, semaphores[1],
NULL);
1861 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
1867 pTpSetWait(wait1, semaphores[1],
NULL);
1868 pTpSetWait(wait2, semaphores[1],
NULL);
1875 ok(
info.userdata == 2,
"expected info.userdata = 2, got %lu\n",
info.userdata);
1880 pTpReleaseWait(wait1);
1881 pTpReleaseWait(wait2);
1882 pTpReleasePool(
pool);
1902 ok(0,
"unexpected result %lu\n",
result);
1931 status = pTpSetPoolStackInformation(
pool, &stack_info);
1932 ok(!
status,
"TpQueryPoolStackInformation failed: %lx\n",
status);
1934 memset(&environment, 0,
sizeof(environment));
1942 ok(semaphores[
i] !=
NULL,
"failed to create semaphore %i\n",
i);
1947 ok(waits[
i] !=
NULL,
"expected waits[%d] != NULL\n",
i);
1949 pTpSetWait(waits[
i], semaphores[
i],
NULL);
1962 pTpSetWait(waits[
i], semaphores[
i],
NULL);
1975 pTpSetWait(waits[
i], semaphores[
i],
NULL);
1983 pTpSetWait(waits[
i], semaphores[
i], &when);
1992 ok(
multi_wait_info.result >> 16,
"expected multi_wait_info.result >> 16 != 0\n");
1997 pTpSetWait(waits[
i], semaphores[
i],
NULL);
2004 pTpReleaseWait(waits[
i]);
2008 pTpReleasePool(
pool);
2035 pTpWaitForIoCompletion(
io,
FALSE);
2073 ok(!!
io,
"expected non-NULL TP_IO\n");
2075 pTpWaitForIoCompletion(
io,
FALSE);
2078 pTpStartAsyncIoOperation(
io);
2090 pTpWaitForIoCompletion(
io,
FALSE);
2091 ok(userdata.
count == 1,
"callback ran %u times\n", userdata.
count);
2092 ok(userdata.
ovl == &
ovl,
"expected %p, got %p\n", &
ovl, userdata.
ovl);
2095 ok(userdata.
io ==
io,
"expected %p, got %p\n",
io, userdata.
io);
2101 pTpStartAsyncIoOperation(
io);
2102 pTpStartAsyncIoOperation(
io);
2116 pTpWaitForIoCompletion(
io,
FALSE);
2117 ok(userdata.
count == 2,
"callback ran %u times\n", userdata.
count);
2120 ok(userdata.
io ==
io,
"expected %p, got %p\n",
io, userdata.
io);
2128 pTpStartAsyncIoOperation(
io);
2130 pTpWaitForIoCompletion(
io,
TRUE);
2131 ok(!userdata.
count,
"callback ran %u times\n", userdata.
count);
2133 pTpStartAsyncIoOperation(
io);
2141 pTpWaitForIoCompletion(
io,
FALSE);
2142 ok(userdata.
count == 1,
"callback ran %u times\n", userdata.
count);
2143 ok(userdata.
ovl == &
ovl,
"expected %p, got %p\n", &
ovl, userdata.
ovl);
2146 ok(userdata.
io ==
io,
"expected %p, got %p\n",
io, userdata.
io);
2149 pTpStartAsyncIoOperation(
io);
2155 pTpCancelAsyncIoOperation(
io);
2156 pTpWaitForIoCompletion(
io,
FALSE);
2157 ok(!userdata.
count,
"callback ran %u times\n", userdata.
count);
2160 pTpStartAsyncIoOperation(
io);
2168 pTpWaitForIoCompletion(
io,
FALSE);
2169 ok(userdata.
count == 1,
"callback ran %u times\n", userdata.
count);
2170 ok(userdata.
ovl == &
ovl,
"expected %p, got %p\n", &
ovl, userdata.
ovl);
2173 ok(userdata.
io ==
io,
"expected %p, got %p\n",
io, userdata.
io);
2176 pTpStartAsyncIoOperation(
io);
2177 pTpCancelAsyncIoOperation(
io);
2184 pTpWaitForIoCompletion(
io,
FALSE);
2191 ok(userdata.
count == 0,
"callback ran %u times\n", userdata.
count);
2193 pTpReleaseIoCompletion(
io);
2205 ok(
ret,
"Got unexpected ret %#x.\n",
ret);
2206 pTpReleaseIoCompletion(
io);
2208 ok(!
ret,
"Got unexpected ret %#x.\n",
ret);
2222 pTpStartAsyncIoOperation(
io);
2223 pTpWaitForIoCompletion(
io,
TRUE);
2225 ok(
ret,
"Got unexpected ret %#x.\n",
ret);
2226 pTpReleaseIoCompletion(
io);
2228 ok(
ret,
"Got unexpected ret %#x.\n",
ret);
2236 ok(
ret,
"Got unexpected ret %#x.\n",
ret);
2243 ok(!
ret,
"Got unexpected ret %#x.\n",
ret);
2249 pTpReleasePool(
pool);
2296 ok(!!
io,
"expected non-NULL TP_IO\n");
2298 pWaitForThreadpoolIoCallbacks(
io,
FALSE);
2301 pStartThreadpoolIo(
io);
2313 pWaitForThreadpoolIoCallbacks(
io,
FALSE);
2314 ok(userdata.
count == 1,
"callback ran %u times\n", userdata.
count);
2315 ok(userdata.
ovl == &
ovl,
"expected %p, got %p\n", &
ovl, userdata.
ovl);
2318 ok(userdata.
io ==
io,
"expected %p, got %p\n",
io, userdata.
io);
2324 pStartThreadpoolIo(
io);
2325 pStartThreadpoolIo(
io);
2339 pWaitForThreadpoolIoCallbacks(
io,
FALSE);
2340 ok(userdata.
count == 2,
"callback ran %u times\n", userdata.
count);
2343 ok(userdata.
io ==
io,
"expected %p, got %p\n",
io, userdata.
io);
2346 pStartThreadpoolIo(
io);
2347 pWaitForThreadpoolIoCallbacks(
io,
TRUE);
2348 ok(!userdata.
count,
"callback ran %u times\n", userdata.
count);
2350 pStartThreadpoolIo(
io);
2358 pWaitForThreadpoolIoCallbacks(
io,
FALSE);
2359 ok(userdata.
count == 1,
"callback ran %u times\n", userdata.
count);
2360 ok(userdata.
ovl == &
ovl,
"expected %p, got %p\n", &
ovl, userdata.
ovl);
2363 ok(userdata.
io ==
io,
"expected %p, got %p\n",
io, userdata.
io);
2366 pStartThreadpoolIo(
io);
2372 pCancelThreadpoolIo(
io);
2373 pWaitForThreadpoolIoCallbacks(
io,
FALSE);
2374 ok(!userdata.
count,
"callback ran %u times\n", userdata.
count);
2377 pStartThreadpoolIo(
io);
2385 pWaitForThreadpoolIoCallbacks(
io,
FALSE);
2386 ok(userdata.
count == 1,
"callback ran %u times\n", userdata.
count);
2387 ok(userdata.
ovl == &
ovl,
"expected %p, got %p\n", &
ovl, userdata.
ovl);
2390 ok(userdata.
io ==
io,
"expected %p, got %p\n",
io, userdata.
io);
2395 pCloseThreadpoolIo(
io);
2396 pTpReleasePool(
pool);
#define InterlockedIncrement
BOOL WINAPI CancelIo(IN HANDLE hFile)
static HINSTANCE instance
#define ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
DWORD WINAPI QueueUserAPC(IN PAPCFUNC pfnAPC, IN HANDLE hThread, IN ULONG_PTR dwData)
HANDLE WINAPI OpenThread(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwThreadId)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
DWORD WINAPI GetTickCount(VOID)
GLuint GLsizei GLsizei * length
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
BOOL WINAPI HeapValidate(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem)
#define THREAD_SET_CONTEXT
#define InterlockedExchangeAdd
#define FILE_FLAG_OVERLAPPED
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK io
static PIO_STATUS_BLOCK iosb
static void test_tp_io(void)
static void CALLBACK unexpected_group_cancel_cleanup_cb(void *object, void *userdata)
static DWORD WINAPI io_wait_thread(void *arg)
static void CALLBACK wait_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, TP_WAIT *wait, TP_WAIT_RESULT result)
static void CALLBACK simple_cb(TP_CALLBACK_INSTANCE *instance, void *userdata)
static void CALLBACK disassociate2_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, TP_WORK *work)
static void CALLBACK work_group_cancel_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, TP_WORK *work)
static void test_tp_work_scheduler(void)
static void CALLBACK wait_release_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, TP_WAIT *wait, TP_WAIT_RESULT result)
static void CALLBACK rtl_wait_apc_cb(ULONG_PTR userdata)
static void test_tp_work(void)
static void CALLBACK work_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, TP_WORK *work)
static void CALLBACK group_cancel_cleanup_release2_cb(void *object, void *userdata)
static void test_tp_timer(void)
static void CALLBACK instance_semaphore_completion_cb(TP_CALLBACK_INSTANCE *instance, void *userdata)
static void CALLBACK io_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, void *cvalue, IO_STATUS_BLOCK *iosb, TP_IO *io)
static TP_CALLBACK_ENVIRON *static TP_CALLBACK_ENVIRON *static PTP_WORK_CALLBACK
static void CALLBACK disassociate_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, TP_WORK *work)
static TP_POOL_STACK_INFORMATION *static LARGE_INTEGER LONG
static void test_tp_group_cancel(void)
static void test_tp_window_length(void)
static DWORD CALLBACK rtl_work_cb(void *userdata)
static PTP_TIMER_CALLBACK
static void test_tp_wait(void)
static void CALLBACK timer_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, TP_TIMER *timer)
static void test_tp_disassociate(void)
static void CALLBACK work2_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, TP_WORK *work)
static void CALLBACK simple_group_cancel_cb(TP_CALLBACK_INSTANCE *instance, void *userdata)
static void CALLBACK rtl_wait_cb(void *userdata, BOOLEAN timeout)
static void test_kernel32_tp_io(void)
static DWORD group_cancel_tid
static HANDLE rtl_wait_apc_semaphore
static void CALLBACK unexpected_work_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, TP_WORK *work)
static void test_tp_group_wait(void)
static void test_tp_multi_wait(void)
static void CALLBACK work_release_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, TP_WORK *work)
static void CALLBACK unexpected_timer_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, TP_TIMER *timer)
static void CALLBACK disassociate3_cb(TP_CALLBACK_INSTANCE *instance, void *userdata)
static void test_tp_instance(void)
static TP_CALLBACK_ENVIRON *static PTP_WAIT_CALLBACK
static void CALLBACK group_cancel_cleanup_increment_cb(void *object, void *userdata)
static void CALLBACK kernel32_io_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, void *ovl, ULONG ret, ULONG_PTR length, TP_IO *io)
static void CALLBACK instance_finalization_cb(TP_CALLBACK_INSTANCE *instance, void *userdata)
static void CALLBACK simple2_cb(TP_CALLBACK_INSTANCE *instance, void *userdata)
static void CALLBACK group_cancel_cleanup_release_cb(void *object, void *userdata)
static void test_RtlRegisterWait(void)
static BOOL init_threadpool(void)
static void CALLBACK multi_wait_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, TP_WAIT *wait, TP_WAIT_RESULT result)
static void CALLBACK window_length_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, TP_TIMER *timer)
static void test_RtlQueueWorkItem(void)
static void CALLBACK unexpected_simple_cb(TP_CALLBACK_INSTANCE *instance, void *userdata)
static TP_IO *WINAPI * pCreateThreadpoolIo(HANDLE, PTP_WIN32_IO_CALLBACK, void *, TP_CALLBACK_ENVIRON *)
static struct @1720 multi_wait_info
static void CALLBACK unexpected_wait_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, TP_WAIT *wait, TP_WAIT_RESULT result)
static void CALLBACK timer_release_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, TP_TIMER *timer)
static void TP_CALLBACK_ENVIRON *static PVOID
static void CALLBACK simple_release_cb(TP_CALLBACK_INSTANCE *instance, void *userdata)
static void test_tp_simple(void)
NTSYSAPI NTSTATUS NTAPI RtlQueueWorkItem(_In_ WORKERCALLBACKFUNC Function, _In_opt_ PVOID Context, _In_ ULONG Flags)
NTSYSAPI NTSTATUS NTAPI RtlRegisterWait(_In_ PHANDLE phNewWaitObject, _In_ HANDLE hObject, _In_ WAITORTIMERCALLBACKFUNC Callback, _In_ PVOID pvContext, _In_ ULONG ulMilliseconds, _In_ ULONG ulFlags)
NTSYSAPI NTSTATUS NTAPI RtlDeregisterWaitEx(_In_ HANDLE hWaitHandle, _In_opt_ HANDLE hCompletionEvent)
NTSYSAPI NTSTATUS NTAPI RtlDeregisterWait(_In_ HANDLE hWaitHandle)
HANDLE WINAPI CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
NTSTATUS NTAPI NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
#define STATUS_TOO_MANY_THREADS
VOID WINAPI TpReleaseCleanupGroupMembers(TP_CLEANUP_GROUP *group, BOOL cancel_pending, PVOID userdata)
VOID WINAPI TpReleaseTimer(TP_TIMER *timer)
VOID WINAPI TpReleasePool(TP_POOL *pool)
void WINAPI TpStartAsyncIoOperation(TP_IO *io)
VOID WINAPI TpDisassociateCallback(TP_CALLBACK_INSTANCE *instance)
NTSTATUS WINAPI TpAllocTimer(TP_TIMER **out, PTP_TIMER_CALLBACK callback, PVOID userdata, TP_CALLBACK_ENVIRON *environment)
VOID WINAPI TpSetTimer(TP_TIMER *timer, LARGE_INTEGER *timeout, LONG period, LONG window_length)
VOID WINAPI TpReleaseCleanupGroup(TP_CLEANUP_GROUP *group)
NTSTATUS WINAPI TpCallbackMayRunLong(TP_CALLBACK_INSTANCE *instance)
VOID WINAPI TpWaitForWork(TP_WORK *work, BOOL cancel_pending)
NTSTATUS WINAPI TpSimpleTryPost(PTP_SIMPLE_CALLBACK callback, PVOID userdata, TP_CALLBACK_ENVIRON *environment)
void WINAPI TpReleaseIoCompletion(TP_IO *io)
VOID WINAPI TpPostWork(TP_WORK *work)
NTSTATUS WINAPI TpAllocWork(TP_WORK **out, PTP_WORK_CALLBACK callback, PVOID userdata, TP_CALLBACK_ENVIRON *environment)
NTSTATUS WINAPI TpAllocCleanupGroup(TP_CLEANUP_GROUP **out)
NTSTATUS WINAPI TpAllocWait(TP_WAIT **out, PTP_WAIT_CALLBACK callback, PVOID userdata, TP_CALLBACK_ENVIRON *environment)
NTSTATUS WINAPI TpQueryPoolStackInformation(TP_POOL *pool, TP_POOL_STACK_INFORMATION *stack_info)
VOID WINAPI TpWaitForWait(TP_WAIT *wait, BOOL cancel_pending)
VOID WINAPI TpReleaseWork(TP_WORK *work)
VOID WINAPI TpWaitForTimer(TP_TIMER *timer, BOOL cancel_pending)
void WINAPI TpCancelAsyncIoOperation(TP_IO *io)
VOID WINAPI TpReleaseWait(TP_WAIT *wait)
VOID WINAPI TpSetWait(TP_WAIT *wait, HANDLE handle, LARGE_INTEGER *timeout)
BOOL WINAPI TpIsTimerSet(TP_TIMER *timer)
VOID WINAPI TpCallbackReleaseSemaphoreOnCompletion(TP_CALLBACK_INSTANCE *instance, HANDLE semaphore, DWORD count)
VOID WINAPI TpSetPoolMaxThreads(TP_POOL *pool, DWORD maximum)
NTSTATUS WINAPI TpAllocIoCompletion(TP_IO **out, HANDLE file, PTP_IO_CALLBACK callback, void *userdata, TP_CALLBACK_ENVIRON *environment)
NTSTATUS WINAPI TpSetPoolStackInformation(TP_POOL *pool, TP_POOL_STACK_INFORMATION *stack_info)
void WINAPI TpWaitForIoCompletion(TP_IO *io, BOOL cancel_pending)
NTSTATUS WINAPI TpAllocPool(TP_POOL **out, PVOID reserved)
PTP_CLEANUP_GROUP CleanupGroup
PTP_SIMPLE_CALLBACK FinalizationCallback
TP_CALLBACK_PRIORITY CallbackPriority
PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreA(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCSTR lpName OPTIONAL)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreW(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCWSTR lpName OPTIONAL)
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
#define STATUS_INVALID_PARAMETER
static rfbScreenInfoPtr server
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
#define success(from, fromstr, to, tostr)
DWORD WINAPI GetLastError(void)
#define PIPE_ACCESS_DUPLEX
DWORD WINAPI GetCurrentThreadId(void)
VOID(NTAPI * PTP_WIN32_IO_CALLBACK)(PTP_CALLBACK_INSTANCE, PVOID, PVOID, ULONG, ULONG_PTR, PTP_IO)
#define ERROR_OPERATION_ABORTED
#define WT_TRANSFER_IMPERSONATION
@ TP_CALLBACK_PRIORITY_HIGH
struct _TP_CLEANUP_GROUP TP_CLEANUP_GROUP
#define WT_EXECUTEINPERSISTENTTHREAD
struct _TP_CALLBACK_INSTANCE * PTP_CALLBACK_INSTANCE
#define WT_EXECUTEONLYONCE
#define WT_EXECUTEINIOTHREAD
#define WT_EXECUTELONGFUNCTION
#define WT_EXECUTEINWAITTHREAD
struct _TP_TIMER TP_TIMER
VOID(NTAPI * PTP_SIMPLE_CALLBACK)(_Inout_ PTP_CALLBACK_INSTANCE Instance, _Inout_opt_ PVOID Context)
struct _TP_CALLBACK_INSTANCE TP_CALLBACK_INSTANCE
#define WT_EXECUTEDEFAULT