How to extract a device or driver's name?

Doron, Peter!

I’d like agree about SetupDi* advantages. But some events and privet
experience have pushed me analyze registry.
I name only the mains:

  1. About year ago I tried to use Protocol NDIS example from
    Microsoft DDK. It is loading and even working about. But!!! Computer
    hangs up on the reboot, if the driver remains in the memory. The reason
    was the attempt the Protocol driver reconfiguration via SetupDI*. I
    receive the stable allergy to SetupDI* after.
  2. I right now have finishing the huge code which analyzes a lot of
    Registry sections comprising Hardware installation info. Code has been
    checked for every Windows version from W2000 to W2K3. It works perfect
    and (the most important!) has NOT any branch, dependently from OS
    version. Obviously, it is not guarantee from future problems. But who
    from us has these guarantees…? :slight_smile:
  3. Unfortunately SetupDi* doesn’t deliver all useful information
    which I need. As example only, it has NOT callback about hardware
    configuration changes.
  4. I myself one time had been forced edit registry after hardware
    installation due it was the single way to close the SetupDI* problem.

I agree with you, I would prefer using official documented API. But if
this API would be defined and written better, than SetupDI* done…

Regards,
Michael.

Doron Holan wrote:

Programming is hard. Plain and simple. Some problems are simple, some
are hard. Some APIs you like, some you don’t. Going behind the back of
those APIs and getting at the data yourself will only cause problems for
you and your customers.

That’s true. However, I have to say that the SetupDi APIs are among the
most arcane and obscure APIs in the entire Win32 set. Despite the fact
that I have written several, I seriously doubt that I could successfully
create a SetupDi-based program from scratch with the MSDN docs, without
being able to cut-and-paste working code from a sample.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

> ----------

From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Tim Roberts[SMTP:xxxxx@probo.com]
Reply To: Windows System Software Devs Interest List
Sent: Monday, April 03, 2006 8:40 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to extract a device or driver’s name?

That’s true. However, I have to say that the SetupDi APIs are among the
most arcane and obscure APIs in the entire Win32 set.

I guess the word ‘obnoxious’ is the most accurate here :slight_smile:

Despite the fact that I have written several, I seriously doubt that I could successfully
create a SetupDi-based program from scratch with the MSDN docs, without
being able to cut-and-paste working code from a sample.

It is possible and necessary for non-trivial cases which can’t be find in the samples. Time consuming and unnecessarily hard. Docs should contain the relations between APIs, ideally as a graph. I wonder if there is any person in the world, including Setup API inventors, who fully understands it and who’d be able to describe all relations. If it is even possible. Sometimes it is better to throw out the monster and design new one from scratch.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

Correct. DevicePath is the one which can be passed to CreateFile. In fact,
the only purpose of the “device interface detail” entity is to provide you with
the openable filename.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Harsha Inamdar”
To: “Windows System Software Devs Interest List”
Sent: Thursday, March 30, 2006 2:38 AM
Subject: [ntdev] How to extract a device or driver’s name?

> Hi All,
>
> I am trying to extract a name of the device or the driver from
> typedef struct _SP_DEVICE_INTERFACE_DETAIL_DATA_A {
> DWORD cbSize;
> CHAR DevicePath[ANYSIZE_ARRAY];
> } SP_DEVICE_INTERFACE_DETAIL_DATA_A
>
> defined in DDK.
>
> Can somebody please tell me how to extract the name as this structure
doesn’t have the name field. It gives the DevicePath but not device name.
>
> Thanks,
> Harsha
>
>
> ---------------------------------
> Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates.
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

> That’s true. However, I have to say that the SetupDi APIs are among the

most arcane and obscure APIs in the entire Win32 set. Despite the fact

Some of the PnP IDs (I think Instance ID) are just not available via SetupDi.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com