oblitum / Interception

The Interception API aims to build a portable programming interface that allows one to intercept and control a range of input devices.
http://oblita.com/interception
1.32k stars 271 forks source link

No interception on self compiled executables #92

Closed Jupakabra closed 4 years ago

Jupakabra commented 4 years ago

Hello, I'm having a strange problem. I'm trying to run examples, like axes (including interception.c myself), but on one of the computers only keyboard gets intercepted and on other computer neither keyboard nor mouse gets intercepted.

The weird thing is that if I use the interception.dll directly everything works as expected. Is there any reason this might be happening? Also how does the driver know that 0 through 9 handles from the CreateFileA function are keyboard and next ones are mouse, I don't see any indexes being passed to the driver to differentiate? Because on computer where only keyboard gets intercepted it seems that 10-20 devices are bound as keyboards for some reason.

oblitum commented 4 years ago

I have no idea why it would not work on a given machine without further investigation. Currently lib and driver assume 10 filter device objects will be created for each kind of device, 10 for keyboard, and 10 for mouse, regardless you have that much connected or not.

Muchiachio commented 4 years ago

Examples are compiled only against \\.\interception00 device, but in reality there are 20 devices ranging from 00 to 19. One of your pcs was lucky to have the keyboard bound to 00 device, that's why it worked. If you want to get this working you will have to create handles for all 20 device names and use interception_wait to get the index of the device being used on your system.

oblitum commented 4 years ago

Examples are compiled only against \.\interception00 device

This is wrong info. Most examples, if not all, set a generic keyboard or mouse predicate to cover any of the first 10 devices of each kind attached.

Jupakabra commented 4 years ago

Thanks @Muchiachio you are real life saver! Compiled with \\.\interception01 and it started working now I can finish with my modifications. I have no idea how it works for others, had a clean windows 10 and it never worked from sources only with linked dll.