Re: How do you get the number of physically installed hard disks (Win32)?

Pashupati,

you wrote on Friday, October 11, 2002, 19:11:31:

PW>> why not just use the interface name to open the device?

PK> There are other modules in the applications which assumes I am
PK> passing the device name in the form of PHYSICALDRIVEN.

The only reason I can think of why this should be necessary is that the
other modules parse the PHYSICALDRIVEx string to get at the disk number.
I would question this design :slight_smile:

PK> I am just wondering if computer management, winobj can show the
PK> correct device name, why cann’t application get this info. I had
PK> another q : is there way to update system object name space?

DefineDosDevice(). Remember that in XP, there is the system and then
per-user DOS name spaces. Read on DefineDosDevice() in the PSDK.

Ralf.

Hi Pashupati,

you wrote on Friday, October 11, 2002, 19:11:31:

PW>> why not just use the interface name to open the device?

PK> There are other modules in the applications which assumes I am
PK> passing the device name in the form of PHYSICALDRIVEN.

The only reason I can think of why this should be necessary is that the
other modules parse the PHYSICALDRIVEx string to get at the disk number.
I would question this design :slight_smile:

PK> I am just wondering if computer management, winobj can show the
PK> correct device name, why cann’t application get this info. I had
PK> another q : is there way to update system object name space?

DefineDosDevice(). Remember that in XP, there is the system and then
per-user DOS name spaces. Read on DefineDosDevice() in the PSDK.

Ralf.

try opening the device using the interface name and sending
IOCTL_STORAGE_GET_DRIVE_NUMBER (or some similarlly named API). I think
device number will correspond to the PhysicalDriveN number.

-p
-----Original Message-----
From: Pashupati Kumar [mailto:xxxxx@legato.com]
Sent: Friday, October 11, 2002 10:09 AM
To: NT Developers Interest List
Subject: [ntdev] Re: How do you get the number of physically installed
hard disks (Win32)?

To give you some idea of what we are doing. We have SAN setup and we are
using snapshot and disks come offline and online very often.Handling
devices in form of PHYSICALDRIVEN is kind of familiar and other
components would not have to chage from NT world and the basic premise
in the code would still hold. If ATALL it cann’t be done, may be i would
think of using interface name.
I have used in past NtQueryDirectoryObject, but not for this purpose. Do
u think this is the right approach.
thanks
pashupati

-----Original Message-----
From: Ralf Buschmann [mailto:xxxxx@backmagic.de]
Sent: Thursday, October 10, 2002 11:05 PM
To: NT Developers Interest List
Subject: [ntdev] Re: How do you get the number of physically installed
hard disks (Win32)?

Pashupati,
you wrote on Friday, October 11, 2002, 02:49:22:
PK> In my experience, I have seen the \.\PHYSICALDRIVEN not to be in
PK> sequence, as in from 0 to N-1 especially in SAN environment. For an
PK> example, I have disk being shown as \.\PHYSICALDRIVE15 when there
PK> are just 3 disks. Is there any way to this win32 name from other
PK> win32 name, which you get from interface detail info.
Not that I’m aware of. But why do you need to use \.\PHYSICALDRIVEx at
all if you can open the device by other means, as discussed?
PK> Winobj info is updated for such devices, any clue which calls/data
PK> structures is it using?
WinObj uses the undocumented NtQueryDirectoryObject() API to walk the
object manager name space. Get Gary Nebbetts’s “Native API Reference”
book if you want to go down this path.
Ralf.


You are currently subscribed to ntdev as: xxxxx@Legato.COM
To unsubscribe send a blank email to %%email.unsub%%

You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to %%email.unsub%%