Volume listing was Re: How to know when disk drive is ready?

Hello,

Reactivating the thread…

Is there any way to ensure that the initial volume listing is over, so
I can choose one of the volumes to work on.

I get the arrival notifications in my driver, but how can I know when its over?

Guilherme

On Sat, Jul 3, 2010 at 2:17 PM, Guilherme Moro wrote:
> Thansk Maxim.
>
> I used IoRegisterPlugPlayNotification to the volume class, and it works great!
>
> I have one more question, but let me open a new thread.
>
> Guilherme Moro
>
> On Thu, Jul 1, 2010 at 5:39 PM, Maxim S. Shatskih
> wrote:
>>> I need to list the hard drives
>>
>> Also, you can wait for PnP interface arrival for Volume class.
>>
>> –
>> 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
>>
>

Trying to get the “initial set of volumes” is a losing game. Depending
on buses, controllers and other things, you can find it takes a long
time.

If at all possible design your driver so it does not care.

Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

-----Original Message-----
From: Guilherme Moro [mailto:xxxxx@gmail.com]
Posted At: Wednesday, July 07, 2010 5:52 PM
Posted To: ntdev
Conversation: Volume listing was Re: How to know when disk drive is
ready?
Subject: Volume listing was Re: How to know when disk drive is ready?

Hello,

Reactivating the thread…

Is there any way to ensure that the initial volume listing is over, so
I can
choose one of the volumes to work on.

I get the arrival notifications in my driver, but how can I know when
its
over?

Guilherme

On Sat, Jul 3, 2010 at 2:17 PM, Guilherme Moro

> wrote:
> > Thansk Maxim.
> >
> > I used IoRegisterPlugPlayNotification to the volume class, and it
works
> great!
> >
> > I have one more question, but let me open a new thread.
> >
> > Guilherme Moro
> >
> > On Thu, Jul 1, 2010 at 5:39 PM, Maxim S. Shatskih
> > wrote:
> >>> I need to list the hard drives
> >>
> >> Also, you can wait for PnP interface arrival for Volume class.
> >>
> >> –
> >> 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
> >>
> >
>
>
> Information from ESET Smart Security, version of virus
signature
> database 5260 (20100707)

>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>

Ok, no initial volumes…

So, what about a call to ZwCreateFile and ZwQueryVolumeInformationFile
… trying this when receiveing a device arrival returns me an
error(STATUS_INVALID_DEVICE_REQUEST)

this could be some effect showing that the device is not ready yet?

There are any request that can say if the volume is ready to access?

Guilherme Moro

On Wed, Jul 7, 2010 at 7:24 PM, Don Burn wrote:
> Trying to get the “initial set of volumes” is a losing game. ?Depending
> on buses, controllers and other things, you can find it takes a long
> time.
>
> If at all possible design your driver so it does not care.
>
>
> Don Burn (MVP, Windows DKD)
> Windows Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/WinDrvr
>
>> -----Original Message-----
>> From: Guilherme Moro [mailto:xxxxx@gmail.com]
>> Posted At: Wednesday, July 07, 2010 5:52 PM
>> Posted To: ntdev
>> Conversation: Volume listing was Re: How to know when disk drive is
> ready?
>> Subject: Volume listing was Re: How to know when disk drive is ready?
>>
>> Hello,
>>
>> Reactivating the thread…
>>
>> Is there any way to ensure that the initial volume listing is over, so
> I can
>> choose one of the volumes to work on.
>>
>> I get the arrival notifications in my driver, but how can I know when
> its
>> over?
>>
>> Guilherme
>>
>> On Sat, Jul 3, 2010 at 2:17 PM, Guilherme Moro
>
>> wrote:
>> > Thansk Maxim.
>> >
>> > I used IoRegisterPlugPlayNotification to the volume class, and it
> works
>> great!
>> >
>> > I have one more question, but let me open a new thread.
>> >
>> > Guilherme Moro
>> >
>> > On Thu, Jul 1, 2010 at 5:39 PM, Maxim S. Shatskih
>> > wrote:
>> >>> I need to list the hard drives
>> >>
>> >> Also, you can wait for PnP interface arrival for Volume class.
>> >>
>> >> –
>> >> 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
>> >>
>> >
>>
>>
>> Information from ESET Smart Security, version of virus
> signature
>> database 5260 (20100707)

