[KBDHID] Implement IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION

This commit is contained in:
Eric Kohl 2021-09-12 14:40:26 +02:00
parent c1de553eba
commit f81fb355ae

View file

@ -10,6 +10,18 @@
#include "kbdhid.h" #include "kbdhid.h"
/* This structure starts with the same layout as KEYBOARD_INDICATOR_TRANSLATION */
typedef struct _LOCAL_KEYBOARD_INDICATOR_TRANSLATION {
USHORT NumberOfIndicatorKeys;
INDICATOR_LIST IndicatorList[3];
} LOCAL_KEYBOARD_INDICATOR_TRANSLATION, *PLOCAL_KEYBOARD_INDICATOR_TRANSLATION;
static LOCAL_KEYBOARD_INDICATOR_TRANSLATION IndicatorTranslation = { 3, {
{0x3A, KEYBOARD_CAPS_LOCK_ON},
{0x45, KEYBOARD_NUM_LOCK_ON},
{0x46, KEYBOARD_SCROLL_LOCK_ON}}};
VOID VOID
KbdHid_DispatchInputData( KbdHid_DispatchInputData(
IN PKBDHID_DEVICE_EXTENSION DeviceExtension, IN PKBDHID_DEVICE_EXTENSION DeviceExtension,
@ -522,11 +534,24 @@ KbdHid_InternalDeviceControl(
return STATUS_SUCCESS; return STATUS_SUCCESS;
case IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION: case IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION:
/* not implemented */ if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(LOCAL_KEYBOARD_INDICATOR_TRANSLATION))
DPRINT1("IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION not implemented\n"); {
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED; /* buffer too small */
Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
IoCompleteRequest(Irp, IO_NO_INCREMENT); IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_NOT_IMPLEMENTED; return STATUS_INVALID_PARAMETER;
}
/* copy translations */
RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer,
&IndicatorTranslation,
sizeof(LOCAL_KEYBOARD_INDICATOR_TRANSLATION));
/* done */
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = sizeof(LOCAL_KEYBOARD_INDICATOR_TRANSLATION);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
} }
/* unknown control code */ /* unknown control code */