SetupDiEnumDeviceInterfaces fails

My SetupDiEnumDeviceInterfaces call from my application is always returning false.

SetupDiGetClassDevs call is returning valid HDEVINFO. I am also making sure that that GUID being passed in all calls is the same as the driver I want my application to talk to.

My driver is a WDF driver – this the 1st time I am working with a WDF driver. I am making sure that I use WdfDeviceCreateDeviceInterface call followed by a WdfDeviceSetDeviceInterfaceState call to register the device interface and enable the device interface in my driver’s AddDevice.

Am I missing something?

Any thoughts as to what the problem might be?

Thanks!
Vidya

On Fri, 3 Oct 2008 20:23:59 -0700, “Dharmaraju, Vidyadhari”
wrote:

>My SetupDiEnumDeviceInterfaces call from my application is always returning false.
>
>SetupDiGetClassDevs call is returning valid HDEVINFO. I am also making sure that that GUID being passed in all calls is the same as the driver I want my application to talk to.
>
>My driver is a WDF driver – this the 1st time I am working with a WDF driver. I am making sure that I use WdfDeviceCreateDeviceInterface call followed by a WdfDeviceSetDeviceInterfaceState call to register the device interface and enable the device interface in my driver’s AddDevice.
>
>Am I missing something?
>
>Any thoughts as to what the problem might be?
>

What does GetLastError() return after your call to SetupDiEnumDeviceInterfaces()
returns FALSE? The error code should give you a clue as to why the function is
failing.

…John

Also, before invoking SetupDiEnumDeviceInterfaces make sure that you
are setting
cbSize value of SP_DEVICE_INTERFACE_DATA variable. This is mandatory
before the function call. GetLastError will definitely point to this
error.

Regards.

On Sun, Oct 5, 2008 at 12:00 AM, John Hensley wrote:
> On Fri, 3 Oct 2008 20:23:59 -0700, “Dharmaraju, Vidyadhari”
> wrote:
>
>>My SetupDiEnumDeviceInterfaces call from my application is always returning false.
>>
>>SetupDiGetClassDevs call is returning valid HDEVINFO. I am also making sure that that GUID being passed in all calls is the same as the driver I want my application to talk to.
>>
>>My driver is a WDF driver – this the 1st time I am working with a WDF driver. I am making sure that I use WdfDeviceCreateDeviceInterface call followed by a WdfDeviceSetDeviceInterfaceState call to register the device interface and enable the device interface in my driver’s AddDevice.
>>
>>Am I missing something?
>>
>>Any thoughts as to what the problem might be?
>>
>
> What does GetLastError() return after your call to SetupDiEnumDeviceInterfaces()
> returns FALSE? The error code should give you a clue as to why the function is
> failing.
>
> …John
>
> —
> NTDEV is sponsored by OSR
>
> 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
>

If you create a device interface during EvtDriverDeviceAdd then KMDF will enable it automatically. Not that I think this is your problem, but for future reference.

-p

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Dharmaraju, Vidyadhari
Sent: Friday, October 03, 2008 8:24 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] SetupDiEnumDeviceInterfaces fails

My SetupDiEnumDeviceInterfaces call from my application is always returning false.

SetupDiGetClassDevs call is returning valid HDEVINFO. I am also making sure that that GUID being passed in all calls is the same as the driver I want my application to talk to.

My driver is a WDF driver – this the 1st time I am working with a WDF driver. I am making sure that I use WdfDeviceCreateDeviceInterface call followed by a WdfDeviceSetDeviceInterfaceState call to register the device interface and enable the device interface in my driver’s AddDevice.

Am I missing something?

Any thoughts as to what the problem might be?

Thanks!
Vidya


NTDEV is sponsored by OSR

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