dinput: the DIK_ keycode is not the same as the scancode.

Vitaliy Margolen wine-devel at kievinfo.com
Fri Aug 1 15:15:04 CDT 2008


James Mckenzie wrote:
> Vitaliy Margolen <wine-devel at kievinfo.com> at Jul 31, 2008 10:10 PM (PNT) wrote about Re: dinput: the DIK_ keycode is not the same as the scancode.
>>> -    dik_code = hook->scanCode & 0xff;
>>> +    dik_code = This->ScanCodemap[hook->scanCode];
>> Scan code can be larger then 256 so "& 0xff" is really necessary.
>>
> What is the type of scanCode.  If it is BYTE and BYTE is properly defined as being between 0x00 and 0xff, then the check is not necessary.  If it is defined as something else, then the check IS necessary and should nto be dropped

typedef struct tagKBDLLHOOKSTRUCT
{
     DWORD   vkCode;
     DWORD   scanCode;
     DWORD   flags;
     DWORD   time;
     ULONG_PTR dwExtraInfo;
} KBDLLHOOKSTRUCT, *LPKBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT;


(scanCode & 0x100) != 0 indicates an extended key.

> In this case, I feel that map_dik_code should be defined as BYTE and no other type.  Was that the intent of your comment?
That and definitions of the variables and the array type.


Vitaliy.



More information about the wine-devel mailing list