Commit 54eebfe5 authored by Lei Zhang's avatar Lei Zhang Committed by Alexandre Julliard

user32: Check input to GetAsyncKeyState().

parent c3cdc671
...@@ -272,6 +272,8 @@ HWND WINAPI GetCapture(void) ...@@ -272,6 +272,8 @@ HWND WINAPI GetCapture(void)
*/ */
SHORT WINAPI GetAsyncKeyState(INT nKey) SHORT WINAPI GetAsyncKeyState(INT nKey)
{ {
if (nKey < 0 || nKey > 256)
return 0;
return USER_Driver->pGetAsyncKeyState( nKey ); return USER_Driver->pGetAsyncKeyState( nKey );
} }
......
...@@ -1240,6 +1240,13 @@ static void test_ToUnicode(void) ...@@ -1240,6 +1240,13 @@ static void test_ToUnicode(void)
todo_wine ok(ret == 0, "ToUnicode for CTRL + SHIFT + Return didn't return 0 (was %i)\n", ret); todo_wine ok(ret == 0, "ToUnicode for CTRL + SHIFT + Return didn't return 0 (was %i)\n", ret);
} }
static void test_get_async_key_state(void)
{
/* input value sanity checks */
ok(0 == GetAsyncKeyState(1000000), "GetAsyncKeyState did not return 0\n");
ok(0 == GetAsyncKeyState(-1000000), "GetAsyncKeyState did not return 0\n");
}
START_TEST(input) START_TEST(input)
{ {
init_function_pointers(); init_function_pointers();
...@@ -1254,6 +1261,7 @@ START_TEST(input) ...@@ -1254,6 +1261,7 @@ START_TEST(input)
test_mouse_ll_hook(); test_mouse_ll_hook();
test_key_map(); test_key_map();
test_ToUnicode(); test_ToUnicode();
test_get_async_key_state();
if(pGetMouseMovePointsEx) if(pGetMouseMovePointsEx)
test_GetMouseMovePointsEx(); test_GetMouseMovePointsEx();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment