I am making a simple program to enumerate all of the devices currently connected to your Windows along with their pointers, then display the proper name for the device you clicked a button on your WPF window in C#.
I have finished writing the code to interpret device input, now all I need is to just get the product name for the device, aka something like TUF GAMING M5 in case of my mouse, which is how it shows up in my Device Manager window.
It appears as though using
NativeMethods.GetRawInputDeviceInfo(hDevice, RawInputDeviceInfo.RIDI_DEVICENAME, IntPtr.Zero, ref pcbSize);
gets me the device path and not something actually meant to be read by a human. I’ve seen people mention
BOOLEAN HidD_GetProductString(in] HANDLE HidDeviceObject, [out] PVOID Buffer, [in] ULONG BufferLength);
but everytime it’s mentioned, people say it only seems to work for HID devices and not mouses or keyboards. Even if I did decide to use it, I don’t know how to get the appropriate BufferLength for it with nothing but a raw input device struct.
If anyone is able to help me with this, I would strong appreciate it.
The Great ReLLeRtR is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.