Click here to Skip to main content
15,909,051 members
Home / Discussions / Hardware & Devices
   

Hardware & Devices

 
GeneralRe: Hooking Raw Input - Detect HID mice Pin
Dave Kreskowiak2-Apr-08 3:45
mveDave Kreskowiak2-Apr-08 3:45 
GeneralRe: Hooking Raw Input - Detect HID mice Pin
maszup2-Apr-08 5:05
maszup2-Apr-08 5:05 
GeneralRe: Hooking Raw Input - Detect HID mice Pin
Randor 2-Apr-08 5:10
professional Randor 2-Apr-08 5:10 
GeneralRe: Hooking Raw Input - Detect HID mice Pin
maszup2-Apr-08 5:33
maszup2-Apr-08 5:33 
GeneralRe: Hooking Raw Input - Detect HID mice Pin
Randor 2-Apr-08 6:31
professional Randor 2-Apr-08 6:31 
AnswerRe: Hooking Raw Input - Detect HID mice Pin
maszup2-Apr-08 9:27
maszup2-Apr-08 9:27 
GeneralRe: Hooking Raw Input - Detect HID mice Pin
maszup7-Apr-08 21:56
maszup7-Apr-08 21:56 
GeneralRe: Hooking Raw Input - Detect HID mice Pin
Randor 12-Apr-08 20:30
professional Randor 12-Apr-08 20:30 
maszup wrote:
1) how do i know to which driver in driver stack should i connect to get access to the HID mouse? Do I really need very low access to USB port?


I already explained this. No, all you would need to do is attach to \\Device\\PointerClass0 and all other corresponding pointing devices. You can look them up in the registry when you install the driver and iterate through all of them. They are located at:

HKEY_LOCAL_MACHINE\HARDWARE\DeviceMap\PointerClass

maszup wrote:
2) how do i interface with the lower driver? what is the structure the lower driver offer to me? how can i know what is the context?


You do not need to interact with the lower drivers. With an upper level filter driver you only need to copy the input packet and save or filter it.

maszup wrote:
3) how to get the information about the position from the lower driver? from its context?


In the 'moufiltr' example in the DDK look at the function MouFilter_ServiceCallback. You have a pointer to a MOUSE_INPUT_DATA struct which will tell you the last mouse cursor position. You need to save a copy of this. You will also need to implement a new IOCTL command which will pass a buffer to recieve it.

maszup wrote:
4) the example mouse filter is for hooking the PS2 mouse? is it possible to get access to a driver that doesn't distinguish to PS2 or USB mouse?


Although the sample documentation references PS2 it actually doesn't matter. The driver is built for a HID input device of FILE_DEVICE_MOUSE == 0x0000000f

It is exceedingly simple to modify the example in the DDK to do what you require. All you need to do is save a copy of MOUSE_INPUT_DATA each time one arrives. And add 1 more case statement to the function in the example called MouFilter_InternIoCtl() which will handle a new control command. Your usermode application can simply pass a pointer to a memory buffer and your IOCTL handler will copy the data to the usermode program or service. You can even pass the entire MOUSE_INPUT_DATA struct if you wanted.

Make sure to watch out for race conditions when you save a copy of that struct... when a HID driver locks up you sometimes cannot even get into Windows without removing it. I generally do my driver development in VMWare. When I first started developing drivers I was lock out of my computer several times, heh. Its funny now but it wasn't back then.

Anyway I would recommend reading the article by Toby Opferman about implementing an IOCTL.

http://www.codeproject.com/KB/system/driverdev2.aspx[^]

Its not as difficult as it seems. If you have any questions you can post them here or contact me via e-mail.

Best Wishes,
-David Delaune
GeneralRe: Hooking Raw Input - Detect HID mice Pin
Dave Kreskowiak2-Apr-08 6:48
mveDave Kreskowiak2-Apr-08 6:48 
QuestionBuilding c# pc remote control? Pin
Goalie3531-Mar-08 17:22
Goalie3531-Mar-08 17:22 
AnswerRe: Building c# pc remote control? Pin
Matthew Butler2-Apr-08 14:56
Matthew Butler2-Apr-08 14:56 
GeneralRe: Building c# pc remote control? Pin
Goalie352-Apr-08 19:11
Goalie352-Apr-08 19:11 
GeneralRe: Building c# pc remote control? Pin
Matthew Butler3-Apr-08 2:57
Matthew Butler3-Apr-08 2:57 
GeneralMonitor blur Pin
Mekong River31-Mar-08 17:19
Mekong River31-Mar-08 17:19 
GeneralRe: Monitor blur Pin
Sebastian Schneider2-Apr-08 5:00
Sebastian Schneider2-Apr-08 5:00 
GeneralRe: Monitor blur Pin
Mekong River3-Apr-08 0:11
Mekong River3-Apr-08 0:11 
GeneralRe: Monitor blur Pin
Dave Kreskowiak3-Apr-08 3:47
mveDave Kreskowiak3-Apr-08 3:47 
General_asm code Pin
ForNow31-Mar-08 14:33
ForNow31-Mar-08 14:33 
GeneralUsing and Preserving Registers in Inline Assembly Pin
Randor 1-Apr-08 16:42
professional Randor 1-Apr-08 16:42 
GeneralRe: Using and Preserving Registers in Inline Assembly Pin
ForNow1-Apr-08 19:41
ForNow1-Apr-08 19:41 
GeneralAnything special prlouge __fastcall with _asm Pin
ForNow3-Apr-08 6:16
ForNow3-Apr-08 6:16 
GeneralRe: Anything special prlouge __fastcall with _asm Pin
Randor 7-Apr-08 17:37
professional Randor 7-Apr-08 17:37 
GeneralRe: Anything special prlouge __fastcall with _asm Pin
ForNow7-Apr-08 23:03
ForNow7-Apr-08 23:03 
GeneralRe: Using and Preserving Registers in Inline Assembly Pin
bob169726-Apr-08 7:39
bob169726-Apr-08 7:39 
GeneralRe: Using and Preserving Registers in Inline Assembly Pin
Randor 7-Apr-08 17:58
professional Randor 7-Apr-08 17:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.