25#define WIN32_NO_STATUS
32#define PIPENAME "\\\\.\\PiPe\\tests_pipe.c"
34#define NB_SERVER_LOOPS 8
120#define test_not_signaled(h) _test_not_signaled(__LINE__,h)
127#define test_signaled(h) _test_signaled(__LINE__,h)
134#define test_pipe_info(a,b,c,d,e) _test_pipe_info(__LINE__,a,b,c,d,e)
137 DWORD flags = 0xdeadbeef, out_buf_size = 0xdeadbeef, in_buf_size = 0xdeadbeef, max_instances = 0xdeadbeef;
141 ok_(__FILE__,
line)(
res,
"GetNamedPipeInfo failed: %x\n",
res);
142 ok_(__FILE__,
line)(
flags == ex_flags,
"flags = %lx, expected %lx\n",
flags, ex_flags);
143 ok_(__FILE__,
line)(out_buf_size == ex_out_buf_size,
"out_buf_size = %lx, expected %lu\n", out_buf_size, ex_out_buf_size);
144 ok_(__FILE__,
line)(in_buf_size == ex_in_buf_size,
"in_buf_size = %lx, expected %lu\n", in_buf_size, ex_in_buf_size);
145 ok_(__FILE__,
line)(max_instances == ex_max_instances,
"max_instances = %lx, expected %lu\n", max_instances, ex_max_instances);
148#define test_file_access(a,b) _test_file_access(__LINE__,a,b)
158 ok_(__FILE__,
line)(
info.AccessFlags == expected_access,
"got access %08lx expected %08lx\n",
159 info.AccessFlags, expected_access);
166 static const char obuf[] =
"Bit Bucket";
167 static const char obuf2[] =
"More bits";
168 char ibuf[32], *
pbuf;
177 trace(
"test_CreateNamedPipe starting in byte mode\n");
179 trace(
"test_CreateNamedPipe starting in message mode\n");
183 ok(
ret == 0,
"WaitNamedPipe returned %d for nonexistent pipe\n",
ret);
194 "CreateNamedPipe should fail if name doesn't start with \\\\.\\pipe\n");
206 "CreateNamedPipe should fail with PIPE_TYPE_BYTE | PIPE_READMODE_MESSAGE\n");
213 "CreateNamedPipe should fail if name is NULL\n");
218 "connecting to nonexistent named pipe should fail with ERROR_FILE_NOT_FOUND\n");
260 memset(ibuf, 0,
sizeof(ibuf));
262 ok(written ==
sizeof(
obuf),
"write file len\n");
264 ok(readden ==
sizeof(
obuf),
"read got %ld bytes\n", readden);
265 ok(
memcmp(
obuf, ibuf, written) == 0,
"content check\n");
267 memset(ibuf, 0,
sizeof(ibuf));
269 ok(written ==
sizeof(obuf2),
"write file len\n");
271 ok(readden ==
sizeof(obuf2),
"read got %ld bytes\n", readden);
272 ok(
memcmp(obuf2, ibuf, written) == 0,
"content check\n");
275 memset(ibuf, 0,
sizeof(ibuf));
277 ok(written ==
sizeof(
obuf),
"write file len 1\n");
281 ok(
left == 0,
"peek 1 got %ld bytes left\n",
left);
285 ok(readden ==
sizeof(
obuf),
"read 1 got %ld bytes\n", readden);
286 ok(
memcmp(
obuf, ibuf, written) == 0,
"content 1 check\n");
288 memset(ibuf, 0,
sizeof(ibuf));
290 ok(written ==
sizeof(obuf2),
"write file len 2\n");
292 ok(
avail ==
sizeof(obuf2),
"peek 2 got %ld bytes\n",
avail);
294 ok(
left == 0,
"peek 2 got %ld bytes left\n",
left);
296 ok(
left ==
sizeof(obuf2),
"peek 2 got %ld bytes left\n",
left);
298 ok(
avail ==
sizeof(obuf2),
"peek 2 got %ld bytes\n",
avail);
300 ok(
left == 0,
"peek 2 got %ld bytes left\n",
left);
302 ok(
left ==
sizeof(obuf2),
"peek 2 got %ld bytes left\n",
left);
304 ok(readden ==
sizeof(obuf2),
"read 2 got %ld bytes\n", readden);
305 ok(
memcmp(obuf2, ibuf, written) == 0,
"content 2 check\n");
308 memset(ibuf, 0,
sizeof(ibuf));
310 ok(written ==
sizeof(obuf2),
"write file len\n");
312 ok(readden == 4,
"peek got %ld bytes\n", readden);
313 ok(
avail ==
sizeof(obuf2),
"peek got %ld bytes available\n",
avail);
315 ok(
left == -4,
"peek got %ld bytes left\n",
left);
317 ok(
left ==
sizeof(obuf2)-4,
"peek got %ld bytes left\n",
left);
319 ok(readden == 4,
"read got %ld bytes\n", readden);
321 ok(readden ==
sizeof(obuf2) - 4,
"read got %ld bytes\n", readden);
322 ok(
memcmp(obuf2, ibuf, written) == 0,
"content check\n");
324 memset(ibuf, 0,
sizeof(ibuf));
326 ok(written ==
sizeof(
obuf),
"write file len\n");
328 ok(readden == 4,
"peek got %ld bytes\n", readden);
332 ok(
left == -4,
"peek got %ld bytes left\n",
left);
342 ok(readden == 4,
"read got %ld bytes\n", readden);
344 ok(readden ==
sizeof(
obuf) - 4,
"read got %ld bytes\n", readden);
345 ok(
memcmp(
obuf, ibuf, written) == 0,
"content check\n");
348 memset(ibuf, 0,
sizeof(ibuf));
350 ok(written ==
sizeof(obuf2),
"write file len\n");
354 ok(readden == 4,
"read got %ld bytes\n", readden);
362 ok(readden == 4,
"read got %ld bytes\n", readden);
367 ok(readden == 4,
"read got %ld bytes\n", readden);
369 ok(readden ==
sizeof(obuf2) - 8,
"read got %ld bytes\n", readden);
370 ok(
memcmp(obuf2, ibuf, written) == 0,
"content check\n");
373 memset(ibuf, 0,
sizeof(ibuf));
375 ok(written ==
sizeof(
obuf),
"write file len 3a\n");
377 ok(written ==
sizeof(obuf2),
"write file len 3b\n");
379 ok(readden == 4,
"peek3 got %ld bytes\n", readden);
381 ok(
left == -4,
"peek3 got %ld bytes left\n",
left);
384 ok(
avail ==
sizeof(
obuf) +
sizeof(obuf2),
"peek3 got %ld bytes available\n",
avail);
387 ok(readden ==
sizeof(
obuf) +
sizeof(obuf2),
"peek3 got %ld bytes\n", readden);
392 ok(readden ==
sizeof(
obuf),
"peek3 got %ld bytes\n", readden);
393 ok(
left == 0,
"peek3 got %ld bytes left\n",
left);
395 ok(
avail ==
sizeof(
obuf) +
sizeof(obuf2),
"peek3 got %ld bytes available\n",
avail);
400 ok(
memcmp(obuf2,
pbuf,
sizeof(obuf2)) == 0,
"pipe content 3b check\n");
403 ok(readden ==
sizeof(
obuf) +
sizeof(obuf2),
"read 3 got %ld bytes\n", readden);
407 ok(
memcmp(obuf2,
pbuf,
sizeof(obuf2)) == 0,
"content 3b check\n");
410 memset(ibuf, 0,
sizeof(ibuf));
412 ok(written ==
sizeof(
obuf),
"write file len 4a\n");
414 ok(written ==
sizeof(obuf2),
"write file len 4b\n");
416 ok(readden == 4,
"peek3 got %ld bytes\n", readden);
418 ok(
left == -4,
"peek3 got %ld bytes left\n",
left);
421 ok(
avail ==
sizeof(
obuf) +
sizeof(obuf2),
"peek3 got %ld bytes available\n",
avail);
424 ok(readden ==
sizeof(
obuf) +
sizeof(obuf2),
"peek4 got %ld bytes\n", readden);
429 ok(readden ==
sizeof(
obuf),
"peek4 got %ld bytes\n", readden);
430 ok(
left == 0,
"peek4 got %ld bytes left\n",
left);
432 ok(
avail ==
sizeof(
obuf) +
sizeof(obuf2),
"peek4 got %ld bytes available\n",
avail);
437 ok(
memcmp(obuf2,
pbuf,
sizeof(obuf2)) == 0,
"pipe content 4b check\n");
441 ok(readden ==
sizeof(
obuf) +
sizeof(obuf2),
"read 4 got %ld bytes\n", readden);
444 ok(readden ==
sizeof(
obuf),
"read 4 got %ld bytes\n", readden);
450 ok(
memcmp(obuf2,
pbuf,
sizeof(obuf2)) == 0,
"content 4b check\n");
463 memset(ibuf, 0,
sizeof(ibuf));
465 ok(written ==
sizeof(
obuf),
"write file len 3a\n");
467 ok(written ==
sizeof(obuf2),
"write file len 3b\n");
469 ok(readden ==
sizeof(
obuf),
"peek5 got %ld bytes\n", readden);
470 ok(
avail ==
sizeof(
obuf) +
sizeof(obuf2),
"peek5 got %ld bytes available\n",
avail);
471 ok(
left == 0,
"peek5 got %ld bytes left\n",
left);
475 ok(readden ==
sizeof(
obuf),
"read 5 got %ld bytes\n", readden);
478 if (readden <=
sizeof(
obuf))
484 ok(readden ==
sizeof(obuf2),
"peek6a got %ld bytes\n", readden);
485 ok(
avail ==
sizeof(obuf2),
"peek6a got %ld bytes available\n",
avail);
488 ok(readden ==
sizeof(obuf2),
"read 6a got %ld bytes\n", readden);
490 ok(
memcmp(obuf2,
pbuf,
sizeof(obuf2)) == 0,
"content 6a check\n");
492 memset(ibuf, 0,
sizeof(ibuf));
494 ok(written ==
sizeof(
obuf),
"write file len 6a\n");
496 ok(written ==
sizeof(obuf2),
"write file len 6b\n");
498 ok(readden ==
sizeof(
obuf),
"peek6 got %ld bytes\n", readden);
500 ok(
avail ==
sizeof(
obuf) +
sizeof(obuf2),
"peek6b got %ld bytes available\n",
avail);
504 ok(readden ==
sizeof(
obuf),
"read 6b got %ld bytes\n", readden);
507 if (readden <=
sizeof(
obuf))
511 memset(ibuf, 0,
sizeof(ibuf));
513 ok(written ==
sizeof(obuf2),
"write file len 7\n");
517 ok(readden == 4,
"read got %ld bytes 7\n", readden);
519 ok(readden ==
sizeof(obuf2) - 4,
"read got %ld bytes 7\n", readden);
520 ok(
memcmp(obuf2, ibuf, written) == 0,
"content check 7\n");
522 memset(ibuf, 0,
sizeof(ibuf));
524 ok(written ==
sizeof(
obuf),
"write file len 8\n");
528 ok(readden == 4,
"read got %ld bytes 8\n", readden);
530 ok(readden ==
sizeof(
obuf) - 4,
"read got %ld bytes 8\n", readden);
531 ok(
memcmp(
obuf, ibuf, written) == 0,
"content check 8\n");
537 memset(ibuf, 0,
sizeof(ibuf));
539 ok(written ==
sizeof(
obuf),
"write file len 9\n");
541 ok(written ==
sizeof(obuf2),
"write file len 9\n");
545 ok(readden == 4,
"read got %ld bytes 9\n", readden);
548 ok(!
ret,
"RpcReadFile 9\n");
550 ok(readden == 4,
"read got %ld bytes 9\n", readden);
552 ok(
ret,
"RpcReadFile 9\n");
553 ok(readden ==
sizeof(
obuf) - 8,
"read got %ld bytes 9\n", readden);
555 if (readden <=
sizeof(
obuf) - 8)
557 memset(ibuf, 0,
sizeof(ibuf));
560 ok(!
ret,
"RpcReadFile 9\n");
562 ok(readden == 4,
"read got %ld bytes 9\n", readden);
566 ok(readden == 4,
"read got %ld bytes 9\n", readden);
568 ok(
ret,
"RpcReadFile 9\n");
569 ok(readden ==
sizeof(obuf2) - 8,
"read got %ld bytes 9\n", readden);
570 ok(
memcmp(obuf2, ibuf,
sizeof(obuf2)) == 0,
"content check 9\n");
574 memset(ibuf, 0,
sizeof(ibuf));
576 ok(written ==
sizeof(obuf2),
"write file len 10\n");
578 ok(written ==
sizeof(
obuf),
"write file len 10\n");
582 ok(readden == 4,
"read got %ld bytes 10\n", readden);
585 ok(!
ret,
"RpcReadFile 10\n");
587 ok(readden == 4,
"read got %ld bytes 10\n", readden);
589 ok(
ret,
"RpcReadFile 10\n");
590 ok(readden ==
sizeof(obuf2) - 8,
"read got %ld bytes 10\n", readden);
591 ok(
memcmp(obuf2, ibuf,
sizeof(obuf2)) == 0,
"content check 10\n");
592 if (readden <=
sizeof(obuf2) - 8)
594 memset(ibuf, 0,
sizeof(ibuf));
597 ok(!
ret,
"RpcReadFile 10\n");
599 ok(readden == 4,
"read got %ld bytes 10\n", readden);
603 ok(readden == 4,
"read got %ld bytes 10\n", readden);
605 ok(
ret,
"RpcReadFile 10\n");
606 ok(readden ==
sizeof(
obuf) - 8,
"read got %ld bytes 10\n", readden);
621 "connecting to named pipe after other client closes but before DisconnectNamedPipe should fail\n");
623 "connecting to named pipe before other client closes should fail with ERROR_PIPE_BUSY\n");
630 "connecting to named pipe after other client closes but before DisconnectNamedPipe should fail\n");
632 "connecting to named pipe after other client closes but before DisconnectNamedPipe should fail with ERROR_PIPE_BUSY\n");
639 "connecting to named pipe after other client closes but before DisconnectNamedPipe should fail\n");
641 "connecting to named pipe after other client closes but before ConnectNamedPipe should fail with ERROR_PIPE_BUSY\n");
791 static char buf[512];
888 ok(readden,
"short read\n");
893 ok(written == readden,
"write file len\n");
910 trace(
"serverThreadMain2\n");
954 ok(written == readden,
"write file len\n");
1013 int letWFSOEwait = (
i & 2);
1014 int letGORwait = (
i & 1);
1017 memset(&oOverlap, 0,
sizeof(oOverlap));
1022 if (
winetest_debug > 1)
trace(
"Server calling non-overlapped ConnectNamedPipe on overlapped pipe...\n");
1040 ok(
ret == 0,
"wait ConnectNamedPipe returned %lx\n",
ret);
1043 if (!letGORwait && !letWFSOEwait && !
success) {
1068 ok(
ret == 0,
"wait ReadFile returned %lx\n",
ret);
1071 if (!letGORwait && !letWFSOEwait && !
success) {
1092 ok(
ret == 0,
"wait WriteFile returned %lx\n",
ret);
1095 if (!letGORwait && !letWFSOEwait && !
success) {
1102 ok(written == readden,
"write file len\n");
1130 ok(hcompletion !=
NULL,
"CreateIoCompletionPort failed, error=%li\n",
GetLastError());
1145 memset(&oConnect, 0,
sizeof(oConnect));
1146 memset(&oRead, 0,
sizeof(oRead));
1147 memset(&oWrite, 0,
sizeof(oWrite));
1154 "overlapped ConnectNamedPipe got %u err %lu\n",
success,
err );
1161 "ConnectNamedPipe GetQueuedCompletionStatus wrong error %lu\n",
GetLastError());
1167 ok(compkey == 12345,
"got completion key %i instead of 12345\n", (
int)compkey);
1168 ok(oResult == &oConnect,
"got overlapped pointer %p instead of %p\n", oResult, &oConnect);
1186 ok(compkey == 12345,
"got completion key %i instead of 12345\n", (
int)compkey);
1187 ok(oResult == &oRead,
"got overlapped pointer %p instead of %p\n", oResult, &oRead);
1201 ok(compkey == 12345,
"got completion key %i instead of 12345\n", (
int)compkey);
1202 ok(oResult == &oWrite,
"got overlapped pointer %p instead of %p\n", oResult, &oWrite);
1203 ok(written == readden,
"write file len\n");
1217 "overlapped WriteFile on disconnected pipe returned %u, err=%li\n",
success,
err);
1226 "WriteFile GetQueuedCompletionStatus returned %u, err=%li, oResult %p\n",
1235 "overlapped ReadFile on disconnected pipe returned %u, err=%li\n",
success,
err);
1243 "ReadFile GetQueuedCompletionStatus returned %u, err=%li, oResult %p\n",
1304 memset(&oOverlap, 0,
sizeof(oOverlap));
1330 ok(
ret == 0,
"wait ReadFileEx returned %lx\n",
ret);
1352 ok(
ret == 0,
"wait WriteFileEx returned %lx\n",
ret);
1374 static const char obuf[] =
"Bit Bucket";
1380 for (loop = 0; loop < 3; loop++) {
1399 memset(ibuf, 0,
sizeof(ibuf));
1402 ok(written ==
sizeof(
obuf),
"write file len\n");
1405 ok(readden ==
sizeof(
obuf),
"read file len\n");
1406 ok(
memcmp(
obuf, ibuf, written) == 0,
"content check\n");
1420 DWORD serverThreadId;
1422 DWORD alarmThreadId;
1424 trace(
"test_NamedPipe_2 starting\n");
1475 static const char obuf[] =
"Bit Bucket";
1491 win_skip(
"Named pipes are not implemented\n");
1511 ok(written ==
sizeof(
obuf),
"write file len\n");
1519 "ReadFile from disconnected pipe with bytes waiting\n");
1522 "ReadFile from disconnected pipe with bytes waiting\n");
1525 "DisconnectNamedPipe worked twice\n");
1545 HANDLE piperead, pipewrite;
1558 ok(
CreatePipe(&piperead, &pipewrite, &pipe_attr, 0) != 0,
"CreatePipe failed\n");
1568 ok(written ==
sizeof(
PIPENAME),
"Write to anonymous pipe wrote %ld bytes\n", written);
1569 ok(
ReadFile(piperead,readbuf,
sizeof(readbuf),&
read,
NULL),
"Read from non empty pipe failed\n");
1571 ok(
CloseHandle(pipewrite),
"CloseHandle for the write pipe failed\n");
1572 ok(
CloseHandle(piperead),
"CloseHandle for the read pipe failed\n");
1575 ok(
CreatePipe(&piperead, &pipewrite, &pipe_attr, 0) != 0,
"CreatePipe failed\n");
1577 ok(written ==
sizeof(
PIPENAME),
"Write to anonymous pipe wrote %ld bytes\n", written);
1579 ok(
CloseHandle(pipewrite),
"CloseHandle for the Write Pipe failed\n");
1580 ok(
ReadFile(piperead,readbuf,
sizeof(readbuf),&
read,
NULL),
"Read from broken pipe with pending data failed\n");
1583 ok(
ReadFile(piperead,readbuf,
sizeof(readbuf),&
read,
NULL) == 0,
"Broken pipe not detected\n");
1584 ok(
CloseHandle(piperead),
"CloseHandle for the read pipe failed\n");
1590 ok(
CreatePipe(&piperead, &pipewrite, &pipe_attr, (
size + 24)) != 0,
"CreatePipe failed\n");
1592 ok(written ==
size,
"Write to anonymous pipe wrote %ld bytes\n", written);
1594 ok(
CloseHandle(pipewrite),
"CloseHandle for the Write Pipe failed\n");
1597 ok(
read ==
size,
"Read from anonymous pipe got %ld bytes\n",
read);
1600 ok(
ReadFile(piperead,readbuf,
sizeof(readbuf),&
read,
NULL) == 0,
"Broken pipe not detected\n");
1601 ok(
CloseHandle(piperead),
"CloseHandle for the read pipe failed\n");
1607 ok(
CreatePipe(&piperead, &pipewrite, &pipe_attr, 1) != 0,
"CreatePipe failed\n");
1610 ok(
CloseHandle(pipewrite),
"CloseHandle for the Write Pipe failed\n");
1611 ok(
CloseHandle(piperead),
"CloseHandle for the read pipe failed\n");
1616 static const char testdata[] =
"Hello World";
1630 numbytes = 0xdeadbeef;
1633 ok(numbytes ==
sizeof(
testdata),
"expected sizeof(testdata), got %lu\n", numbytes);
1635 numbytes = 0xdeadbeef;
1638 ok(numbytes ==
sizeof(
testdata),
"expected sizeof(testdata), got %lu\n", numbytes);
1643 numbytes = 0xdeadbeef;
1647 ok(numbytes == 0,
"expected 0, got %lu\n", numbytes);
1649 numbytes = 0xdeadbeef;
1652 ok(numbytes ==
sizeof(
testdata),
"expected sizeof(testdata), got %lu\n", numbytes);
1654 numbytes = 0xdeadbeef;
1658 ok(numbytes ==
sizeof(
testdata),
"expected sizeof(testdata), got %lu\n", numbytes);
1668 ok(!
ret,
"ReadFile unexpectedly succeeded\n");
1671 numbytes = 0xdeadbeef;
1675 ok(numbytes == 0xdeadbeef,
"numbytes = %lu\n", numbytes);
1679 ok(!
ret,
"WriteFile unexpectedly succeeded\n");
1692 numbytes = 0xdeadbeef;
1695 ok(numbytes == 0,
"expected 0, got %lu\n", numbytes);
1700 numbytes = 0xdeadbeef;
1704 ok(numbytes == 0,
"expected 0, got %lu\n", numbytes);
1708 ok(!
ret,
"ReadFile unexpectedly succeeded\n");
1719 ok(!
ret,
"ReadFile unexpectedly succeeded\n");
1724 ok(!
ret,
"WriteFile unexpectedly succeeded\n");
1739 numbytes = 0xdeadbeef;
1742 ok(numbytes ==
sizeof(
testdata),
"expected sizeof(testdata), got %lu\n", numbytes);
1744 numbytes = 0xdeadbeef;
1747 ok(numbytes ==
sizeof(
testdata),
"expected sizeof(testdata), got %lu\n", numbytes);
1752 numbytes = 0xdeadbeef;
1757 ok(numbytes == 0,
"expected 0, got %lu\n", numbytes);
1759 numbytes = 0xdeadbeef;
1762 ok(numbytes ==
sizeof(
testdata),
"expected sizeof(testdata), got %lu\n", numbytes);
1764 numbytes = 0xdeadbeef;
1768 ok(numbytes ==
sizeof(
testdata),
"expected sizeof(testdata), got %lu\n", numbytes);
1778 ok(!
ret,
"ReadFile unexpectedly succeeded\n");
1781 numbytes = 0xdeadbeef;
1785 ok(numbytes == 0xdeadbeef,
"numbytes = %lu\n", numbytes);
1789 ok(!
ret,
"WriteFile unexpectedly succeeded\n");
1802 numbytes = 0xdeadbeef;
1805 ok(numbytes == 0,
"expected 0, got %lu\n", numbytes);
1810 numbytes = 0xdeadbeef;
1814 ok(numbytes == 0,
"expected 0, got %lu\n", numbytes);
1818 ok(!
ret,
"ReadFile unexpectedly succeeded\n");
1829 ok(!
ret,
"ReadFile unexpectedly succeeded\n");
1834 ok(!
ret,
"WriteFile unexpectedly succeeded\n");
1847#define PIPE_NAME "\\\\.\\pipe\\named_pipe_test"
1854 const char message[] =
"Test";
1855 DWORD bytes_read, bytes_written;
1883 ok(
ret,
"GetTokenInformation(TokenPrivileges) failed with %ld\n",
GetLastError());
1967 DWORD dwBytesWritten;
1976 params.token = hClientToken;
1985 "ImpersonateNamedPipeClient should have failed with ERROR_CANNOT_IMPERSONATE instead of %ld\n",
GetLastError());
1999 (*test_func)(0, hToken);
2003 ok(
ret,
"GetTokenInformation(TokenImpersonationLevel) failed with error %ld\n",
GetLastError());
2022 (*test_func)(1, hToken);
2068 all_privs_disabled =
FALSE;
2075 return all_privs_disabled;
2085 ok(
ret,
"GetTokenInformation(TokenStatistics)\n");
2086 if (!
ret)
return -1;
2100 ok(priv_count == 0,
"privilege count should have been 0 instead of %ld\n", priv_count);
2104 ok(priv_count > 0,
"privilege count should now be > 0 instead of 0\n");
2108 ok(0,
"shouldn't happen\n");
2124 ok(0,
"shouldn't happen\n");
2139 ok(0,
"shouldn't happen\n");
2155 ok(0,
"shouldn't happen\n");
2170 ok(0,
"shouldn't happen\n");
2182 ok(priv_count == 0,
"privilege count should have been 0 instead of %ld\n", priv_count);
2186 ok(priv_count > 0,
"privilege count should now be > 0 instead of 0\n");
2190 ok(0,
"shouldn't happen\n");
2207 ok(0,
"shouldn't happen\n");
2223 ok(0,
"shouldn't happen\n");
2233 if( !pDuplicateTokenEx ) {
2234 skip(
"DuplicateTokenEx not found\n");
2241 skip(
"couldn't open process token, skipping impersonation tests\n");
2247 skip(
"token didn't have any privileges or they were all disabled. token not suitable for impersonation tests\n");
2301 ok(pipe !=
NULL,
"pipe NULL\n");
2386 ok(
ret ==
FALSE,
"ConnectNamedPipe succeeded\n");
2393 numbytes = 0xdeadbeef;
2395 ok(
ret ==
TRUE,
"GetOverlappedResult failed\n");
2396 ok(numbytes == 0,
"expected 0, got %lu\n", numbytes);
2415 ok(
ret ==
FALSE,
"ConnectNamedPipe succeeded\n");
2429 DWORD state, instances, maxCollectionCount, collectDataTimeout;
2448 ok(instances == 1,
"expected 1 instances, got %ld\n", instances);
2458 "expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
2464 "expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
2478 "expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
2499 ok(instances == 1,
"expected 1 instances, got %ld\n", instances);
2589 char write_buf[1024];
2610 ok(
ret ==
FALSE,
"ConnectNamedPipe succeeded\n");
2614 ok(wait ==
WAIT_TIMEOUT,
"WaitForSingleObject returned %lx\n", wait);
2621 ok(wait ==
WAIT_OBJECT_0,
"WaitForSingleObject returned %lx\n", wait);
2646 memset(write_buf, 0xaa,
sizeof(write_buf));
2647 for (
i=0;
i<256;
i++)
2675 for (
i=0;
i<256;
i++)
2684 "WaitForSingleObject returned %lx\n", wait);
2692 num_bytes = 0xdeadbeef;
2695 ok(!
ret,
"ReadFile should fail\n");
2697 ok(num_bytes == 0,
"expected 0, got %lu\n", num_bytes);
2704 num_bytes = 0xdeadbeef;
2707 ok(!
ret,
"ReadFile should fail\n");
2709 ok(num_bytes == 0,
"bytes %lu\n", num_bytes);
2714 ok(wait ==
WAIT_TIMEOUT,
"WaitForSingleObject returned %lx\n", wait);
2716 num_bytes = 0xdeadbeef;
2718 ok(
ret,
"WriteFile failed\n");
2719 ok(num_bytes == 1,
"bytes %lu\n", num_bytes);
2722 ok(wait ==
WAIT_OBJECT_0,
"WaitForSingleObject returned %lx\n", wait);
2724 ok(num_bytes == 1,
"bytes %lu\n", num_bytes);
2729 num_bytes = 0xdeadbeef;
2731 ok(
ret,
"ReadFile failed\n");
2732 ok(num_bytes == 1,
"bytes %lu\n", num_bytes);
2739#define test_peek_pipe(a,b,c,d) _test_peek_pipe(__LINE__,a,b,c,d)
2742 DWORD bytes_read = 0xdeadbeed,
avail = 0xdeadbeef,
left = 0xdeadbeed;
2751 ok_(__FILE__,
line)(bytes_read == expected_read,
"bytes_read = %lu, expected %lu\n", bytes_read, expected_read);
2752 ok_(__FILE__,
line)(
avail == expected_avail,
"avail = %lu, expected %lu\n",
avail, expected_avail);
2753 ok_(__FILE__,
line)(
left == expected_message_length - expected_read,
"left = %ld, expected %ld\n",
2754 left, expected_message_length - expected_read);
2759 "io.Information = %Iu\n",
io.Information);
2762 ok_(__FILE__,
line)(peek_buf->
MessageLength == expected_message_length,
"MessageLength = %lu, expected %lu\n",
2769 ok_(__FILE__,
line)(bytes_read == 1,
"bytes_read = %lu, expected %lu\n", bytes_read, expected_read);
2770 ok_(__FILE__,
line)(
avail == expected_avail,
"avail = %lu, expected %lu\n",
avail, expected_avail);
2771 ok_(__FILE__,
line)(
left == expected_message_length-1,
"left = %ld, expected %ld\n",
left, expected_message_length-1);
2775#define overlapped_read_sync(a,b,c,d,e) _overlapped_read_sync(__LINE__,a,b,c,d,e)
2805#define overlapped_read_async(a,b,c,d) _overlapped_read_async(__LINE__,a,b,c,d)
2820#define overlapped_write_sync(a,b,c) _overlapped_write_sync(__LINE__,a,b,c)
2823 DWORD written_bytes = 0xdeadbeef;
2831 ok_(__FILE__,
line)(written_bytes ==
size,
"WriteFile returned written_bytes = %lu\n", written_bytes);
2833 written_bytes = 0xdeadbeef;
2836 ok_(__FILE__,
line)(written_bytes ==
size,
"GetOverlappedResult returned written_bytes %lu expected %lu\n", written_bytes,
size);
2841#define overlapped_write_async(a,b,c,d) _overlapped_write_async(__LINE__,a,b,c,d)
2844 DWORD written_bytes = 0xdeadbeef;
2851 ok_(__FILE__,
line)(!written_bytes,
"written_bytes = %lu\n", written_bytes);
2856#define test_flush_sync(a) _test_flush_sync(__LINE__,a)
2878 ok(!
res,
"FlushFileBuffers should have failed\n");
2885#define test_flush_async(a,b) _test_flush_async(__LINE__,a,b)
2900#define test_flush_done(a) _test_flush_done(__LINE__,a)
2908#define test_overlapped_result(a,b,c,d) _test_overlapped_result(__LINE__,a,b,c,d)
2925#define test_overlapped_failure(a,b,c) _test_overlapped_failure(__LINE__,a,b,c)
2940#define cancel_overlapped(a,b) _cancel_overlapped(__LINE__,a,b)
2953 OVERLAPPED read_overlapped, read_overlapped2, write_overlapped, write_overlapped2;
2972 test_peek_pipe(
reader, 3000 + (msg_mode ? 0 : buf_size), 3000 + buf_size, msg_mode ? 3000 : 0);
2979 msg_mode ? 3000 : 0);
2986 msg_mode ? 3000 : 0);
3078 win_skip(
"CancelIoEx not available\n");
3093 res = pCancelIoEx(
reader, &read_overlapped2);
3095 res = pCancelIoEx(
reader, &read_overlapped2);
3096 ok(!
res,
"CancelIOEx succeeded unexpectedly\n");
3098 "In CancelIoEx failure, expected ERROR_NOT_FOUND, got %ld\n",
GetLastError());
3105 buf_size + 2001, msg_mode ? buf_size + 2000 : 0);
3116 buf_size + 2001, msg_mode ? buf_size + 2000 : 0);
3134#define overlapped_transact(a,b,c,d,e,f) _overlapped_transact(__LINE__,a,b,c,d,e,f)
3147#define overlapped_transact_failure(a,b,c,d,e,f) _overlapped_transact_failure(__LINE__,a,b,c,d,e,f)
3157 ok_(__FILE__,
line)(!
res,
"TransactNamedPipe succeeded\n");
3166 "TransactNamedPipe returned error %lu, expected %lu\n",
3197 return info.hProcess;
3245 trace(
"testing %s, %s server->client writes...\n",
3246 msg_mode ?
"message mode" :
"byte mode", msg_read_mode ?
"message read" :
"byte read");
3248 trace(
"testing %s, %s client->server writes...\n",
3249 msg_mode ?
"message mode" :
"byte mode", msg_read_mode ?
"message read" :
"byte read");
3367 if (!pCancelIoEx)
return;
3394 trace(
"testing server->client transaction...\n");
3400 trace(
"testing client->server transaction...\n");
3431 ret = pGetNamedPipeClientProcessId(pipe, &
pid);
3436 ret = pGetNamedPipeServerProcessId(pipe, &
pid);
3454 return info.hProcess;
3465#if defined(__REACTOS__) && DLL_EXPORT_VERSION >= 0x600
3467 if (
is_reactos() || !pGetNamedPipeClientProcessId)
3469 if (!pGetNamedPipeClientProcessId)
3472 win_skip(
"GetNamedPipeClientProcessId not available\n");
3480 ok(!
ret,
"success\n");
3495 ok(!
ret,
"success\n");
3589 ret = pGetNamedPipeClientSessionId(pipe, &
id);
3594 ret = pGetNamedPipeServerSessionId(pipe, &
id);
3596 ok(
id == server_id,
"got %04lx expected %04lx\n",
id, server_id);
3608#if defined(__REACTOS__) && DLL_EXPORT_VERSION >= 0x600
3610 if (
is_reactos() || !pGetNamedPipeClientSessionId)
3612 if (!pGetNamedPipeClientSessionId)
3615 win_skip(
"GetNamedPipeClientSessionId not available\n");
3627 ok(!
ret,
"success\n");
3631 ret = pGetNamedPipeClientSessionId(
server, &
id);
3636 ret = pGetNamedPipeClientSessionId(
client, &
id);
3642 ok(!
ret,
"success\n");
3646 ret = pGetNamedPipeServerSessionId(
client, &
id);
3651 ret = pGetNamedPipeServerSessionId(
server, &
id);
3659 ret = pGetNamedPipeClientSessionId(
server, &
id);
3664 ret = pGetNamedPipeServerSessionId(
server, &
id);
3674 ret = pGetNamedPipeClientSessionId(
server, &
id);
3679 ret = pGetNamedPipeServerSessionId(
server, &
id);
3684 ret = pGetNamedPipeClientSessionId(
client, &
id);
3689 ret = pGetNamedPipeServerSessionId(
client, &
id);
3700 ret = pGetNamedPipeClientSessionId(
client, &
id);
3705 ret = pGetNamedPipeServerSessionId(
client, &
id);
3733 win_skip(
"Skipping multiple instance tests on too old Windows\n");
3750 memset(&ov, 0,
sizeof(ov));
3755 memset(&ov, 0,
sizeof(ov));
3767 memset(&ov, 0,
sizeof(ov));
3772 memset(&ov, 0,
sizeof(ov));
3784 memset(&ov, 0,
sizeof(ov));
3798 memset(&ov, 0,
sizeof(ov));
3803 memset(&ov, 0,
sizeof(ov));
3813 memset(&ov, 0,
sizeof(ov));
3825 memset(&ov, 0,
sizeof(ov));
3830 memset(&ov, 0,
sizeof(ov));
3842 memset(&ov, 0,
sizeof(ov));
3923 memset(&ov, 0,
sizeof(ov));
3943 char readbuf[32768];
3944 static const char teststring[] =
"bits";
3957 memset(&ol, 0,
sizeof(ol));
3960 ok(
ReadFile(piperead, readbuf,
sizeof(readbuf), &
read, &ol) ==
FALSE,
"ReadFile should fail\n");
3966 ok(
WriteFile(pipewrite, teststring,
sizeof(teststring), &
write,
NULL),
"WriteFile should succeed\n");
3967 ok(
ReadFile(piperead, readbuf,
sizeof(readbuf), &
read, &ol),
"ReadFile should succeed\n");
3968 ok(
read ==
write,
"read/write bytes should match\n");
3970 ok(
CloseHandle(pipewrite),
"CloseHandle for the write pipe failed\n");
3971 ok(
CloseHandle(piperead),
"CloseHandle for the read pipe failed\n");
3985 memset(&ol, 0,
sizeof(ol));
3987 memset(&ol2, 0,
sizeof(ol2));
3992 ok(
WriteFile(pipewrite, readbuf, 513, &
write, &ol),
"WriteFile should succeed\n");
3996 ok(
write <
sizeof(readbuf),
"WriteFile should fail to write the whole buffer\n");
3997 ok(
write == 0,
"WriteFile doesn't do partial writes here\n");
4003 ok(
ReadFile(piperead, readbuf,
sizeof(readbuf), &
read, &ol2) ==
FALSE,
"ReadFile should fail\n");
4005 ok(
WriteFile(pipewrite, teststring,
sizeof(teststring), &
write, &ol),
"WriteFile should succeed\n");
4008 ok(
read ==
sizeof(teststring),
"got %ld\n",
read);
4014 ok(
ReadFile(piperead, readbuf,
sizeof(readbuf), &
read, &ol2) ==
FALSE,
"ReadFile should fail\n");
4016 ok(
WriteFile(pipewrite, readbuf, 513, &
write, &ol),
"WriteFile should succeed\n");
4017 ok(
write == 513,
"got %ld, write should be %d\n",
write, 513);
4019 ok(
read == 513,
"got %ld, read should be %d\n",
read, 513);
4027 ok(
WriteFile(pipewrite, readbuf, 513, &
write, &ol),
"WriteFile should succeed\n");
4028 ok(
write == 513,
"got %ld, write should be %d\n",
write, 513);
4030 ok(
read == 1,
"got %ld, read should be %d\n",
read, 1);
4035 ok(
ReadFile(piperead, readbuf,
sizeof(readbuf), &
read, &ol2),
"ReadFile should succeed\n");
4036 ok(
read == 512,
"got %ld, write should be %d\n",
write, 512);
4044 ok(
WriteFile(pipewrite, readbuf, 514, &
write, &ol),
"WriteFile should succeed\n");
4054 ok(
read == 0,
"got %ld, read should be %d\n",
read, 1);
4060 ok(
read == 1,
"got %ld, read should be %d\n",
read, 1);
4067 ok(
WriteFile(pipewrite, readbuf, 512, &
write, &ol),
"WriteFile should succeed\n");
4068 ok(
write == 512,
"WriteFile should write the whole buffer\n");
4074 ok(
CloseHandle(pipewrite),
"CloseHandle for the write pipe failed\n");
4075 ok(
CloseHandle(piperead),
"CloseHandle for the read pipe failed\n");
4087 memset(&ol, 0,
sizeof(ol));
4113 ok(
CloseHandle(pipewrite),
"CloseHandle for the write pipe failed\n");
4124 if (!pGetOverlappedResultEx)
4126 win_skip(
"GetOverlappedResultEx() is not available\n");
4139 ok(!
ret,
"expected failure\n");
4144 ret = pGetOverlappedResultEx(
client, &ovl, &ret_size, 0,
TRUE);
4145 ok(!
ret,
"expected failure\n");
4150 ret = pGetOverlappedResultEx(
client, &ovl, &ret_size, 10,
FALSE);
4151 ok(!
ret,
"expected failure\n");
4156 ret = pGetOverlappedResultEx(
client, &ovl, &ret_size, 10,
TRUE);
4157 ok(!
ret,
"expected failure\n");
4184 ok(!
ret,
"expected failure\n");
4211 ok(!
ret,
"wait timed out\n");
4218 ok(!
ret,
"expected failure\n");
4221 ok(
key == 123,
"got key %Iu\n",
key);
4235 ok(!
ret,
"expected failure\n");
4247 memset(&ov, 0,
sizeof(ov));
4251 ok(!
ret,
"expected failure\n");
4269 res = pCancelSynchronousIo((
HANDLE)0xdeadbeef);
4270 ok(!
res,
"CancelSynchronousIo succeeded unexpectedly\n");
4272 "In CancelSynchronousIo failure, expected ERROR_INVALID_HANDLE, got %ld\n",
GetLastError());
4276 ok(!
res,
"CancelSynchronousIo succeeded unexpectedly\n");
4278 "In CancelSynchronousIo failure, expected ERROR_NOT_FOUND, got %ld\n",
GetLastError());
4293 "In CancelSynchronousIo failure, expected 0xdeadbeef got %ld\n",
GetLastError());
4295 ok(wait ==
WAIT_OBJECT_0,
"WaitForSingleObject returned %lx\n", wait);
4310 ok(!
res,
"CancelSynchronousIo succeeded unexpectedly\n");
4312 "In CancelSynchronousIo failure, expected ERROR_NOT_FOUND, got %ld\n",
GetLastError());
4332 pGetNamedPipeClientProcessId = (
void *)
GetProcAddress(
hmod,
"GetNamedPipeClientProcessId");
4333 pGetNamedPipeServerProcessId = (
void *)
GetProcAddress(
hmod,
"GetNamedPipeServerProcessId");
4334 pGetNamedPipeClientSessionId = (
void *)
GetProcAddress(
hmod,
"GetNamedPipeClientSessionId");
4335 pGetNamedPipeServerSessionId = (
void *)
GetProcAddress(
hmod,
"GetNamedPipeServerSessionId");
4403 skip(
"These next tests crash or hang on ReactOS and Windows Server 2003.\n");
#define ERROR_INSUFFICIENT_BUFFER
#define ERROR_INVALID_FUNCTION
BOOL WINAPI CancelIo(IN HANDLE hFile)
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
BOOL WINAPI SetThreadToken(IN PHANDLE ThreadHandle OPTIONAL, IN HANDLE TokenHandle)
BOOL WINAPI ImpersonateNamedPipeClient(HANDLE hNamedPipe)
BOOL WINAPI OpenThreadToken(HANDLE ThreadHandle, DWORD DesiredAccess, BOOL OpenAsSelf, HANDLE *TokenHandle)
#define ERROR_CALL_NOT_IMPLEMENTED
#define ERROR_INVALID_PARAMETER
struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES
#define ReadFile(a, b, c, d, e)
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define GetCurrentProcess()
#define HeapFree(x, y, z)
#define ERROR_INVALID_HANDLE
#define ERROR_ACCESS_DENIED
#define ERROR_INVALID_NAME
BOOL WINAPI FlushFileBuffers(IN HANDLE hFile)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
BOOL WINAPI ReadFileEx(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead OPTIONAL, IN LPOVERLAPPED lpOverlapped, IN LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
BOOL WINAPI WriteFileEx(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, IN LPOVERLAPPED lpOverlapped, IN LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
VOID WINAPI ExitProcess(IN UINT uExitCode)
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
BOOL WINAPI ProcessIdToSessionId(IN DWORD dwProcessId, OUT PDWORD pSessionId)
DWORD WINAPI QueueUserAPC(IN PAPCFUNC pfnAPC, IN HANDLE hThread, IN ULONG_PTR dwData)
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 RevertToSelf(void)
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl sscanf(const char *, const char *,...) __WINE_CRT_SCANF_ATTR(2
_ACRTIMP size_t __cdecl strlen(const char *)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
GLdouble GLdouble GLdouble r
GLenum const GLfloat * params
GLenum GLuint GLenum GLsizei const GLchar * buf
GLboolean GLboolean GLboolean GLboolean a
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
#define PROCESS_DUP_HANDLE
HANDLE WINAPI CreateIoCompletionPort(IN HANDLE FileHandle, IN HANDLE ExistingCompletionPort, IN ULONG_PTR CompletionKey, IN DWORD NumberOfConcurrentThreads)
BOOL WINAPI GetOverlappedResult(IN HANDLE hFile, IN LPOVERLAPPED lpOverlapped, OUT LPDWORD lpNumberOfBytesTransferred, IN BOOL bWait)
BOOL WINAPI GetQueuedCompletionStatus(IN HANDLE CompletionHandle, IN LPDWORD lpNumberOfBytesTransferred, OUT PULONG_PTR lpCompletionKey, OUT LPOVERLAPPED *lpOverlapped, IN DWORD dwMilliseconds)
static void _overlapped_read_sync(unsigned line, HANDLE reader, void *buf, DWORD buf_size, DWORD expected_result, BOOL partial_read)
static DWORD CALLBACK synchronousIoThreadMain2(void *arg)
static void _test_flush_sync(unsigned line, HANDLE pipe)
static void _test_flush_done(unsigned line, HANDLE thread)
static void test_multiple_instances(void)
#define overlapped_transact_failure(a, b, c, d, e, f)
#define overlapped_write_sync(a, b, c)
static void CALLBACK user_apc(ULONG_PTR param)
static void exerciseServer(const char *pipename, HANDLE serverThread)
static HANDLE alarm_event
static HANDLE async_wait_pipe(void)
static BOOL are_all_privileges_disabled(HANDLE hToken)
static void test_NamedPipeHandleState(void)
#define test_peek_pipe(a, b, c, d)
static int test_DisconnectNamedPipe(void)
static void _test_pipe_info(unsigned line, HANDLE pipe, DWORD ex_flags, DWORD ex_out_buf_size, DWORD ex_in_buf_size, DWORD ex_max_instances)
static void _test_overlapped_result(unsigned line, HANDLE handle, OVERLAPPED *overlapped, DWORD expected_result, BOOL partial_read)
#define test_flush_async(a, b)
static LPOVERLAPPED completion_lpoverlapped
#define cancel_overlapped(a, b)
static HANDLE create_check_id_process(const char *verb, DWORD id)
static void test_ReadFile(void)
static ULONG *static ULONG *static ULONG *static ULONG *static OVERLAPPED DWORD BOOL
static void test_CloseHandle(void)
static void _overlapped_transact(unsigned line, HANDLE caller, void *write_buf, DWORD write_size, void *read_buf, DWORD read_size, OVERLAPPED *overlapped)
#define overlapped_transact(a, b, c, d, e, f)
static void _overlapped_transact_failure(unsigned line, HANDLE caller, void *write_buf, DWORD write_size, void *read_buf, DWORD read_size, DWORD expected_error)
static DWORD CALLBACK overlapped_server(LPVOID arg)
static void test_no_sqos(int call_index, HANDLE hToken)
static HANDLE make_impersonation_token(DWORD Access, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
static void test_GetNamedPipeInfo(void)
static DWORD CALLBACK serverThreadMain4(LPVOID arg)
static void test_NamedPipe_2(void)
static void test_no_sqos_no_token(int call_index, HANDLE hToken)
static void child_process_exit_process_async(DWORD parent_pid, HANDLE parent_pipe)
static LPSECURITY_ATTRIBUTES
static void test_readfileex_pending(void)
static HANDLE create_writepipe_process(HANDLE pipe)
static HANDLE _test_flush_async(unsigned line, HANDLE pipe, DWORD error)
static void child_process_check_pid(DWORD server_pid)
static DWORD CALLBACK serverThreadMain2(LPVOID arg)
static void test_namedpipe_process_id(void)
static void test_dynamic_context_no_token(int call_index, HANDLE hToken)
static void test_nowait(DWORD pipe_type)
static void test_GetOverlappedResultEx(void)
static LPOVERLAPPED lpOverlapped
#define test_file_access(a, b)
static void test_TransactNamedPipe(void)
static DWORD CALLBACK serverThreadMain3(LPVOID arg)
static void test_CancelSynchronousIo(void)
static void _test_file_access(unsigned line, HANDLE handle, DWORD expected_access)
static void test_dynamic_context(int call_index, HANDLE hToken)
static void test_dynamic_context_revert(int call_index, HANDLE hToken)
static void child_process_check_session_id(DWORD server_id)
#define overlapped_read_async(a, b, c, d)
static void child_process_write_pipe(HANDLE pipe)
static void _cancel_overlapped(unsigned line, HANDLE handle, OVERLAPPED *overlapped)
static DWORD CALLBACK rpcThreadMain(LPVOID arg)
static DWORD CALLBACK alarmThreadMain(LPVOID arg)
static void _test_overlapped_failure(unsigned line, HANDLE handle, OVERLAPPED *overlapped, DWORD error)
#define test_pipe_info(a, b, c, d, e)
static void _test_peek_pipe(unsigned line, HANDLE pipe, DWORD expected_read, DWORD expected_avail, DWORD expected_message_length)
static DWORD completion_num_bytes
static DWORD get_privilege_count(HANDLE hToken)
static void _test_not_signaled(unsigned line, HANDLE handle)
static void test_static_context_revert(int call_index, HANDLE hToken)
static int completion_called
static DWORD CALLBACK serverThreadMain1(LPVOID arg)
static SECURITY_IMPERSONATION_LEVEL
#define test_flush_sync(a)
static DWORD CALLBACK synchronousIoThreadMain(void *arg)
static void test_ImpersonateNamedPipeClient(HANDLE hClientToken, DWORD security_flags, BOOL revert, void(*test_func)(int, HANDLE))
static void test_CreateNamedPipe_instances_must_match(void)
static HANDLE create_overlapped_server(OVERLAPPED *overlapped)
static void test_overlapped_error(void)
#define test_overlapped_failure(a, b, c)
static void _overlapped_write_async(unsigned line, HANDLE writer, void *buf, DWORD size, OVERLAPPED *overlapped)
static void test_CreatePipe(void)
static void test_no_sqos_revert(int call_index, HANDLE hToken)
static void _test_signaled(unsigned line, HANDLE handle)
static DWORD CALLBACK serverThreadMain5(LPVOID arg)
static void test_overlapped(void)
static void test_exit_process_async(void)
#define test_flush_done(a)
static DWORD CALLBACK named_pipe_client_func(LPVOID p)
#define overlapped_read_sync(a, b, c, d, e)
static BOOL RpcReadFile(HANDLE hFile, LPVOID buffer, DWORD bytesToRead, LPDWORD bytesRead, LPOVERLAPPED overlapped)
static void _overlapped_read_async(unsigned line, HANDLE reader, void *buf, DWORD buf_size, OVERLAPPED *overlapped)
static void test_namedpipe_session_id(void)
static void test_wait_pipe(void)
#define test_not_signaled(h)
static DWORD completion_errorcode
static void _overlapped_write_sync(unsigned line, HANDLE writer, void *buf, DWORD size)
static DWORD expected_flush_error
#define overlapped_write_async(a, b, c, d)
static void test_blocking_rw(HANDLE writer, HANDLE reader, DWORD buf_size, BOOL msg_mode, BOOL msg_read)
#define test_overlapped_result(a, b, c, d)
static void test_CreateNamedPipe(int pipemode)
static DWORD CALLBACK flush_proc(HANDLE pipe)
static void test_static_context(int call_index, HANDLE hToken)
static void create_overlapped_pipe(DWORD mode, HANDLE *client, HANDLE *server)
static void test_overlapped_transport(BOOL msg_mode, BOOL msg_read_mode)
static void test_impersonation(void)
static DWORD WINAPI wait_pipe_proc(void *arg)
enum _SECURITY_IMPERSONATION_LEVEL SECURITY_IMPERSONATION_LEVEL
struct task_struct * current
#define FILE_FLAG_OVERLAPPED
#define ERROR_FILE_NOT_FOUND
static PEXPLICIT_ACCESSW *static HMODULE hmod
const char * expected_result
static PROCESS_INFORMATION pi
static void test_func(IDispatchEx *obj)
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK io
static void test_transact(void)
unsigned __int3264 UINT_PTR
#define FILE_PIPE_SERVER_END
BOOL WINAPI GetNamedPipeInfo(HANDLE hNamedPipe, LPDWORD lpFlags, LPDWORD lpOutBufferSize, LPDWORD lpInBufferSize, LPDWORD lpMaxInstances)
BOOL WINAPI PeekNamedPipe(HANDLE hNamedPipe, LPVOID lpBuffer, DWORD nBufferSize, LPDWORD lpBytesRead, LPDWORD lpTotalBytesAvail, LPDWORD lpBytesLeftThisMessage)
BOOL WINAPI ConnectNamedPipe(IN HANDLE hNamedPipe, IN LPOVERLAPPED lpOverlapped)
BOOL WINAPI WaitNamedPipeA(LPCSTR lpNamedPipeName, DWORD nTimeOut)
BOOL WINAPI DisconnectNamedPipe(HANDLE hNamedPipe)
HANDLE WINAPI CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
BOOL WINAPI TransactNamedPipe(IN HANDLE hNamedPipe, IN LPVOID lpInBuffer, IN DWORD nInBufferSize, OUT LPVOID lpOutBuffer, IN DWORD nOutBufferSize, OUT LPDWORD lpBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
BOOL WINAPI SetNamedPipeHandleState(HANDLE hNamedPipe, LPDWORD lpMode, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout)
BOOL WINAPI GetNamedPipeHandleStateA(HANDLE hNamedPipe, LPDWORD lpState, LPDWORD lpCurInstances, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPSTR lpUserName, DWORD nMaxUserNameSize)
BOOL WINAPI CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize)
#define FILE_READ_ATTRIBUTES
NTSYSAPI NTSTATUS NTAPI NtQueryInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, OUT PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
#define FILE_WRITE_ATTRIBUTES
NTSYSAPI NTSTATUS NTAPI NtFsControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK ULONG ULONG ULONG ULONG ULONG read_mode
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK ULONG ULONG ULONG ULONG pipe_type
static BOOL read_bytes(parse_buffer *buf, LPVOID data, DWORD size)
int winetest_get_mainargs(char ***pargv)
#define wait_child_process
#define _WIN32_WINNT_WS03
#define FileAccessInformation
#define STATUS_BUFFER_OVERFLOW
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE completion_routine
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED * overlapped
LPVOID lpSecurityDescriptor
DWORD WINAPI SleepEx(IN DWORD dwMilliseconds, IN BOOL bAlertable)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
DWORD WINAPI WaitForSingleObjectEx(IN HANDLE hHandle, IN DWORD dwMilliseconds, IN BOOL bAlertable)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
#define FIELD_OFFSET(t, f)
static rfbScreenInfoPtr server
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
#define success(from, fromstr, to, tostr)
#define PIPE_ACCESS_INBOUND
#define PIPE_READMODE_BYTE
DWORD WINAPI GetLastError(void)
#define NMPWAIT_WAIT_FOREVER
HANDLE WINAPI GetCurrentThread(void)
#define NMPWAIT_USE_DEFAULT_WAIT
#define PIPE_ACCESS_DUPLEX
#define WAIT_IO_COMPLETION
#define SECURITY_IMPERSONATION
DWORD WINAPI GetCurrentProcessId(void)
#define PIPE_READMODE_MESSAGE
#define SECURITY_SQOS_PRESENT
#define PIPE_ACCESS_OUTBOUND
#define PIPE_TYPE_MESSAGE
#define SECURITY_CONTEXT_TRACKING
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
#define ERROR_SEM_TIMEOUT
#define ERROR_IO_INCOMPLETE
#define ERROR_PATH_NOT_FOUND
#define ERROR_BROKEN_PIPE
#define ERROR_CANNOT_IMPERSONATE
#define ERROR_PIPE_NOT_CONNECTED
#define ERROR_PIPE_LISTENING
#define ERROR_OPERATION_ABORTED
#define ERROR_PIPE_CONNECTED
#define FILE_READ_PROPERTIES
#define FILE_WRITE_PROPERTIES
static const WCHAR userName[]
#define DUPLICATE_SAME_ACCESS
#define DUPLICATE_CLOSE_SOURCE
_Out_ PBOOLEAN _Out_ PBOOLEAN _Out_ PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET * Privileges
#define TOKEN_ADJUST_PRIVILEGES
@ TokenImpersonationLevel
#define TOKEN_IMPERSONATE
#define SE_PRIVILEGE_ENABLED