103
104static const int GETSCAN[]={0, 0x38, 0x38, 0x2D, 0x2D, 0x2A, 0x2A, 0x1D, 0x1D };
105
107
108static const char *
getdesc[]={
"",
"+alt",
"-alt",
"+X",
"-X",
"+shift",
"-shift",
"+ctrl",
"-ctrl"};
109
110
111typedef struct
112{
114 union
115 {
121
122typedef struct {
127
128
129
130
131
132
133static const struct {
142 { 0 }
143};
144
145
146
150
151
153{
155
156#define GET_PROC(func) \
157 if (!(p ## func = (void*)GetProcAddress(hdll, #func))) \
158 trace("GetProcAddress(%s) failed\n", #func)
159
160 GET_PROC(GetCurrentInputMessageSource);
167#undef GET_PROC
168}
169
171{
175
178
180 {
189 }
192 }
193 else
194 {
199
205 }
206 }
207
209
211 if( pwParam) *pwParam = VKey;
213}
214
215
216
217
218
219
220
221
222
223
225{
232
236 {
244
248 else
250 }
252 ;
255 ok(
ret == evtctr,
"SendInput failed to send some events\n");
258 trace(
"======== key stroke sequence #%d: %s =============\n",
262 trace(
"message[%d] %-15s wParam %04lx lParam %08lx time %x\n",
i,
265 ok(
msg.message == expmsg[
i].message &&
266 msg.wParam == expmsg[
i].wParam &&
267 msg.lParam == expmsg[
i].lParam,
268 "%u/%u: wrong message %x/%08lx/%08lx expected %s/%08lx/%08lx\n",
269 seqnr,
i,
msg.message,
msg.wParam,
msg.lParam,
271 }
273 }
275 trace(
"%d messages retrieved\n",
i);
277 {
278 skip(
"simulated keyboard input doesn't work\n" );
280 }
281 ok(
i == kmctr,
"message count is wrong: got %d expected: %d\n",
i, kmctr);
283}
284
285
287{
293
298 kbuf[1] = kevdwn[1-
i];
300 kbuf[3] = kevup[1-
j];
302 }
303 }
304 }
305
311 if(
k==
i ||
k==
j)
continue;
316 if(
n==
l ||
n==
m)
continue;
324 }
325 }
326 }
327 }
328 }
329 }
330 }
332}
333
334
336{
340}
341
344{
346}
347
349{
353
365
374
375
377
381}
382
384{
386}
387
389{
391}
392
393
395{
397 int diff = 200;
398 int min_timeout = 50;
400
401 while (diff > 0)
402 {
405 {
407 ok(
msg.time != 0,
"message %#x has time set to 0\n",
msg.message);
408
411 }
413 }
414}
415
420};
421
422typedef enum {
434
440};
441
449
450
453 {
'F', 0,
FALSE, {{
'F', 0x00}, {0}},
461
462
463
466 {
'O', 0,
FALSE, {{
'O', 0x00}, {0}},
472
473
474
479 {
'X', 0,
FALSE, {{
'X', 0x00}, {0}},
487
488
489
492 {
'A', 0,
FALSE, {{
'A', 0x00}, {0}},
498
499
500
502
510
511
512
521
522
531
532
533
534
535
536
537
546
547
556
557
558
559
568
569
578
579
588
589
598
599
608
609
610
611
613 {{
VK_MENU, 0x00}, {
VK_LMENU, 0x00}, {
VK_CONTROL, 0x00, 1}, {
VK_LCONTROL, 0x01, 1}, {0}},
619 {{
VK_MENU, 0x80}, {
VK_LMENU, 0x80}, {
VK_CONTROL, 0x81, 1}, {
VK_LCONTROL, 0x80, 1}, {0}},
625
626
636
637
639 {{
VK_MENU, 0x00}, {
VK_RMENU, 0x00}, {
VK_CONTROL, 0x00, 1}, {
VK_LCONTROL, 0x01, 1}, {0}},
645 {{
VK_MENU, 0x80}, {
VK_RMENU, 0x80}, {
VK_CONTROL, 0x81, 1}, {
VK_LCONTROL, 0x80, 1}, {0}},
651
652
662
663
665 {{
VK_MENU, 0x00}, {
VK_RMENU, 0x00}, {
VK_CONTROL, 0x00, 1}, {
VK_LCONTROL, 0x01, 1}, {0}},
670 {{
VK_MENU, 0x80}, {
VK_RMENU, 0x80}, {
VK_CONTROL, 0x81, 1}, {
VK_LCONTROL, 0x80, 1}, {0}},
675
676
677
694
695 {0, 0,
FALSE, {{0}}, {{0}}}
696};
697
700
701
704{
705 int i, failcount = 0;
709
710 while (
t->wVk && foreground) {
711
712
713 BOOL matched = ((ks1[
t->wVk]&0x80) == (
t->before_state&0x80)
714 && (ks2[
t->wVk]&0x80) == (~
t->before_state&0x80));
715
716 if (!matched && !
t->optional &&
test->_todo_wine)
717 {
718 failcount++;
720 ok(matched,
"%2d (%x/%x): %02x from %02x -> %02x "
721 "instead of %02x -> %02x\n",
id,
test->wVk,
test->dwFlags,
722 t->wVk, ks1[
t->wVk]&0x80, ks2[
t->wVk]&0x80,
t->before_state,
723 ~
t->before_state&0x80);
724 }
725 } else {
726 ok(matched ||
t->optional,
"%2d (%x/%x): %02x from %02x -> %02x "
727 "instead of %02x -> %02x\n",
id,
test->wVk,
test->dwFlags,
728 t->wVk, ks1[
t->wVk]&0x80, ks2[
t->wVk]&0x80,
t->before_state,
729 ~
t->before_state&0x80);
730 }
731 ks2[
t->wVk] = ks1[
t->wVk];
733 }
734 for (
i = 0;
i < 256;
i++)
735 if (ks2[
i] != ks1[
i] &&
test->_todo_wine)
736 {
737 failcount++;
739 ok(
FALSE,
"%2d (%x/%x): %02x from %02x -> %02x unexpected\n",
741 }
742 else
743 ok(ks2[
i] == ks1[
i],
"%2d (%x/%x): %02x from %02x -> %02x unexpected\n",
745
747 {
749
751 {
753 {
755 {
757 continue;
758 }
760 {
761 failcount++;
763 ok(
FALSE,
"%2d (%x/%x): in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
765 }
766 else
768 "%2d (%x/%x): in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
770 }
772 {
774 {
775 failcount++;
777 ok(
FALSE,
"%2d (%x/%x): in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
779 }
780 else
782 "%2d (%x/%x): in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
784 }
786 "%2d (%x/%x): the msg 0x%04x should have been sent by a hook\n",
788
789 }
791 {
793 continue;
794 }
796 {
797
798
800 continue;
801 }
802
806 {
808 "%2d (%x/%x): the msg 0x%04x should have been sent by a hook\n",
810 }
811
812
816 {
818 "%2d (%x/%x): the msg 0x%04x was expected, but got msg 0x%04x instead\n",
820 }
821 else if (
test->_todo_wine)
822 {
823 failcount++;
826 "%2d (%x/%x): the msg 0x%04x was expected, but got msg 0x%04x instead\n",
828 }
829 else
831 "%2d (%x/%x): the msg 0x%04x was expected, but got msg 0x%04x instead\n",
833
834 actual_cnt++;
836 }
837
840
841
843 {
844 if (
test->_todo_wine)
845 {
846 failcount++;
848 ok(
FALSE,
"%2d (%x/%x): the msg sequence is not complete: expected %04x - actual %04x\n",
850 }
851 else
852 ok(
FALSE,
"%2d (%x/%x): the msg sequence is not complete: expected %04x - actual %04x\n",
854 }
855
856 if(
test->_todo_wine && !failcount)
858 ok(
TRUE,
"%2d (%x/%x): marked \"todo_wine\" but succeeds\n",
id,
test->wVk,
test->dwFlags);
859
861}
862
863
866{
868
870 {
873 {
878 }
879 }
881}
882
884{
886
888 {
891 {
896 }
897
898if(0)
899{
904}
905
907 trace(
"Hook: w=%lx vk:%8x sc:%8x fl:%8x %lx\n",
wparam,
909 }
911}
913{
915 int ii;
916 BYTE ks1[256], ks2[256];
921
923 {
924 skip(
"Skipping Input_blackbox test on non-US keyboard\n");
925 return;
926 }
933 if (!foreground)
934 skip(
"Failed to set foreground window; some tests will be skipped.\n");
935
937 {
939 win_skip(
"WH_KEYBOARD_LL is not supported\n");
940 return;
941 }
942
943
944
946
949
952 i.u.ki.dwExtraInfo = 0;
953
956 i.u.ki.wScan = ii+1 ;
963 }
964
968}
969
971{
985}
986
988{
991
992
996
997
1001
1007 }
1009 }
1012 "Last keydown msg should have been VK_PACKET[0x%04x] (was: 0x%x)\n", VK_PACKET,
key_status.last_key_down);
1014 "Last char msg wparam should have been 0x3c0 (was: 0x%x)\n",
key_status.last_char);
1017 "Last hookdown msg should have been 0x3c0, was: 0x%x\n",
key_status.last_hook_down);
1018 }
1019
1020 inputs[1].u.
ki.
wVk = 0;
1023
1029 }
1031 }
1034 "Last keyup msg should have been VK_PACKET[0x%04x] (was: 0x%x)\n", VK_PACKET,
key_status.last_key_up);
1037 "Last hookup msg should have been 0x3c0, was: 0x%x\n",
key_status.last_hook_up);
1038 }
1039
1040
1044
1045 inputs[1].u.
ki.
wVk = 0;
1046 inputs[1].u.
ki.
wScan = 0x3041;
1047 inputs[1].u.
ki.
dwFlags = KEYEVENTF_UNICODE;
1048
1055 }
1057 }
1060 "Last syskeydown msg should have been VK_PACKET[0x%04x] (was: 0x%x)\n", VK_PACKET,
key_status.last_syskey_down);
1062 "Last syschar msg should have been 0x3041 (was: 0x%x)\n",
key_status.last_syschar);
1065 "Last hooksysdown msg should have been 0x3041, was: 0x%x\n",
key_status.last_hook_syskey_down);
1066 }
1067
1068 inputs[1].u.
ki.
wVk = 0;
1069 inputs[1].u.
ki.
wScan = 0x3041;
1071
1075
1082 }
1084 }
1087 "Last keyup msg should have been VK_PACKET[0x%04x] (was: 0x%x)\n", VK_PACKET,
key_status.last_key_up);
1090 "Last hook up msg should have been 0x3041, was: 0x%x\n",
key_status.last_hook_up);
1091 }
1092
1093
1094 inputs[0].u.
ki.
wVk = 0x51;
1096 inputs[0].u.
ki.
dwFlags = KEYEVENTF_UNICODE;
1097
1098 inputs[1].u.
ki.
wVk = 0x51;
1101
1105 {
1108 }
1109
1111 {
1117 }
1118}
1119
1122{
1126 break;
1129 break;
1132 break;
1135 break;
1138 break;
1141 break;
1142 }
1144}
1145
1147{
1152 win_skip(
"SendInput doesn't support unicode on this platform\n");
1153 }else{
1157 }else
1160 }
1164 break;
1167 break;
1170 break;
1173 break;
1174 }
1175 }
1177}
1178
1180{
1181 WCHAR classNameW[] = {
'I',
'n',
'p',
'u',
't',
'U',
'n',
'i',
'c',
'o',
'd',
'e',
1182 'K','e','y','T','e','s','t','C','l','a','s','s',0};
1183 WCHAR windowNameW[] = {
'I',
'n',
'p',
'u',
't',
'U',
'n',
'i',
'c',
'o',
'd',
'e',
1184 'K','e','y','T','e','s','t',0};
1191
1203 win_skip(
"Unicode functions not supported\n");
1204 return;
1205 }
1206
1208 if (hModuleImm32) {
1209 pImmDisableIME = (
void *)
GetProcAddress(hModuleImm32,
"ImmDisableIME");
1210 if (pImmDisableIME)
1211 pImmDisableIME(0);
1212 }
1213 pImmDisableIME =
NULL;
1215
1216
1220
1223
1226 win_skip(
"unable to set WH_KEYBOARD_LL hook\n");
1227
1232
1233
1235
1237
1239
1243}
1244
1246{
1249
1250 for (
i = 0;
i < 512;
i++)
1251 {
1254 ok(
len || !
buff[0],
"%d: Buffer is not zeroed\n",
i);
1255 }
1256}
1257
1260#define STEP 3
1261
1263{
1266
1268 {
1269
1271
1274
1275
1282 else
1283 ok(pt1.
x ==
pt.x && pt1.
y ==
pt.y,
"Wrong set pos: (%d,%d)\n", pt1.
x, pt1.
y);
1284 }
1286}
1287
1289{
1292
1294 {
1297
1298
1302 else
1304 }
1306}
1307
1309{
1311
1313 {
1314
1317 }
1319}
1320
1322{
1324 HHOOK hook1, hook2;
1327
1332
1334 {
1335 win_skip(
"cannot set MOUSE_LL hook\n" );
1336 goto done;
1337 }
1339
1353
1354 SetRect(&rc, 50, 50, 151, 151);
1357
1367
1372
1373
1374
1375
1376
1385
1392
1395
1396 SetRect(&rc, 150, 150, 150, 150);
1399
1421
1424
1426 SetRect(&rc, 150, 150, 150, 150);
1431
1433 SetRect(&rc, 150, 150, 150, 150);
1439
1441 SetRect(&rc, 150, 150, 150, 150);
1447
1449
1450done:
1453}
1454
1456{
1457#define BUFLIM 64
1458#define MYERROR 0xdeadbeef
1461 MOUSEMOVEPOINT
out[200];
1463
1464
1467 return;
1468 }
1469 memset(&
in, 0,
sizeof(MOUSEMOVEPOINT));
1472
1473
1474
1475
1476
1478 retval = pGetMouseMovePointsEx(0, &
in,
out,
BUFLIM, GMMP_USE_DISPLAY_POINTS);
1480 {
1481 win_skip(
"GetMouseMovePointsEx broken on WinME\n" );
1482 return;
1483 }
1484 ok(retval == -1,
"expected GetMouseMovePointsEx to fail, got %d\n", retval);
1486 "expected error ERROR_INVALID_PARAMETER, got %u\n",
GetLastError());
1487
1489 retval = pGetMouseMovePointsEx(
sizeof(MOUSEMOVEPOINT)-1, &
in,
out,
BUFLIM, GMMP_USE_DISPLAY_POINTS);
1490 ok(retval == -1,
"expected GetMouseMovePointsEx to fail, got %d\n", retval);
1492 "expected error ERROR_INVALID_PARAMETER, got %u\n",
GetLastError());
1493
1495 retval = pGetMouseMovePointsEx(
sizeof(MOUSEMOVEPOINT)+1, &
in,
out,
BUFLIM, GMMP_USE_DISPLAY_POINTS);
1496 ok(retval == -1,
"expected GetMouseMovePointsEx to fail, got %d\n", retval);
1498 "expected error ERROR_INVALID_PARAMETER, got %u\n",
GetLastError());
1499
1500
1501
1503 retval = pGetMouseMovePointsEx(
sizeof(MOUSEMOVEPOINT),
NULL,
out,
BUFLIM, GMMP_USE_DISPLAY_POINTS);
1504 ok(retval == -1,
"expected GetMouseMovePointsEx to fail, got %d\n", retval);
1506 "expected error ERROR_NOACCESS, got %u\n",
GetLastError());
1507
1509 retval = pGetMouseMovePointsEx(
sizeof(MOUSEMOVEPOINT), &
in,
NULL,
BUFLIM, GMMP_USE_DISPLAY_POINTS);
1510 ok(retval == -1,
"expected GetMouseMovePointsEx to fail, got %d\n", retval);
1512 "expected error ERROR_NOACCESS, got %u\n",
GetLastError());
1513
1515 retval = pGetMouseMovePointsEx(
sizeof(MOUSEMOVEPOINT),
NULL,
NULL,
BUFLIM, GMMP_USE_DISPLAY_POINTS);
1516 ok(retval == -1,
"expected GetMouseMovePointsEx to fail, got %d\n", retval);
1518 "expected error ERROR_NOACCESS, got %u\n",
GetLastError());
1519
1522 retval = pGetMouseMovePointsEx(
sizeof(MOUSEMOVEPOINT), &
in,
NULL,
count, GMMP_USE_DISPLAY_POINTS);
1523 if (retval == -1)
1525 else
1526 ok(retval ==
count,
"expected GetMouseMovePointsEx to succeed, got %d\n", retval);
1527
1528
1529
1530
1533 retval = pGetMouseMovePointsEx(
sizeof(MOUSEMOVEPOINT), &
in,
out,
count, GMMP_USE_DISPLAY_POINTS);
1534 ok(retval ==
count,
"expected GetMouseMovePointsEx to fail, got %d\n", retval);
1536 "expected error ERROR_INVALID_PARAMETER, got %u\n",
GetLastError());
1537
1540 retval = pGetMouseMovePointsEx(
sizeof(MOUSEMOVEPOINT), &
in,
out,
count, GMMP_USE_DISPLAY_POINTS);
1541 if (retval == -1)
1543 else
1544 ok(retval ==
count,
"expected GetMouseMovePointsEx to succeed, got %d\n", retval);
1545
1548 retval = pGetMouseMovePointsEx(
sizeof(MOUSEMOVEPOINT), &
in,
out,
count, GMMP_USE_DISPLAY_POINTS);
1549 if (retval == -1)
1551 else
1552 ok((0 <= retval) && (retval <=
count),
"expected GetMouseMovePointsEx to succeed, got %d\n", retval);
1553
1555 retval = pGetMouseMovePointsEx(
sizeof(MOUSEMOVEPOINT), &
in,
out,
BUFLIM+1, GMMP_USE_DISPLAY_POINTS);
1556 ok(retval == -1,
"expected GetMouseMovePointsEx to fail, got %d\n", retval);
1558 "expected error ERROR_INVALID_PARAMETER, got %u\n",
GetLastError());
1559
1560
1561
1562
1564 retval = pGetMouseMovePointsEx(
sizeof(MOUSEMOVEPOINT)-1,
NULL,
out,
BUFLIM, GMMP_USE_DISPLAY_POINTS);
1565 ok(retval == -1,
"expected GetMouseMovePointsEx to fail, got %d\n", retval);
1567 "expected error ERROR_INVALID_PARAMETER, got %u\n",
GetLastError());
1568
1570 retval = pGetMouseMovePointsEx(
sizeof(MOUSEMOVEPOINT)-1, &
in,
NULL,
BUFLIM, GMMP_USE_DISPLAY_POINTS);
1571 ok(retval == -1,
"expected GetMouseMovePointsEx to fail, got %d\n", retval);
1573 "expected error ERROR_INVALID_PARAMETER, got %u\n",
GetLastError());
1574
1576 retval = pGetMouseMovePointsEx(
sizeof(MOUSEMOVEPOINT),
NULL,
out,
BUFLIM+1, GMMP_USE_DISPLAY_POINTS);
1577 ok(retval == -1,
"expected GetMouseMovePointsEx to fail, got %d\n", retval);
1579 "expected error ERROR_INVALID_PARAMETER, got %u\n",
GetLastError());
1580
1582 retval = pGetMouseMovePointsEx(
sizeof(MOUSEMOVEPOINT), &
in,
NULL,
BUFLIM+1, GMMP_USE_DISPLAY_POINTS);
1583 ok(retval == -1,
"expected GetMouseMovePointsEx to fail, got %d\n", retval);
1585 "expected error ERROR_INVALID_PARAMETER, got %u\n",
GetLastError());
1586
1587#undef BUFLIM
1588#undef MYERROR
1589}
1590
1592{
1593 RAWINPUTDEVICELIST
devices[32];
1594 UINT ret, oret, devcount, odevcount,
i;
1596
1600 ok(
ret == -1,
"expected -1, got %d\n",
ret);
1602
1606 ok(
ret == -1,
"expected -1, got %d\n",
ret);
1608
1609 devcount = 0;
1610 ret = pGetRawInputDeviceList(
NULL, &devcount,
sizeof(
devices[0]));
1611 ok(
ret == 0,
"expected 0, got %d\n",
ret);
1612 ok(devcount > 0,
"expected non-zero\n");
1613
1615 devcount = 0;
1618 ok(
ret == -1,
"expected -1, got %d\n",
ret);
1620 ok(devcount > 0,
"expected non-zero\n");
1621
1622
1624 ok(
ret > 0,
"expected non-zero\n");
1625
1626 for(
i = 0;
i < devcount; ++
i)
1627 {
1629 char nameA[128];
1631 RID_DEVICE_INFO
info;
1633
1634
1636 sz = 5;
1637 ret = pGetRawInputDeviceInfoW(
devices[
i].hDevice, RIDI_DEVICENAME,
name, &sz);
1638 ok(
ret == -1,
"GetRawInputDeviceInfo gave wrong failure: %d\n",
err);
1639 ok(sz > 5 && sz <
ARRAY_SIZE(
name),
"Size should have been set and not too large (got: %u)\n", sz);
1640
1641
1642 ret = pGetRawInputDeviceInfoW(
devices[
i].hDevice, RIDI_DEVICENAME,
name, &sz);
1643 ok(
ret == sz,
"GetRawInputDeviceInfo gave wrong return: %d\n",
err);
1645 ok(
len + 1 ==
ret,
"GetRawInputDeviceInfo returned wrong length (name: %u, ret: %u)\n",
len + 1,
ret);
1646
1647
1648 ret = pGetRawInputDeviceInfoA(
devices[
i].hDevice, RIDI_DEVICENAME, nameA, &sz);
1649 ok(
ret == sz,
"GetRawInputDeviceInfoA gave wrong return: %d\n",
err);
1651 ok(
len + 1 ==
ret,
"GetRawInputDeviceInfoA returned wrong length (name: %u, ret: %u)\n",
len + 1,
ret);
1652
1653
1656 sz =
sizeof(
info) - 1;
1657 ret = pGetRawInputDeviceInfoW(
devices[
i].hDevice, RIDI_DEVICEINFO, &
info, &sz);
1658 ok(
ret == -1,
"GetRawInputDeviceInfo gave wrong failure: %d\n",
err);
1659 ok(sz ==
sizeof(
info),
"GetRawInputDeviceInfo set wrong size\n");
1660
1661 ret = pGetRawInputDeviceInfoW(
devices[
i].hDevice, RIDI_DEVICEINFO, &
info, &sz);
1662 ok(
ret ==
sizeof(
info),
"GetRawInputDeviceInfo gave wrong return: %d\n",
err);
1663 ok(sz ==
sizeof(
info),
"GetRawInputDeviceInfo set wrong size\n");
1664 ok(
info.dwType ==
devices[
i].dwType,
"GetRawInputDeviceInfo set wrong type: 0x%x\n",
info.dwType);
1665
1668 ret = pGetRawInputDeviceInfoA(
devices[
i].hDevice, RIDI_DEVICEINFO, &
info, &sz);
1669 ok(
ret ==
sizeof(
info),
"GetRawInputDeviceInfo gave wrong return: %d\n",
err);
1670 ok(sz ==
sizeof(
info),
"GetRawInputDeviceInfo set wrong size\n");
1671 ok(
info.dwType ==
devices[
i].dwType,
"GetRawInputDeviceInfo set wrong type: 0x%x\n",
info.dwType);
1672
1673
1674
1680 }
1681
1682
1685 ok(
ret > 0,
"expected non-zero\n");
1686 ok(devcount == odevcount,
"expected %d, got %d\n", devcount, odevcount);
1687 devcount = odevcount;
1689 ret = pGetRawInputDeviceList(
NULL, &odevcount,
sizeof(
devices[0]));
1690 ok(
ret == 0,
"expected 0, got %d\n",
ret);
1691 ok(odevcount == oret,
"expected %d, got %d\n", oret, odevcount);
1692}
1693
1695{
1698
1699
1701 ok(
ret == ~0
U,
"Expect ret %u, got %u\n", ~0
U,
ret);
1702}
1703
1705{
1709 static const UINT numpad_collisions[][2] = {
1719 };
1720
1722 ok(
s != 0,
"MapVirtualKeyEx(VK_SHIFT) should return non-zero\n");
1725 "%x != %x\n",
s, sL);
1726
1728 ok(kL ==
VK_SHIFT,
"Scan code -> vKey = %x (not VK_SHIFT)\n", kL);
1730 ok(kR ==
VK_SHIFT,
"Scan code -> vKey = %x (not VK_SHIFT)\n", kR);
1731
1734 "Scan code -> vKey = %x (not VK_LSHIFT)\n", kL);
1737 "Scan code -> vKey = %x (not VK_RSHIFT)\n", kR);
1738
1739
1741 {
1744
1745
1746 if (numpad_scan && other_scan == numpad_scan)
1747 {
1749 ok(vkey != numpad_collisions[
i][0],
1750 "Got numpad vKey %x for scan code %x when there was another choice\n",
1751 vkey, numpad_scan);
1752 }
1753 }
1754}
1755
1756#define shift 1
1757#define ctrl 2
1758
1760{
1767{
1768 { 'A', 0, 0, 1, {'a',0}},
1769 {
'A',
ctrl, 0, 1, {1, 0}},
1775 {
'4',
ctrl, 0, 0, {0}},
1777 { 0,
ctrl,
'!', 0, {0}},
1778 { 0,
ctrl,
'\"', 0, {0}},
1779 { 0,
ctrl,
'#', 0, {0}},
1780 { 0,
ctrl,
'$', 0, {0}},
1781 { 0,
ctrl,
'%', 0, {0}},
1782 { 0,
ctrl,
'\'', 0, {0}},
1783 { 0,
ctrl,
'(', 0, {0}},
1784 { 0,
ctrl,
')', 0, {0}},
1785 { 0,
ctrl,
'*', 0, {0}},
1786 { 0,
ctrl,
'+', 0, {0}},
1787 { 0,
ctrl,
',', 0, {0}},
1788 { 0,
ctrl,
'-', 0, {0}},
1789 { 0,
ctrl,
'.', 0, {0}},
1790 { 0,
ctrl,
'/', 0, {0}},
1791 { 0,
ctrl,
':', 0, {0}},
1792 { 0,
ctrl,
';', 0, {0}},
1793 { 0,
ctrl,
'<', 0, {0}},
1794 { 0,
ctrl,
'=', 0, {0}},
1795 { 0,
ctrl,
'>', 0, {0}},
1796 { 0,
ctrl,
'?', 0, {0}},
1797 { 0,
ctrl,
'@', 1, {0}},
1798 { 0,
ctrl,
'[', 1, {0x1b}},
1799 { 0,
ctrl,
'\\', 1, {0x1c}},
1800 { 0,
ctrl,
']', 1, {0x1d}},
1801 { 0,
ctrl,
'^', 1, {0x1e}},
1802 { 0,
ctrl,
'_', 1, {0x1f}},
1803 { 0,
ctrl,
'`', 0, {0}},
1807};
1808
1810{
1813 const BYTE SC_RETURN = 0x1c, SC_TAB = 0x0f, SC_A = 0x1e;
1814 const BYTE HIGHEST_BIT = 0x80;
1817
1818 for(
i=0;
i<256;
i++)
1820
1821 wStr[1] = 0xAA;
1825 {
1826 win_skip(
"ToUnicode is not implemented\n");
1827 return;
1828 }
1829
1830 ok(
ret == 1,
"ToUnicode for Return key didn't return 1 (was %i)\n",
ret);
1832 {
1833 ok(wStr[0]==
'\r',
"ToUnicode for CTRL + Return was %i (expected 13)\n", wStr[0]);
1834 ok(wStr[1]==0 ||
broken(wStr[1]!=0) ,
1835 "ToUnicode didn't null-terminate the buffer when there was room.\n");
1836 }
1837
1839 {
1841
1843 {
1844 short vk_ret;
1845
1846 if (!us_kbd) continue;
1848 if (vk_ret == -1) continue;
1851 if (vk_ret & 0x200)
mod |=
ctrl;
1852 }
1854
1857
1863
1864 }
1867
1869 ok(
ret == 0,
"ToUnicode with NULL keystate didn't return 0 (was %i)\n",
ret);
1871 ok(
ret == 0,
"ToUnicode with NULL keystate didn't return 0 (was %i)\n",
ret);
1873 ok(
ret == 0,
"ToUnicode with NULL keystate didn't return 0 (was %i)\n",
ret);
1875 ok(
ret == 0,
"ToUnicodeEx with NULL keystate didn't return 0 (was %i)\n",
ret);
1877 ok(
ret == 0,
"ToUnicodeEx with NULL keystate didn't return 0 (was %i)\n",
ret);
1879 ok(
ret == 0,
"ToUnicodeEx with NULL keystate didn't return 0 (was %i)\n",
ret);
1880}
1881
1883{
1886 const BYTE SC_RETURN = 0x1c, SC_A = 0x1e;
1887 const BYTE HIGHEST_BIT = 0x80;
1889
1891
1892 character = 0;
1894 ok(
ret == 1,
"ToAscii for Return key didn't return 1 (was %i)\n",
ret);
1895 ok(character ==
'\r',
"ToAscii for Return was %i (expected 13)\n", character);
1896
1897 character = 0;
1899 ok(
ret == 1,
"ToAscii for character 'A' didn't return 1 (was %i)\n",
ret);
1900 ok(character ==
'a',
"ToAscii for character 'A' was %i (expected %i)\n", character,
'a');
1901
1904 character = 0;
1906 ok(
ret == 1,
"ToAscii for CTRL + Return key didn't return 1 (was %i)\n",
ret);
1907 ok(character ==
'\n',
"ToAscii for CTRL + Return was %i (expected 10)\n", character);
1908
1909 character = 0;
1911 ok(
ret == 1,
"ToAscii for CTRL + character 'A' didn't return 1 (was %i)\n",
ret);
1912 ok(character == 1,
"ToAscii for CTRL + character 'A' was %i (expected 1)\n", character);
1913
1917 ok(
ret == 0,
"ToAscii for CTRL + Shift + Return key didn't return 0 (was %i)\n",
ret);
1918
1920 ok(
ret == 0,
"ToAscii for NULL keystate didn't return 0 (was %i)\n",
ret);
1922 ok(
ret == 0,
"ToAscii for NULL keystate didn't return 0 (was %i)\n",
ret);
1924 ok(
ret == 0,
"ToAsciiEx for NULL keystate didn't return 0 (was %i)\n",
ret);
1926 ok(
ret == 0,
"ToAsciiEx for NULL keystate didn't return 0 (was %i)\n",
ret);
1927}
1928
1930{
1931
1934}
1935
1937{
1940
1941 if (0)
1943
1948
1950
1951 klid[0] = 0;
1954 ok(!
strcmp(klid,
"00000409"),
"expected 00000409, got %s\n", klid);
1955}
1956
1958{
1963
1968
1974
1979
1980 memset( bufferW, 0xcc,
sizeof(bufferW) );
1984
1985 memset( bufferW, 0xcc,
sizeof(bufferW) );
1990
1991 memset( bufferW, 0xcc,
sizeof(bufferW) );
1994 ok( bufferW[0] == 0xcccc,
"wrong string %s\n",
wine_dbgstr_w(bufferW) );
1995}
1996
1998{
2001
2013 ok(events_no == 2,
"SendInput returned %d\n", events_no);
2014}
2015
2017{
2019
2020 for (;;)
2021 {
2024 {
2026 else break;
2027 }
2029 }
2030 if (!
ret)
msg->message = 0;
2032}
2033
2035{
2038
2039 do {
2046
2048}
2049
2053{
2055 {
2056
2059 }
2060
2062}
2063
2065{
2069};
2070
2072{
2075
2078 ok(
win != 0,
"CreateWindow failed\n");
2082
2085 return 0;
2086}
2087
2089{
2090 int region_type;
2091 HRGN hregion;
2093
2097 ok(hregion !=
NULL,
"CreateRectRgn failed\n");
2099 region_type =
GetRgnBox(hregion, region);
2100 ok(region_type ==
SIMPLEREGION,
"expected SIMPLEREGION, got %d\n", region_type);
2103}
2104
2106{
2107 BOOL got_button_down, got_button_up;
2114 int region_type;
2115 HRGN hregion;
2119
2122 ok(!
ret,
"GetCursorPos succeed\n");
2124
2127 ok(
ret,
"GetCursorPos failed\n");
2129
2132 ok(button_win != 0,
"CreateWindow failed\n");
2133
2136 if (
hwnd != button_win)
2137 {
2138 skip(
"there's another window covering test window\n");
2140 return;
2141 }
2142
2143
2145 got_button_down = got_button_up =
FALSE;
2147 {
2149
2151 {
2152 got_button_down =
TRUE;
2153 }
2155 {
2156 got_button_up =
TRUE;
2157 break;
2158 }
2159 }
2160 ok(got_button_down,
"expected WM_LBUTTONDOWN message\n");
2161 ok(got_button_up,
"expected WM_LBUTTONUP message\n");
2162
2163
2166 ok(static_win != 0,
"CreateWindow failed\n");
2171 got_button_down = got_button_up =
FALSE;
2173 {
2175
2177 {
2178 ok(
msg.hwnd == button_win,
"msg.hwnd = %p\n",
msg.hwnd);
2179 got_button_down =
TRUE;
2180 }
2182 {
2183 ok(
msg.hwnd == button_win,
"msg.hwnd = %p\n",
msg.hwnd);
2184 got_button_up =
TRUE;
2185 break;
2186 }
2187 }
2189 ok(got_button_down,
"expected WM_RBUTTONDOWN message\n");
2190 ok(got_button_up,
"expected WM_RBUTTONUP message\n");
2192
2193
2196 ok(static_win != 0,
"CreateWindow failed\n");
2201 got_button_down = got_button_up =
FALSE;
2203 {
2205
2207 {
2208 ok(
msg.hwnd == button_win,
"msg.hwnd = %p\n",
msg.hwnd);
2209 got_button_down =
TRUE;
2210 }
2212 {
2213 ok(
msg.hwnd == button_win,
"msg.hwnd = %p\n",
msg.hwnd);
2214 got_button_up =
TRUE;
2215 break;
2216 }
2217 }
2219 ok(got_button_down,
"expected WM_LBUTTONDOWN message\n");
2220 ok(got_button_up,
"expected WM_LBUTTONUP message\n");
2222
2223
2231 got_button_down = got_button_up =
FALSE;
2235 {
2237
2239 got_button_down =
TRUE;
2241 got_button_up =
TRUE;
2242 }
2247 ok(!got_button_down,
"unexpected WM_RBUTTONDOWN message\n");
2248 ok(!got_button_up,
"unexpected WM_RBUTTONUP message\n");
2249
2250
2251
2255 got_button_down = got_button_up =
FALSE;
2258 "AttachThreadInput failed\n");
2263 {
2265
2267 got_button_down =
TRUE;
2269 got_button_up =
TRUE;
2270 }
2274 ok(!got_button_down,
"unexpected WM_LBUTTONDOWN message\n");
2275 ok(!got_button_up,
"unexpected WM_LBUTTONUP message\n");
2276
2277
2280 ok(
hwnd != 0,
"CreateWindow failed\n");
2282 got_button_down = got_button_up =
FALSE;
2285 {
2287
2289 {
2290 ok(
msg.hwnd == button_win,
"msg.hwnd = %p\n",
msg.hwnd);
2291 got_button_down =
TRUE;
2292 }
2294 {
2295 ok(
msg.hwnd == button_win,
"msg.hwnd = %p\n",
msg.hwnd);
2296 got_button_up =
TRUE;
2297 break;
2298 }
2299 }
2300 ok(got_button_down,
"expected WM_RBUTTONDOWN message\n");
2301 ok(got_button_up,
"expected WM_RBUTTONUP message\n");
2303
2304
2307 ok(
hwnd != 0,
"CreateWindow failed\n");
2308 got_button_down = got_button_up =
FALSE;
2311 {
2313
2315 {
2316 ok(
msg.hwnd == button_win,
"msg.hwnd = %p\n",
msg.hwnd);
2317 got_button_down =
TRUE;
2318 }
2320 {
2321 ok(
msg.hwnd == button_win,
"msg.hwnd = %p\n",
msg.hwnd);
2322 got_button_up =
TRUE;
2323 break;
2324 }
2325 }
2326 ok(got_button_down,
"expected WM_LBUTTONDOWN message\n");
2327 ok(got_button_up,
"expected WM_LBUTTONUP message\n");
2330
2342
2343
2347
2351
2354 ret = SetLayeredWindowAttributes(
hwnd, 0, 255, LWA_ALPHA);
2355 ok(
ret,
"SetLayeredWindowAttributes failed\n");
2358
2359 if (pGetWindowRgnBox)
2360 {
2361 region_type = pGetWindowRgnBox(
hwnd, ®ion);
2362 ok(region_type ==
ERROR,
"expected ERROR, got %d\n", region_type);
2363 }
2364
2367 "expected region (100,100)-(200,200), got %s\n",
wine_dbgstr_rect(®ion));
2370 "expected region (100,100)-(200,200), got %s\n",
wine_dbgstr_rect(®ion));
2373 "expected region (100,100)-(200,200), got %s\n",
wine_dbgstr_rect(®ion));
2376 "expected region (100,100)-(200,200), got %s\n",
wine_dbgstr_rect(®ion));
2379 "expected region (110,110)-(130,130), got %s\n",
wine_dbgstr_rect(®ion));
2382 "expected region (100,100)-(200,200), got %s\n",
wine_dbgstr_rect(®ion));
2383
2384 got_button_down = got_button_up =
FALSE;
2387 {
2389
2391 {
2393 got_button_down =
TRUE;
2394 }
2396 {
2398 got_button_up =
TRUE;
2399 break;
2400 }
2401 }
2402 ok(got_button_down,
"expected WM_LBUTTONDOWN message\n");
2403 ok(got_button_up,
"expected WM_LBUTTONUP message\n");
2404
2405 ret = SetLayeredWindowAttributes(
hwnd, 0, 0, LWA_ALPHA);
2406 ok(
ret,
"SetLayeredWindowAttributes failed\n");
2409
2410 if (pGetWindowRgnBox)
2411 {
2412 region_type = pGetWindowRgnBox(
hwnd, ®ion);
2413 ok(region_type ==
ERROR,
"expected ERROR, got %d\n", region_type);
2414 }
2415
2416 got_button_down = got_button_up =
FALSE;
2419 {
2421
2423 {
2424 ok(
msg.hwnd == button_win,
"msg.hwnd = %p\n",
msg.hwnd);
2425 got_button_down =
TRUE;
2426 }
2428 {
2429 ok(
msg.hwnd == button_win,
"msg.hwnd = %p\n",
msg.hwnd);
2430 got_button_up =
TRUE;
2431 break;
2432 }
2433 }
2434 ok(got_button_down ||
broken(!got_button_down),
"expected WM_LBUTTONDOWN message\n");
2435 ok(got_button_up,
"expected WM_LBUTTONUP message\n");
2436
2437 ret = SetLayeredWindowAttributes(
hwnd,
RGB(0, 255, 0), 255, LWA_ALPHA | LWA_COLORKEY);
2438 ok(
ret,
"SetLayeredWindowAttributes failed\n");
2441
2442 if (pGetWindowRgnBox)
2443 {
2444 region_type = pGetWindowRgnBox(
hwnd, ®ion);
2445 ok(region_type ==
ERROR,
"expected ERROR, got %d\n", region_type);
2446 }
2447
2448 got_button_down = got_button_up =
FALSE;
2451 {
2453
2455 {
2457 got_button_down =
TRUE;
2458 }
2460 {
2462 got_button_up =
TRUE;
2463 break;
2464 }
2465 }
2466 ok(got_button_down,
"expected WM_LBUTTONDOWN message\n");
2467 ok(got_button_up,
"expected WM_LBUTTONUP message\n");
2468
2469 ret = SetLayeredWindowAttributes(
hwnd,
RGB(128, 128, 128), 0, LWA_COLORKEY);
2470 ok(
ret,
"SetLayeredWindowAttributes failed\n");
2473
2474 if (pGetWindowRgnBox)
2475 {
2476 region_type = pGetWindowRgnBox(
hwnd, ®ion);
2477 ok(region_type ==
ERROR,
"expected ERROR, got %d\n", region_type);
2478 }
2479
2480 got_button_down = got_button_up =
FALSE;
2483 {
2485
2487 {
2489 ok(
msg.hwnd == button_win,
"msg.hwnd = %p\n",
msg.hwnd);
2490 got_button_down =
TRUE;
2491 }
2493 {
2495 ok(
msg.hwnd == button_win,
"msg.hwnd = %p\n",
msg.hwnd);
2496 got_button_up =
TRUE;
2497 break;
2498 }
2499 }
2500 ok(got_button_down,
"expected WM_LBUTTONDOWN message\n");
2501 ok(got_button_up,
"expected WM_LBUTTONUP message\n");
2502
2506
2507 if (pGetWindowRgnBox)
2508 {
2509 region_type = pGetWindowRgnBox(
hwnd, ®ion);
2510 ok(region_type ==
ERROR,
"expected ERROR, got %d\n", region_type);
2511 }
2512
2513 got_button_down = got_button_up =
FALSE;
2516 {
2518
2520 {
2522 got_button_down =
TRUE;
2523 }
2525 {
2527 got_button_up =
TRUE;
2528 break;
2529 }
2530 }
2531 ok(got_button_down,
"expected WM_LBUTTONDOWN message\n");
2532 ok(got_button_up,
"expected WM_LBUTTONUP message\n");
2533
2535 ok(hregion !=
NULL,
"CreateRectRgn failed\n");
2537 ok(
ret,
"SetWindowRgn failed\n");
2541
2542 if (pGetWindowRgnBox)
2543 {
2544 region_type = pGetWindowRgnBox(
hwnd, ®ion);
2545 ok(region_type ==
SIMPLEREGION,
"expected SIMPLEREGION, got %d\n", region_type);
2546 }
2547
2548 got_button_down = got_button_up =
FALSE;
2551 {
2553
2555 {
2556 ok(
msg.hwnd == button_win,
"msg.hwnd = %p\n",
msg.hwnd);
2557 got_button_down =
TRUE;
2558 }
2560 {
2561 ok(
msg.hwnd == button_win,
"msg.hwnd = %p\n",
msg.hwnd);
2562 got_button_up =
TRUE;
2563 break;
2564 }
2565 }
2566 ok(got_button_down,
"expected WM_LBUTTONDOWN message\n");
2567 ok(got_button_up,
"expected WM_LBUTTONUP message\n");
2568
2572
2576}
2577
2578
2580{
2582 {
2586 }
2588}
2589
2591{
2598};
2599
2601{
2605
2607 {
2609 "WaitForSingleObject failed\n");
2611 }
2612
2614 {
2617 }
2618
2620 {
2623 }
2624
2626 100, 100, 200, 200, 0, 0, 0,
NULL);
2628
2630 {
2633 }
2634
2636
2638 {
2641 }
2642
2643 return 0;
2644}
2645
2647{
2653
2656 cls.cbClsExtra = 0;
2657 cls.cbWndExtra = 0;
2659 cls.hIcon = 0;
2662 cls.lpszMenuName =
NULL;
2663 cls.lpszClassName = "TestWindowClass";
2665
2672 {
2673 win_skip(
"skipping interthread message test under win9x\n");
2674 return;
2675 }
2676
2679
2682
2684 0, 0, 0, 0, 0, 0, 0,
NULL);
2685 ok(ourWnd!= 0,
"failed to create ourWnd window\n");
2686
2688 0, 0, 0, 0, 0, 0, 0,
NULL);
2689 ok(Wnd2!= 0,
"failed to create Wnd2 window\n");
2690
2693
2696
2699
2701
2706
2708
2711
2715
2720
2722
2727
2729
2732
2735
2741
2744
2747
2750
2753
2756
2758
2761
2764
2766
2769
2772
2774
2779
2781
2784
2787
2789
2792
2795
2801
2804
2807 ok(!
ret,
"AttachThreadInput succeeded\n");
2809 "expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
2810
2813 ok(!
ret,
"AttachThreadInput succeeded\n");
2815 "expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
2816
2818
2821
2824
2827
2833
2836
2839
2842
2845
2848
2851
2857
2860
2863
2866
2869
2872
2877}
2878
2880{
2883
2887
2890 "expected that highest bit is set, got %x\n",
result);
2891
2895
2897 ok(!(
result & 0x8000),
"expected that highest bit is unset, got %x\n",
result);
2898
2899 return 0;
2900}
2901
2903{
2908
2913
2917
2922
2926
2930
2932
2937
2941}
2942
2944{
2947 char oem_char;
2948
2949 for (oem = 0; oem < 0x200; oem++)
2950 {
2952
2953 oem_char =
LOBYTE( oem );
2954
2955
2956
2957
2958 if (!
OemToCharBuffW( &oem_char, &wchr, 1 ) || (wchr ==
'?' && oem_char < 0))
2960 else
2961 {
2964 if (!scan)
2966 else
2967 {
2968 vkey &= 0xff00;
2969 vkey <<= 8;
2971 }
2972 }
2974 }
2975}
2976
2978
2980{
2981 INPUT_MESSAGE_SOURCE
source;
2983
2984 ok( pGetCurrentInputMessageSource( &
source ),
"GetCurrentInputMessageSource failed\n" );
2986 {
3011 break;
3012 default:
3013 ok(
source.deviceType == IMDT_UNAVAILABLE,
"%x: wrong deviceType %x\n",
3016 break;
3017 }
3018
3020}
3021
3023{
3029
3042 0, 0, 0, 0 );
3047
3054 inputs[1] = inputs[0];
3056
3061
3064 {
3069 }
3074 {
3079 }
3080
3088 {
3091 }
3092
3097 {
3100 }
3101
3104}
3105
3107{
3109 POINTER_INPUT_TYPE
type = -1;
3111
3113 ret = pGetPointerType(
id,
NULL);
3114 ok(!
ret,
"GetPointerType should have failed.\n");
3116 "expected error ERROR_INVALID_PARAMETER, got %u.\n",
GetLastError());
3117
3119 ret = pGetPointerType(
id, &
type);
3121 "expected error ERROR_INVALID_PARAMETER, got %u.\n",
GetLastError());
3122 ok(!
ret,
"GetPointerType failed, got type %d for %u.\n",
type,
id );
3124
3125 id = 1;
3126 ret = pGetPointerType(
id, &
type);
3127 ok(
ret,
"GetPointerType failed, got type %d for %u.\n",
type,
id );
3129}
3130
3132{
3133 int cnt, cnt2;
3137