24#define WIN32_NO_STATUS
67#define GET_PROC(func) \
70 p ## func = (void *)GetProcAddress(module, #func); \
71 if (!p ## func) trace("Failed to get address for %s\n", #func); \
118 win_skip(
"Threadpool functions not supported, skipping tests\n");
193 if (
info->semaphore2)
218 ok(semaphores[0] !=
NULL,
"failed to create semaphore\n");
220 ok(semaphores[1] !=
NULL,
"failed to create semaphore\n");
221 info.semaphore1 = semaphores[0];
232 ok(wait1 !=
NULL,
"expected wait1 != NULL\n");
234 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
235 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
244 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
248 ok(
info.userdata == 2,
"expected info.userdata = 2, got %lu\n",
info.userdata);
253 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
262 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
266 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
271 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
279 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
282 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
287 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
295 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
299 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
304 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
314 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
321 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
330 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
331 ok(
info.threadid ==
threadid,
"unexpected different wait thread id %lx\n",
info.threadid);
336 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
345 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
346 ok(
info.threadid ==
threadid,
"unexpected different wait thread id %lx\n",
info.threadid);
351 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
361 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
362 ok(
info.threadid ==
threadid,
"unexpected different wait thread id %lx\n",
info.threadid);
367 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
377 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
378 ok(
info.threadid != 0,
"expected info.threadid != 0, got %lu\n",
info.threadid);
391 ok(
info.userdata == 2,
"expected info.userdata = 2, got %lu\n",
info.userdata);
394 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
403 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
404 ok(
info.threadid != 0,
"expected info.threadid != 0, got %lu\n",
info.threadid);
412 "WaitForSingleObject returned %lu\n",
result);
418 ok(
info.userdata == 2,
"expected info.userdata = 2, got %lu\n",
info.userdata);
421 ok(!
status,
"RtlDeregisterWait failed with status %lx\n",
status);
428 ok(!
status,
"RtlDeregisterWaitEx failed with status %lx\n",
status);
429 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
435 ok(!
status,
"RtlDeregisterWaitEx failed with status %lx\n",
status);
436 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
442 ok(!
status,
"RtlDeregisterWaitEx failed with status %lx\n",
status);
443 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
453 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
456 ok(!
status,
"RtlDeregisterWaitEx failed with status %lx\n",
status);
457 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
464 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
467 ok(!
status,
"RtlDeregisterWaitEx failed with status %lx\n",
status);
468 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
475 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
478 ok(!
status,
"RtlDeregisterWaitEx failed with status %lx\n",
status);
479 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
484 info.semaphore2 = semaphores[1];
493 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
506 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
519 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
533 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
535 ok(!
status,
"RtlDeregisterWaitEx failed with status %lx\n",
status);
546 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
548 ok(!
status,
"RtlDeregisterWaitEx failed with status %lx\n",
status);
559 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
590#if !defined(__REACTOS__) || _WIN32_WINNT >= _WIN32_WINNT_WIN7
605 memset(&environment, 0,
sizeof(environment));
620 memset(&environment, 0,
sizeof(environment));
629#if !defined(__REACTOS__) || _WIN32_WINNT >= _WIN32_WINNT_WIN7
630 memset(&environment3, 0,
sizeof(environment3));
633 environment3.
Size =
sizeof(environment3);
635 for (
i = 0;
i < 3; ++
i)
647 "TpSimpleTryPost failed with status %lx\n",
status);
651 memset(&environment, 0,
sizeof(environment));
657 "TpSimpleTryPost unexpectedly returned status %lx\n",
status);
667 ok(!
status,
"TpAllocCleanupGroup failed with status %lx\n",
status);
672 memset(&environment, 0,
sizeof(environment));
683 pTpSetPoolMaxThreads(
pool, 10);
684 memset(&environment, 0,
sizeof(environment));
688 for (
i = 0;
i < 100;
i++)
697 if (!pTpQueryPoolStackInformation)
699 skip(
"TpQueryPoolStackInformation not available\n");
705 status = pTpQueryPoolStackInformation(
pool, &stack_info);
712 status = pTpSetPoolStackInformation(
pool, &stack_info);
715 status = pTpQueryPoolStackInformation(
pool, &stack_info);
724 pTpReleaseCleanupGroup(
group);
725 pTpReleasePool(
pool);
755 pTpSetPoolMaxThreads(
pool, 1);
759 memset(&environment, 0,
sizeof(environment));
764 ok(work !=
NULL,
"expected work != NULL\n");
768 for (
i = 0;
i < 5;
i++)
770 pTpWaitForWork(work,
FALSE);
775 for (
i = 0;
i < 10;
i++)
777 pTpWaitForWork(work,
TRUE);
781 pTpReleaseWork(work);
782 pTpReleasePool(
pool);
800 pTpSetPoolMaxThreads(
pool, 1);
805 ok(!
status,
"TpAllocCleanupGroup failed with status %lx\n",
status);
810 memset(&environment, 0,
sizeof(environment));
815 ok(work !=
NULL,
"expected work != NULL\n");
819 memset(&environment, 0,
sizeof(environment));
825 ok(work2 !=
NULL,
"expected work2 != NULL\n");
829 for (
i = 0;
i < 10;
i++)
831 for (
i = 0;
i < 10;
i++)
834 pTpWaitForWork(work,
TRUE);
835 pTpWaitForWork(work2,
TRUE);
836 ok(
userdata & 0xffff,
"expected userdata & 0xffff != 0, got %lu\n",
userdata & 0xffff);
841 for (
i = 0;
i < 10;
i++)
843 for (
i = 0;
i < 3;
i++)
846 pTpWaitForWork(work,
TRUE);
847 ok((
userdata & 0xffff) < 10,
"expected userdata & 0xffff < 10, got %lu\n",
userdata & 0xffff);
851 pTpReleaseWork(work);
852 pTpReleaseCleanupGroup(
group);
853 pTpReleasePool(
pool);
868 pTpReleaseWork(work);
876 pTpReleaseTimer(timer);
885 pTpReleaseWait(wait);
913 ok(!
status,
"TpAllocCleanupGroup failed with status %lx\n",
status);
918 memset(&environment, 0,
sizeof(environment));
924 ok(work !=
NULL,
"expected work != NULL\n");
932 memset(&environment, 0,
sizeof(environment));
938 ok(timer !=
NULL,
"expected timer != NULL\n");
940 pTpSetTimer(timer, &when, 0, 0);
947 memset(&environment, 0,
sizeof(environment));
953 ok(wait !=
NULL,
"expected wait != NULL\n");
961 pTpReleaseCleanupGroup(
group);
962 pTpReleasePool(
pool);
977 "expected STATUS_TOO_MANY_THREADS, got %08lx\n",
status);
980 for (
i = 0;
i < 4;
i++)
1002 ok(
object == (
void *)0xdeadbeef,
"expected 0xdeadbeef, got %p\n",
object);
1022 ok(0,
"Unexpected callback\n");
1027 ok(0,
"Unexpected callback\n");
1032 ok(0,
"Unexpected callback\n");
1038 ok(0,
"Unexpected callback\n");
1043 ok(0,
"Unexpected callback\n");
1070 pTpSetPoolMaxThreads(
pool, 1);
1075 ok(!
status,
"TpAllocCleanupGroup failed with status %lx\n",
status);
1079 memset(&environment, 0,
sizeof(environment));
1087 memset(&environment, 0,
sizeof(environment));
1098 ok(work !=
NULL,
"expected work != NULL\n");
1103 ok(timer !=
NULL,
"expected timer != NULL\n");
1108 ok(wait !=
NULL,
"expected wait != NULL\n");
1111 pTpReleaseCleanupGroupMembers(
group,
TRUE, semaphores);
1119 memset(&environment, 0,
sizeof(environment));
1126 ok(work !=
NULL,
"expected work != NULL\n");
1134 pTpReleaseCleanupGroupMembers(
group,
TRUE, semaphores);
1142 memset(&environment, 0,
sizeof(environment));
1149 ok(work !=
NULL,
"expected work != NULL\n");
1157 memset(&environment, 0,
sizeof(environment));
1166 pTpReleaseCleanupGroupMembers(
group,
TRUE, semaphores);
1170 memset(&environment, 0,
sizeof(environment));
1177 ok(work !=
NULL,
"expected work != NULL\n");
1181 for (
i = 0;
i < 10;
i++)
1186 pTpReleaseCleanupGroupMembers(
group,
TRUE, &userdata2);
1188 ok(userdata2 == 1,
"expected only one cancellation callback, got %lu\n", userdata2);
1193 pTpReleaseCleanupGroup(
group);
1194 pTpReleasePool(
pool);
1202 pTpCallbackReleaseSemaphoreOnCompletion(
instance, semaphores[0], 1);
1220 ok(semaphores[0] !=
NULL,
"failed to create semaphore\n");
1222 ok(semaphores[1] !=
NULL,
"failed to create semaphore\n");
1231 memset(&environment, 0,
sizeof(environment));
1240 memset(&environment, 0,
sizeof(environment));
1252 pTpReleasePool(
pool);
1301 ok(semaphores[0] !=
NULL,
"failed to create semaphore\n");
1303 ok(semaphores[1] !=
NULL,
"failed to create semaphore\n");
1313 ok(!
status,
"TpAllocCleanupGroup failed with status %lx\n",
status);
1318 memset(&environment, 0,
sizeof(environment));
1323 ok(work !=
NULL,
"expected work != NULL\n");
1326 pTpWaitForWork(work,
FALSE);
1333 pTpReleaseWork(work);
1337 memset(&environment, 0,
sizeof(environment));
1343 ok(work !=
NULL,
"expected work != NULL\n");
1346 pTpWaitForWork(work,
FALSE);
1357 memset(&environment, 0,
sizeof(environment));
1363 ok(work !=
NULL,
"expected work != NULL\n");
1375 memset(&environment, 0,
sizeof(environment));
1391 pTpReleaseCleanupGroup(
group);
1392 pTpReleasePool(
pool);
1426 memset(&environment, 0,
sizeof(environment));
1431 ok(timer !=
NULL,
"expected timer != NULL\n");
1433 success = pTpIsTimerSet(timer);
1434 ok(!
success,
"TpIsTimerSet returned TRUE\n");
1438 pTpSetTimer(timer, &when, 0, 0);
1439 success = pTpIsTimerSet(timer);
1440 ok(
success,
"TpIsTimerSet returned FALSE\n");
1442 pTpWaitForTimer(timer,
FALSE);
1448 success = pTpIsTimerSet(timer);
1449 ok(
success,
"TpIsTimerSet returned FALSE\n");
1454 pTpSetTimer(timer, &when, 0, 0);
1455 success = pTpIsTimerSet(timer);
1456 ok(
success,
"TpIsTimerSet returned FALSE\n");
1458 pTpWaitForTimer(timer,
FALSE);
1464 success = pTpIsTimerSet(timer);
1465 ok(
success,
"TpIsTimerSet returned FALSE\n");
1469 pTpSetTimer(timer, &when, 0, 0);
1470 success = pTpIsTimerSet(timer);
1471 ok(
success,
"TpIsTimerSet returned FALSE\n");
1473 pTpWaitForTimer(timer,
FALSE);
1477 success = pTpIsTimerSet(timer);
1478 ok(
success,
"TpIsTimerSet returned FALSE\n");
1481 pTpSetTimer(timer,
NULL, 0, 0);
1482 success = pTpIsTimerSet(timer);
1483 ok(!
success,
"TpIsTimerSet returned TRUE\n");
1484 pTpWaitForTimer(timer,
TRUE);
1486 pTpReleaseTimer(timer);
1494 memset(&environment, 0,
sizeof(environment));
1499 ok(timer !=
NULL,
"expected timer != NULL\n");
1503 pTpSetTimer(timer, &when, 200, 0);
1504 success = pTpIsTimerSet(timer);
1505 ok(
success,
"TpIsTimerSet returned FALSE\n");
1509 for (
i = 0;
i < 3;
i++)
1515 ok(ticks >= 500 && (ticks <= 700 ||
broken(ticks <= 750)) ,
1516 "expected approximately 600 ticks, got %lu\n", ticks);
1519 pTpSetTimer(timer,
NULL, 0, 0);
1520 success = pTpIsTimerSet(timer);
1521 ok(!
success,
"TpIsTimerSet returned TRUE\n");
1522 pTpWaitForTimer(timer,
TRUE);
1525 pTpReleaseTimer(timer);
1526 pTpReleasePool(
pool);
1565 memset(&environment, 0,
sizeof(environment));
1566 environment.Version = 1;
1567 environment.Pool =
pool;
1573 ok(timer1 !=
NULL,
"expected timer1 != NULL\n");
1579 ok(timer2 !=
NULL,
"expected timer2 != NULL\n");
1587 pTpSetTimer(timer2, &when, 0, 0);
1590 pTpSetTimer(timer1, &when, 0, 75);
1596 ok(info1.
ticks != 0 && info2.
ticks != 0,
"expected that ticks are nonzero\n");
1598 "expected that timers are not merged\n");
1606 pTpSetTimer(timer2, &when, 0, 0);
1609 pTpSetTimer(timer1, &when, 0, 200);
1615 ok(info1.
ticks != 0 && info2.
ticks != 0,
"expected that ticks are nonzero\n");
1617 ok(merged ||
broken(!merged) ,
"expected that timers are merged\n");
1625 pTpSetTimer(timer1, &when, 0, 200);
1628 pTpSetTimer(timer2, &when, 0, 0);
1634 ok(info1.
ticks != 0 && info2.
ticks != 0,
"expected that ticks are nonzero\n");
1637 ok(merged ||
broken(!merged) ,
"expected that timers are merged\n");
1640 pTpReleaseTimer(timer1);
1641 pTpReleaseTimer(timer2);
1642 pTpReleasePool(
pool);
1661 ok(0,
"unexpected result %lu\n",
result);
1677 ok(semaphores[0] !=
NULL,
"failed to create semaphore\n");
1679 ok(semaphores[1] !=
NULL,
"failed to create semaphore\n");
1680 info.semaphore = semaphores[0];
1689 memset(&environment, 0,
sizeof(environment));
1696 ok(wait1 !=
NULL,
"expected wait1 != NULL\n");
1701 ok(wait2 !=
NULL,
"expected wait2 != NULL\n");
1705 pTpSetWait(wait1, semaphores[1],
NULL);
1709 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
1716 pTpSetWait(wait1, semaphores[1], &when);
1719 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
1722 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
1729 pTpSetWait(wait1, semaphores[1], &when);
1732 pTpWaitForWait(wait1,
TRUE);
1733 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
1736 "WaitForSingleObject returned %lu\n",
result);
1738 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
1740 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
1747 pTpSetWait(wait1, semaphores[1], &when);
1750 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
1754 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
1761 pTpSetWait(wait1, semaphores[1], &when);
1764 pTpWaitForWait(wait1,
TRUE);
1765 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
1769 "WaitForSingleObject returned %lu\n",
result);
1772 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
1778 ok(
info.userdata == 0,
"expected info.userdata = 0, 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);
1793 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
1801 pTpSetWait(wait1, semaphores[1], &when);
1804 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
1808 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
1815 pTpSetWait(wait1, semaphores[1], &when);
1818 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
1825 pTpSetWait(wait1, semaphores[1], &when);
1828 pTpSetWait(wait1,
NULL, (
void *)0xdeadbeef);
1833 ok(
info.userdata == 0,
"expected info.userdata = 0, got %lu\n",
info.userdata);
1843 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
1848 pTpSetWait(wait1, semaphores[1], &when);
1857 ok(
info.userdata == 0x10000,
"expected info.userdata = 0x10000, got %lu\n",
info.userdata);
1863 ok(semaphores[1] !=
NULL,
"failed to create semaphore\n");
1867 pTpSetWait(wait1, semaphores[1],
NULL);
1868 pTpSetWait(wait2, semaphores[1],
NULL);
1875 ok(
info.userdata == 1,
"expected info.userdata = 1, got %lu\n",
info.userdata);
1881 pTpSetWait(wait1, semaphores[1],
NULL);
1882 pTpSetWait(wait2, semaphores[1],
NULL);
1889 ok(
info.userdata == 2,
"expected info.userdata = 2, got %lu\n",
info.userdata);
1894 pTpReleaseWait(wait1);
1895 pTpReleaseWait(wait2);
1896 pTpReleasePool(
pool);
1916 ok(0,
"unexpected result %lu\n",
result);
1934 if (pTpSetPoolStackInformation ==
NULL)
1936 win_skip(
"TpSetPoolStackInformation not available\n");
1953 status = pTpSetPoolStackInformation(
pool, &stack_info);
1954 ok(!
status,
"TpQueryPoolStackInformation failed: %lx\n",
status);
1956 memset(&environment, 0,
sizeof(environment));
1964 ok(semaphores[
i] !=
NULL,
"failed to create semaphore %i\n",
i);
1969 ok(waits[
i] !=
NULL,
"expected waits[%d] != NULL\n",
i);
1971 pTpSetWait(waits[
i], semaphores[
i],
NULL);
1984 pTpSetWait(waits[
i], semaphores[
i],
NULL);
1997 pTpSetWait(waits[
i], semaphores[
i],
NULL);
2005 pTpSetWait(waits[
i], semaphores[
i], &when);
2014 ok(
multi_wait_info.result >> 16,
"expected multi_wait_info.result >> 16 != 0\n");
2019 pTpSetWait(waits[
i], semaphores[
i],
NULL);
2026 pTpReleaseWait(waits[
i]);
2030 pTpReleasePool(
pool);
2057 pTpWaitForIoCompletion(
io,
FALSE);
2091 ok(!!
io,
"expected non-NULL TP_IO\n");
2093 pTpWaitForIoCompletion(
io,
FALSE);
2096 pTpStartAsyncIoOperation(
io);
2108 pTpWaitForIoCompletion(
io,
FALSE);
2109 ok(userdata.
count == 1,
"callback ran %u times\n", userdata.
count);
2110 ok(userdata.
ovl == &
ovl,
"expected %p, got %p\n", &
ovl, userdata.
ovl);
2113 ok(userdata.
io ==
io,
"expected %p, got %p\n",
io, userdata.
io);
2119 pTpStartAsyncIoOperation(
io);
2120 pTpStartAsyncIoOperation(
io);
2134 pTpWaitForIoCompletion(
io,
FALSE);
2135 ok(userdata.
count == 2,
"callback ran %u times\n", userdata.
count);
2138 ok(userdata.
io ==
io,
"expected %p, got %p\n",
io, userdata.
io);
2146 pTpStartAsyncIoOperation(
io);
2148 pTpWaitForIoCompletion(
io,
TRUE);
2149 ok(!userdata.
count,
"callback ran %u times\n", userdata.
count);
2151 pTpStartAsyncIoOperation(
io);
2159 pTpWaitForIoCompletion(
io,
FALSE);
2160 ok(userdata.
count == 1,
"callback ran %u times\n", userdata.
count);
2161 ok(userdata.
ovl == &
ovl,
"expected %p, got %p\n", &
ovl, userdata.
ovl);
2164 ok(userdata.
io ==
io,
"expected %p, got %p\n",
io, userdata.
io);
2167 pTpStartAsyncIoOperation(
io);
2173 pTpCancelAsyncIoOperation(
io);
2174 pTpWaitForIoCompletion(
io,
FALSE);
2175 ok(!userdata.
count,
"callback ran %u times\n", userdata.
count);
2178 pTpStartAsyncIoOperation(
io);
2186 pTpWaitForIoCompletion(
io,
FALSE);
2187 ok(userdata.
count == 1,
"callback ran %u times\n", userdata.
count);
2188 ok(userdata.
ovl == &
ovl,
"expected %p, got %p\n", &
ovl, userdata.
ovl);
2191 ok(userdata.
io ==
io,
"expected %p, got %p\n",
io, userdata.
io);
2194 pTpStartAsyncIoOperation(
io);
2195 pTpCancelAsyncIoOperation(
io);
2202 pTpWaitForIoCompletion(
io,
FALSE);
2209 ok(userdata.
count == 0,
"callback ran %u times\n", userdata.
count);
2211 pTpReleaseIoCompletion(
io);
2223 ok(
ret,
"Got unexpected ret %#x.\n",
ret);
2224 pTpReleaseIoCompletion(
io);
2226 ok(!
ret,
"Got unexpected ret %#x.\n",
ret);
2240 pTpStartAsyncIoOperation(
io);
2241 pTpWaitForIoCompletion(
io,
TRUE);
2243 ok(
ret,
"Got unexpected ret %#x.\n",
ret);
2244 pTpReleaseIoCompletion(
io);
2246 ok(
ret,
"Got unexpected ret %#x.\n",
ret);
2254 ok(
ret,
"Got unexpected ret %#x.\n",
ret);
2261 ok(!
ret,
"Got unexpected ret %#x.\n",
ret);
2267 pTpReleasePool(
pool);
2310 ok(!!
io,
"expected non-NULL TP_IO\n");
2312 pWaitForThreadpoolIoCallbacks(
io,
FALSE);
2315 pStartThreadpoolIo(
io);
2327 pWaitForThreadpoolIoCallbacks(
io,
FALSE);
2328 ok(userdata.
count == 1,
"callback ran %u times\n", userdata.
count);
2329 ok(userdata.
ovl == &
ovl,
"expected %p, got %p\n", &
ovl, userdata.
ovl);
2332 ok(userdata.
io ==
io,
"expected %p, got %p\n",
io, userdata.
io);
2338 pStartThreadpoolIo(
io);
2339 pStartThreadpoolIo(
io);
2353 pWaitForThreadpoolIoCallbacks(
io,
FALSE);
2354 ok(userdata.
count == 2,
"callback ran %u times\n", userdata.
count);
2357 ok(userdata.
io ==
io,
"expected %p, got %p\n",
io, userdata.
io);
2360 pStartThreadpoolIo(
io);
2361 pWaitForThreadpoolIoCallbacks(
io,
TRUE);
2362 ok(!userdata.
count,
"callback ran %u times\n", userdata.
count);
2364 pStartThreadpoolIo(
io);
2372 pWaitForThreadpoolIoCallbacks(
io,
FALSE);
2373 ok(userdata.
count == 1,
"callback ran %u times\n", userdata.
count);
2374 ok(userdata.
ovl == &
ovl,
"expected %p, got %p\n", &
ovl, userdata.
ovl);
2377 ok(userdata.
io ==
io,
"expected %p, got %p\n",
io, userdata.
io);
2380 pStartThreadpoolIo(
io);
2386 pCancelThreadpoolIo(
io);
2387 pWaitForThreadpoolIoCallbacks(
io,
FALSE);
2388 ok(!userdata.
count,
"callback ran %u times\n", userdata.
count);
2391 pStartThreadpoolIo(
io);
2399 pWaitForThreadpoolIoCallbacks(
io,
FALSE);
2400 ok(userdata.
count == 1,
"callback ran %u times\n", userdata.
count);
2401 ok(userdata.
ovl == &
ovl,
"expected %p, got %p\n", &
ovl, userdata.
ovl);
2404 ok(userdata.
io ==
io,
"expected %p, got %p\n",
io, userdata.
io);
2409 pCloseThreadpoolIo(
io);
2410 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)
BOOL WINAPI DECLSPEC_HOTPATCH TpSimpleTryPost(PTP_SIMPLE_CALLBACK callback, PVOID userdata, TP_CALLBACK_ENVIRON *environment)
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
PTP_IO WINAPI DECLSPEC_HOTPATCH CreateThreadpoolIo(HANDLE handle, PTP_WIN32_IO_CALLBACK callback, PVOID userdata, TP_CALLBACK_ENVIRON *environment)
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 struct @1834 multi_wait_info
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 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)
static void ULONG ULONG * ret_size
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
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 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)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreA(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCSTR lpName OPTIONAL)
VOID(WINAPI * PTP_WIN32_IO_CALLBACK)(_Inout_ PTP_CALLBACK_INSTANCE Instance, _Inout_opt_ PVOID Context, _Inout_opt_ PVOID Overlapped, _In_ ULONG IoResult, _In_ ULONG_PTR NumberOfBytesTransferred, _Inout_ PTP_IO Io)
WINBASEAPI VOID WINAPI WaitForThreadpoolIoCallbacks(_Inout_ PTP_IO pio, _In_ BOOL fCancelPendingCallbacks)
WINBASEAPI VOID WINAPI StartThreadpoolIo(_Inout_ PTP_IO pio)
WINBASEAPI VOID WINAPI CancelThreadpoolIo(_Inout_ PTP_IO pio)
WINBASEAPI VOID WINAPI CloseThreadpoolIo(_Inout_ PTP_IO pio)
#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)
NTSYSAPI void WINAPI TpWaitForWork(TP_WORK *, BOOL)
NTSYSAPI void WINAPI TpReleaseWork(TP_WORK *)
NTSYSAPI void WINAPI TpDisassociateCallback(TP_CALLBACK_INSTANCE *)
NTSYSAPI NTSTATUS WINAPI TpQueryPoolStackInformation(TP_POOL *, TP_POOL_STACK_INFORMATION *stack_info)
NTSYSAPI void WINAPI TpStartAsyncIoOperation(TP_IO *)
NTSYSAPI void WINAPI TpReleasePool(TP_POOL *)
NTSYSAPI NTSTATUS WINAPI TpAllocTimer(TP_TIMER **, PTP_TIMER_CALLBACK, PVOID, TP_CALLBACK_ENVIRON *)
NTSYSAPI NTSTATUS WINAPI TpAllocCleanupGroup(TP_CLEANUP_GROUP **)
NTSYSAPI void WINAPI TpWaitForTimer(TP_TIMER *, BOOL)
NTSYSAPI void WINAPI TpWaitForIoCompletion(TP_IO *, BOOL)
NTSYSAPI void WINAPI TpCancelAsyncIoOperation(TP_IO *)
NTSYSAPI BOOL WINAPI TpIsTimerSet(TP_TIMER *)
NTSYSAPI void WINAPI TpReleaseTimer(TP_TIMER *)
NTSYSAPI void WINAPI TpPostWork(TP_WORK *)
NTSYSAPI void WINAPI TpWaitForWait(TP_WAIT *, BOOL)
NTSYSAPI NTSTATUS WINAPI TpAllocIoCompletion(TP_IO **, HANDLE, PTP_IO_CALLBACK, void *, TP_CALLBACK_ENVIRON *)
NTSYSAPI void WINAPI TpSetWait(TP_WAIT *, HANDLE, LARGE_INTEGER *)
NTSYSAPI NTSTATUS WINAPI TpAllocPool(TP_POOL **, PVOID)
NTSYSAPI void WINAPI TpReleaseIoCompletion(TP_IO *)
NTSYSAPI NTSTATUS WINAPI TpAllocWait(TP_WAIT **, PTP_WAIT_CALLBACK, PVOID, TP_CALLBACK_ENVIRON *)
NTSYSAPI void WINAPI TpSetPoolMaxThreads(TP_POOL *, DWORD)
NTSYSAPI void WINAPI TpCallbackReleaseSemaphoreOnCompletion(TP_CALLBACK_INSTANCE *, HANDLE, DWORD)
NTSYSAPI NTSTATUS WINAPI TpAllocWork(TP_WORK **, PTP_WORK_CALLBACK, PVOID, TP_CALLBACK_ENVIRON *)
NTSYSAPI void WINAPI TpReleaseCleanupGroupMembers(TP_CLEANUP_GROUP *, BOOL, PVOID)
NTSYSAPI void WINAPI TpReleaseCleanupGroup(TP_CLEANUP_GROUP *)
NTSYSAPI void WINAPI TpSetTimer(TP_TIMER *, LARGE_INTEGER *, LONG, LONG)
NTSYSAPI NTSTATUS WINAPI TpCallbackMayRunLong(TP_CALLBACK_INSTANCE *)
NTSYSAPI NTSTATUS WINAPI TpSetPoolStackInformation(TP_POOL *, TP_POOL_STACK_INFORMATION *stack_info)
NTSYSAPI void WINAPI TpReleaseWait(TP_WAIT *)
#define ERROR_OPERATION_ABORTED
#define WT_TRANSFER_IMPERSONATION
@ TP_CALLBACK_PRIORITY_HIGH
struct _TP_CLEANUP_GROUP TP_CLEANUP_GROUP
#define WT_EXECUTEINPERSISTENTTHREAD
#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