Windows系统USB鼠标MOUSE_INPUT_DATA24字节长度解析(BUSHOUND可抓包)
			 2022-06-07
			  本文链接为:http://www.usbzh.com/article/detail-1050.html ,欢迎转载,转载请附上本文链接。
	
			
			
			
			
		
			注意,这里不是我们通过USB鼠标HID报告描述符定义的格式,而是系统收到HID鼠标报告内容之后通过数据转换供系统使用的数据格式。
鼠标的数据格式定义如下:
typedef struct _MOUSE_INPUT_DATA {
  USHORT UnitId;
  USHORT Flags;
  union {
    ULONG Buttons;
    struct {
      USHORT ButtonFlags;
      USHORT ButtonData;
    };
  };
  ULONG  RawButtons;
  LONG   LastX;
  LONG   LastY;
  ULONG  ExtraInformation;
} MOUSE_INPUT_DATA, *PMOUSE_INPUT_DATA;
微软官方的资料可详见:https://docs.microsoft.com/zh-cn/windows/win32/api/ntddmou/ns-ntddmou-mouse_input_data
而BUSHOUND定义的如下:
| Offset | Length | Content | 
|---|---|---|
| 0 | 2 | Not used | 
| 2 | 2 | Position type: | 
| 0000h = relative position | ||
| 0001h = absolute position | ||
| 4 | 2 | Button flags: | 
| 0001h = left button down | ||
| 0002h = left button up | ||
| 0004h = right button down | ||
| 0008h = right button up | ||
| 0010h = middle button down | ||
| 0020h = middle button up | ||
| 0040h = button 4 down | ||
| 0080h = button 4 up | ||
| 0100h = button 5 down | ||
| 0200h = button 5 up | ||
| 0400h = mouse wheel | ||
| 6 | 2 | Mouse wheel data | 
| 8 | 4 | Not used | 
| 12 | 4 | X position | 
| 16 | 4 | Y position | 
| 20 | 4 | Device specific information | 
使用BUSHOUND抓包时,只需要选中设备,即可抓包:

HID人机交互QQ群:564808376   
UAC音频QQ群:218581009   
UVC相机QQ群:331552032   
BOT&UASP大容量存储QQ群:258159197   
STC-USB单片机QQ群:315457461   
USB技术交流QQ群2:580684376   
USB技术交流QQ群:952873936    
		 HID开发笔记
			HID开发笔记
			




