From 7ea3a29eca9dbe58370d8f8a4b380fbafb7b8246 Mon Sep 17 00:00:00 2001 From: Lionel Ulmer Date: Tue, 6 Aug 2002 23:49:12 +0000 Subject: [PATCH] Handle 'not acquired' error messages on keyboard GetDeviceData. --- dlls/dinput/keyboard/main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dlls/dinput/keyboard/main.c b/dlls/dinput/keyboard/main.c index ec1babaaa4d..6653e4f0b56 100644 --- a/dlls/dinput/keyboard/main.c +++ b/dlls/dinput/keyboard/main.c @@ -78,6 +78,8 @@ HHOOK keyboard_hook; LRESULT CALLBACK KeyboardCallback( int code, WPARAM wparam, LPARAM lparam ) { + TRACE("(%d,%d,%ld)\n", code, wparam, lparam); + if (code == HC_ACTION) { BYTE dik_code; @@ -112,6 +114,9 @@ LRESULT CALLBACK KeyboardCallback( int code, WPARAM wparam, LPARAM lparam ) current->buffer[n].dwTimeStamp = timestamp; current->buffer[n].dwSequence = current->dinput->evsequence++; + TRACE("Adding event at offset %d : %ld - %ld - %ld - %ld\n", n, + current->buffer[n].dwOfs, current->buffer[n].dwData, current->buffer[n].dwTimeStamp, current->buffer[n].dwSequence); + if (current->count == current->buffersize) { current->start++; @@ -246,6 +251,9 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceData( TRACE("(this=%p,%ld,%p,%p(%ld)),0x%08lx)\n", This,dodsize,dod,entries,entries?*entries:0,flags); + if (This->acquired == 0) + return DIERR_NOTACQUIRED; + if (This->buffer == NULL) return DIERR_NOTBUFFERED; @@ -285,6 +293,8 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceData( LeaveCriticalSection(&(This->crit)); + TRACE("Returning %ld events queued\n", *entries); + return ret; }