full instance ID path from devices

I have two keyboards plugged in which have the same hardware id.
I know that I need the serial number but with which function can I get it?
Or how can I get the instance name of a device?

Thanks
Manfred

From a driver? From an app? What will you do with the information once you have it…IOW what bigger problem are you trying to solve? Btw, keyboards usually don’t have serial numbers.

d

Bent from my phone


From: xxxxx@lists.osr.com on behalf of xxxxx@x-publisher.com
Sent: Wednesday, March 7, 2018 8:21:15 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] full instance ID path from devices

I have two keyboards plugged in which have the same hardware id.
I know that I need the serial number but with which function can I get it?
Or how can I get the instance name of a device?

Thanks
Manfred


NTDEV is sponsored by OSR

Visit the list online at: https:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at https:

To unsubscribe, visit the List Server section of OSR Online at https:</https:></https:></https:>

I iterate through the keyboards attached to my filter driver and need a unique identifier for customizing.
I know there is the Keboard UnitId but this id is attached first if the user types something on the keyboard.

What is with this function WdfDeviceAllocAndQueryPropertyEx? It seems that this does it but I didnt find an example how the DEVPROPKEY must be defined for DEVPKEY_Device_InstanceId.

I get this
“HID\VID_046A&PID_0023&MI_00”
“HID\VID_046A&PID_0023&MI_00”
and I need this
“HID\VID_046A&PID_0023&MI_00\8&26101c2b&0&0000_0”
“HID\VID_046A&PID_0023&MI_00\8&3483bdfa&0&0000_0”

xxxxx@x-publisher.com wrote:

I iterate through the keyboards attached to my filter driver and need a unique identifier for customizing.
I know there is the Keboard UnitId but this id is attached first if the user types something on the keyboard.

What is with this function WdfDeviceAllocAndQueryPropertyEx? It seems that this does it but I didnt find an example how the DEVPROPKEY must be defined for DEVPKEY_Device_InstanceId.

"How it must be defined?"  I don’t know what you mean by that.  The
DEVPKEY GUIDs are all defined in <devpkey.h>. You just use the name.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.</devpkey.h>

Why are you iterating through the keyboards outside of the context of pnp. If you want to filter all keyboards, install your filter as a class upper filter. Once you are in the pnp stack, you have access to the PDO and with the PDO you can call WdfDeviceOpenRegistryKey(PDO, PLUGPLAY_REGKEY_DEVICE, …) (or WDM equivalent API) which gives you the per device storage you need for customizatiosn without opening or needing the full instance ID path

d

-----Original Message-----
From: xxxxx@lists.osr.com On Behalf Of xxxxx@x-publisher.com
Sent: Wednesday, March 7, 2018 9:07 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] full instance ID path from devices

I iterate through the keyboards attached to my filter driver and need a unique identifier for customizing.
I know there is the Keboard UnitId but this id is attached first if the user types something on the keyboard.

What is with this function WdfDeviceAllocAndQueryPropertyEx? It seems that this does it but I didnt find an example how the DEVPROPKEY must be defined for DEVPKEY_Device_InstanceId.


NTDEV is sponsored by OSR

Visit the list online at: https:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at https:

To unsubscribe, visit the List Server section of OSR Online at https:</https:></https:></https:>

@Doran: The reason is perhabs that I dont understand it all.
What is wrong:
DEVICE_OBJECT *pdo = WdfDeviceWdmGetPhysicalDevice(device);

status = WdfDeviceOpenRegistryKey(WdfWdmDeviceGetWdfDeviceHandle(pdo),
PLUGPLAY_REGKEY_DEVICE,
STANDARD_RIGHTS_ALL,
WDF_NO_OBJECT_ATTRIBUTES,
&hKey);

Device is the actual device.

The following code (IoOpenDeviceRegistryKey) works but can anybody say where I can find this registry key “PLUGPLAY_REGKEY_DEVICE,” in the registry? I have an filterdriver and get the pdo with:

DEVICE_OBJECT *pdo = WdfDeviceWdmGetPhysicalDevice(device);

IoOpenDeviceRegistryKey(pdo,
PLUGPLAY_REGKEY_DEVICE,
KEY_READ,
&deviceParameterHandle);

More precisely: What registry key I get with the following code:

WdfDeviceWdmGetPhysicalDevice(device)

status = IoOpenDeviceRegistryKey(pdo,
PLUGPLAY_REGKEY_DEVICE | PLUGPLAY_REGKEY_CURRENT_HWPROFILE,
KEY_READ,
&deviceParameterHandle);

Is it e.g. the following?
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\HID\VID_046A&PID_010D&MI_00
or is it:
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\HID

I call the above function from an Upperfilter device.

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\HID\VID_046A&PID_010D&MI_00<instance id>\Device Parameters

Bent from my phone
________________________________
From: xxxxx@lists.osr.com on behalf of xxxxx@x-publisher.com
Sent: Thursday, March 8, 2018 5:32:22 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] full instance ID path from devices

More precisely: What registry key I get with the following code:

WdfDeviceWdmGetPhysicalDevice(device)

status = IoOpenDeviceRegistryKey(pdo,
PLUGPLAY_REGKEY_DEVICE | PLUGPLAY_REGKEY_CURRENT_HWPROFILE,
KEY_READ,
&deviceParameterHandle);

Is it e.g. the following?
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\HID\VID_046A&PID_010D&MI_00
or is it:
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\HID

I call the above function from an Upperfilter device.


NTDEV is sponsored by OSR

Visit the list online at: https:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at https:

To unsubscribe, visit the List Server section of OSR Online at https:</https:></https:></https:>