Instance ID

Hi,

I am figuring out the way to distinguish between various disk drives present
in the system. Then I came across "An instance ID is a device identification
string that distinguishes a device from other devices of the same type on a
computer. An instance ID contains serial number information, if supported by
the underlying bus, or some kind of location information. The string cannot
contain any “" characters; otherwise, the generic format of the string is
bus-specific.”

To obtain the bus-supplied instance ID for a device, use an
**http:IRP_MN_QUERY
request and set the
Parameters.QueryId.IdType member to BusQueryInstanceID.

Is there any way to get the instance ID in the user mode using setup API’s
or may be some other API’s.


Regards
Rohit Gauba

“A positive thought is the seed of a positive result”</http:>

In user mode, use the device instance path, the includes the enumerator and instance id.

d

dent from a phpne with no keynoard


From: Rohit
Sent: July 27, 2010 3:43 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Instance ID

Hi,

I am figuring out the way to distinguish between various disk drives present in the system. Then I came across "An instance ID is a device identification string that distinguishes a device from other devices of the same type on a computer. An instance ID contains serial number information, if supported by the underlying bus, or some kind of location information. The string cannot contain any “" characters; otherwise, the generic format of the string is bus-specific.”

To obtain the bus-supplied instance ID for a device, use an http: IRP_MN_QUERY request and set the Parameters.QueryId.IdType member to BusQueryInstanceID.

Is there any way to get the instance ID in the user mode using setup API’s or may be some other API’s.


Regards
Rohit Gauba

“A positive thought is the seed of a positive result”

— 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</http:>

Use SetupApiXxxx functions to enumerate the drives.

Gary G. Little

H (952) 223-1349

C (952) 454-4629

xxxxx@comcast.net

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Rohit
Sent: Tuesday, July 27, 2010 5:43 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Instance ID

Hi,

I am figuring out the way to distinguish between various disk drives present
in the system. Then I came across "An instance ID is a device identification
string that distinguishes a device from other devices of the same type on a
computer. An instance ID contains serial number information, if supported by
the underlying bus, or some kind of location information. The string cannot
contain any “" characters; otherwise, the generic format of the string is
bus-specific.”

To obtain the bus-supplied instance ID for a device, use an IRP_MN_QUERY
request and set the Parameters.QueryId.IdType member to BusQueryInstanceID.

Is there any way to get the instance ID in the user mode using setup API’s
or may be some other API’s.


Regards
Rohit Gauba

“A positive thought is the seed of a positive result”

— 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

Yeh. you can use SetupDiGetClassDevs and SetupDiEnumDeviceInterfaces
functions to enumerate the drives

On Tue, Jul 27, 2010 at 7:50 PM, Gary G. Little wrote:

> Use SetupApiXxxx functions to enumerate the drives.
>
>
>
> Gary G. Little
>
> H (952) 223-1349
>
> C (952) 454-4629
>
> xxxxx@comcast.net
>
>
>
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] *On Behalf Of *Rohit
> Sent: Tuesday, July 27, 2010 5:43 AM
>
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Instance ID
>
>
>
> Hi,
>
> I am figuring out the way to distinguish between various disk drives
> present in the system. Then I came across "An instance ID is a device
> identification string that distinguishes a device from other devices of the
> same type on a computer. An instance ID contains serial number information,
> if supported by the underlying bus, or some kind of location information.
> The string cannot contain any “" characters; otherwise, the generic format
> of the string is bus-specific.”
>
> To obtain the bus-supplied instance ID for a device, use an IRP_MN_QUERY
> request and set the Parameters.QueryId.IdType member to
> BusQueryInstanceID
.
>
> Is there any way to get the instance ID in the user mode using setup API’s
> or may be some other API’s.
>
>
>
>
>
> –
> Regards
> Rohit Gauba
>
> “A positive thought is the seed of a positive result”
>
> — 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
>
> —
> 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
>


Prageeth Madhushanka
Sri Lanka

Sheesh . I never do spell those right the first time I use them .

Gary G. Little

H (952) 223-1349

C (952) 454-4629

xxxxx@comcast.net

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Prageeth Madhushanka
Sent: Tuesday, July 27, 2010 11:41 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Instance ID

Yeh. you can use SetupDiGetClassDevs and SetupDiEnumDeviceInterfaces
functions to enumerate the drives

On Tue, Jul 27, 2010 at 7:50 PM, Gary G. Little
wrote:

Use SetupApiXxxx functions to enumerate the drives.

Gary G. Little

H (952) 223-1349

C (952) 454-4629

xxxxx@comcast.net

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Rohit
Sent: Tuesday, July 27, 2010 5:43 AM

To: Windows System Software Devs Interest List

Subject: [ntdev] Instance ID

Hi,

I am figuring out the way to distinguish between various disk drives present
in the system. Then I came across "An instance ID is a device identification
string that distinguishes a device from other devices of the same type on a
computer. An instance ID contains serial number information, if supported by
the underlying bus, or some kind of location information. The string cannot
contain any “" characters; otherwise, the generic format of the string is
bus-specific.”

To obtain the bus-supplied instance ID for a device, use an IRP_MN_QUERY
request and set the Parameters.QueryId.IdType member to BusQueryInstanceID.

Is there any way to get the instance ID in the user mode using setup API’s
or may be some other API’s.


Regards
Rohit Gauba

“A positive thought is the seed of a positive result”

— 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


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


Prageeth Madhushanka
Sri Lanka

— 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

>Is there any way to get the instance ID in the user mode using setup API’s or may be some other

API’s.

In user mode, use SetupDiGetClassDevs with the “device interface” flag for “physical disk” GUID.

The names returned (via SetupDiGetDeviceInterfaceDetail) are based on the instance IDs.

Instance IDs themselves are intentionally not documented by MS due to some reasons.

Also, you can use MBR signatures for physical disks.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

There really isn’t any guarantee that this value will not change on systems
where disks come and go. The unique id for a disk is the disk serial number

  • which only exists for disks that conform to standards that define such a
    thing - and should be obtained using storage ioctls not pnp ioctls.

Mark Roddy

On Tue, Jul 27, 2010 at 5:58 PM, Maxim S. Shatskih
wrote:

> >Is there any way to get the instance ID in the user mode using setup
> API’s or may be some other
> >API’s.
>
> In user mode, use SetupDiGetClassDevs with the “device interface” flag for
> “physical disk” GUID.
>
> The names returned (via SetupDiGetDeviceInterfaceDetail) are based on the
> instance IDs.
>
> Instance IDs themselves are intentionally not documented by MS due to
> some reasons.
>
> Also, you can use MBR signatures for physical disks.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> 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
>

>There really isn’t any guarantee that this value will not change on systems where disks come and go.

It will not change unless the same disk is re-attached to some another controller.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

So any decent server class system would be a likely candidate for breaking a
design based on device instance id. In general device uniqueness is best
determined, in my opinion, from device specific ‘uniquifiers’ such as disk
serial numbers, rather than hoping that pnp enumeration will provide
something that always works.

Mark Roddy

On Wed, Jul 28, 2010 at 6:31 AM, Maxim S. Shatskih
wrote:

> >There really isn’t any guarantee that this value will not change on
> systems where disks come and go.
>
> It will not change unless the same disk is re-attached to some another
> controller.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> 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
>