How to get SP_DEVICE_INTERFACE_DETAIL_DATA from SetupDiEnumDeviceInfo elements

Hi,

can someone please tell me, how i can get a SP_DEVICE_INTERFACE_DETAIL_DATA from SetupDiEnumDeviceInfo for eacht element in the device information set. Unfortunately i couldnt manage it by my own. I am interessted in the “TCHAR DevicePath[ANYSIZE_ARRAY];” member of the structure.

thanks in advance

K.

You have to allocate the structure from the heap after you query for the size. In C when you have an array at the end of a structure you can allocate more than sizeof(structure) and allocate more elements in the array out of one allocation. Look at the enum.exe part of the toaster sample on how to enumerate device interfaces and open them.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@arcor.de
Sent: Thursday, July 7, 2016 11:15 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to get SP_DEVICE_INTERFACE_DETAIL_DATA from SetupDiEnumDeviceInfo elements

Hi,

can someone please tell me, how i can get a SP_DEVICE_INTERFACE_DETAIL_DATA from SetupDiEnumDeviceInfo for eacht element in the device information set. Unfortunately i couldnt manage it by my own. I am interessted in the “TCHAR DevicePath[ANYSIZE_ARRAY];” member of the structure.

thanks in advance

K.


NTDEV is sponsored by OSR

Visit the list online at: http:

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

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

Hi Doron,

thanks for the example. Well, i am not sure what exactly i am doing wrong here, but maybe you can point me into the right direction. This is what i am doing so far:

First SetupDiGetClassDevsEx with DIGCF_ALLCLASSES //success
Then enum SetupDiEnumDeviceInfo with zero indexed MemberIndex till ERROR_NO_MORE_ITEMS//success
Passing data from SetupDiEnumDeviceInfo to SetupDiEnumDeviceInterfaces fails // returns FALSE, GetLastError() == 0
Passed parameters are:

valid DeviceInfoSet from previous SetupDiGetClassDevsEx
valid DeviceInfoData from SetupDiEnumDeviceInfo
valid GUID from DeviceInfoData.ClassGuid
valid MemberIndex from SetupDiEnumDeviceInfo
preallocated and cbSize set valid DeviceInterfaceData structure

The SetupDiEnumDeviceInterfaces always fails with FALSE but GetLastError() returns also always 0.

Its obvoius that i am doing something wrong here, but what?

K.

You can only get device interface data when enumerating a specific device interface. You are enumerating all devices which already is down the wrong path. Again, look at the enum.exe sample in toaster as it has copy and paste code for you to use

On Jul 8, 2016 12:55 AM, xxxxx@arcor.de wrote:
Hi Doron,

thanks for the example. Well, i am not sure what exactly i am doing wrong here, but maybe you can point me into the right direction. This is what i am doing so far:

First SetupDiGetClassDevsEx with DIGCF_ALLCLASSES //success
Then enum SetupDiEnumDeviceInfo with zero indexed MemberIndex till ERROR_NO_MORE_ITEMS//success
Passing data from SetupDiEnumDeviceInfo to SetupDiEnumDeviceInterfaces fails // returns FALSE, GetLastError() == 0
Passed parameters are:

valid DeviceInfoSet from previous SetupDiGetClassDevsEx
valid DeviceInfoData from SetupDiEnumDeviceInfo
valid GUID from DeviceInfoData.ClassGuid
valid MemberIndex from SetupDiEnumDeviceInfo
preallocated and cbSize set valid DeviceInterfaceData structure

The SetupDiEnumDeviceInterfaces always fails with FALSE but GetLastError() returns also always 0.

Its obvoius that i am doing something wrong here, but what?

K.


NTDEV is sponsored by OSR

Visit the list online at: http:

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

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

Hi Doron,

thanks again for the information. This works fine. But where does this DevicePath member exactly come from? Stored in registry somehow? Object managers namespace? Just out of curiosity.

K.

It has changed from version to version, it doesn’t matter what the backing storage implementation is.

Get Outlook for Androidhttps:

On Wed, Jul 13, 2016 at 9:04 PM -0700, “xxxxx@arcor.de” > wrote:

Hi Doron,

thanks again for the information. This works fine. But where does this DevicePath member exactly come from? Stored in registry somehow? Object managers namespace? Just out of curiosity.

K.


NTDEV is sponsored by OSR

Visit the list online at: http:

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

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