Skip to content

Commit

Permalink
user32: Use input shared memory in GetKeyboardState.
Browse files Browse the repository at this point in the history
  • Loading branch information
rbernon authored and ivyl committed Dec 9, 2021
1 parent c7165cc commit d2cbafa
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion dlls/user32/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,11 +523,22 @@ SHORT WINAPI DECLSPEC_HOTPATCH GetKeyState(INT vkey)
*/
BOOL WINAPI DECLSPEC_HOTPATCH GetKeyboardState( LPBYTE state )
{
BOOL ret;
volatile struct input_shared_memory *shared = get_input_shared_memory();
BOOL ret, skip = TRUE;
UINT i;

TRACE("(%p)\n", state);

if (!shared) skip = FALSE;
else SHARED_READ_BEGIN( &shared->seq )
{
if (!shared->created) skip = FALSE; /* server needs to create the queue */
else memcpy( state, (const void *)shared->keystate, 256 );
}
SHARED_READ_END( &shared->seq );

if (skip) return TRUE;

memset( state, 0, 256 );
SERVER_START_REQ( get_key_state )
{
Expand Down

0 comments on commit d2cbafa

Please sign in to comment.