25#define WIN32_NO_STATUS
32#define PIPENAME "\\\\.\\PiPe\\tests_pipe.c"
33#define PIPENAME_SPECIAL "\\\\.\\PiPe\\tests->pipe.c"
35#define NB_SERVER_LOOPS 8
116#define test_not_signaled(h) _test_not_signaled(__LINE__,h)
124#define test_signaled(h) _test_signaled(__LINE__,h)
131#define test_pipe_info(a,b,c,d,e) _test_pipe_info(__LINE__,a,b,c,d,e)
134 DWORD flags = 0xdeadbeef, out_buf_size = 0xdeadbeef, in_buf_size = 0xdeadbeef, max_instances = 0xdeadbeef;
138 ok_(__FILE__,
line)(
res,
"GetNamedPipeInfo failed: %x\n",
res);
139 ok_(__FILE__,
line)(
flags == ex_flags,
"flags = %x, expected %x\n",
flags, ex_flags);
140 ok_(__FILE__,
line)(out_buf_size == ex_out_buf_size,
"out_buf_size = %x, expected %u\n", out_buf_size, ex_out_buf_size);
141 ok_(__FILE__,
line)(in_buf_size == ex_in_buf_size,
"in_buf_size = %x, expected %u\n", in_buf_size, ex_in_buf_size);
142 ok_(__FILE__,
line)(max_instances == ex_max_instances,
"max_instances = %x, expected %u\n", max_instances, ex_max_instances);
149 static const char obuf[] =
"Bit Bucket";
150 static const char obuf2[] =
"More bits";
151 char ibuf[32], *
pbuf;
160 trace(
"test_CreateNamedPipe starting in byte mode\n");
162 trace(
"test_CreateNamedPipe starting in message mode\n");
166 ok(
ret == 0,
"WaitNamedPipe returned %d for nonexistent pipe\n",
ret);
177 "CreateNamedPipe should fail if name doesn't start with \\\\.\\pipe\n");
189 "CreateNamedPipe should fail with PIPE_TYPE_BYTE | PIPE_READMODE_MESSAGE\n");
196 "CreateNamedPipe should fail if name is NULL\n");
201 "connecting to nonexistent named pipe should fail with ERROR_FILE_NOT_FOUND\n");
240 memset(ibuf, 0,
sizeof(ibuf));
242 ok(written ==
sizeof(
obuf),
"write file len\n");
244 ok(readden ==
sizeof(
obuf),
"read got %d bytes\n", readden);
245 ok(
memcmp(
obuf, ibuf, written) == 0,
"content check\n");
247 memset(ibuf, 0,
sizeof(ibuf));
249 ok(written ==
sizeof(obuf2),
"write file len\n");
251 ok(readden ==
sizeof(obuf2),
"read got %d bytes\n", readden);
252 ok(
memcmp(obuf2, ibuf, written) == 0,
"content check\n");
255 memset(ibuf, 0,
sizeof(ibuf));
257 ok(written ==
sizeof(
obuf),
"write file len 1\n");
261 ok(
left == 0,
"peek 1 got %d bytes left\n",
left);
265 ok(readden ==
sizeof(
obuf),
"read 1 got %d bytes\n", readden);
266 ok(
memcmp(
obuf, ibuf, written) == 0,
"content 1 check\n");
268 memset(ibuf, 0,
sizeof(ibuf));
270 ok(written ==
sizeof(obuf2),
"write file len 2\n");
272 ok(
avail ==
sizeof(obuf2),
"peek 2 got %d bytes\n",
avail);
274 ok(
left == 0,
"peek 2 got %d bytes left\n",
left);
276 ok(
left ==
sizeof(obuf2),
"peek 2 got %d bytes left\n",
left);
278 ok(
avail ==
sizeof(obuf2),
"peek 2 got %d bytes\n",
avail);
280 ok(
left == 0,
"peek 2 got %d bytes left\n",
left);
282 ok(
left ==
sizeof(obuf2),
"peek 2 got %d bytes left\n",
left);
284 ok(readden ==
sizeof(obuf2),
"read 2 got %d bytes\n", readden);
285 ok(
memcmp(obuf2, ibuf, written) == 0,
"content 2 check\n");
288 memset(ibuf, 0,
sizeof(ibuf));
290 ok(written ==
sizeof(obuf2),
"write file len\n");
292 ok(readden == 4,
"peek got %d bytes\n", readden);
293 ok(
avail ==
sizeof(obuf2),
"peek got %d bytes available\n",
avail);
295 ok(
left == -4,
"peek got %d bytes left\n",
left);
297 ok(
left ==
sizeof(obuf2)-4,
"peek got %d bytes left\n",
left);
299 ok(readden == 4,
"read got %d bytes\n", readden);
301 ok(readden ==
sizeof(obuf2) - 4,
"read got %d bytes\n", readden);
302 ok(
memcmp(obuf2, ibuf, written) == 0,
"content check\n");
304 memset(ibuf, 0,
sizeof(ibuf));
306 ok(written ==
sizeof(
obuf),
"write file len\n");
308 ok(readden == 4,
"peek got %d bytes\n", readden);
312 ok(
left == -4,
"peek got %d bytes left\n",
left);
322 ok(readden == 4,
"read got %d bytes\n", readden);
324 ok(readden ==
sizeof(
obuf) - 4,
"read got %d bytes\n", readden);
325 ok(
memcmp(
obuf, ibuf, written) == 0,
"content check\n");
328 memset(ibuf, 0,
sizeof(ibuf));
330 ok(written ==
sizeof(obuf2),
"write file len\n");
334 ok(readden == 4,
"read got %d bytes\n", readden);
342 ok(readden == 4,
"read got %d bytes\n", readden);
347 ok(readden == 4,
"read got %d bytes\n", readden);
349 ok(readden ==
sizeof(obuf2) - 8,
"read got %d bytes\n", readden);
350 ok(
memcmp(obuf2, ibuf, written) == 0,
"content check\n");
353 memset(ibuf, 0,
sizeof(ibuf));
355 ok(written ==
sizeof(
obuf),
"write file len 3a\n");
357 ok(written ==
sizeof(obuf2),
"write file len 3b\n");
359 ok(readden == 4,
"peek3 got %d bytes\n", readden);
361 ok(
left == -4,
"peek3 got %d bytes left\n",
left);
364 ok(
avail ==
sizeof(
obuf) +
sizeof(obuf2),
"peek3 got %d bytes available\n",
avail);
367 ok(readden ==
sizeof(
obuf) +
sizeof(obuf2),
"peek3 got %d bytes\n", readden);
372 ok(readden ==
sizeof(
obuf),
"peek3 got %d bytes\n", readden);
373 ok(
left == 0,
"peek3 got %d bytes left\n",
left);
375 ok(
avail ==
sizeof(
obuf) +
sizeof(obuf2),
"peek3 got %d bytes available\n",
avail);
380 ok(
memcmp(obuf2,
pbuf,
sizeof(obuf2)) == 0,
"pipe content 3b check\n");
383 ok(readden ==
sizeof(
obuf) +
sizeof(obuf2),
"read 3 got %d bytes\n", readden);
387 ok(
memcmp(obuf2,
pbuf,
sizeof(obuf2)) == 0,
"content 3b check\n");
390 memset(ibuf, 0,
sizeof(ibuf));
392 ok(written ==
sizeof(
obuf),
"write file len 4a\n");
394 ok(written ==
sizeof(obuf2),
"write file len 4b\n");
396 ok(readden == 4,
"peek3 got %d bytes\n", readden);
398 ok(
left == -4,
"peek3 got %d bytes left\n",
left);
401 ok(
avail ==
sizeof(
obuf) +
sizeof(obuf2),
"peek3 got %d bytes available\n",
avail);
404 ok(readden ==
sizeof(
obuf) +
sizeof(obuf2),
"peek4 got %d bytes\n", readden);
409 ok(readden ==
sizeof(
obuf),
"peek4 got %d bytes\n", readden);
410 ok(
left == 0,
"peek4 got %d bytes left\n",
left);
412 ok(
avail ==
sizeof(
obuf) +
sizeof(obuf2),
"peek4 got %d bytes available\n",
avail);
417 ok(
memcmp(obuf2,
pbuf,
sizeof(obuf2)) == 0,
"pipe content 4b check\n");
421 ok(readden ==
sizeof(
obuf) +
sizeof(obuf2),
"read 4 got %d bytes\n", readden);
424 ok(readden ==
sizeof(
obuf),
"read 4 got %d bytes\n", readden);
430 ok(
memcmp(obuf2,
pbuf,
sizeof(obuf2)) == 0,
"content 4b check\n");
443 memset(ibuf, 0,
sizeof(ibuf));
445 ok(written ==
sizeof(
obuf),
"write file len 3a\n");
447 ok(written ==
sizeof(obuf2),
"write file len 3b\n");
449 ok(readden ==
sizeof(
obuf),
"peek5 got %d bytes\n", readden);
450 ok(
avail ==
sizeof(
obuf) +
sizeof(obuf2),
"peek5 got %d bytes available\n",
avail);
451 ok(
left == 0,
"peek5 got %d bytes left\n",
left);
455 ok(readden ==
sizeof(
obuf),
"read 5 got %d bytes\n", readden);
458 if (readden <=
sizeof(
obuf))
464 ok(readden ==
sizeof(obuf2),
"peek6a got %d bytes\n", readden);
465 ok(
avail ==
sizeof(obuf2),
"peek6a got %d bytes available\n",
avail);
468 ok(readden ==
sizeof(obuf2),
"read 6a got %d bytes\n", readden);
470 ok(
memcmp(obuf2,
pbuf,
sizeof(obuf2)) == 0,
"content 6a check\n");
472 memset(ibuf, 0,
sizeof(ibuf));
474 ok(written ==
sizeof(
obuf),
"write file len 6a\n");
476 ok(written ==
sizeof(obuf2),
"write file len 6b\n");
478 ok(readden ==
sizeof(
obuf),
"peek6 got %d bytes\n", readden);
480 ok(
avail ==
sizeof(
obuf) +
sizeof(obuf2),
"peek6b got %d bytes available\n",
avail);
484 ok(readden ==
sizeof(
obuf),
"read 6b got %d bytes\n", readden);
487 if (readden <=
sizeof(
obuf))
491 memset(ibuf, 0,
sizeof(ibuf));
493 ok(written ==
sizeof(obuf2),
"write file len 7\n");
497 ok(readden == 4,
"read got %d bytes 7\n", readden);
499 ok(readden ==
sizeof(obuf2) - 4,
"read got %d bytes 7\n", readden);
500 ok(
memcmp(obuf2, ibuf, written) == 0,
"content check 7\n");
502 memset(ibuf, 0,
sizeof(ibuf));
504 ok(written ==
sizeof(
obuf),
"write file len 8\n");
508 ok(readden == 4,
"read got %d bytes 8\n", readden);
510 ok(readden ==
sizeof(
obuf) - 4,
"read got %d bytes 8\n", readden);
511 ok(
memcmp(
obuf, ibuf, written) == 0,
"content check 8\n");
517 memset(ibuf, 0,
sizeof(ibuf));
519 ok(written ==
sizeof(
obuf),
"write file len 9\n");
521 ok(written ==
sizeof(obuf2),
"write file len 9\n");
525 ok(readden == 4,
"read got %d bytes 9\n", readden);
528 ok(!
ret,
"RpcReadFile 9\n");
530 ok(readden == 4,
"read got %d bytes 9\n", readden);
532 ok(
ret,
"RpcReadFile 9\n");
533 ok(readden ==
sizeof(
obuf) - 8,
"read got %d bytes 9\n", readden);
535 if (readden <=
sizeof(
obuf) - 8)
537 memset(ibuf, 0,
sizeof(ibuf));
540 ok(!
ret,
"RpcReadFile 9\n");
542 ok(readden == 4,
"read got %d bytes 9\n", readden);
546 ok(readden == 4,
"read got %d bytes 9\n", readden);
548 ok(
ret,
"RpcReadFile 9\n");
549 ok(readden ==
sizeof(obuf2) - 8,
"read got %d bytes 9\n", readden);
550 ok(
memcmp(obuf2, ibuf,
sizeof(obuf2)) == 0,
"content check 9\n");
554 memset(ibuf, 0,
sizeof(ibuf));
556 ok(written ==
sizeof(obuf2),
"write file len 10\n");
558 ok(written ==
sizeof(
obuf),
"write file len 10\n");
562 ok(readden == 4,
"read got %d bytes 10\n", readden);
565 ok(!
ret,
"RpcReadFile 10\n");
567 ok(readden == 4,
"read got %d bytes 10\n", readden);
569 ok(
ret,
"RpcReadFile 10\n");
570 ok(readden ==
sizeof(obuf2) - 8,
"read got %d bytes 10\n", readden);
571 ok(
memcmp(obuf2, ibuf,
sizeof(obuf2)) == 0,
"content check 10\n");
572 if (readden <=
sizeof(obuf2) - 8)
574 memset(ibuf, 0,
sizeof(ibuf));
577 ok(!
ret,
"RpcReadFile 10\n");
579 ok(readden == 4,
"read got %d bytes 10\n", readden);
583 ok(readden == 4,
"read got %d bytes 10\n", readden);
585 ok(
ret,
"RpcReadFile 10\n");
586 ok(readden ==
sizeof(
obuf) - 8,
"read got %d bytes 10\n", readden);
601 "connecting to named pipe after other client closes but before DisconnectNamedPipe should fail\n");
603 "connecting to named pipe before other client closes should fail with ERROR_PIPE_BUSY\n");
610 "connecting to named pipe after other client closes but before DisconnectNamedPipe should fail\n");
612 "connecting to named pipe after other client closes but before DisconnectNamedPipe should fail with ERROR_PIPE_BUSY\n");
619 "connecting to named pipe after other client closes but before DisconnectNamedPipe should fail\n");
621 "connecting to named pipe after other client closes but before ConnectNamedPipe should fail with ERROR_PIPE_BUSY\n");
736 static char buf[512];
833 ok(readden,
"short read\n");
838 ok(written == readden,
"write file len\n");
855 trace(
"serverThreadMain2\n");
875 if (
i == 0 && pQueueUserAPC) {
898 ok(written == readden,
"write file len\n");
906 if (
i == 0 && pQueueUserAPC)
957 int letWFSOEwait = (
i & 2);
958 int letGORwait = (
i & 1);
961 memset(&oOverlap, 0,
sizeof(oOverlap));
966 if (
winetest_debug > 1)
trace(
"Server calling non-overlapped ConnectNamedPipe on overlapped pipe...\n");
984 ok(
ret == 0,
"wait ConnectNamedPipe returned %x\n",
ret);
987 if (!letGORwait && !letWFSOEwait && !
success) {
1012 ok(
ret == 0,
"wait ReadFile returned %x\n",
ret);
1015 if (!letGORwait && !letWFSOEwait && !
success) {
1036 ok(
ret == 0,
"wait WriteFile returned %x\n",
ret);
1039 if (!letGORwait && !letWFSOEwait && !
success) {
1046 ok(written == readden,
"write file len\n");
1074 ok(hcompletion !=
NULL,
"CreateIoCompletionPort failed, error=%i\n",
GetLastError());
1089 memset(&oConnect, 0,
sizeof(oConnect));
1090 memset(&oRead, 0,
sizeof(oRead));
1091 memset(&oWrite, 0,
sizeof(oWrite));
1098 "overlapped ConnectNamedPipe got %u err %u\n",
success,
err );
1105 "ConnectNamedPipe GetQueuedCompletionStatus wrong error %u\n",
GetLastError());
1111 ok(compkey == 12345,
"got completion key %i instead of 12345\n", (
int)compkey);
1112 ok(oResult == &oConnect,
"got overlapped pointer %p instead of %p\n", oResult, &oConnect);
1130 ok(compkey == 12345,
"got completion key %i instead of 12345\n", (
int)compkey);
1131 ok(oResult == &oRead,
"got overlapped pointer %p instead of %p\n", oResult, &oRead);
1145 ok(compkey == 12345,
"got completion key %i instead of 12345\n", (
int)compkey);
1146 ok(oResult == &oWrite,
"got overlapped pointer %p instead of %p\n", oResult, &oWrite);
1147 ok(written == readden,
"write file len\n");
1161 "overlapped WriteFile on disconnected pipe returned %u, err=%i\n",
success,
err);
1170 "WriteFile GetQueuedCompletionStatus returned %u, err=%i, oResult %p\n",
1179 "overlapped ReadFile on disconnected pipe returned %u, err=%i\n",
success,
err);
1187 "ReadFile GetQueuedCompletionStatus returned %u, err=%i, oResult %p\n",
1248 memset(&oOverlap, 0,
sizeof(oOverlap));
1274 ok(
ret == 0,
"wait ReadFileEx returned %x\n",
ret);
1296 ok(
ret == 0,
"wait WriteFileEx returned %x\n",
ret);
1318 static const char obuf[] =
"Bit Bucket";
1324 for (loop = 0; loop < 3; loop++) {
1343 memset(ibuf, 0,
sizeof(ibuf));
1346 ok(written ==
sizeof(
obuf),
"write file len\n");
1349 ok(readden ==
sizeof(
obuf),
"read file len\n");
1350 ok(
memcmp(
obuf, ibuf, written) == 0,
"content check\n");
1364 DWORD serverThreadId;
1366 DWORD alarmThreadId;
1368 trace(
"test_NamedPipe_2 starting\n");
1419 static const char obuf[] =
"Bit Bucket";
1435 win_skip(
"Named pipes are not implemented\n");
1455 ok(written ==
sizeof(
obuf),
"write file len\n");
1461 "ReadFile from disconnected pipe with bytes waiting\n");
1464 "DisconnectNamedPipe worked twice\n");
1486 HANDLE piperead, pipewrite;
1500 ok(
CreatePipe(&piperead, &pipewrite, &pipe_attr, 0) != 0,
"CreatePipe failed\n");
1505 ok(written ==
sizeof(
PIPENAME),
"Write to anonymous pipe wrote %d bytes\n", written);
1506 ok(
ReadFile(piperead,readbuf,
sizeof(readbuf),&
read,
NULL),
"Read from non empty pipe failed\n");
1508 ok(
CloseHandle(pipewrite),
"CloseHandle for the write pipe failed\n");
1509 ok(
CloseHandle(piperead),
"CloseHandle for the read pipe failed\n");
1512 ok(
CreatePipe(&piperead, &pipewrite, &pipe_attr, 0) != 0,
"CreatePipe failed\n");
1514 ok(written ==
sizeof(
PIPENAME),
"Write to anonymous pipe wrote %d bytes\n", written);
1516 ok(
CloseHandle(pipewrite),
"CloseHandle for the Write Pipe failed\n");
1517 ok(
ReadFile(piperead,readbuf,
sizeof(readbuf),&
read,
NULL),
"Read from broken pipe with pending data failed\n");
1520 ok(
ReadFile(piperead,readbuf,
sizeof(readbuf),&
read,
NULL) == 0,
"Broken pipe not detected\n");
1521 ok(
CloseHandle(piperead),
"CloseHandle for the read pipe failed\n");
1527 ok(
CreatePipe(&piperead, &pipewrite, &pipe_attr, (
size + 24)) != 0,
"CreatePipe failed\n");
1529 ok(written ==
size,
"Write to anonymous pipe wrote %d bytes\n", written);
1531 ok(
CloseHandle(pipewrite),
"CloseHandle for the Write Pipe failed\n");
1534 ok(
read ==
size,
"Read from anonymous pipe got %d bytes\n",
read);
1537 ok(
ReadFile(piperead,readbuf,
sizeof(readbuf),&
read,
NULL) == 0,
"Broken pipe not detected\n");
1538 ok(
CloseHandle(piperead),
"CloseHandle for the read pipe failed\n");
1544 ok(
CreatePipe(&piperead, &pipewrite, &pipe_attr, 1) != 0,
"CreatePipe failed\n");
1547 ok(
CloseHandle(pipewrite),
"CloseHandle for the Write Pipe failed\n");
1548 ok(
CloseHandle(piperead),
"CloseHandle for the read pipe failed\n");
1553 static const char testdata[] =
"Hello World";
1567 numbytes = 0xdeadbeef;
1570 ok(numbytes ==
sizeof(
testdata),
"expected sizeof(testdata), got %u\n", numbytes);
1572 numbytes = 0xdeadbeef;
1575 ok(numbytes ==
sizeof(
testdata),
"expected sizeof(testdata), got %u\n", numbytes);
1580 numbytes = 0xdeadbeef;
1584 ok(numbytes == 0,
"expected 0, got %u\n", numbytes);
1586 numbytes = 0xdeadbeef;
1589 ok(numbytes ==
sizeof(
testdata),
"expected sizeof(testdata), got %u\n", numbytes);
1591 numbytes = 0xdeadbeef;
1595 ok(numbytes ==
sizeof(
testdata),
"expected sizeof(testdata), got %u\n", numbytes);
1605 ok(!
ret,
"ReadFile unexpectedly succeeded\n");
1608 numbytes = 0xdeadbeef;
1612 ok(numbytes == 0xdeadbeef,
"numbytes = %u\n", numbytes);
1616 ok(!
ret,
"WriteFile unexpectedly succeeded\n");
1629 numbytes = 0xdeadbeef;
1632 ok(numbytes == 0,
"expected 0, got %u\n", numbytes);
1637 numbytes = 0xdeadbeef;
1641 ok(numbytes == 0,
"expected 0, got %u\n", numbytes);
1645 ok(!
ret,
"ReadFile unexpectedly succeeded\n");
1656 ok(!
ret,
"ReadFile unexpectedly succeeded\n");
1661 ok(!
ret,
"WriteFile unexpectedly succeeded\n");
1676 numbytes = 0xdeadbeef;
1679 ok(numbytes ==
sizeof(
testdata),
"expected sizeof(testdata), got %u\n", numbytes);
1681 numbytes = 0xdeadbeef;
1684 ok(numbytes ==
sizeof(
testdata),
"expected sizeof(testdata), got %u\n", numbytes);
1689 numbytes = 0xdeadbeef;
1694 ok(numbytes == 0,
"expected 0, got %u\n", numbytes);
1696 numbytes = 0xdeadbeef;
1699 ok(numbytes ==
sizeof(
testdata),
"expected sizeof(testdata), got %u\n", numbytes);
1701 numbytes = 0xdeadbeef;
1705 ok(numbytes ==
sizeof(
testdata),
"expected sizeof(testdata), got %u\n", numbytes);
1715 ok(!
ret,
"ReadFile unexpectedly succeeded\n");
1718 numbytes = 0xdeadbeef;
1722 ok(numbytes == 0xdeadbeef,
"numbytes = %u\n", numbytes);
1726 ok(!
ret,
"WriteFile unexpectedly succeeded\n");
1739 numbytes = 0xdeadbeef;
1742 ok(numbytes == 0,
"expected 0, got %u\n", numbytes);
1747 numbytes = 0xdeadbeef;
1751 ok(numbytes == 0,
"expected 0, got %u\n", numbytes);
1755 ok(!
ret,
"ReadFile unexpectedly succeeded\n");
1766 ok(!
ret,
"ReadFile unexpectedly succeeded\n");
1771 ok(!
ret,
"WriteFile unexpectedly succeeded\n");
1784#define PIPE_NAME "\\\\.\\pipe\\named_pipe_test"
1791 const char message[] =
"Test";
1792 DWORD bytes_read, bytes_written;
1820 ok(
ret,
"GetTokenInformation(TokenPrivileges) failed with %d\n",
GetLastError());
1904 DWORD dwBytesWritten;
1913 params.token = hClientToken;
1922 "ImpersonateNamedPipeClient should have failed with ERROR_CANNOT_IMPERSONATE instead of %d\n",
GetLastError());
1936 (*test_func)(0, hToken);
1940 ok(
ret,
"GetTokenInformation(TokenImpersonationLevel) failed with error %d\n",
GetLastError());
1959 (*test_func)(1, hToken);
2005 all_privs_disabled =
FALSE;
2012 return all_privs_disabled;
2022 ok(
ret,
"GetTokenInformation(TokenStatistics)\n");
2023 if (!
ret)
return -1;
2037 ok(priv_count == 0,
"privilege count should have been 0 instead of %d\n", priv_count);
2041 ok(priv_count > 0,
"privilege count should now be > 0 instead of 0\n");
2045 ok(0,
"shouldn't happen\n");
2061 ok(0,
"shouldn't happen\n");
2076 ok(0,
"shouldn't happen\n");
2092 ok(0,
"shouldn't happen\n");
2107 ok(0,
"shouldn't happen\n");
2119 ok(priv_count == 0,
"privilege count should have been 0 instead of %d\n", priv_count);
2123 ok(priv_count > 0,
"privilege count should now be > 0 instead of 0\n");
2127 ok(0,
"shouldn't happen\n");
2144 ok(0,
"shouldn't happen\n");
2160 ok(0,
"shouldn't happen\n");
2170 if( !pDuplicateTokenEx ) {
2171 skip(
"DuplicateTokenEx not found\n");
2178 skip(
"couldn't open process token, skipping impersonation tests\n");
2184 skip(
"token didn't have any privileges or they were all disabled. token not suitable for impersonation tests\n");
2238 ok(pipe !=
NULL,
"pipe NULL\n");
2323 ok(
ret ==
FALSE,
"ConnectNamedPipe succeeded\n");
2330 numbytes = 0xdeadbeef;
2332 ok(
ret ==
TRUE,
"GetOverlappedResult failed\n");
2333 ok(numbytes == 0,
"expected 0, got %u\n", numbytes);
2352 ok(
ret ==
FALSE,
"ConnectNamedPipe succeeded\n");
2366 DWORD state, instances, maxCollectionCount, collectDataTimeout;
2385 ok(instances == 1,
"expected 1 instances, got %d\n", instances);
2392 &maxCollectionCount, &collectDataTimeout,
userName,
2396 "expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
2402 "expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
2416 "expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
2437 ok(instances == 1,
"expected 1 instances, got %d\n", instances);
2527 char write_buf[1024];
2548 ok(
ret ==
FALSE,
"ConnectNamedPipe succeeded\n");
2552 ok(wait ==
WAIT_TIMEOUT,
"WaitForSingleObject returned %x\n", wait);
2584 memset(write_buf, 0xaa,
sizeof(write_buf));
2585 for (
i=0;
i<256;
i++)
2613 for (
i=0;
i<256;
i++)
2622 "WaitForSingleObject returned %x\n", wait);
2630 num_bytes = 0xdeadbeef;
2633 ok(!
ret,
"ReadFile should fail\n");
2635 ok(num_bytes == 0,
"expected 0, got %u\n", num_bytes);
2642 num_bytes = 0xdeadbeef;
2645 ok(!
ret,
"ReadFile should fail\n");
2647 ok(num_bytes == 0,
"bytes %u\n", num_bytes);
2652 ok(wait ==
WAIT_TIMEOUT,
"WaitForSingleObject returned %x\n", wait);
2654 num_bytes = 0xdeadbeef;
2656 ok(
ret,
"WriteFile failed\n");
2657 ok(num_bytes == 1,
"bytes %u\n", num_bytes);
2662 ok(num_bytes == 1,
"bytes %u\n", num_bytes);
2667 num_bytes = 0xdeadbeef;
2669 ok(
ret,
"ReadFile failed\n");
2670 ok(num_bytes == 1,
"bytes %u\n", num_bytes);
2677#define test_peek_pipe(a,b,c,d) _test_peek_pipe(__LINE__,a,b,c,d)
2680 DWORD bytes_read = 0xdeadbeed,
avail = 0xdeadbeef,
left = 0xdeadbeed;
2689 ok_(__FILE__,
line)(bytes_read == expected_read,
"bytes_read = %u, expected %u\n", bytes_read, expected_read);
2690 ok_(__FILE__,
line)(
avail == expected_avail,
"avail = %u, expected %u\n",
avail, expected_avail);
2691 ok_(__FILE__,
line)(
left == expected_message_length - expected_read,
"left = %d, expected %d\n",
2692 left, expected_message_length - expected_read);
2697 "io.Information = %lu\n",
io.Information);
2700 ok_(__FILE__,
line)(peek_buf->
MessageLength == expected_message_length,
"MessageLength = %u, expected %u\n",
2707 ok_(__FILE__,
line)(bytes_read == 1,
"bytes_read = %u, expected %u\n", bytes_read, expected_read);
2708 ok_(__FILE__,
line)(
avail == expected_avail,
"avail = %u, expected %u\n",
avail, expected_avail);
2709 ok_(__FILE__,
line)(
left == expected_message_length-1,
"left = %d, expected %d\n",
left, expected_message_length-1);
2713#define overlapped_read_sync(a,b,c,d,e) _overlapped_read_sync(__LINE__,a,b,c,d,e)
2743#define overlapped_read_async(a,b,c,d) _overlapped_read_async(__LINE__,a,b,c,d)
2758#define overlapped_write_sync(a,b,c) _overlapped_write_sync(__LINE__,a,b,c)
2761 DWORD written_bytes = 0xdeadbeef;
2769 ok_(__FILE__,
line)(written_bytes ==
size,
"WriteFile returned written_bytes = %u\n", written_bytes);
2771 written_bytes = 0xdeadbeef;
2774 ok_(__FILE__,
line)(written_bytes ==
size,
"GetOverlappedResult returned written_bytes %u expected %u\n", written_bytes,
size);
2779#define overlapped_write_async(a,b,c,d) _overlapped_write_async(__LINE__,a,b,c,d)
2782 DWORD written_bytes = 0xdeadbeef;
2791 ok_(__FILE__,
line)(!written_bytes,
"written_bytes = %u\n", written_bytes);
2796#define test_flush_sync(a) _test_flush_sync(__LINE__,a)
2819#define test_flush_async(a,b) _test_flush_async(__LINE__,a,b)
2834#define test_flush_done(a) _test_flush_done(__LINE__,a)
2842#define test_overlapped_result(a,b,c,d) _test_overlapped_result(__LINE__,a,b,c,d)
2859#define test_overlapped_failure(a,b,c) _test_overlapped_failure(__LINE__,a,b,c)
2874#define cancel_overlapped(a,b) _cancel_overlapped(__LINE__,a,b)
2887 OVERLAPPED read_overlapped, read_overlapped2, write_overlapped, write_overlapped2;