>>
>> The message was checked by ESET Smart Security.
>>
>> http://www.eset.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 are any request that can say if the volume is ready to access?
You should install a volume upper filter and analyze which requests go to volumes. It may help you to understand initialization phase.

Igor Sharovar

So just when he thinks it is safe somebody plugs in a hot plug disk and a
volume gets mounted. This is not a good design. The OP has to deal with
async volume arrivals/departures.

Mark Roddy

On Wed, Jul 7, 2010 at 8:54 PM, wrote:

> >There are any request that can say if the volume is ready to access?
> You should install a volume upper filter and analyze which requests go to
> volumes. It may help you to understand initialization phase.
>
> Igor Sharovar
>
>
>
> —
> 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 don’t want to be volume filter and just care for getting their
arrival and removal notifications, why don’t you register for PnP
notification of volume device interface.
Use IoRegisterPlugPlayNotification for GUID_DEVINTERFACE_VOLUME
(http://msdn.microsoft.com/en-us/library/ff545990(v=VS.85).aspxhttp:
)

Regards
Deepak

On Thu, Jul 8, 2010 at 8:16 AM, Mark Roddy wrote:

> So just when he thinks it is safe somebody plugs in a hot plug disk and a
> volume gets mounted. This is not a good design. The OP has to deal with
> async volume arrivals/departures.
>
> Mark Roddy
>
>
>
> On Wed, Jul 7, 2010 at 8:54 PM, wrote:
>
>> >There are any request that can say if the volume is ready to access?
>> You should install a volume upper filter and analyze which requests go to
>> volumes. It may help you to understand initialization phase.
>>
>> Igor Sharovar
>>
>>
>>
>> —
>> 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</http:>

> Is there any way to ensure that the initial volume listing is over

It will never be so, the disks can dynamically arrive and depart.


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

> > Is there any way to ensure that the initial volume listing is over

During boot, the PnP discovery goes something like (simplified):

Put root ACPI device on PnP action queue
While PnP action queue is not empty {
Process devices in the PnP action queue and add them to the devnode
tree and start the ones you can
Enumerate any bus that has never been enumerated or have changed
relationships
Add any new devices reported on a bus to the PnP action queue
Add any busses that need enumeration to the PnP action queue
}
Mount the system disk, crash if no system volume found

The system stalls during boot until all discovered busses have enumerated
(or enumeration times out because the link is down). When PnP believes all
busses are correctly enumerated, it looks for the boot disk volume. If it
doesn’t find it, the system crashes. After that, volumes can arrive and
depart at any time, except for the system boot volume or any volume with a
paging file on it, which can never depart.

A bus driver can take a while (seconds or more) to enumerate a bus, on Vista
and later, busses can enumerate in parallel (reducing boot elapsed time).
It’s a tricky business to know how long to wait for some external fabric to
fully get enumerated. The iSCSI bus driver for example I believe will wait 2
minutes or so to try and connect to persistent mounted disks (it has to wait
for the network stacks to come up first).

I don’t believe there is a convenient API to register for a callback when
the PnP enumeration is complete.

If you make your driver a non-boot start driver, it will not be loaded by
the OS loader, so will get loaded off the system volume after it’s online.
At this point, you know the “initial” enumeration must have already
happened.

There is no guarantee of when ALL the volumes eventually accessible will be
enumerated. For example, after a power failure of a server, SAN and storage
array, it can be a while before all the volumes are online again. Or another
example, a user might insert a USB storage fob 3 minutes after turning on
the computer, was that supposed to be part of the “initial” volume listing?

Jan

Thanks all responses …

Any removable disk will not be used, I just want to know the fixed
disks (in my scenario, it will be for sure just a SATA internal disk).

I’m already using the IoRegisterPlugPlayNotification for
GUID_DEVINTERFACE_VOLUME, so I get all the arrivals, but I need to
choose the partition with the most free space before I can proceed
with the machine boot, so I cant wait too much time, so I think a kind
of probing will be the only way, using a fixed time to wait.

besides that, I’m in trouble with the ZwCreateFile and
ZwQueryVolumeInformationFile, that keep failing with INVALID_REQUEST ,
I checked the parameters, but cant find any error. I’m using
notification->SymbolicLinkName that comes with the
GUID_DEVICE_INTERFACE_ARRIVAL, the ZwCreateFile occurs well, but
ZwQueryVolumeInformationFile always return invalid request, any clue?

Guilherme Moro

