Module: wine Branch: master Commit: 54eebfe5e51801d8610baa5a100c06e04fab3b91 URL: http://source.winehq.org/git/wine.git/?a=commit;h=54eebfe5e51801d8610baa5a10...
Author: Lei Zhang thestig@google.com Date: Mon Dec 8 11:25:30 2008 -0800
user32: Check input to GetAsyncKeyState().
---
dlls/user32/input.c | 2 ++ dlls/user32/tests/input.c | 8 ++++++++ 2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 69bf2e8..625ecdc 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -272,6 +272,8 @@ HWND WINAPI GetCapture(void) */ SHORT WINAPI GetAsyncKeyState(INT nKey) { + if (nKey < 0 || nKey > 256) + return 0; return USER_Driver->pGetAsyncKeyState( nKey ); }
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index 8211cdb..a242fba 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -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); }
+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) { init_function_pointers(); @@ -1254,6 +1261,7 @@ START_TEST(input) test_mouse_ll_hook(); test_key_map(); test_ToUnicode(); + test_get_async_key_state();
if(pGetMouseMovePointsEx) test_GetMouseMovePointsEx();