ReactOS 0.4.16-dev-257-g6aa11ac
NtUserGetAsyncKeyState.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Win32k tests
3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4 * PURPOSE: Test for NtUserGetAsyncKeyState
5 * COPYRIGHT: Copyright 2022 Thomas Faber (thomas.faber@reactos.org)
6 */
7
8#include "../win32nt.h"
9
11{
12 SHORT Ret;
14
15 SetLastError(0xdeadbeef);
18 ok(Ret == 0, "Ret = %d\n", Ret);
19 ok(Error == 0xdeadbeef, "Error = %lu\n", Error);
20
21 SetLastError(0xdeadbeef);
22 Ret = NtUserGetAsyncKeyState(1); // VK_LBUTTON
24 ok(Ret == 0 || Ret == 1, "Ret = %d\n", Ret);
25 ok(Error == 0xdeadbeef, "Error = %lu\n", Error);
26
27 SetLastError(0xdeadbeef);
28 Ret = NtUserGetAsyncKeyState(0xfe);
30 ok(Ret == 0, "Ret = %d\n", Ret);
31 ok(Error == 0xdeadbeef, "Error = %lu\n", Error);
32
33 SetLastError(0xdeadbeef);
34 Ret = NtUserGetAsyncKeyState(0xff);
36 ok(Ret == 0, "Ret = %d\n", Ret);
37 ok(Error == 0xdeadbeef, "Error = %lu\n", Error);
38
39 SetLastError(0xdeadbeef);
40 Ret = NtUserGetAsyncKeyState(0x100);
42 ok(Ret == 0, "Ret = %d\n", Ret);
43 ok(Error == ERROR_INVALID_PARAMETER, "Error = %lu\n", Error);
44
45 SetLastError(0xdeadbeef);
46 Ret = NtUserGetAsyncKeyState(0x101);
48 ok(Ret == 0, "Ret = %d\n", Ret);
49 ok(Error == ERROR_INVALID_PARAMETER, "Error = %lu\n", Error);
50
51 SetLastError(0xdeadbeef);
52 Ret = NtUserGetAsyncKeyState(0x10000000);
54 ok(Ret == 0, "Ret = %d\n", Ret);
55 ok(Error == ERROR_INVALID_PARAMETER, "Error = %lu\n", Error);
56
57 SetLastError(0xdeadbeef);
58 Ret = NtUserGetAsyncKeyState(0x7fffffff);
60 ok(Ret == 0, "Ret = %d\n", Ret);
61 ok(Error == ERROR_INVALID_PARAMETER, "Error = %lu\n", Error);
62
63 SetLastError(0xdeadbeef);
64 Ret = NtUserGetAsyncKeyState(0x80000000);
66 ok(Ret == 0, "Ret = %d\n", Ret);
67 ok(Error == ERROR_INVALID_PARAMETER, "Error = %lu\n", Error);
68
69 SetLastError(0xdeadbeef);
70 Ret = NtUserGetAsyncKeyState(-2);
72 ok(Ret == 0, "Ret = %d\n", Ret);
73 ok(Error == ERROR_INVALID_PARAMETER, "Error = %lu\n", Error);
74
75 SetLastError(0xdeadbeef);
76 Ret = NtUserGetAsyncKeyState(-1);
78 ok(Ret == 0, "Ret = %d\n", Ret);
79 ok(Error == ERROR_INVALID_PARAMETER, "Error = %lu\n", Error);
80}
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
BOOL Error
Definition: chkdsk.c:66
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
unsigned long DWORD
Definition: ntddk_ex.h:95
SHORT NTAPI NtUserGetAsyncKeyState(INT Key)
Definition: keyboard.c:634
short SHORT
Definition: pedump.c:59
DWORD WINAPI GetLastError(void)
Definition: except.c:1042