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
10
START_TEST
(
NtUserGetAsyncKeyState
)
11
{
12
SHORT
Ret;
13
DWORD
Error
;
14
15
SetLastError
(0xdeadbeef);
16
Ret =
NtUserGetAsyncKeyState
(0);
17
Error
=
GetLastError
();
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
23
Error
=
GetLastError
();
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);
29
Error
=
GetLastError
();
30
ok
(Ret == 0,
"Ret = %d\n"
, Ret);
31
ok
(
Error
== 0xdeadbeef,
"Error = %lu\n"
,
Error
);
32
33
SetLastError
(0xdeadbeef);
34
Ret =
NtUserGetAsyncKeyState
(0xff);
35
Error
=
GetLastError
();
36
ok
(Ret == 0,
"Ret = %d\n"
, Ret);
37
ok
(
Error
== 0xdeadbeef,
"Error = %lu\n"
,
Error
);
38
39
SetLastError
(0xdeadbeef);
40
Ret =
NtUserGetAsyncKeyState
(0x100);
41
Error
=
GetLastError
();
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);
47
Error
=
GetLastError
();
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);
53
Error
=
GetLastError
();
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);
59
Error
=
GetLastError
();
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);
65
Error
=
GetLastError
();
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);
71
Error
=
GetLastError
();
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);
77
Error
=
GetLastError
();
78
ok
(Ret == 0,
"Ret = %d\n"
, Ret);
79
ok
(
Error
==
ERROR_INVALID_PARAMETER
,
"Error = %lu\n"
,
Error
);
80
}
ok
#define ok(value,...)
Definition:
atltest.h:57
START_TEST
#define START_TEST(x)
Definition:
atltest.h:75
Error
BOOL Error
Definition:
chkdsk.c:66
ERROR_INVALID_PARAMETER
#define ERROR_INVALID_PARAMETER
Definition:
compat.h:101
SetLastError
#define SetLastError(x)
Definition:
compat.h:752
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
NtUserGetAsyncKeyState
SHORT NTAPI NtUserGetAsyncKeyState(INT Key)
Definition:
keyboard.c:634
SHORT
short SHORT
Definition:
pedump.c:59
GetLastError
DWORD WINAPI GetLastError(void)
Definition:
except.c:1042
modules
rostests
apitests
win32nt
ntuser
NtUserGetAsyncKeyState.c
Generated on Mon Nov 11 2024 06:08:06 for ReactOS by
1.9.6