36#define TEST_ATTRIB (BACKGROUND_BLUE | FOREGROUND_GREEN)
37#define DEFAULT_ATTRIB (FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED)
41#define CONTENT(c) ('A' + (((c).Y * 17 + (c).X) % 23))
43#define okCURSOR(hCon, c) do { \
44 CONSOLE_SCREEN_BUFFER_INFO __sbi; \
45 BOOL expect = GetConsoleScreenBufferInfo((hCon), &__sbi) && \
46 __sbi.dwCursorPosition.X == (c).X && __sbi.dwCursorPosition.Y == (c).Y; \
47 ok(expect, "Expected cursor at (%d,%d), got (%d,%d)\n", \
48 (c).X, (c).Y, __sbi.dwCursorPosition.X, __sbi.dwCursorPosition.Y); \
51#define okCHAR(hCon, c, ch, attr) do { \
52 char __ch; WORD __attr; DWORD __len; BOOL expect; \
53 expect = ReadConsoleOutputCharacterA((hCon), &__ch, 1, (c), &__len) == 1 && __len == 1 && __ch == (ch); \
54 ok(expect, "At (%d,%d): expecting char '%c'/%02x got '%c'/%02x\n", (c).X, (c).Y, (ch), (ch), __ch, __ch); \
55 expect = ReadConsoleOutputAttribute((hCon), &__attr, 1, (c), &__len) == 1 && __len == 1 && __attr == (attr); \
56 ok(expect, "At (%d,%d): expecting attr %04x got %04x\n", (c).X, (c).Y, (attr), __attr); \
63#define KERNEL32_GET_PROC(func) \
64 p##func = (void *)GetProcAddress(hKernel32, #func); \
65 if(!p##func) trace("GetProcAddress(hKernel32, '%s') failed\n", #func);
74#undef KERNEL32_GET_PROC
85 for (
c.X = 0;
c.X < sbSize.
X;
c.X++)
87 for (
c.Y = 0;
c.Y < sbSize.
Y;
c.Y++)
146 ok(!
ret,
"Expected failure\n");
153 ok(!
ret,
"Expected failure\n");
154 ok(
info.dwSize == -1,
"Expected no change for dwSize\n");
161 ok(
ret,
"Expected success\n");
164 "Expected 12 or 25, got %d\n",
info.dwSize);
165 ok(
info.bVisible,
"Expected the cursor to be visible\n");
166 ok(
GetLastError() == 0xdeadbeef,
"GetLastError: expecting %u got %u\n",
174 static const char emptybuf[16];
215 const char*
mytest =
"abcdefg";
224 for (
c.X = 0;
c.X < mylen;
c.X++)
237 const char*
mytest =
"123";
243 "clearing wrap at EOL & processed output\n");
246 c.X = sbSize.
X - 3;
c.Y = 0;
250 ok(
ret != 0 &&
len == mylen,
"Couldn't write, ret = %d, len = %d\n",
ret,
len);
252 for (
p = mylen - 3;
p < mylen;
p++)
254 c.X = sbSize.
X - 3 +
p % 3;
261 p = sbSize.
X - 3 + mylen % 3;
265 c.X = sbSize.
X - mylen;
c.Y = 0;
275 const char*
mytest =
"abcd\nf\tg";
282 "clearing wrap at EOL & setting processed output\n");
285 c.X = sbSize.
X - 5;
c.Y = 0;
290 for (
c.X = sbSize.
X - 5;
c.X < sbSize.
X - 1;
c.X++)
299 win_skip(
"Win9x/WinMe don't respect ~ENABLE_WRAP_AT_EOL_OUTPUT\n");
307 for (
c.X = 1;
c.X < 8;
c.X++)
316 c.X = sbSize.
X - 4;
c.Y = 0;
321 for (
c.X = sbSize.
X - 4;
c.X < sbSize.
X;
c.X++)
327 for (
c.X = 1;
c.X < 8;
c.X++)
336 c.X = sbSize.
X - 3;
c.Y = 0;
341 for (
p = mylen2 - 3;
p < mylen2;
p++)
343 c.X = sbSize.
X - 3 +
p % 3;
348 for (
c.X = 1;
c.X < 8;
c.X++)
361 const char*
mytest =
"abcd\nf\tg";
366 "setting wrap at EOL & clearing processed output\n");
369 c.X = sbSize.
X - 9;
c.Y = 0;
374 for (
p = 0;
p < mylen;
p++)
376 c.X = sbSize.
X - 9 +
p;
379 c.X = sbSize.
X - 9 + mylen;
385 c.X = sbSize.
X - 3;
c.Y = 0;
397 const char*
mytest =
"abcd\nf\tg";
403 "setting wrap at EOL & processed output\n");
406 c.X = sbSize.
X - 9;
c.Y = 0;
410 for (
p = 0;
p < 4;
p++)
412 c.X = sbSize.
X - 9 +
p;
415 c.X = sbSize.
X - 9 +
p;
418 win_skip(
"Win9x/WinMe changes attribs for '\\n' up to 'f'\n");
423 for (
c.X = 1;
c.X < 8;
c.X++)
431 c.X = sbSize.
X - 3;
c.Y = 2;
435 for (
p = 0;
p < 3;
p++)
437 c.X = sbSize.
X - 3 +
p;
445 win_skip(
"Win9x/WinMe changes attribs for '\\n' up to 'f'\n");
451 for (
c.X = 1;
c.X < 8;
c.X++)
487#define IN_SRECT(r,c) ((r).Left <= (c).X && (c).X <= (r).Right && (r).Top <= (c).Y && (c).Y <= (r).Bottom)
488#define IN_SRECT2(r,d,c) ((d).X <= (c).X && (c).X <= (d).X + (r).Right - (r).Left && (d).Y <= (c).Y && (c).Y <= (d).Y + (r).Bottom - (r).Top)
503 clip.
Right = sbSize.
X - 1;
509 for (
c.Y = 0;
c.Y < sbSize.
Y;
c.Y++)
511 for (
c.X = 0;
c.X < sbSize.
X;
c.X++)
538 clip.
Right = sbSize.
X - 1;
544 for (
c.Y = 0;
c.Y < sbSize.
Y;
c.Y++)
546 for (
c.X = 0;
c.X < sbSize.
X;
c.X++)
580 for (
c.Y = 0;
c.Y < sbSize.
Y;
c.Y++)
582 for (
c.X = 0;
c.X < sbSize.
X;
c.X++)
600 "Expected ERROR_NOT_ENOUGH_MEMORY, got %u\n",
GetLastError());
622 for (
c.Y = 0;
c.Y < sbSize.
Y;
c.Y++)
624 for (
c.X = 0;
c.X < sbSize.
X;
c.X++)
664 if (0)
ok(
mch_count == 1,
"Event isn't synchronous\n");
697 HANDLE hConOutRW, hConOutRO, hConOutWT;
698 HANDLE hFileOutRW, hFileOutRO, hFileOutWT;
700 char test_str1[] =
"Test for SB1";
701 char test_str2[] =
"Test for SB2";
702 char test_cp866[] = {0xe2, 0xa5, 0xe1, 0xe2, 0};
703 char test_cp1251[] = {0xf2, 0xe5, 0xf1, 0xf2, 0};
714 skip(
"Codepage 866 not available\n");
724 win_skip(
"SetConsoleOutputCP is not implemented\n");
727 ok(
ret,
"Cannot set output codepage to 866\n");
733 "Cannot create a new screen buffer for ReadWrite\n");
738 "Cannot create a new screen buffer for ReadOnly\n");
743 "Cannot create a new screen buffer for WriteOnly\n");
759 "Shouldn't succeed\n");
761 "GetLastError: expecting %u got %u\n",
768 "GetLastError: expecting %u got %u\n",
774 "GetLastError: expecting %u got %u\n",
780 "GetLastError: expecting %u got %u\n",
787 ok(!
ret,
"Shouldn't succeed\n");
789 "GetLastError: got %u\n",
error);
794 ok(!
ret,
"Shouldn't succeed\n");
796 "GetLastError: got %u\n",
error);
801 ok(!
ret,
"Shouldn't succeed\n");
803 "GetLastError: got %u\n",
error);
813 "GetLastError: expecting %u got %u\n",
848 ok(
ret &&
len ==
lstrlenA(test_str2),
"ReadConsoleOutputCharacterA failed\n");
858 ok(
ret &&
len ==
lstrlenA(test_cp866),
"ReadConsoleOutputCharacterW failed\n");
871 ok(
ret &&
len ==
lstrlenA(test_cp1251),
"ReadConsoleOutputCharacterW failed\n");
872 str_wbuf[
lstrlenA(test_cp1251)] = 0;
880 ok(
ret &&
len ==
lstrlenA(test_cp1251),
"ReadConsoleOutputCharacterW failed\n");
881 str_wbuf[
lstrlenA(test_cp1251)] = 0;
899 ok(
ret &&
len ==
lstrlenA(test_str1),
"ReadConsoleOutputCharacterA failed\n");
915 ok(!
timeout,
"wait shouldn't have timed out\n");
923 DWORD events_written;
931 ok(
ret ==
TRUE,
"Expected RegisterWaitForSingleObject to return TRUE, got %d\n",
ret);
935 record.Event.KeyEvent.bKeyDown = 1;
936 record.Event.KeyEvent.wRepeatCount = 1;
939 record.Event.KeyEvent.uChar.UnicodeChar =
'\r';
940 record.Event.KeyEvent.dwControlKeyState = 0;
942 ok(
ret ==
TRUE,
"Expected WriteConsoleInputW to return TRUE, got %d\n",
ret);
949 "UnregisterWait failed with error %d\n",
GetLastError());
968 static char input_exe[
MAX_PATH] =
"winetest.exe";
971 ret = pGetConsoleInputExeNameA(0,
NULL);
973 ok(
ret,
"GetConsoleInputExeNameA failed\n");
977 ret = pGetConsoleInputExeNameA(0,
buffer);
979 ok(
ret,
"GetConsoleInputExeNameA failed\n");
986 ok(
ret,
"GetConsoleInputExeNameA failed\n");
990 ret = pSetConsoleInputExeNameA(
NULL);
992 ok(!
ret,
"SetConsoleInputExeNameA failed\n");
996 ret = pSetConsoleInputExeNameA(
"");
998 ok(!
ret,
"SetConsoleInputExeNameA failed\n");
1001 ret = pSetConsoleInputExeNameA(input_exe);
1002 ok(
ret,
"SetConsoleInputExeNameA failed\n");
1005 ok(
ret,
"GetConsoleInputExeNameA failed\n");
1013 if (!pGetConsoleProcessList)
1015 win_skip(
"GetConsoleProcessList is not available\n");
1020 ret = pGetConsoleProcessList(
NULL, 0);
1021 ok(
ret == 0,
"Expected failure\n");
1023 "Expected ERROR_INVALID_PARAMETER, got %d\n",
1027 ret = pGetConsoleProcessList(
NULL, 1);
1028 ok(
ret == 0,
"Expected failure\n");
1030 "Expected ERROR_INVALID_PARAMETER, got %d\n",
1040 ret = pGetConsoleProcessList(
list, 0);
1041 ok(
ret == 0,
"Expected failure\n");
1043 "Expected ERROR_INVALID_PARAMETER, got %d\n",
1047 ret = pGetConsoleProcessList(
list, 1);
1049 ok(
ret == 1,
"Expected 1, got %d\n",
ret);
1058 ok(
ret == 1,
"Expected 1, got %d\n",
ret);
1071 static const WCHAR conW[] = {
'C',
'O',
'N',0};
1077 for (
i = 0;
i <
sizeof(accesses) /
sizeof(accesses[0]);
i++)
1081 "Expected to open the CON device on write (%x)\n", accesses[
i]);
1091 "Expected to open the CON device on read (%x)\n", accesses[
i]);
1102 static const WCHAR coninW[] = {
'C',
'O',
'N',
'I',
'N',
'$',0};
1103 static const WCHAR conoutW[] = {
'C',
'O',
'N',
'O',
'U',
'T',
'$',0};
1105 static const WCHAR invalidW[] = {
'I',
'N',
'V',
'A',
'L',
'I',
'D',0};
1115 } invalid_table[] = {
1154 {coninW, 0,
FALSE, 0 },
1155 {coninW, 0,
TRUE, 0 },
1164 {conoutW, 0,
FALSE, 0 },
1178 win_skip(
"OpenConsoleW is not available\n");
1182 for (
index = 0;
index <
sizeof(invalid_table)/
sizeof(invalid_table[0]);
index++)
1186 invalid_table[
index].inherit, invalid_table[
index].creation);
1189 "Expected OpenConsoleW to return INVALID_HANDLE_VALUE for index %d, got %p\n",
1191 ok(gle == invalid_table[
index].gle || (gle != 0 && gle == invalid_table[
index].gle2),
1192 "Expected GetLastError() to return %u/%u for index %d, got %u\n",
1196 for (
index = 0;
index <
sizeof(valid_table)/
sizeof(valid_table[0]);
index++)
1199 valid_table[
index].inherit, valid_table[
index].creation);
1202 "Expected OpenConsoleW to succeed for index %d, got %p\n",
index,
ret);
1220 static const WCHAR coninW[] = {
'C',
'O',
'N',
'I',
'N',
'$',0};
1221 static const WCHAR conoutW[] = {
'C',
'O',
'N',
'O',
'U',
'T',
'$',0};
1251 for (
index = 0;
index <
sizeof(cf_table)/
sizeof(cf_table[0]);
index++)
1255 sa.nLength =
sizeof(
sa);
1256 sa.lpSecurityDescriptor =
NULL;
1257 sa.bInheritHandle = cf_table[
index].inherit;
1265 "Expected CreateFileW not to return INVALID_HANDLE_VALUE for index %d\n",
index);
1267 "Expected GetLastError() to return %u for index %d, got %u\n",
1273 "Expected CreateFileW to succeed for index %d\n",
index);
1284 if (!pVerifyConsoleIoHandle)
1286 win_skip(
"VerifyConsoleIoHandle is not available\n");
1292 ret = pVerifyConsoleIoHandle((
HANDLE)0xdeadbee0);
1294 ok(!
ret,
"expected VerifyConsoleIoHandle to fail\n");
1295 ok(
error == 0xdeadbeef,
"wrong GetLastError() %d\n",
error);
1299 ret = pVerifyConsoleIoHandle((
HANDLE)0xdeadbee1);
1301 ok(!
ret,
"expected VerifyConsoleIoHandle to fail\n");
1302 ok(
error == 0xdeadbeef,
"wrong GetLastError() %d\n",
error);
1306 ret = pVerifyConsoleIoHandle((
HANDLE)0xdeadbee2);
1308 ok(!
ret,
"expected VerifyConsoleIoHandle to fail\n");
1309 ok(
error == 0xdeadbeef,
"wrong GetLastError() %d\n",
error);
1313 ret = pVerifyConsoleIoHandle((
HANDLE)0xdeadbee3);
1315 ok(!
ret,
"expected VerifyConsoleIoHandle to fail\n");
1316 ok(
error == 0xdeadbeef,
"wrong GetLastError() %d\n",
error);
1324 "expected VerifyConsoleIoHandle to succeed\n");
1325 ok(
error == 0xdeadbeef,
"wrong GetLastError() %d\n",
error);
1339 "wrong GetLastError() %d\n",
error);
1346 ok(
error == 0xdeadbeef,
"wrong GetLastError() %d\n",
error);
1352 ok(!
ret,
"expected SetStdHandle to fail\n");
1354 "wrong GetLastError() %d\n",
error);
1360 ok(
ret,
"expected SetStdHandle to succeed\n");
1361 ok(
error == 0xdeadbeef,
"wrong GetLastError() %d\n",
error);
1383 for (
i = 0;
i <
sizeof(invalid_table)/
sizeof(invalid_table[0]);
i++)
1386 if (invalid_table[
i].nrofevents)
count = 0xdeadbeef;
1388 invalid_table[
i].nrofevents);
1389 ok(!
ret,
"[%d] Expected GetNumberOfConsoleInputEvents to return FALSE, got %d\n",
i,
ret);
1390 if (invalid_table[
i].nrofevents)
1393 "[%d] Expected output count to be unmodified, got %u\n",
i,
count);
1396 "[%d] Expected last error to be %u, got %u\n",
1405 ok(!
ret,
"Expected GetNumberOfConsoleInputEvents to return FALSE, got %d\n",
ret);
1407 "Expected last error to be ERROR_INVALID_ACCESS, got %u\n",
1413 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1414 ok(
count != 0xdeadbeef,
"Expected output count to initialized\n");
1462 ok(
ret ==
TRUE,
"Expected GetConsoleMode to return TRUE, got %d\n",
ret);
1470 ok(
ret ==
TRUE,
"Expected SetConsoleMode to return TRUE, got %d\n",
ret);
1479 ok(
ret ==
TRUE,
"Expected FlushConsoleInputBuffer to return TRUE, got %d\n",
ret);
1484 for (
i = 0;
i <
sizeof(invalid_table)/
sizeof(invalid_table[0]);
i++)
1486 if (invalid_table[
i].win_crash)
1490 if (invalid_table[
i].written)
count = 0xdeadbeef;
1494 invalid_table[
i].written);
1495 ok(!
ret,
"[%d] Expected WriteConsoleInputA to return FALSE, got %d\n",
i,
ret);
1497 ok(gle == invalid_table[
i].gle || (gle != 0 && gle == invalid_table[
i].gle2),
1498 "[%d] Expected last error to be %u or %u, got %u\n",
1499 i, invalid_table[
i].gle, invalid_table[
i].gle2, gle);
1504 ok(
ret ==
TRUE,
"Expected WriteConsoleInputA to return TRUE, got %d\n",
ret);
1505 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
1509 ok(
ret ==
TRUE,
"Expected WriteConsoleInputA to return TRUE, got %d\n",
ret);
1510 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
1514 ok(
ret ==
TRUE,
"Expected WriteConsoleInputA to return TRUE, got %d\n",
ret);
1515 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1518 ok(
ret ==
TRUE,
"Expected FlushConsoleInputBuffer to return TRUE, got %d\n",
ret);
1525 ok(
ret ==
TRUE,
"Expected WriteConsoleInputA to return TRUE, got %d\n",
ret);
1526 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1529 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1530 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1533 ok(
ret ==
TRUE,
"Expected WriteConsoleInputA to return TRUE, got %d\n",
ret);
1534 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1537 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1539 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1542 ok(
ret ==
TRUE,
"Expected FlushConsoleInputBuffer to return TRUE, got %d\n",
ret);
1544 for (
i = 0;
i <
sizeof(event_list)/
sizeof(event_list[0]);
i++)
1552 ok(
ret ==
TRUE,
"Expected WriteConsoleInputA to return TRUE, got %d\n",
ret);
1553 ok(
count ==
sizeof(event_list)/
sizeof(event_list[0]),
1554 "Expected count to be event list length, got %u\n",
count);
1557 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1558 ok(
count ==
sizeof(event_list)/
sizeof(event_list[0]),
1559 "Expected count to be event list length, got %u\n",
count);
1562 ok(
ret ==
TRUE,
"Expected WriteConsoleInputA to return TRUE, got %d\n",
ret);
1563 ok(
count ==
sizeof(event_list)/
sizeof(event_list[0]),
1564 "Expected count to be event list length, got %u\n",
count);
1567 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1568 ok(
count == 2*
sizeof(event_list)/
sizeof(event_list[0]),
1569 "Expected count to be twice event list length, got %u\n",
count);
1573 ok(
ret ==
TRUE,
"Expected WriteConsoleInputA to return TRUE, got %d\n",
ret);
1574 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1577 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1579 ok(
count == 2*
sizeof(event_list)/
sizeof(event_list[0]),
1580 "Expected count to be twice event list length, got %u\n",
count);
1583 ok(
ret ==
TRUE,
"Expected FlushConsoleInputBuffer to return TRUE, got %d\n",
ret);
1597 ok(
ret ==
TRUE,
"Expected WriteConsoleInputA to return TRUE, got %d\n",
ret);
1598 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1601 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1602 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1605 ok(
ret ==
TRUE,
"Expected WriteConsoleInputA to return TRUE, got %d\n",
ret);
1606 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1609 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1610 ok(
count == 2,
"Expected count to be 2, got %u\n",
count);
1613 ok(
ret ==
TRUE,
"Expected FlushConsoleInputBuffer to return TRUE, got %d\n",
ret);
1620 ok(
ret ==
TRUE,
"Expected WriteConsoleInputA to return TRUE, got %d\n",
ret);
1621 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1624 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1625 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1631 ok(
ret ==
TRUE,
"Expected WriteConsoleInputA to return TRUE, got %d\n",
ret);
1632 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1635 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1636 ok(
count == 2,
"Expected count to be 2, got %u\n",
count);
1642 ok(
ret ==
TRUE,
"Expected WriteConsoleInputA to return TRUE, got %d\n",
ret);
1643 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1646 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1647 ok(
count == 3,
"Expected count to be 3, got %u\n",
count);
1651 ok(
ret ==
TRUE,
"Expected SetConsoleMode to return TRUE, got %d\n",
ret);
1699 ok(
ret ==
TRUE,
"Expected GetConsoleMode to return TRUE, got %d\n",
ret);
1707 ok(
ret ==
TRUE,
"Expected SetConsoleMode to return TRUE, got %d\n",
ret);
1716 ok(
ret ==
TRUE,
"Expected FlushConsoleInputBuffer to return TRUE, got %d\n",
ret);
1721 for (
i = 0;
i <
sizeof(invalid_table)/
sizeof(invalid_table[0]);
i++)
1723 if (invalid_table[
i].win_crash)
1727 if (invalid_table[
i].written)
count = 0xdeadbeef;
1731 invalid_table[
i].written);
1732 ok(!
ret,
"[%d] Expected WriteConsoleInputW to return FALSE, got %d\n",
i,
ret);
1734 ok(gle == invalid_table[
i].gle || (gle != 0 && gle == invalid_table[
i].gle2),
1735 "[%d] Expected last error to be %u or %u, got %u\n",
1736 i, invalid_table[
i].gle, invalid_table[
i].gle2, gle);
1741 ok(
ret ==
TRUE,
"Expected WriteConsoleInputW to return TRUE, got %d\n",
ret);
1742 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
1746 ok(
ret ==
TRUE,
"Expected WriteConsoleInputW to return TRUE, got %d\n",
ret);
1747 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
1751 ok(
ret ==
TRUE,
"Expected WriteConsoleInputW to return TRUE, got %d\n",
ret);
1752 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1755 ok(
ret ==
TRUE,
"Expected FlushConsoleInputBuffer to return TRUE, got %d\n",
ret);
1762 ok(
ret ==
TRUE,
"Expected WriteConsoleInputW to return TRUE, got %d\n",
ret);
1763 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1766 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1767 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1770 ok(
ret ==
TRUE,
"Expected WriteConsoleInputW to return TRUE, got %d\n",
ret);
1771 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1774 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1776 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1779 ok(
ret ==
TRUE,
"Expected FlushConsoleInputBuffer to return TRUE, got %d\n",
ret);
1781 for (
i = 0;
i <
sizeof(event_list)/
sizeof(event_list[0]);
i++)
1789 ok(
ret ==
TRUE,
"Expected WriteConsoleInputW to return TRUE, got %d\n",
ret);
1790 ok(
count ==
sizeof(event_list)/
sizeof(event_list[0]),
1791 "Expected count to be event list length, got %u\n",
count);
1794 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1795 ok(
count ==
sizeof(event_list)/
sizeof(event_list[0]),
1796 "Expected count to be event list length, got %u\n",
count);
1799 ok(
ret ==
TRUE,
"Expected WriteConsoleInputW to return TRUE, got %d\n",
ret);
1800 ok(
count ==
sizeof(event_list)/
sizeof(event_list[0]),
1801 "Expected count to be event list length, got %u\n",
count);
1804 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1805 ok(
count == 2*
sizeof(event_list)/
sizeof(event_list[0]),
1806 "Expected count to be twice event list length, got %u\n",
count);
1810 ok(
ret ==
TRUE,
"Expected WriteConsoleInputW to return TRUE, got %d\n",
ret);
1811 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1814 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1816 ok(
count == 2*
sizeof(event_list)/
sizeof(event_list[0]),
1817 "Expected count to be twice event list length, got %u\n",
count);
1820 ok(
ret ==
TRUE,
"Expected FlushConsoleInputBuffer to return TRUE, got %d\n",
ret);
1834 ok(
ret ==
TRUE,
"Expected WriteConsoleInputW to return TRUE, got %d\n",
ret);
1835 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1838 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1839 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1842 ok(
ret ==
TRUE,
"Expected WriteConsoleInputW to return TRUE, got %d\n",
ret);
1843 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1846 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1847 ok(
count == 2,
"Expected count to be 2, got %u\n",
count);
1850 ok(
ret ==
TRUE,
"Expected FlushConsoleInputBuffer to return TRUE, got %d\n",
ret);
1857 ok(
ret ==
TRUE,
"Expected WriteConsoleInputW to return TRUE, got %d\n",
ret);
1858 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1861 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1862 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1868 ok(
ret ==
TRUE,
"Expected WriteConsoleInputW to return TRUE, got %d\n",
ret);
1869 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1872 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1873 ok(
count == 2,
"Expected count to be 2, got %u\n",
count);
1879 ok(
ret ==
TRUE,
"Expected WriteConsoleInputW to return TRUE, got %d\n",
ret);
1880 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1883 ok(
ret ==
TRUE,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d\n",
ret);
1884 ok(
count == 3,
"Expected count to be 3, got %u\n",
count);
1888 ok(
ret ==
TRUE,
"Expected SetConsoleMode to return TRUE, got %d\n",
ret);
1893 static const char output[] = {
'a', 0};
1935 for (
i = 0;
i <
sizeof(invalid_table)/
sizeof(invalid_table[0]);
i++)
1937 if (invalid_table[
i].win7_crash)
1941 if (invalid_table[
i].lpNumCharsWritten)
count = 0xdeadbeef;
1943 invalid_table[
i].
str,
1946 invalid_table[
i].lpNumCharsWritten);
1947 ok(!
ret,
"[%d] Expected WriteConsoleOutputCharacterA to return FALSE, got %d\n",
i,
ret);
1948 if (invalid_table[
i].lpNumCharsWritten)
1951 "[%d] Expected count to be %u, got %u\n",
1955 "[%d] Expected last error to be %u, got %u\n",
1961 ok(
ret ==
TRUE,
"Expected WriteConsoleOutputCharacterA to return TRUE, got %d\n",
ret);
1962 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
1966 ok(
ret ==
TRUE,
"Expected WriteConsoleOutputCharacterA to return TRUE, got %d\n",
ret);
1967 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
1971 ok(
ret ==
TRUE,
"Expected WriteConsoleOutputCharacterA to return TRUE, got %d\n",
ret);
1972 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
1977 static const WCHAR outputW[] = {
'a',0};
2019 for (
i = 0;
i <
sizeof(invalid_table)/
sizeof(invalid_table[0]);
i++)
2021 if (invalid_table[
i].win7_crash)
2025 if (invalid_table[
i].lpNumCharsWritten)
count = 0xdeadbeef;
2027 invalid_table[
i].
str,
2030 invalid_table[
i].lpNumCharsWritten);
2031 ok(!
ret,
"[%d] Expected WriteConsoleOutputCharacterW to return FALSE, got %d\n",
i,
ret);
2032 if (invalid_table[
i].lpNumCharsWritten)
2035 "[%d] Expected count to be %u, got %u\n",
2039 "[%d] Expected last error to be %u, got %u\n",
2045 ok(
ret ==
TRUE,
"Expected WriteConsoleOutputCharacterW to return TRUE, got %d\n",
ret);
2046 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
2050 ok(
ret ==
TRUE,
"Expected WriteConsoleOutputCharacterW to return TRUE, got %d\n",
ret);
2051 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
2055 ok(
ret ==
TRUE,
"Expected WriteConsoleOutputCharacterW to return TRUE, got %d\n",
ret);
2056 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
2102 for (
i = 0;
i <
sizeof(invalid_table)/
sizeof(invalid_table[0]);
i++)
2104 if (invalid_table[
i].win7_crash)
2108 if (invalid_table[
i].lpNumAttrsWritten)
count = 0xdeadbeef;
2110 invalid_table[
i].
attr,
2113 invalid_table[
i].lpNumAttrsWritten);
2114 ok(!
ret,
"[%d] Expected WriteConsoleOutputAttribute to return FALSE, got %d\n",
i,
ret);
2115 if (invalid_table[
i].lpNumAttrsWritten)
2118 "[%d] Expected count to be %u, got %u\n",
2122 "[%d] Expected last error to be %u, got %u\n",
2128 ok(
ret ==
TRUE,
"Expected WriteConsoleOutputAttribute to return TRUE, got %d\n",
ret);
2129 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
2133 ok(
ret ==
TRUE,
"Expected WriteConsoleOutputAttribute to return TRUE, got %d\n",
ret);
2134 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
2138 ok(
ret ==
TRUE,
"Expected WriteConsoleOutputAttribute to return TRUE, got %d\n",
ret);
2139 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
2172 for (
i = 0;
i <
sizeof(invalid_table)/
sizeof(invalid_table[0]);
i++)
2174 if (invalid_table[
i].win7_crash)
2178 if (invalid_table[
i].lpNumCharsWritten)
count = 0xdeadbeef;
2180 invalid_table[
i].ch,
2183 invalid_table[
i].lpNumCharsWritten);
2184 ok(!
ret,
"[%d] Expected FillConsoleOutputCharacterA to return FALSE, got %d\n",
i,
ret);
2186 "[%d] Expected last error to be %u, got %u\n",
2192 ok(
ret ==
TRUE,
"Expected FillConsoleOutputCharacterA to return TRUE, got %d\n",
ret);
2193 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
2197 ok(
ret ==
TRUE,
"Expected FillConsoleOutputCharacterA to return TRUE, got %d\n",
ret);
2198 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
2231 for (
i = 0;
i <
sizeof(invalid_table)/
sizeof(invalid_table[0]);
i++)
2233 if (invalid_table[
i].win7_crash)
2237 if (invalid_table[
i].lpNumCharsWritten)
count = 0xdeadbeef;
2239 invalid_table[
i].ch,
2242 invalid_table[
i].lpNumCharsWritten);
2243 ok(!
ret,
"[%d] Expected FillConsoleOutputCharacterW to return FALSE, got %d\n",
i,
ret);
2245 "[%d] Expected last error to be %u, got %u\n",
2251 ok(
ret ==
TRUE,
"Expected FillConsoleOutputCharacterW to return TRUE, got %d\n",
ret);
2252 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
2256 ok(
ret ==
TRUE,
"Expected FillConsoleOutputCharacterW to return TRUE, got %d\n",
ret);
2257 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
2290 for (
i = 0;
i <
sizeof(invalid_table)/
sizeof(invalid_table[0]);
i++)
2292 if (invalid_table[
i].win7_crash)
2296 if (invalid_table[
i].lpNumAttrsWritten)
count = 0xdeadbeef;
2298 invalid_table[
i].
attr,
2301 invalid_table[
i].lpNumAttrsWritten);
2302 ok(!
ret,
"[%d] Expected FillConsoleOutputAttribute to return FALSE, got %d\n",
i,
ret);
2304 "[%d] Expected last error to be %u, got %u\n",
2310 ok(
ret ==
TRUE,
"Expected FillConsoleOutputAttribute to return TRUE, got %d\n",
ret);
2311 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
2315 ok(
ret ==
TRUE,
"Expected FillConsoleOutputAttribute to return TRUE, got %d\n",
ret);
2316 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
2320 ok(
ret ==
TRUE,
"Expected FillConsoleOutputAttribute to return TRUE, got %d\n",
ret);
2321 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
2368 for (
i = 0;
i <
sizeof(invalid_table)/
sizeof(invalid_table[0]);
i++)
2370 if (invalid_table[
i].win7_crash)
2374 if (invalid_table[
i].read_count)
count = 0xdeadbeef;
2379 invalid_table[
i].read_count);
2380 ok(!
ret,
"[%d] Expected ReadConsoleOutputCharacterA to return FALSE, got %d\n",
i,
ret);
2381 if (invalid_table[
i].read_count)
2384 "[%d] Expected count to be %u, got %u\n",
2388 "[%d] Expected last error to be %u, got %u\n",
2394 ok(
ret ==
TRUE,
"Expected ReadConsoleOutputCharacterA to return TRUE, got %d\n",
ret);
2395 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
2399 ok(
ret ==
TRUE,
"Expected ReadConsoleOutputCharacterA to return TRUE, got %d\n",
ret);
2400 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
2404 ok(
ret ==
TRUE,
"Expected ReadConsoleOutputCharacterA to return TRUE, got %d\n",
ret);
2405 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
2452 for (
i = 0;
i <
sizeof(invalid_table)/
sizeof(invalid_table[0]);
i++)
2454 if (invalid_table[
i].win7_crash)
2458 if (invalid_table[
i].read_count)
count = 0xdeadbeef;
2463 invalid_table[
i].read_count);
2464 ok(!
ret,
"[%d] Expected ReadConsoleOutputCharacterW to return FALSE, got %d\n",
i,
ret);
2465 if (invalid_table[
i].read_count)
2468 "[%d] Expected count to be %u, got %u\n",
2472 "[%d] Expected last error to be %u, got %u\n",
2478 ok(
ret ==
TRUE,
"Expected ReadConsoleOutputCharacterW to return TRUE, got %d\n",
ret);
2479 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
2483 ok(
ret ==
TRUE,
"Expected ReadConsoleOutputCharacterW to return TRUE, got %d\n",
ret);
2484 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
2488 ok(
ret ==
TRUE,
"Expected ReadConsoleOutputCharacterW to return TRUE, got %d\n",
ret);
2489 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
2535 for (
i = 0;
i <
sizeof(invalid_table)/
sizeof(invalid_table[0]);
i++)
2537 if (invalid_table[
i].win7_crash)
2541 if (invalid_table[
i].read_count)
count = 0xdeadbeef;
2543 invalid_table[
i].lpAttribute,
2546 invalid_table[
i].read_count);
2547 ok(!
ret,
"[%d] Expected ReadConsoleOutputAttribute to return FALSE, got %d\n",
i,
ret);
2548 if (invalid_table[
i].read_count)
2551 "[%d] Expected count to be %u, got %u\n",
2555 "[%d] Expected last error to be %u, got %u\n",
2561 ok(
ret ==
TRUE,
"Expected ReadConsoleOutputAttribute to return TRUE, got %d\n",
ret);
2562 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
2566 ok(
ret ==
TRUE,
"Expected ReadConsoleOutputAttribute to return TRUE, got %d\n",
ret);
2567 ok(
count == 0,
"Expected count to be 0, got %u\n",
count);
2571 ok(
ret ==
TRUE,
"Expected ReadConsoleOutputAttribute to return TRUE, got %d\n",
ret);
2572 ok(
count == 1,
"Expected count to be 1, got %u\n",
count);
2587 skip(
"stdin is redirected\n");
2593 "expected ERROR_INVALID_HANDLE, got %d\n",
GetLastError());
2598 ok(!
ret,
"expected 0, got %u\n",
ret);
2601 "expected ERROR_NOT_ENOUGH_MEMORY, got %d\n",
GetLastError());
2607 ok(!
ret,
"expected 0, got %u\n",
ret);
2610 "expected ERROR_NOT_ENOUGH_MEMORY, got %d\n",
GetLastError());
2611 ok(
bytes == 0xdeadbeef,
"expected 0xdeadbeef, got %#x\n",
bytes);
2616 ok(!
ret,
"expected 0, got %u\n",
ret);
2619 "expected ERROR_NOT_ENOUGH_MEMORY, got %d\n",
GetLastError());
2620 ok(
bytes == 0xdeadbeef,
"expected 0xdeadbeef, got %#x\n",
bytes);
2634 ok(!
ret,
"got %d, expected 0\n",
ret);
2642 ok(!
ret,
"got %d, expected 0\n",
ret);
2650 ok(!
ret,
"got %d, expected 0\n",
ret);
2658 ok(!
ret,
"got %d, expected 0\n",
ret);
2666 ok(
ret,
"got %d, expected non-zero\n",
ret);
2680 ok(
ret,
"got %d, expected non-zero\n",
ret);
2703 ok(!
c.X,
"got %d, expected 0\n",
c.X);
2704 ok(!
c.Y,
"got %d, expected 0\n",
c.Y);
2710 ok(!
c.X,
"got %d, expected 0\n",
c.X);
2711 ok(!
c.Y,
"got %d, expected 0\n",
c.Y);
2722 ok(
c.X == font_width,
"got %d, expected %d\n",
c.X, font_width);
2727 if (!pGetNumberOfConsoleFonts)
2729 win_skip(
"GetNumberOfConsoleFonts is not available\n");
2732 index = pGetNumberOfConsoleFonts();
2738 ok(!
c.X,
"got %d, expected 0\n",
c.X);
2739 ok(!
c.Y,
"got %d, expected 0\n",
c.Y);
2746 LONG workarea_w, workarea_h, maxcon_w, maxcon_h;
2759 ok(!
c.X,
"got %d, expected 0\n",
c.X);
2760 ok(!
c.Y,
"got %d, expected 0\n",
c.Y);
2766 ok(!
c.X,
"got %d, expected 0\n",
c.X);
2767 ok(!
c.Y,
"got %d, expected 0\n",
c.Y);
2770 workarea_w =
r.right -
r.left;
2778 if (!pGetNumberOfConsoleFonts)
2780 win_skip(
"GetNumberOfConsoleFonts is not available\n");
2784 if (!pSetConsoleFont)
2786 win_skip(
"SetConsoleFont is not available\n");
2790 for (
i = 0;
i < pGetNumberOfConsoleFonts();
i++)
2792 pSetConsoleFont(std_output,
i);
2799 maxcon_w = workarea_w /
font.X;
2800 maxcon_h = workarea_h /
font.Y;
2801 ok(
c.X == maxcon_w ||
c.X == maxcon_w - 1 ,
"got %d, expected %d\n",
c.X, maxcon_w);
2802 ok(
c.Y == maxcon_h ||
c.Y == maxcon_h - 1 ,
"got %d, expected %d\n",
c.Y, maxcon_h);
2811 pSetConsoleFont(std_output,
index);
2820 int memsize, win_width, win_height, tmp_w, tmp_h;
2824 COORD orig_sb_size, tmp_sb_size, orig_font, tmp_font;
2828 if (!pGetConsoleFontInfo)
2830 win_skip(
"GetConsoleFontInfo is not available\n");
2835 if (!pGetNumberOfConsoleFonts)
2837 win_skip(
"GetNumberOfConsoleFonts is not available\n");
2841 num_fonts = pGetNumberOfConsoleFonts();
2847 orig_sb_size = csbi.
dwSize;
2854 ok(!
ret,
"got %d, expected zero\n",
ret);
2859 ok(!
ret,
"got %d, expected zero\n",
ret);
2863 ret = pGetConsoleFontInfo(std_output,
FALSE, 0, cfi);
2864 ok(!
ret,
"got %d, expected zero\n",
ret);
2876 ret = pGetConsoleFontInfo(std_output,
FALSE, num_fonts, cfi);
2879 todo_wine ok(cfi[
index].dwFontSize.X == win_width,
"got %d, expected %d\n",
2881 todo_wine ok(cfi[
index].dwFontSize.Y == win_height,
"got %d, expected %d\n",
2884 for (
i = 0;
i < num_fonts;
i++)
2886 ok(cfi[
i].nFont ==
i,
"element out of order, got nFont %d, expected %d\n", cfi[
i].nFont,
i);
2888 tmp_w = (
double)orig_font.
X / tmp_font.
X * win_width;
2889 tmp_h = (
double)orig_font.
Y / tmp_font.
Y * win_height;
2896 ok(!
ret,
"got %d, expected zero\n",
ret);
2901 ok(!
ret,
"got %d, expected zero\n",
ret);
2905 ret = pGetConsoleFontInfo(std_output,
TRUE, 0, cfi);
2906 ok(!
ret,
"got %d, expected zero\n",
ret);
2910 ret = pGetConsoleFontInfo(std_output,
TRUE, num_fonts, cfi);
2918 for (
i = 0;
i < num_fonts;
i++)
2920 ok(cfi[
i].nFont ==
i,
"element out of order, got nFont %d, expected %d\n", cfi[
i].nFont,
i);
2941 pSetConsoleFont = (
void