[PATCH v2] hid: Stub HidP_TranslateUsagesToI8042ScanCodes

Sebastian Lackner sebastian at fds-team.de
Mon Sep 19 07:48:24 CDT 2016


On 15.09.2016 14:08, Aric Stewart wrote:
> v2: Corrections pointed out by Sebastian Lackner
> 
> Resolves Bug 39447
> 
> Signed-off-by: Aric Stewart <aric at codeweavers.com>
> ---
>  dlls/hid/hid.spec   |  2 +-
>  dlls/hid/hidp.c     |  9 +++++++++
>  include/ddk/hidpi.h | 29 +++++++++++++++++++++++++++++
>  3 files changed, 39 insertions(+), 1 deletion(-)
> 
> 
> 
> 0003-hid-Stub-HidP_TranslateUsagesToI8042ScanCodes.txt
> 
> 
> diff --git a/dlls/hid/hid.spec b/dlls/hid/hid.spec
> index 4c5e505..2131af2 100644
> --- a/dlls/hid/hid.spec
> +++ b/dlls/hid/hid.spec
> @@ -39,6 +39,6 @@
>  @ stub HidP_SetUsageValue
>  @ stub HidP_SetUsageValueArray
>  @ stub HidP_SetUsages
> -@ stub HidP_TranslateUsagesToI8042ScanCodes
> +@ stdcall HidP_TranslateUsagesToI8042ScanCodes(ptr long long ptr ptr ptr)
>  @ stub HidP_UnsetUsages
>  @ stub HidP_UsageListDifference
> diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c
> index 3d7a12e..c7bfb72 100644
> --- a/dlls/hid/hidp.c
> +++ b/dlls/hid/hidp.c
> @@ -23,6 +23,7 @@
>  #include <stdarg.h>
>  
>  #define NONAMELESSUNION
> +#include "ntstatus.h"
>  #define WIN32_NO_STATUS
>  #include "windef.h"
>  #include "winbase.h"
> @@ -519,3 +520,11 @@ ULONG WINAPI HidP_MaxUsageListLength(HIDP_REPORT_TYPE ReportType, USAGE UsagePag
>      }
>      return count;
>  }
> +
> +NTSTATUS WINAPI HidP_TranslateUsagesToI8042ScanCodes(USAGE *ChangedUsageList, ULONG UsageListLength, HIDP_KEYBOARD_DIRECTION KeyAction, HIDP_KEYBOARD_MODIFIER_STATE *ModifierState, PHIDP_INSERT_SCANCODES InsertCodesProcedure, VOID *InsertCodesContext)

It wouldn't really hurt to split this extremely long line. Also please note that VOID
should usually be avoided in new Wine source, but I will leave that up to you since its
your area. The same also applies to the function declaration.

> +{
> +    FIXME("stub: %p, %i, %i, %p, %p, %p\n", ChangedUsageList, UsageListLength,
> +        KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext);
> +
> +    return STATUS_NOT_IMPLEMENTED;
> +}
> diff --git a/include/ddk/hidpi.h b/include/ddk/hidpi.h
> index 4cfac61..833387e 100644
> --- a/include/ddk/hidpi.h
> +++ b/include/ddk/hidpi.h
> @@ -136,6 +136,34 @@ typedef struct _HIDP_CAPS
>      USHORT  NumberFeatureDataIndices;
>  } HIDP_CAPS, *PHIDP_CAPS;
>  
> +typedef enum _HIDP_KEYBOARD_DIRECTION {
> +    HidP_Keyboard_Break,
> +    HidP_Keyboard_Make
> +} HIDP_KEYBOARD_DIRECTION;
> +
> +typedef struct _HIDP_KEYBOARD_MODIFIER_STATE {
> +   union {
> +      struct {
> +         ULONG LeftControl: 1;
> +         ULONG LeftShift: 1;
> +         ULONG LeftAlt: 1;
> +         ULONG LeftGUI: 1;
> +         ULONG RightControl: 1;
> +         ULONG RightShift: 1;
> +         ULONG RightAlt: 1;
> +         ULONG RigthGUI: 1;
> +         ULONG CapsLock: 1;
> +         ULONG ScollLock: 1;
> +         ULONG NumLock: 1;
> +         ULONG Reserved: 21;
> +      } DUMMYSTRUCTNAME;
> +      ULONG ul;
> +   } DUMMYUNIONNAME;

It looks like you accidentically used three space indentation here.

> +} HIDP_KEYBOARD_MODIFIER_STATE, *PHIDP_KEYBOARD_MODIFIER_STATE;
> +
> +typedef BOOLEAN NTAPI (*PHIDP_INSERT_SCANCODES) (VOID *Context, CHAR *NewScanCodes, ULONG Length);

For GCC it does not seem to matter, but usually the NTAPI should be inside of the brackets.

> +
> +
>  NTSTATUS WINAPI HidP_GetButtonCaps(HIDP_REPORT_TYPE ReportType, PHIDP_BUTTON_CAPS ButtonCaps, PUSHORT  ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
>  NTSTATUS WINAPI HidP_GetCaps(PHIDP_PREPARSED_DATA PreparsedData, PHIDP_CAPS Capabilities);
>  NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, PUSAGE UsageList, PULONG UsageLength, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
> @@ -144,6 +172,7 @@ NTSTATUS WINAPI HidP_GetValueCaps(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS
>  NTSTATUS WINAPI HidP_InitializeReportForID(HIDP_REPORT_TYPE ReportType, UCHAR ReportID, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
>  ULONG WINAPI HidP_MaxUsageListLength(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, PHIDP_PREPARSED_DATA PreparsedData);
>  NTSTATUS WINAPI HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, PLONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
> +NTSTATUS WINAPI HidP_TranslateUsagesToI8042ScanCodes(USAGE *ChangedUsageList, ULONG UsageListLength, HIDP_KEYBOARD_DIRECTION KeyAction, HIDP_KEYBOARD_MODIFIER_STATE *ModifierState, PHIDP_INSERT_SCANCODES InsertCodesProcedure, VOID *InsertCodesContext);
>  
>  #ifndef FACILITY_HID_ERROR_CODE
>  #define FACILITY_HID_ERROR_CODE 0x11
> 
> 
> 




More information about the wine-devel mailing list