Query on IOCTL_MOUNTDEV_LINK_CREATED

I am processing IOCTL_MOUNTDEV_LINK_CREATED in my volume upper filter
driver to obtain the volume GUID of a volume, before passing it down the
stack. This works fine on Windows Server 2003 and I am able to obtain the
GUID. However, on Windows XP (x86) I do not see this IOCTL being issued to
the volume driver stack.
The documentation does not indicate this IOCTL being specific to server
operating systems. It does mention that support for this IOCTL by mount
manager clients is optional. By “optional” I thought that not all mount
manager clients need to implement handling of this IOCTL. Is that right? Or
is this IOCTL specific to server operating sytems?

Regards,
Girish

> stack. This works fine on Windows Server 2003 and I am able to obtain the

GUID. However, on Windows XP (x86) I do not see this IOCTL being issued to
the volume driver stack.

Probably this was a bug in XP fixed in 2003 and later.


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

> Probably this was a bug in XP fixed in 2003 and later.

Thanks Maxim.

In such a case, is there any way where a volume upper filter driver can get
to know the drive letter/GUID associated with the volume? I am trying to
filter the write requests being issued to the volume that my application is
interested in. I have tried the following approaches so far but have not
been successful.

Option 1:
a. Issue IOCTL_MOUNTDEV_QUERY_UNIQUE_ID to the lower device object in
the volume stack (the one on which I am layered over) as part of the
IRP_MN_START_DEVICE
b. Once the unique id is obtained, issue IOCTL_MOUNTMGR_QUERY_POINTS
upon the first IRP_MJ_WRITE to the volume to query the symbolic name and
device name.
Result: I am able to query the unique id, but
IOCTL_MOUNTMGR_QUERY_POINTS always fails with STATUS_INVALID_PARAMETER

Option 2:
a. Capture the symbolic name and device name by interpreting the data
that is part of IOCTL_MOUNTDEV_LINK_CREATED from within the driver.
Result: This method works on Windows Server 2003, but I do not see the
IOCTL being issued to the volume stack on Windows XP.

Any help here would be appreciated.

Regards,
Girish.

Option 1 has always worked for me.
Try to issue IOCTL_MOUNTMGR_QUERY_POINTS inside PNP_START’s completion
handler.
Off course, you would need to fill in ioctl’s in-buf etc correctly (so
as to avoid status_invalid_parameter)

Harish

-----Original Message-----
From: Girish Aithal [mailto:xxxxx@hotmail.com]
Sent: Tuesday, December 29, 2009 2:47 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Query on IOCTL_MOUNTDEV_LINK_CREATED

Probably this was a bug in XP fixed in 2003 and later.

Thanks Maxim.

In such a case, is there any way where a volume upper filter driver can
get
to know the drive letter/GUID associated with the volume? I am trying to

filter the write requests being issued to the volume that my application
is
interested in. I have tried the following approaches so far but have not

been successful.

Option 1:
a. Issue IOCTL_MOUNTDEV_QUERY_UNIQUE_ID to the lower device object
in
the volume stack (the one on which I am layered over) as part of the
IRP_MN_START_DEVICE
b. Once the unique id is obtained, issue IOCTL_MOUNTMGR_QUERY_POINTS

upon the first IRP_MJ_WRITE to the volume to query the symbolic name and

device name.
Result: I am able to query the unique id, but
IOCTL_MOUNTMGR_QUERY_POINTS always fails with STATUS_INVALID_PARAMETER

Option 2:
a. Capture the symbolic name and device name by interpreting the
data
that is part of IOCTL_MOUNTDEV_LINK_CREATED from within the driver.
Result: This method works on Windows Server 2003, but I do not see
the
IOCTL being issued to the volume stack on Windows XP.

Any help here would be appreciated.

Regards,
Girish.


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

On Mon, 28 Dec 2009 16:32:32 +0530, “Girish Aithal”
wrote:

> I am processing IOCTL_MOUNTDEV_LINK_CREATED in my volume upper filter
>driver to obtain the volume GUID of a volume, before passing it down the
>stack. This works fine on Windows Server 2003 and I am able to obtain the
>GUID. However, on Windows XP (x86) I do not see this IOCTL being issued to
>the volume driver stack.
>Girish
>
>

IOCTL_MOUNTDEV_LINK_CREATED is defined as

CTL_CODE(MOUNTDEVCONTROLTYPE, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
on XP.

and as

CTL_CODE(MOUNTDEVCONTROLTYPE, 4, METHOD_BUFFERED, FILE_READ_ACCESS |
FILE_WRITE_ACCESS)
on later platforms.

so you need to check for the alternative ioctl value for XP.

> IOCTL_MOUNTDEV_LINK_CREATED is defined as

CTL_CODE(MOUNTDEVCONTROLTYPE, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
on XP.

and as

CTL_CODE(MOUNTDEVCONTROLTYPE, 4, METHOD_BUFFERED, FILE_READ_ACCESS |
FILE_WRITE_ACCESS)
on later platforms.

so you need to check for the alternative ioctl value for XP.

Ian,
I am using WDK 7600 and I do not see a difference in the IOCTL
definitions for IOCTL_MOUNTDEV_LINK_CREATED between XP and other platforms.
I see something like this in mountdev.h:

#if (NTDDI_VERSION >= NTDDI_WIN2K)

#define IOCTL_MOUNTDEV_LINK_CREATED CTL_CODE(MOUNTDEVCONTROLTYPE, 4,
METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)

#endif

Am I missing something here?

Regards,

Girish.