On Thu, Jul 8, 2010 at 5:40 AM, Jan Bottorff wrote:
>> > Is there any way to ensure that the initial volume listing is over
>
> During boot, the PnP discovery goes something like (simplified):
>
> Put root ACPI device on PnP action queue
> While PnP action queue is not empty {
> ? ? ? ?Process devices in the PnP action queue and add them to the devnode
> tree and start the ones you can
> ? ? ? ?Enumerate any bus that has never been enumerated or have changed
> relationships
> ? ? ? ?Add any new devices reported on a bus to the PnP action queue
> ? ? ? ?Add any busses that need enumeration to the PnP action queue
> }
> Mount the system disk, crash if no system volume found
>
> The system stalls during boot until all discovered busses have enumerated
> (or enumeration times out because the link is down). When PnP believes all
> busses are correctly enumerated, it looks for the boot disk volume. If it
> doesn’t find it, the system crashes. After that, volumes can arrive and
> depart at any time, except for the system boot volume or any volume with a
> paging file on it, which can never depart.
>
> A bus driver can take a while (seconds or more) to enumerate a bus, on Vista
> and later, busses can enumerate in parallel (reducing boot elapsed time).
> It’s a tricky business to know how long to wait for some external fabric to
> fully get enumerated. The iSCSI bus driver for example I believe will wait 2
> minutes or so to try and connect to persistent mounted disks (it has to wait
> for the network stacks to come up first).
>
> I don’t believe there is a convenient API to register for a callback when
> the PnP enumeration is complete.
>
> If you make your driver a non-boot start driver, it will not be loaded by
> the OS loader, so will get loaded off the system volume after it’s online.
> At this point, you know the “initial” enumeration must have already
> happened.
>
> There is no guarantee of when ALL the volumes eventually accessible will be
> enumerated. For example, after a power failure of a server, SAN and storage
> array, it can be a while before all the volumes are online again. Or another
> example, a user might insert a USB storage fob 3 minutes after turning on
> the computer, was that supposed to be part of the “initial” volume listing?
>
> Jan
>
>
> —
> 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
>

eSata ports are becoming quite common.

Mark Roddy

On Thu, Jul 8, 2010 at 2:01 PM, Guilherme Moro wrote:

> Thanks all responses …
>
> Any removable disk will not be used, I just want to know the fixed
> disks (in my scenario, it will be for sure just a SATA internal disk).
>
> I’m already using the IoRegisterPlugPlayNotification for
> GUID_DEVINTERFACE_VOLUME, so I get all the arrivals, but I need to
> choose the partition with the most free space before I can proceed
> with the machine boot, so I cant wait too much time, so I think a kind
> of probing will be the only way, using a fixed time to wait.
>
> besides that, I’m in trouble with the ZwCreateFile and
> ZwQueryVolumeInformationFile, that keep failing with INVALID_REQUEST ,
> I checked the parameters, but cant find any error. I’m using
> notification->SymbolicLinkName that comes with the
> GUID_DEVICE_INTERFACE_ARRIVAL, the ZwCreateFile occurs well, but
> ZwQueryVolumeInformationFile always return invalid request, any clue?
>
> Guilherme Moro
>
>
> On Thu, Jul 8, 2010 at 5:40 AM, Jan Bottorff
> wrote:
> >> > Is there any way to ensure that the initial volume listing is over
> >
> > During boot, the PnP discovery goes something like (simplified):
> >
> > Put root ACPI device on PnP action queue
> > While PnP action queue is not empty {
> > Process devices in the PnP action queue and add them to the
> devnode
> > tree and start the ones you can
> > Enumerate any bus that has never been enumerated or have changed
> > relationships
> > Add any new devices reported on a bus to the PnP action queue
> > Add any busses that need enumeration to the PnP action queue
> > }
> > Mount the system disk, crash if no system volume found
> >
> > The system stalls during boot until all discovered busses have enumerated
> > (or enumeration times out because the link is down). When PnP believes
> all
> > busses are correctly enumerated, it looks for the boot disk volume. If it
> > doesn’t find it, the system crashes. After that, volumes can arrive and
> > depart at any time, except for the system boot volume or any volume with
> a
> > paging file on it, which can never depart.
> >
> > A bus driver can take a while (seconds or more) to enumerate a bus, on
> Vista
> > and later, busses can enumerate in parallel (reducing boot elapsed time).
> > It’s a tricky business to know how long to wait for some external fabric
> to
> > fully get enumerated. The iSCSI bus driver for example I believe will
> wait 2
> > minutes or so to try and connect to persistent mounted disks (it has to
> wait
> > for the network stacks to come up first).
> >
> > I don’t believe there is a convenient API to register for a callback when
> > the PnP enumeration is complete.
> >
> > If you make your driver a non-boot start driver, it will not be loaded by
> > the OS loader, so will get loaded off the system volume after it’s
> online.
> > At this point, you know the “initial” enumeration must have already
> > happened.
> >
> > There is no guarantee of when ALL the volumes eventually accessible will
> be
> > enumerated. For example, after a power failure of a server, SAN and
> storage
> > array, it can be a while before all the volumes are online again. Or
> another
> > example, a user might insert a USB storage fob 3 minutes after turning on
> > the computer, was that supposed to be part of the “initial” volume
> listing?
> >
> > Jan
> >
> >
> > —
> > 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
>

