1885459d8SThomas Faber /*
2885459d8SThomas Faber * PROJECT: ReactOS Win32k tests
3885459d8SThomas Faber * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4885459d8SThomas Faber * PURPOSE: Test for NtUserGetAsyncKeyState
5885459d8SThomas Faber * COPYRIGHT: Copyright 2022 Thomas Faber (thomas.faber@reactos.org)
6885459d8SThomas Faber */
7885459d8SThomas Faber
8*a5c3bb5bSSerge Gautherie #include "../win32nt.h"
9885459d8SThomas Faber
START_TEST(NtUserGetAsyncKeyState)10885459d8SThomas Faber START_TEST(NtUserGetAsyncKeyState)
11885459d8SThomas Faber {
12885459d8SThomas Faber SHORT Ret;
13885459d8SThomas Faber DWORD Error;
14885459d8SThomas Faber
15885459d8SThomas Faber SetLastError(0xdeadbeef);
16885459d8SThomas Faber Ret = NtUserGetAsyncKeyState(0);
17885459d8SThomas Faber Error = GetLastError();
18885459d8SThomas Faber ok(Ret == 0, "Ret = %d\n", Ret);
19885459d8SThomas Faber ok(Error == 0xdeadbeef, "Error = %lu\n", Error);
20885459d8SThomas Faber
21885459d8SThomas Faber SetLastError(0xdeadbeef);
22885459d8SThomas Faber Ret = NtUserGetAsyncKeyState(1); // VK_LBUTTON
23885459d8SThomas Faber Error = GetLastError();
24885459d8SThomas Faber ok(Ret == 0 || Ret == 1, "Ret = %d\n", Ret);
25885459d8SThomas Faber ok(Error == 0xdeadbeef, "Error = %lu\n", Error);
26885459d8SThomas Faber
27885459d8SThomas Faber SetLastError(0xdeadbeef);
28885459d8SThomas Faber Ret = NtUserGetAsyncKeyState(0xfe);
29885459d8SThomas Faber Error = GetLastError();
30885459d8SThomas Faber ok(Ret == 0, "Ret = %d\n", Ret);
31885459d8SThomas Faber ok(Error == 0xdeadbeef, "Error = %lu\n", Error);
32885459d8SThomas Faber
33885459d8SThomas Faber SetLastError(0xdeadbeef);
34885459d8SThomas Faber Ret = NtUserGetAsyncKeyState(0xff);
35885459d8SThomas Faber Error = GetLastError();
36885459d8SThomas Faber ok(Ret == 0, "Ret = %d\n", Ret);
37885459d8SThomas Faber ok(Error == 0xdeadbeef, "Error = %lu\n", Error);
38885459d8SThomas Faber
39885459d8SThomas Faber SetLastError(0xdeadbeef);
40885459d8SThomas Faber Ret = NtUserGetAsyncKeyState(0x100);
41885459d8SThomas Faber Error = GetLastError();
42885459d8SThomas Faber ok(Ret == 0, "Ret = %d\n", Ret);
43885459d8SThomas Faber ok(Error == ERROR_INVALID_PARAMETER, "Error = %lu\n", Error);
44885459d8SThomas Faber
45885459d8SThomas Faber SetLastError(0xdeadbeef);
46885459d8SThomas Faber Ret = NtUserGetAsyncKeyState(0x101);
47885459d8SThomas Faber Error = GetLastError();
48885459d8SThomas Faber ok(Ret == 0, "Ret = %d\n", Ret);
49885459d8SThomas Faber ok(Error == ERROR_INVALID_PARAMETER, "Error = %lu\n", Error);
50885459d8SThomas Faber
51885459d8SThomas Faber SetLastError(0xdeadbeef);
52885459d8SThomas Faber Ret = NtUserGetAsyncKeyState(0x10000000);
53885459d8SThomas Faber Error = GetLastError();
54885459d8SThomas Faber ok(Ret == 0, "Ret = %d\n", Ret);
55885459d8SThomas Faber ok(Error == ERROR_INVALID_PARAMETER, "Error = %lu\n", Error);
56885459d8SThomas Faber
57885459d8SThomas Faber SetLastError(0xdeadbeef);
58885459d8SThomas Faber Ret = NtUserGetAsyncKeyState(0x7fffffff);
59885459d8SThomas Faber Error = GetLastError();
60885459d8SThomas Faber ok(Ret == 0, "Ret = %d\n", Ret);
61885459d8SThomas Faber ok(Error == ERROR_INVALID_PARAMETER, "Error = %lu\n", Error);
62885459d8SThomas Faber
63885459d8SThomas Faber SetLastError(0xdeadbeef);
64885459d8SThomas Faber Ret = NtUserGetAsyncKeyState(0x80000000);
65885459d8SThomas Faber Error = GetLastError();
66885459d8SThomas Faber ok(Ret == 0, "Ret = %d\n", Ret);
67885459d8SThomas Faber ok(Error == ERROR_INVALID_PARAMETER, "Error = %lu\n", Error);
68885459d8SThomas Faber
69885459d8SThomas Faber SetLastError(0xdeadbeef);
70885459d8SThomas Faber Ret = NtUserGetAsyncKeyState(-2);
71885459d8SThomas Faber Error = GetLastError();
72885459d8SThomas Faber ok(Ret == 0, "Ret = %d\n", Ret);
73885459d8SThomas Faber ok(Error == ERROR_INVALID_PARAMETER, "Error = %lu\n", Error);
74885459d8SThomas Faber
75885459d8SThomas Faber SetLastError(0xdeadbeef);
76885459d8SThomas Faber Ret = NtUserGetAsyncKeyState(-1);
77885459d8SThomas Faber Error = GetLastError();
78885459d8SThomas Faber ok(Ret == 0, "Ret = %d\n", Ret);
79885459d8SThomas Faber ok(Error == ERROR_INVALID_PARAMETER, "Error = %lu\n", Error);
80885459d8SThomas Faber }
81