Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
I am having an issue with 3 functions (
HidD_GetManufacturerString
,
HidD_GetProductString
,
HidD_GetSerialNumberString
). The issue is that they return
TRUE
(indicating success), but do not modify the buffer (not even adding a terminator).
MSDN pages for the functions:
HidD_GetManufacturerString
:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff538959%28v=vs.85%29.aspx
HidD_GetProductString
:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff539681%28v=vs.85%29.aspx
HidD_GetSerialNumberString
:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff539683%28v=vs.85%29.aspx
Here is the code that actually calls the methods:
wchar_t manufacturer[MAX_SERIAL_LEN];
wchar_t product[MAX_SERIAL_LEN];
wchar_t serial[MAX_SERIAL_LEN];
ZeroMemory(manufacturer, MAX_SERIAL_LEN);
ZeroMemory(product, MAX_SERIAL_LEN);
ZeroMemory(serial, MAX_SERIAL_LEN);
HidD_GetManufacturerString(hFile, manufacturer, MAX_SERIAL_LEN);
HidD_GetProductString(hFile, product, MAX_SERIAL_LEN);
HidD_GetSerialNumberString(hFile, serial, MAX_SERIAL_LEN);
printf("Information for device %s\nManufacturer: %S\nProduct: %S\nSerial: %S\n\n",
DevIntfDetailData->DevicePath,
manufacturer, product, serial
hFile
is opened like this:
HANDLE hFile = CreateFile(DevIntfDetailData->DevicePath, 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
DevIntfDetailData
is filled using SetupDiGetDeviceInterfaceDetail
MAX_SERIAL_LEN
is defined as
sizeof(wchar_t)*127
–
–
–
Probably a driver bug.
I have a similar problem: The functions return TRUE
, but the buffer is either not touched at all or it is filled with random garbage.
Here’s the catch: This happens only for my headset, and only while I am actively using its microphone via Skype/Teams/etc. Once I leave a call, the functions start returning ordinary names again.
This leads me to believe you’re seeing a faulty driver. Mine is the Windows standard headset driver on Windows 10 1907.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.