Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting... Please check out the Community Guidelines in the
Announcements and Administration Category, below.

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

Comments

  • Doron_HolanDoron_Holan Posts: 10,353
    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:

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

    To unsubscribe, visit the List Server section of OSR Online at
  • 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"
  • Tim_RobertsTim_Roberts Posts: 12,566
    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.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • Doron_HolanDoron_Holan Posts: 10,353
    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 <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 <xxxxx@lists.osr.com>
    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://na01.safelinks.protection.outlook.com/?url=http://www.osronline.com/showlists.cfm?list=ntdev&amp;data=04|01|[email protected]|572fa51aa0924f3901c208d5844dc55f|72f988bf86f141af91ab2d7cd011db47|1|0|636560391922463250|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ==|-2&amp;sdata=I+YPDGYFyH/m0vwAglJkknV3vD9vEUT2oivP5lwpxgI=&amp;reserved=0&gt;

    MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
    Details at <https://na01.safelinks.protection.outlook.com/?url=http://www.osr.com/seminars&amp;data=04|01|[email protected]|572fa51aa0924f3901c208d5844dc55f|72f988bf86f141af91ab2d7cd011db47|1|0|636560391922463250|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ==|-2&amp;sdata=J1rQ0hpzXA2MHzpsx6yzLKrru8Khvu0YAAsf3QabRNQ=&amp;reserved=0&gt;

    To unsubscribe, visit the List Server section of OSR Online at <https://na01.safelinks.protection.outlook.com/?url=http://www.osronline.com/page.cfm?name=ListServer&amp;data=04|01|[email protected]|572fa51aa0924f3901c208d5844dc55f|72f988bf86f141af91ab2d7cd011db47|1|0|636560391922463250|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ==|-2&amp;sdata=NGwjrkKQhgzifLiE66+kf+3DC90yxS6HE78dXv10fRQ=&amp;reserved=0&gt;
  • @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.
  • Doron_HolanDoron_Holan Posts: 10,353
    Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\HID\VID_046A&PID_010D&MI_00\\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:

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

    To unsubscribe, visit the List Server section of OSR Online at
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!