# Using GetRawInputDeviceList returns too many devices

This topic is 4073 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello GDNet This is about using RawInput API, and more specifically, device enumeration. I have copied the following sample from MSDN:
UINT nDevices = 0;
RAWINPUTDEVICELIST* pRawInputDeviceList = NULL;
UINT res = GetRawInputDeviceList(NULL, &nDevices, sizeof(RAWINPUTDEVICELIST));
if (res != 0) return;
pRawInputDeviceList = new RAWINPUTDEVICELIST[nDevices];
res = GetRawInputDeviceList(pRawInputDeviceList, &nDevices, sizeof(RAWINPUTDEVICELIST));
if (res == 0xFFFFFFFE) return;
delete pRawInputDeviceList;
The fact is that nDevices indicates there are 4 devices connected to my system. The first 2 are keyboards, the last 2 are mice. All four devices have different HANDLE values, different names. However, I am 100% positive that I only have ONE keyboard and ONE mouse :) (trust me on this please ;)) Is there anything I have failed to see ? Thanks! - JA

##### Share on other sites
Perhaps it doesn't filter RDP virtual devices?

##### Share on other sites
What you said sounds interesting. Allow me to post a little mode details about the results I get:

Device 1-------------------Name: "\??\Root#RDP_KBD#0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}"Device 2-------------------Name: "\??\ACPI#PNP0303#4&30647147&0#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}"Device 3-------------------Name: "\??\Root#RDP_MOU#0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}"Device 4:-------------------Name: "\??\HID#Vid_046d&Pid_c00c#6&de7ce82&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}"

Looks like the RDP stuff is involved, yet i know nothing about what it is. I will google that at once. However if someone can point some resources to me I would greatly appreciate it.

Thanks raz0r

- JA

Edit: found out RDP stands for Remote Desktop Protocol. I guess the 2 extra device I get might be some kind of virtual devices that allow a computer to be remotely controlled. GetRawInputDeviceList however does not have any argument to specify what to filter out. I don't think that manually disabling the corresponding window services on end user's pc is the way to go, so if anyone got an idea I'm all ears :)

Thanks!

[Edited by - janta on October 23, 2006 12:47:44 AM]

##### Share on other sites
I remember working with this some time ago, and the only way I know of to filter out such devices is by device name.
I'm sure that this method is unreliable and "dirty", however it has worked on all of the machines that I tried it on, but I suppose it might break in the future. =)

In any case, I'm also interested if someone knows...

##### Share on other sites
I also imagined I could "parse" the name but that would be the last option I'd chose (no in fact, if I have no other option that this, I'll use DirectInput...)
BTW when I get some time, I'll try enumerating devices with DirectInput just to see if RDP devices are enumerated as well.

I've tried disabling "Fast User Switching" and "Terminal Services" services but that did not help.

JA

##### Share on other sites

This topic is 4073 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628736
• Total Posts
2984456

• 25
• 11
• 10
• 16
• 14