Look at the computer and all of the connected devices. If you see an eSATA
or even a SATA cable going to a drive outside the box, it is not internal.
That’s the ONLY way.

“Guilherme Moro” wrote in message
news:xxxxx@ntdev…
> Thanks all responses …
>
> Any removable disk will not be used, I just want to know the fixed
> disks (in my scenario, it will be for sure just a SATA internal disk).
>
> I’m already using the IoRegisterPlugPlayNotification for
> GUID_DEVINTERFACE_VOLUME, so I get all the arrivals, but I need to
> choose the partition with the most free space before I can proceed
> with the machine boot, so I cant wait too much time, so I think a kind
> of probing will be the only way, using a fixed time to wait.
>
> besides that, I’m in trouble with the ZwCreateFile and
> ZwQueryVolumeInformationFile, that keep failing with INVALID_REQUEST ,
> I checked the parameters, but cant find any error. I’m using
> notification->SymbolicLinkName that comes with the
> GUID_DEVICE_INTERFACE_ARRIVAL, the ZwCreateFile occurs well, but
> ZwQueryVolumeInformationFile always return invalid request, any clue?
>
> Guilherme Moro
>
>
> On Thu, Jul 8, 2010 at 5:40 AM, Jan Bottorff
> wrote:
>>> > Is there any way to ensure that the initial volume listing is over
>>
>> During boot, the PnP discovery goes something like (simplified):
>>
>> Put root ACPI device on PnP action queue
>> While PnP action queue is not empty {
>> Process devices in the PnP action queue and add them to the
>> devnode
>> tree and start the ones you can
>> Enumerate any bus that has never been enumerated or have changed
>> relationships
>> Add any new devices reported on a bus to the PnP action queue
>> Add any busses that need enumeration to the PnP action queue
>> }
>> Mount the system disk, crash if no system volume found
>>
>> The system stalls during boot until all discovered busses have enumerated
>> (or enumeration times out because the link is down). When PnP believes
>> all
>> busses are correctly enumerated, it looks for the boot disk volume. If it
>> doesn’t find it, the system crashes. After that, volumes can arrive and
>> depart at any time, except for the system boot volume or any volume with
>> a
>> paging file on it, which can never depart.
>>
>> A bus driver can take a while (seconds or more) to enumerate a bus, on
>> Vista
>> and later, busses can enumerate in parallel (reducing boot elapsed time).
>> It’s a tricky business to know how long to wait for some external fabric
>> to
>> fully get enumerated. The iSCSI bus driver for example I believe will
>> wait 2
>> minutes or so to try and connect to persistent mounted disks (it has to
>> wait
>> for the network stacks to come up first).
>>
>> I don’t believe there is a convenient API to register for a callback when
>> the PnP enumeration is complete.
>>
>> If you make your driver a non-boot start driver, it will not be loaded by
>> the OS loader, so will get loaded off the system volume after it’s
>> online.
>> At this point, you know the “initial” enumeration must have already
>> happened.
>>
>> There is no guarantee of when ALL the volumes eventually accessible will
>> be
>> enumerated. For example, after a power failure of a server, SAN and
>> storage
>> array, it can be a while before all the volumes are online again. Or
>> another
>> example, a user might insert a USB storage fob 3 minutes after turning on
>> the computer, was that supposed to be part of the “initial” volume
>> listing?
>>
>> Jan
>>
>>
>> —
>> 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
>>
>