can i get the volume guid from my volume upper filter driver

hi all,
Can i get the volume guid from my volume upper filter driver ?
I want to get it just after IRP_MN_START_DEVICE finished by lower device
and not return to the upper. So i try it by send
IOCTL_MOUNTMGR_QUERY_POINTS to mount mgr but failed with
STATUS_NO_SUCH_DEVICE.
Can anyone tell me if it is doable or not.

thanks.

my code like this:

switch (irpSp->MinorFunction) {
case IRP_MN_START_DEVICE:

KeInitializeEvent(&event, NotificationEvent, FALSE);
IoCopyCurrentIrpStackLocationToNext(Irp);
IoSetCompletionRoutine(Irp,
(PIO_COMPLETION_ROUTINE) FltStartCompletionRoutine,
&event,
TRUE,
TRUE,
TRUE);

status = IoCallDriver(devExt->TargetDeviceObject, Irp);

if (status == STATUS_PENDING) {
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
status = Irp->IoStatus.Status;
}

if (NT_SUCCESS(status)) {

send IOCTL_MOUNTMGR_QUERY_POINTS to mount mgr

}

The Volume GUID has not yet been determined at start device time.

The GUID symbolic link is created by looking up the result of
IOCTL_MOUNTDEV_QUERY_UNIQUE_ID in the registry. Your driver will receive
this ioctl a while after IRP_MN_START_DEVICE. When the volume GUID name
has been created, your driver will receive an IOCTL_MOUNTDEV_LINK_CREATED.
The buffer for this ioctl is a MOUNTDEV_NAME structure containing the volume
GUID name. So, basically, don’t look up the name–wait until the mount
manager tells you.

  • Dan.

xu ge asked:

hi all,
Can i get the volume guid from my volume upper filter driver ?
I want to get it just after IRP_MN_START_DEVICE finished by lower device
and not return to the upper. So i try it by send
IOCTL_MOUNTMGR_QUERY_POINTS to mount mgr but failed with
STATUS_NO_SUCH_DEVICE.
Can anyone tell me if it is doable or not.

thanks.

my code like this:

switch (irpSp->MinorFunction) {
case IRP_MN_START_DEVICE:

KeInitializeEvent(&event, NotificationEvent, FALSE);
IoCopyCurrentIrpStackLocationToNext(Irp);
IoSetCompletionRoutine(Irp,
(PIO_COMPLETION_ROUTINE) FltStartCompletionRoutine,
&event,
TRUE,
TRUE,
TRUE);

status = IoCallDriver(devExt->TargetDeviceObject, Irp);

if (status == STATUS_PENDING) {
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
status = Irp->IoStatus.Status;
}

if (NT_SUCCESS(status)) {

send IOCTL_MOUNTMGR_QUERY_POINTS to mount mgr

}


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

BTW, you’ll receive an IOCTL_MOUNTDEV_LINK_CREATED for ALL links the mount
manager creates, including the drive letter. Use MOUNTMGR_IS_VOLUME_NAME()
to determine which one you want.

  • Dan.

----- Original Message -----
From: “Dan Kyler”
To: “Windows System Software Devs Interest List”
Sent: Friday, March 24, 2006 8:56 AM
Subject: Re:[ntdev] can i get the volume guid from my volume upper filter
driver

> The Volume GUID has not yet been determined at start device time.
>
> The GUID symbolic link is created by looking up the result of
> IOCTL_MOUNTDEV_QUERY_UNIQUE_ID in the registry. Your driver will receive
> this ioctl a while after IRP_MN_START_DEVICE. When the volume GUID name
> has been created, your driver will receive an IOCTL_MOUNTDEV_LINK_CREATED.
> The buffer for this ioctl is a MOUNTDEV_NAME structure containing the
> volume GUID name. So, basically, don’t look up the name–wait until the
> mount manager tells you.
>
> - Dan.
>
> ----------------------------------------
> xu ge asked:
>
> hi all,
> Can i get the volume guid from my volume upper filter driver ?
> I want to get it just after IRP_MN_START_DEVICE finished by lower device
> and not return to the upper. So i try it by send
> IOCTL_MOUNTMGR_QUERY_POINTS to mount mgr but failed with
> STATUS_NO_SUCH_DEVICE.
> Can anyone tell me if it is doable or not.
>
> thanks.
>
> my code like this:
>
> switch (irpSp->MinorFunction) {
> case IRP_MN_START_DEVICE:
>
> KeInitializeEvent(&event, NotificationEvent, FALSE);
> IoCopyCurrentIrpStackLocationToNext(Irp);
> IoSetCompletionRoutine(Irp,
> (PIO_COMPLETION_ROUTINE) FltStartCompletionRoutine,
> &event,
> TRUE,
> TRUE,
> TRUE);
>
> status = IoCallDriver(devExt->TargetDeviceObject, Irp);
>
> if (status == STATUS_PENDING) {
> KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
> status = Irp->IoStatus.Status;
> }
>
> if (NT_SUCCESS(status)) {
> …
> send IOCTL_MOUNTMGR_QUERY_POINTS to mount mgr
> …
> }
>
>
> —
> 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
>
>
> —
> 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

Thank you, Dan

Dan Kyler дµÀ:

BTW, you’ll receive an IOCTL_MOUNTDEV_LINK_CREATED for ALL links the
mount manager creates, including the drive letter. Use
MOUNTMGR_IS_VOLUME_NAME() to determine which one you want.

  • Dan.

----- Original Message ----- From: “Dan Kyler”
> To: “Windows System Software Devs Interest List”
> Sent: Friday, March 24, 2006 8:56 AM
> Subject: Re:[ntdev] can i get the volume guid from my volume upper
> filter driver
>
>
>> The Volume GUID has not yet been determined at start device time.
>>
>> The GUID symbolic link is created by looking up the result of
>> IOCTL_MOUNTDEV_QUERY_UNIQUE_ID in the registry. Your driver will
>> receive this ioctl a while after IRP_MN_START_DEVICE. When the
>> volume GUID name has been created, your driver will receive an
>> IOCTL_MOUNTDEV_LINK_CREATED. The buffer for this ioctl is a
>> MOUNTDEV_NAME structure containing the volume GUID name. So,
>> basically, don’t look up the name–wait until the mount manager tells
>> you.
>>
>> - Dan.
>>
>> ----------------------------------------
>> xu ge asked:
>>
>> hi all,
>> Can i get the volume guid from my volume upper filter driver ?
>> I want to get it just after IRP_MN_START_DEVICE finished by lower device
>> and not return to the upper. So i try it by send
>> IOCTL_MOUNTMGR_QUERY_POINTS to mount mgr but failed with
>> STATUS_NO_SUCH_DEVICE.
>> Can anyone tell me if it is doable or not.
>>
>> thanks.
>>
>> my code like this:
>>
>> switch (irpSp->MinorFunction) {
>> case IRP_MN_START_DEVICE:
>>
>> KeInitializeEvent(&event, NotificationEvent, FALSE);
>> IoCopyCurrentIrpStackLocationToNext(Irp);
>> IoSetCompletionRoutine(Irp,
>> (PIO_COMPLETION_ROUTINE) FltStartCompletionRoutine,
>> &event,
>> TRUE,
>> TRUE,
>> TRUE);
>>
>> status = IoCallDriver(devExt->TargetDeviceObject, Irp);
>>
>> if (status == STATUS_PENDING) {
>> KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
>> status = Irp->IoStatus.Status;
>> }
>>
>> if (NT_SUCCESS(status)) {
>> …
>> send IOCTL_MOUNTMGR_QUERY_POINTS to mount mgr
>> …
>> }
>>
>>
>> —
>> 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
>>
>>
>> —
>> 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
>
>
>

Hi,
I have two questions regarding the volume GUID:
1.Is it possible for the FS to generate write I/O to the volume stack BEFORE
all IOCTL_MOUNTDEV_LINK_CREATED are completed successfully?
2.According to the SDK description, one might assume that volume GUID are
re-created each time a volume is formatted using the format command.
(SDK start quote)
The operating system assigns a unique volume name to a volume when the
computer first encounters it, for example during formatting or installation.
(SDK end quote).
I believe that format operation on the volume don’t change the GUID, does
anybody know if there is any other case in which the OS changes the volume
GUID?

Thanks,
Eran.

“xu ge” wrote in message news:xxxxx@ntdev…
> Thank you, Dan
>
> Dan Kyler дµÀ:
>> BTW, you’ll receive an IOCTL_MOUNTDEV_LINK_CREATED for ALL links the
>> mount manager creates, including the drive letter. Use
>> MOUNTMGR_IS_VOLUME_NAME() to determine which one you want.
>>
>> - Dan.
>>
>> ----- Original Message ----- From: “Dan Kyler”
>> To: “Windows System Software Devs Interest List”
>> Sent: Friday, March 24, 2006 8:56 AM
>> Subject: Re:[ntdev] can i get the volume guid from my volume upper
>> filter driver
>>
>>
>>> The Volume GUID has not yet been determined at start device time.
>>>
>>> The GUID symbolic link is created by looking up the result of
>>> IOCTL_MOUNTDEV_QUERY_UNIQUE_ID in the registry. Your driver will
>>> receive this ioctl a while after IRP_MN_START_DEVICE. When the
>>> volume GUID name has been created, your driver will receive an
>>> IOCTL_MOUNTDEV_LINK_CREATED. The buffer for this ioctl is a
>>> MOUNTDEV_NAME structure containing the volume GUID name. So,
>>> basically, don’t look up the name–wait until the mount manager tells
>>> you.
>>>
>>> - Dan.
>>>
>>> ----------------------------------------
>>> xu ge asked:
>>>
>>> hi all,
>>> Can i get the volume guid from my volume upper filter driver ?
>>> I want to get it just after IRP_MN_START_DEVICE finished by lower device
>>> and not return to the upper. So i try it by send
>>> IOCTL_MOUNTMGR_QUERY_POINTS to mount mgr but failed with
>>> STATUS_NO_SUCH_DEVICE.
>>> Can anyone tell me if it is doable or not.
>>>
>>> thanks.
>>>
>>> my code like this:
>>>
>>> switch (irpSp->MinorFunction) {
>>> case IRP_MN_START_DEVICE:
>>>
>>> KeInitializeEvent(&event, NotificationEvent, FALSE);
>>> IoCopyCurrentIrpStackLocationToNext(Irp);
>>> IoSetCompletionRoutine(Irp,
>>> (PIO_COMPLETION_ROUTINE) FltStartCompletionRoutine,
>>> &event,
>>> TRUE,
>>> TRUE,
>>> TRUE);
>>>
>>> status = IoCallDriver(devExt->TargetDeviceObject, Irp);
>>>
>>> if (status == STATUS_PENDING) {
>>> KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
>>> status = Irp->IoStatus.Status;
>>> }
>>>
>>> if (NT_SUCCESS(status)) {
>>> …
>>> send IOCTL_MOUNTMGR_QUERY_POINTS to mount mgr
>>> …
>>> }
>>>
>>>
>>> —
>>> 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
>>>
>>>
>>> —
>>> 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
>>
>>
>>
>

  1. You will not see any file system I/O before the mount manager has
    completed it’s processing.
  2. The volume GUID is good for the life of the partition, no matter how many
    times it’s formatted. (This is potentially implementation specific, but
    that’s how the MS storage stacks implement it.) The same volume will have
    different GUIDs on different nodes of a cluster.
  • Dan.

Eran Borovik asked:

Hi,
I have two questions regarding the volume GUID:
1.Is it possible for the FS to generate write I/O to the volume stack BEFORE
all IOCTL_MOUNTDEV_LINK_CREATED are completed successfully?
2.According to the SDK description, one might assume that volume GUID are
re-created each time a volume is formatted using the format command.
(SDK start quote)
The operating system assigns a unique volume name to a volume when the
computer first encounters it, for example during formatting or installation.
(SDK end quote).
I believe that format operation on the volume don’t change the GUID, does
anybody know if there is any other case in which the OS changes the volume
GUID?

Thanks,
Eran.

>IOCTL_MOUNTDEV_LINK_CREATED.

The buffer for this ioctl is a MOUNTDEV_NAME structure containing the volume
GUID name.

Maybe it is a good idea for MS to update the DDK docs to state that the name in
IOCTL_MOUNTDEV_LINK_CREATED is always a volume GUID name?

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

> 2.According to the SDK description, one might assume that volume GUID are

re-created each time a volume is formatted using the format command.
(SDK start quote)

No. This is true for Volume Serial Numbers only. They are set to a newly
invented value on formatting.

Volume GUID is invented by MountMgr for each newly met mountdev ID, and the
mountdev ID of the volume is not changed on FORMAT. Mountdev ID is a function
of the “container”, while FORMAT acts on containee data only.

For instance, for removable media drives, Mountdev ID is the hardware PnP ID.
For fixed disk non-RAID partitions, it is 12 bytes - MBR signature + byte
offset of the partition. For Dynamic Disk, Veritas and other software RAIDs the
mountdev IDs are generated using some heuristic of these software RAID vendors.

The operating system assigns a unique volume name to a volume when the
computer first encounters it

Yes, when MountMgr sees some mountdev ID for the first time.

, for example during formatting or installation.

Not during formatting. Formatting does not change the mountdev ID. But, for
instance, destroying and re-creating the software RAID group in Veritas Storage
Foundation will create a new mountdev ID.

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

> Maybe it is a good idea for MS to update the DDK docs to state that the

name in
IOCTL_MOUNTDEV_LINK_CREATED is always a volume GUID name?

It’s not. Mountmgr sends this ioctl for every link it creates, including
drive letters.

  • Dan.

----- Original Message -----
From: “Maxim S. Shatskih”
To: “Windows System Software Devs Interest List”
Sent: Saturday, April 08, 2006 12:18 PM
Subject: Re: Re:[ntdev] can i get the volume guid from my volume upper
filter driver

> >IOCTL_MOUNTDEV_LINK_CREATED.
>> The buffer for this ioctl is a MOUNTDEV_NAME structure containing the
>> volume
>> GUID name.
>
> Maybe it is a good idea for MS to update the DDK docs to state that the
> name in
> IOCTL_MOUNTDEV_LINK_CREATED is always a volume GUID name?
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> 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