I am using GetRawInputDeviceInfo
to get the device name of the USB device HID name.
For some reason, when I run my code under Windows XP, I get a device name that starts with \??\
rather than \\?\
.
This, of course, means that when I try to use this device name (for example, in CreateFile
), it will not work. If I edit the device name and manually fix it as \\?\
, Everything will be fine.
This does not happen on Windows 7. On Win7, everything works fine.
I also test GetLastError
after every API call and errors.
My whole OS is 32 bit and my project is compiled using unicode.
Any suggestions what am I doing wrong? Here are snippets of code from my console application that gets the device name.
nResult = GetRawInputDeviceInfo( pDeviceList[i].hDevice, RIDI_DEVICENAME, NULL, &nBufferSize ); if( nResult < 0 ) { cout << "ERR: Unable to get Device Name character count.." << endl; return false; } WCHAR* wcDeviceName = new WCHAR[ nBufferSize + 1 ]; if( wcDeviceName == NULL ) { cout << "ERR: Unable to allocate memory for Device Name.." << endl; return false; } nResult = GetRawInputDeviceInfo( pDeviceList[i].hDevice, RIDI_DEVICENAME, wcDeviceName, &nBufferSize ); if( nResult < 0 ) { cout << "ERR: Unable to get Device Name.." << endl; delete [] wcDeviceName; return false; } wcDeviceName[1]='\\';
source share