problem with Hardware ID

HI,
I am developing driver for a PCI-e based multiport serial controller that hosts multiple COM ports. I am writing two drivers for this.

  1. The controller driver which acts as FDO for controller as well as creating PDOs for the serial Ports

  2. The Serial port driver which creates FDOs for UART ports.
    In Controller driver while creating PDOs for UART ports, i am giving a hardward ID as PTL\PTLSER_123412AB_123412AB.

I have seen a related post on this. It suggested to remove null characters from the device ID string etc. I made sure i don’t have null characters in the Device ID and Hardware ID. Also i am specifying all the values for Hardware ID, Device ID, Compatible ID and Instance ID.

I am copying values of Device ID and Hardware ID etc into a UNICODE_STRING buffer before assigning them to the PDOs.

I am copying them in the below mentioned manner.

swprintf(buf.Buffer,L"PTL" L"\" PTLSER_DESCRIPTION L"%08X%08X", FdoData->ulDeviceId, FdoData->ulSubDeviceId);
“buf” is a UNICODE_STRING with the following values.
WCHAR stringBuffer[MAX_ID_LEN]; - MAX_ID_LEN is 128
buf.Buffer = stringBuffer;
buf.Length = 128;
buf.MaximumLength = sizeof(stringBuffer);
and then i assign device ID using the below API.
status = WdfPdoInitAssignDeviceID(pDeviceInit, &buf);

Likewise i assign Hardware ID, Compatible ID etc values also.
After we install the driver, we are getting the below error in device manager.

"The device is working properly. There is a secondary device connected to this hardware that Windows cannot identify because it does not have a valid hardware identification number ".

I am confirming that the Hardware ID and Device ID are formed successfully by printing them in the logs using KdPrint. I am getting the expected values.

But Windows can’t see to recognize it. What could be the problem here?

See my answer on the wdk forum. Short answer us buf.Length = 128; is incorrect and needs to be the length of the valid string in bytes. You don’t need to be setting the values on your own, there are various helper APIs which will.do this for you.

d

Bent from my phone


From: xxxxx@gmail.commailto:xxxxx
Sent: ?6/?11/?2014 8:17 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: [ntdev] problem with Hardware ID

HI,
I am developing driver for a PCI-e based multiport serial controller that hosts multiple COM ports. I am writing two drivers for this.
1. The controller driver which acts as FDO for controller as well as creating PDOs for the serial Ports

2. The Serial port driver which creates FDOs for UART ports.
In Controller driver while creating PDOs for UART ports, i am giving a hardward ID as PTL\PTLSER_123412AB_123412AB.

I have seen a related post on this. It suggested to remove null characters from the device ID string etc. I made sure i don’t have null characters in the Device ID and Hardware ID. Also i am specifying all the values for Hardware ID, Device ID, Compatible ID and Instance ID.

I am copying values of Device ID and Hardware ID etc into a UNICODE_STRING buffer before assigning them to the PDOs.

I am copying them in the below mentioned manner.

swprintf(buf.Buffer,L"PTL" L"\" PTLSER_DESCRIPTION L"%08X%08X", FdoData->ulDeviceId, FdoData->ulSubDeviceId);
“buf” is a UNICODE_STRING with the following values.
WCHAR stringBuffer[MAX_ID_LEN]; - MAX_ID_LEN is 128
buf.Buffer = stringBuffer;
buf.Length = 128;
buf.MaximumLength = sizeof(stringBuffer);
and then i assign device ID using the below API.
status = WdfPdoInitAssignDeviceID(pDeviceInit, &buf);

Likewise i assign Hardware ID, Compatible ID etc values also.
After we install the driver, we are getting the below error in device manager.

"The device is working properly. There is a secondary device connected to this hardware that Windows cannot identify because it does not have a valid hardware identification number ".

I am confirming that the Hardware ID and Device ID are formed successfully by printing them in the logs using KdPrint. I am getting the expected values.

But Windows can’t see to recognize it. What could be the problem here?


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

Thankyou for the reply Doron.

Earlier i was using some macros like DECLARE_GLOBAL_CONST_UNICODE_STRING, DECLARE_UNICODE_STRING_SIZE. But i was getting compilation errors so i had to resort to initializing the strings manually.

Are there any specific headers or libraries that i need to include for my code to compile smoothly?

I found out the answer for this from one of the posts. I should declare these macros at the beginning of the function since this file is a C file. That solved the problem.

THanks a lot Tim Roberts!!