Mounting on a directory

I have a virtual disk driver that runs on XP.
It currently creates a named device object with
a drive letter. The virtual disk can be formatted
and used via the drive letter. I would like to
add the capability to ‘mount’ the virtual disk
on a directory (a nested mount). The mountvol
utility requires a ‘Volume GUID’ in order to mount
(set the reparse point).

Questions:

  1. Can I simply write a program to issue the
    FSCTL_SET_REPARSE_POINT with my device’s symlink
    instead of the Volume-GUID symlink as the reparse
    data? Or does the IO manager look at the reparse
    data for a mount point and require a Volume GUID?

  2. If I need a Volume-GUID, what’s the correct process?
    I’ve tried the following but do not get the mount
    manager IOCTL’s sent to my driver.

a) Create a device object based on a request
from user space via IoCreateDevice() as FILE_DEVICE_DISK.

b) Create a symlink to it based on it’s name.

c) In a backgroud system thread:

  1. Call IoReportDetectedDevice
    Status = IoReportDetectedDevice(
    Globals.DriverObject,
    InterfaceTypeUndefined,
    0,
    0,
    NULL,
    NULL,
    FALSE,
    &PnPDeviceObject); (Set to NULL)

  2. Attach my device object to the newly created PnP Device object.

  3. Register as a disk
    Status = IoRegisterDeviceInterface(
    PnPDeviceObject,
    &GUID_DEVINTERFACE_DISK,
    NULL,
    &DeviceExtension->DiskGuidName);

The GUID returned was:
??\ROOT#myvol#0000#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}

  1. Enable the interface

  2. Register as a Volume device
    Status = IoRegisterDeviceInterface(
    PnPDeviceObject,
    &MOUNTDEV_MOUNTED_DEVICE_GUID,
    NULL,
    &DeviceExtension->VolumeGuidName);

The GUID returned was:
??\ROOT#myvol#0000#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}

  1. Enable the interface

A short time later I get the following two debug messages:
CreateTargetEntry() RegisterDeviceNotification() failed. Win32
Error:1066
DmServerServiceHandlerEx() CreateTargetEntry() failed: 1066.

The only IOCTL I get from the mount manager is
IOCTL_MOUNTDEV_QUERY_DEVICE_NAME to which I respond with
my device name (e.g. \Device\MyVol\test_vol).

What am I doing wrong?

Thanks in advance,
-bob

OK, I figured I should try to answer question 1 on
my own…
I ended up writing a program to set the reparse point
with a regular symlink (i.e. not a Volume-GUID) and it
seems to work OK. Can anybody comment on whether
or not it’s a reasonable thing to do?

Still can’t get the mount manager / GUID stuff
to work however.

Thanks,
-bob

Bob Nelson wrote:

I have a virtual disk driver that runs on XP.
It currently creates a named device object with
a drive letter. The virtual disk can be formatted
and used via the drive letter. I would like to
add the capability to ‘mount’ the virtual disk
on a directory (a nested mount). The mountvol
utility requires a ‘Volume GUID’ in order to mount
(set the reparse point).

Questions:

  1. Can I simply write a program to issue the
    FSCTL_SET_REPARSE_POINT with my device’s symlink
    instead of the Volume-GUID symlink as the reparse
    data? Or does the IO manager look at the reparse
    data for a mount point and require a Volume GUID?

  2. If I need a Volume-GUID, what’s the correct process?
    I’ve tried the following but do not get the mount
    manager IOCTL’s sent to my driver.

a) Create a device object based on a request
from user space via IoCreateDevice() as FILE_DEVICE_DISK.

b) Create a symlink to it based on it’s name.

c) In a backgroud system thread:

  1. Call IoReportDetectedDevice
    Status = IoReportDetectedDevice(
    Globals.DriverObject,
    InterfaceTypeUndefined,
    0,
    0,
    NULL,
    NULL,
    FALSE,
    &PnPDeviceObject); (Set to NULL)

  2. Attach my device object to the newly created PnP Device object.

  3. Register as a disk
    Status = IoRegisterDeviceInterface(
    PnPDeviceObject,
    &GUID_DEVINTERFACE_DISK,
    NULL,
    &DeviceExtension->DiskGuidName);

The GUID returned was:
??\ROOT#myvol#0000#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}

  1. Enable the interface

  2. Register as a Volume device
    Status = IoRegisterDeviceInterface(
    PnPDeviceObject,
    &MOUNTDEV_MOUNTED_DEVICE_GUID,
    NULL,
    &DeviceExtension->VolumeGuidName);

The GUID returned was:
??\ROOT#myvol#0000#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}

  1. Enable the interface

A short time later I get the following two debug messages:
CreateTargetEntry() RegisterDeviceNotification() failed. Win32
Error:1066
DmServerServiceHandlerEx() CreateTargetEntry() failed: 1066.

The only IOCTL I get from the mount manager is
IOCTL_MOUNTDEV_QUERY_DEVICE_NAME to which I respond with
my device name (e.g. \Device\MyVol\test_vol).

What am I doing wrong?

Thanks in advance,
-bob


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

I solved the same problem different way. The requirement was it has to work with all FS, not only NTFS. The solution was to write relatively simple FS filter driver which uses STATUS_REPARSE to redirect requests to the mounted virtual drive. Works with no problem from w2k to Vista a there is no need to bother with mount manager :slight_smile:

Anyway, your solution can be easier once you make it working if NTFS only limitation isn’t a problem for you.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Bob Nelson[SMTP:xxxxx@oracle.com]
Reply To: Windows System Software Devs Interest List
Sent: Monday, July 10, 2006 10:41 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Mounting on a directory

OK, I figured I should try to answer question 1 on
my own…
I ended up writing a program to set the reparse point
with a regular symlink (i.e. not a Volume-GUID) and it
seems to work OK. Can anybody comment on whether
or not it’s a reasonable thing to do?

Still can’t get the mount manager / GUID stuff
to work however.

Thanks,
-bob

Bob Nelson wrote:
> I have a virtual disk driver that runs on XP.
> It currently creates a named device object with
> a drive letter. The virtual disk can be formatted
> and used via the drive letter. I would like to
> add the capability to ‘mount’ the virtual disk
> on a directory (a nested mount). The mountvol
> utility requires a ‘Volume GUID’ in order to mount
> (set the reparse point).
>
> Questions:
>
> 1) Can I simply write a program to issue the
> FSCTL_SET_REPARSE_POINT with my device’s symlink
> instead of the Volume-GUID symlink as the reparse
> data? Or does the IO manager look at the reparse
> data for a mount point and require a Volume GUID?
>
> 2) If I need a Volume-GUID, what’s the correct process?
> I’ve tried the following but do not get the mount
> manager IOCTL’s sent to my driver.
>
> a) Create a device object based on a request
> from user space via IoCreateDevice() as FILE_DEVICE_DISK.
>
> b) Create a symlink to it based on it’s name.
>
> c) In a backgroud system thread:
>
> 1) Call IoReportDetectedDevice
> Status = IoReportDetectedDevice(
> Globals.DriverObject,
> InterfaceTypeUndefined,
> 0,
> 0,
> NULL,
> NULL,
> FALSE,
> &PnPDeviceObject); (Set to NULL)
>
> 2) Attach my device object to the newly created PnP Device object.
>
> 3) Register as a disk
> Status = IoRegisterDeviceInterface(
> PnPDeviceObject,
> &GUID_DEVINTERFACE_DISK,
> NULL,
> &DeviceExtension->DiskGuidName);
>
> The GUID returned was:
> ??\ROOT#myvol#0000#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
>
> 4) Enable the interface
>
> 5) Register as a Volume device
> Status = IoRegisterDeviceInterface(
> PnPDeviceObject,
> &MOUNTDEV_MOUNTED_DEVICE_GUID,
> NULL,
> &DeviceExtension->VolumeGuidName);
>
> The GUID returned was:
> ??\ROOT#myvol#0000#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}
>
> 6) Enable the interface
>
>
> A short time later I get the following two debug messages:
> CreateTargetEntry() RegisterDeviceNotification() failed. Win32
> Error:1066
> DmServerServiceHandlerEx() CreateTargetEntry() failed: 1066.
>
> The only IOCTL I get from the mount manager is
> IOCTL_MOUNTDEV_QUERY_DEVICE_NAME to which I respond with>
> my device name (e.g. \Device\MyVol\test_vol).
>
> What am I doing wrong?
>
> Thanks in advance,
> -bob
>
> —
> 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 Michal,

Could you give a little more details about your example.

Thanks.

Ellen

From: “Michal Vodicka”
>Reply-To: “Windows System Software Devs Interest List”
>
>To: “Windows System Software Devs Interest List”
>Subject: RE: [ntdev] Mounting on a directory
>Date: Tue, 11 Jul 2006 01:01:30 +0200
>
>I solved the same problem different way. The requirement was it has to work
>with all FS, not only NTFS. The solution was to write relatively simple FS
>filter driver which uses STATUS_REPARSE to redirect requests to the mounted
>virtual drive. Works with no problem from w2k to Vista a there is no need
>to bother with mount manager :slight_smile:
>
>Anyway, your solution can be easier once you make it working if NTFS only
>limitation isn’t a problem for you.
>
>Best regards,
>
>Michal Vodicka
>UPEK, Inc.
>[xxxxx@upek.com, http://www.upek.com]
>
>
> > ----------
> > From:
> xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com]
>on behalf of Bob Nelson[SMTP:xxxxx@oracle.com]
> > Reply To: Windows System Software Devs Interest List
> > Sent: Monday, July 10, 2006 10:41 PM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] Mounting on a directory
> >
> > OK, I figured I should try to answer question 1 on
> > my own…
> > I ended up writing a program to set the reparse point
> > with a regular symlink (i.e. not a Volume-GUID) and it
> > seems to work OK. Can anybody comment on whether
> > or not it’s a reasonable thing to do?
> >
> > Still can’t get the mount manager / GUID stuff
> > to work however.
> >
> > Thanks,
> > -bob
> >
> > Bob Nelson wrote:
> > > I have a virtual disk driver that runs on XP.
> > > It currently creates a named device object with
> > > a drive letter. The virtual disk can be formatted
> > > and used via the drive letter. I would like to
> > > add the capability to ‘mount’ the virtual disk
> > > on a directory (a nested mount). The mountvol
> > > utility requires a ‘Volume GUID’ in order to mount
> > > (set the reparse point).
> > >
> > > Questions:
> > >
> > > 1) Can I simply write a program to issue the
> > > FSCTL_SET_REPARSE_POINT with my device’s symlink
> > > instead of the Volume-GUID symlink as the reparse
> > > data? Or does the IO manager look at the reparse
> > > data for a mount point and require a Volume GUID?
> > >
> > > 2) If I need a Volume-GUID, what’s the correct process?
> > > I’ve tried the following but do not get the mount
> > > manager IOCTL’s sent to my driver.
> > >
> > > a) Create a device object based on a request
> > > from user space via IoCreateDevice() as FILE_DEVICE_DISK.
> > >
> > > b) Create a symlink to it based on it’s name.
> > >
> > > c) In a backgroud system thread:
> > >
> > > 1) Call IoReportDetectedDevice
> > > Status = IoReportDetectedDevice(
> > > Globals.DriverObject,
> > > InterfaceTypeUndefined,
> > > 0,
> > > 0,
> > > NULL,
> > > NULL,
> > > FALSE,
> > > &PnPDeviceObject); (Set to NULL)
> > >
> > > 2) Attach my device object to the newly created PnP Device object.
> > >
> > > 3) Register as a disk
> > > Status = IoRegisterDeviceInterface(
> > > PnPDeviceObject,
> > > &GUID_DEVINTERFACE_DISK,
> > > NULL,
> > > &DeviceExtension->DiskGuidName);
> > >
> > > The GUID returned was:
> > > ??\ROOT#myvol#0000#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
> > >
> > > 4) Enable the interface
> > >
> > > 5) Register as a Volume device
> > > Status = IoRegisterDeviceInterface(
> > > PnPDeviceObject,
> > > &MOUNTDEV_MOUNTED_DEVICE_GUID,
> > > NULL,
> > > &DeviceExtension->VolumeGuidName);
> > >
> > > The GUID returned was:
> > > ??\ROOT#myvol#0000#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}
> > >
> > > 6) Enable the interface
> > >
> > >
> > > A short time later I get the following two debug messages:
> > > CreateTargetEntry() RegisterDeviceNotification() failed. Win32
> > > Error:1066
> > > DmServerServiceHandlerEx() CreateTargetEntry() failed: 1066.
> > >
> > > The only IOCTL I get from the mount manager is
> > > IOCTL_MOUNTDEV_QUERY_DEVICE_NAME to which I respond with>
> > > my device name (e.g. \Device\MyVol\test_vol).
> > >
> > > What am I doing wrong?
> > >
> > > Thanks in advance,
> > > -bob
> > >
> > > —
> > > 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
> >
>
>—
>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

Ellen,

what details would you like to know? It is as simple as I wrote but “simple” in the terms of FS filter development and I’m sure there are people who’d say “simple FS filter” is oxymoron.

Well, the driver works following way. It attaches to the volume(s) which contain directories to which virtual driver(s) should be mounted. When an user mode app creates virtual drive because of user request (another driver creates virtual drives), it sends an IOCTL to the driver with information about requested mount (target directory + virtual drive letter). The driver finds the device name for the virtual driver letter and remembers it. Then for every create IRP at attached volume(s) it resolves the full pathname of the request, compares it with redirection(s) and when it matches, changes the file name to virtual drive device name + relative portion of orginal name (cuts off the directory to which is drive mounted). Then it sets IoStatus.Information to IO_REPARSE and IoStatus.Status to STATUS_REPARSE, completes IRP and returns STATUS_REPARSE. The rest is on IO manager.

If you have more questions about individual steps, I’d suggest to read IFS kit docs and samples (SFilter for example), search NTFSD list archives and maybe subscribe this list because this subject is a bit off topic here.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of ellen chu[SMTP:xxxxx@hotmail.com]
Reply To: Windows System Software Devs Interest List
Sent: Tuesday, July 11, 2006 8:38 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Mounting on a directory

Hi Michal,

Could you give a little more details about your example.

Thanks.

Ellen

>From: “Michal Vodicka”
> >Reply-To: “Windows System Software Devs Interest List”
> >
> >To: “Windows System Software Devs Interest List”
> >Subject: RE: [ntdev] Mounting on a directory
> >Date: Tue, 11 Jul 2006 01:01:30 +0200
> >
> >I solved the same problem different way. The requirement was it has to work
> >with all FS, not only NTFS. The solution was to write relatively simple FS
> >filter driver which uses STATUS_REPARSE to redirect requests to the mounted
> >virtual drive. Works with no problem from w2k to Vista a there is no need
> >to bother with mount manager :slight_smile:
> >
> >Anyway, your solution can be easier once you make it working if NTFS only
> >limitation isn’t a problem for you.
> >
> >Best regards,
> >
> >Michal Vodicka
> >UPEK, Inc.
> >[xxxxx@upek.com, http://www.upek.com]
> >
> >
> > > ----------
> > > From:
> > xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com]
> >on behalf of Bob Nelson[SMTP:xxxxx@oracle.com]
> > > Reply To: Windows System Software Devs Interest List
> > > Sent: Monday, July 10, 2006 10:41 PM
> > > To: Windows System Software Devs Interest List
> > > Subject: Re: [ntdev] Mounting on a directory
> > >
> > > OK, I figured I should try to answer question 1 on
> > > my own…
> > > I ended up writing a program to set the reparse point
> > > with a regular symlink (i.e. not a Volume-GUID) and it
> > > seems to work OK. Can anybody comment on whether
> > > or not it’s a reasonable thing to do?
> > >
> > > Still can’t get the mount manager / GUID stuff
> > > to work however.
> > >
> > > Thanks,
> > > -bob
> > >
> > > Bob Nelson wrote:
> > > > I have a virtual disk driver that runs on XP.
> > > > It currently creates a named device object with
> > > > a drive letter. The virtual disk can be formatted
> > > > and used via the drive letter. I would like to
> > > > add the capability to ‘mount’ the virtual disk
> > > > on a directory (a nested mount). The mountvol
> > > > utility requires a ‘Volume GUID’ in order to mount>
> > > > (set the reparse point).
> > > >
> > > > Questions:
> > > >
> > > > 1) Can I simply write a program to issue the
> > > > FSCTL_SET_REPARSE_POINT with my device’s symlink
> > > > instead of the Volume-GUID symlink as the reparse
> > > > data? Or does the IO manager look at the reparse
> > > > data for a mount point and require a Volume GUID?
> > > >
> > > > 2) If I need a Volume-GUID, what’s the correct process?
> > > > I’ve tried the following but do not get the mount
> > > > manager IOCTL’s sent to my driver.
> > > >
> > > > a) Create a device object based on a request
> > > > from user space via IoCreateDevice() as FILE_DEVICE_DISK.
> > > >
> > > > b) Create a symlink to it based on it’s name.
> > > >
> > > > c) In a backgroud system thread:
> > > >
> > > > 1) Call IoReportDetectedDevice
> > > > Status = IoReportDetectedDevice(
> > > > Globals.DriverObject,
> > > > InterfaceTypeUndefined,
> > > > 0,
> > > > 0,
> > > > NULL,
> > > > NULL,
> > > > FALSE,
> > > > &PnPDeviceObject); (Set to NULL)
> > > >
> > > > 2) Attach my device object to the newly created PnP Device object.
> > > >
> > > > 3) Register as a disk
> > > > Status = IoRegisterDeviceInterface(
> > > > PnPDeviceObject,
> > > > &GUID_DEVINTERFACE_DISK,
> > > > NULL,
> > > > &DeviceExtension->DiskGuidName);
> > > >
> > > > The GUID returned was:
> > > > ??\ROOT#myvol#0000#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
> > > >
> > > > 4) Enable the interface
> > > >
> > > > 5) Register as a Volume device
> > > > Status = IoRegisterDeviceInterface(
> > > > PnPDeviceObject,
> > > > &MOUNTDEV_MOUNTED_DEVICE_GUID,
> > > > NULL,
> > > > &DeviceExtension->VolumeGuidName);
> > > >
> > > > The GUID returned was:
> > > > ??\ROOT#myvol#0000#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}
> > > >
> > > > 6) Enable the interface
> > > >
> > > >
> > > > A short time later I get the following two debug messages:
> > > > CreateTargetEntry() RegisterDeviceNotification() failed. Win32
> > > > Error:1066
> > > > DmServerServiceHandlerEx() CreateTargetEntry() failed: 1066.
> > > >
> > > > The only IOCTL I get from the mount manager is
> > > > IOCTL_MOUNTDEV_QUERY_DEVICE_NAME to which I respond with>
> > > > my device name (e.g. \Device\MyVol\test_vol).
> > > >
> > > > What am I doing wrong?
> > > >
> > > > Thanks in advance,
> > > > -bob
> > > >
> > > > —
> > > > 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
> > >
> >
> >—
> >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 Michal,

Thank you for your reply.

My major issue is how to handle FSCTL_SET_REPARSE_POINT request in my filter
driver, redirect a directory to remote file system (\server\share), I don’t
know how to do it, do you think I must mount \server\share to a virtual
driver first, then redirect this virtual driver?

Thanks.

Ellen

From: “Michal Vodicka”
>Reply-To: “Windows System Software Devs Interest List”
>
>To: “Windows System Software Devs Interest List”
>Subject: RE: [ntdev] Mounting on a directory
>Date: Wed, 12 Jul 2006 00:08:30 +0200
>
>Ellen,
>
>what details would you like to know? It is as simple as I wrote but
>“simple” in the terms of FS filter development and I’m sure there are
>people who’d say “simple FS filter” is oxymoron.
>
>Well, the driver works following way. It attaches to the volume(s) which
>contain directories to which virtual driver(s) should be mounted. When an
>user mode app creates virtual drive because of user request (another driver
>creates virtual drives), it sends an IOCTL to the driver with information
>about requested mount (target directory + virtual drive letter). The driver
>finds the device name for the virtual driver letter and remembers it. Then
>for every create IRP at attached volume(s) it resolves the full pathname of
>the request, compares it with redirection(s) and when it matches, changes
>the file name to virtual drive device name + relative portion of orginal
>name (cuts off the directory to which is drive mounted). Then it sets
>IoStatus.Information to IO_REPARSE and IoStatus.Status to STATUS_REPARSE,
>completes IRP and returns STATUS_REPARSE. The rest is on IO manager.
>
>If you have more questions about individual steps, I’d suggest to read IFS
>kit docs and samples (SFilter for example), search NTFSD list archives and
>maybe subscribe this list because this subject is a bit off topic here.
>
>Best regards,
>
>Michal Vodicka
>UPEK, Inc.
>[xxxxx@upek.com, http://www.upek.com]
>
>
> > ----------
> > From:
> xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com]
>on behalf of ellen chu[SMTP:xxxxx@hotmail.com]
> > Reply To: Windows System Software Devs Interest List
> > Sent: Tuesday, July 11, 2006 8:38 PM
> > To: Windows System Software Devs Interest List
> > Subject: RE: [ntdev] Mounting on a directory
> >
> > Hi Michal,
> >
> > Could you give a little more details about your example.
> >
> > Thanks.
> >
> > Ellen
> >
> >
> > >From: “Michal Vodicka”
> > >Reply-To: “Windows System Software Devs Interest List”
> > >
> > >To: “Windows System Software Devs Interest List”
> > >Subject: RE: [ntdev] Mounting on a directory
> > >Date: Tue, 11 Jul 2006 01:01:30 +0200
> > >
> > >I solved the same problem different way. The requirement was it has to
>work
> > >with all FS, not only NTFS. The solution was to write relatively simple
>FS
> > >filter driver which uses STATUS_REPARSE to redirect requests to the
>mounted
> > >virtual drive. Works with no problem from w2k to Vista a there is no
>need
> > >to bother with mount manager :slight_smile:
> > >
> > >Anyway, your solution can be easier once you make it working if NTFS
>only
> > >limitation isn’t a problem for you.
> > >
> > >Best regards,
> > >
> > >Michal Vodicka
> > >UPEK, Inc.
> > >[xxxxx@upek.com, http://www.upek.com]
> > >
> > >
> > > > ----------
> > > > From:
> >
> > xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com]
> > >on behalf of Bob Nelson[SMTP:xxxxx@oracle.com]
> > > > Reply To: Windows System Software Devs Interest List
> > > > Sent: Monday, July 10, 2006 10:41 PM
> > > > To: Windows System Software Devs Interest List
> > > > Subject: Re: [ntdev] Mounting on a directory
> > > >
> > > > OK, I figured I should try to answer question 1 on
> > > > my own…
> > > > I ended up writing a program to set the reparse point
> > > > with a regular symlink (i.e. not a Volume-GUID) and it
> > > > seems to work OK. Can anybody comment on whether
> > > > or not it’s a reasonable thing to do?
> > > >
> > > > Still can’t get the mount manager / GUID stuff
> > > > to work however.
> > > >
> > > > Thanks,
> > > > -bob
> > > >
> > > > Bob Nelson wrote:
> > > > > I have a virtual disk driver that runs on XP.
> > > > > It currently creates a named device object with
> > > > > a drive letter. The virtual disk can be formatted
> > > > > and used via the drive letter. I would like to
> > > > > add the capability to ‘mount’ the virtual disk
> > > > > on a directory (a nested mount). The mountvol
> > > > > utility requires a ‘Volume GUID’ in order to mount>
> > > > > (set the reparse point).
> > > > >
> > > > > Questions:
> > > > >
> > > > > 1) Can I simply write a program to issue the
> > > > > FSCTL_SET_REPARSE_POINT with my device’s symlink
> > > > > instead of the Volume-GUID symlink as the reparse
> > > > > data? Or does the IO manager look at the reparse
> > > > > data for a mount point and require a Volume GUID?
> > > > >
> > > > > 2) If I need a Volume-GUID, what’s the correct process?
> > > > > I’ve tried the following but do not get the mount
> > > > > manager IOCTL’s sent to my driver.
> > > > >
> > > > > a) Create a device object based on a request
> > > > > from user space via IoCreateDevice() as FILE_DEVICE_DISK.
> > > > >
> > > > > b) Create a symlink to it based on it’s name.
> > > > >
> > > > > c) In a backgroud system thread:
> > > > >
> > > > > 1) Call IoReportDetectedDevice
> > > > > Status = IoReportDetectedDevice(
> > > > > Globals.DriverObject,
> > > > > InterfaceTypeUndefined,
> > > > > 0,
> > > > > 0,
> > > > > NULL,
> > > > > NULL,
> > > > > FALSE,
> > > > > &PnPDeviceObject); (Set to NULL)
> > > > >
> > > > > 2) Attach my device object to the newly created PnP Device
>object.
> > > > >
> > > > > 3) Register as a disk
> > > > > Status = IoRegisterDeviceInterface(
> > > > > PnPDeviceObject,
> > > > > &GUID_DEVINTERFACE_DISK,
> > > > > NULL,
> > > > > &DeviceExtension->DiskGuidName);
> > > > >
> > > > > The GUID returned was:
> > > > >
>??\ROOT#myvol#0000#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
> > > > >
> > > > > 4) Enable the interface
> > > > >
> > > > > 5) Register as a Volume device
> > > > > Status = IoRegisterDeviceInterface(
> > > > > PnPDeviceObject,
> > > > > &MOUNTDEV_MOUNTED_DEVICE_GUID,
> > > > > NULL,
> > > > > &DeviceExtension->VolumeGuidName);
> > > > >
> > > > > The GUID returned was:
> > > > >
>??\ROOT#myvol#0000#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}
> > > > >
> > > > > 6) Enable the interface
> > > > >
> > > > >
> > > > > A short time later I get the following two debug messages:
> > > > > CreateTargetEntry() RegisterDeviceNotification() failed. Win32
> > > > > Error:1066
> > > > > DmServerServiceHandlerEx() CreateTargetEntry() failed: 1066.
> > > > >
> > > > > The only IOCTL I get from the mount manager is
> > > > > IOCTL_MOUNTDEV_QUERY_DEVICE_NAME to which I respond with>
> > > > > my device name (e.g. \Device\MyVol\test_vol).
> > > > >
> > > > > What am I doing wrong?
> > > > >
> > > > > Thanks in advance,
> > > > > -bob
> > > > >
> > > > > —
> > > > > 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
> > > >
> > >
> > >—
> > >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
> >
>
>—
>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

Sorry Ellen, I have no experience with FSCTL_SET_REPARSE point. This is different solution. It should be possible to handle it the way I described below but correct device would have to be found before. I never tried to mount remote directory.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of ellen chu[SMTP:xxxxx@hotmail.com]
Reply To: Windows System Software Devs Interest List
Sent: Wednesday, July 12, 2006 5:17 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Mounting on a directory

Hi Michal,

Thank you for your reply.

My major issue is how to handle FSCTL_SET_REPARSE_POINT request in my filter
driver, redirect a directory to remote file system (\server\share), I don’t
know how to do it, do you think I must mount \server\share to a virtual
driver first, then redirect this virtual driver?

Thanks.

Ellen

>From: “Michal Vodicka”
> >Reply-To: “Windows System Software Devs Interest List”
> >
> >To: “Windows System Software Devs Interest List”
> >Subject: RE: [ntdev] Mounting on a directory
> >Date: Wed, 12 Jul 2006 00:08:30 +0200
> >
> >Ellen,
> >
> >what details would you like to know? It is as simple as I wrote but
> >“simple” in the terms of FS filter development and I’m sure there are
> >people who’d say “simple FS filter” is oxymoron.
> >
> >Well, the driver works following way. It attaches to the volume(s) which
> >contain directories to which virtual driver(s) should be mounted. When an
> >user mode app creates virtual drive because of user request (another driver
> >creates virtual drives), it sends an IOCTL to the driver with information
> >about requested mount (target directory + virtual drive letter). The driver
> >finds the device name for the virtual driver letter and remembers it. Then
> >for every create IRP at attached volume(s) it resolves the full pathname of
> >the request, compares it with redirection(s) and when it matches, changes
> >the file name to virtual drive device name + relative portion of orginal
> >name (cuts off the directory to which is drive mounted). Then it sets
> >IoStatus.Information to IO_REPARSE and IoStatus.Status to STATUS_REPARSE,
> >completes IRP and returns STATUS_REPARSE. The rest is on IO manager.
> >
> >If you have more questions about individual steps, I’d suggest to read IFS
> >kit docs and samples (SFilter for example), search NTFSD list archives and
> >maybe subscribe this list because this subject is a bit off topic here.
> >
> >Best regards,
> >
> >Michal Vodicka
> >UPEK, Inc.
> >[xxxxx@upek.com, http://www.upek.com]
> >
> >
> > > ----------
> > > From:
> > xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com]
> >on behalf of ellen chu[SMTP:xxxxx@hotmail.com]
> > > Reply To: Windows System Software Devs Interest List
> > > Sent: Tuesday, July 11, 2006 8:38 PM
> > > To: Windows System Software Devs Interest List
> > > Subject: RE: [ntdev] Mounting on a directory
> > >
> > > Hi Michal,
> > >
> > > Could you give a little more details about your example.
> > >
> > > Thanks.
> > >
> > > Ellen
> > >
> > >
> > > >From: “Michal Vodicka”
> > > >Reply-To: “Windows System Software Devs Interest List”
> > > >
> > > >To: “Windows System Software Devs Interest List”
> > > >Subject: RE: [ntdev] Mounting on a directory
> > > >Date: Tue, 11 Jul 2006 01:01:30 +0200
> > > >
> > > >I solved the same problem different way. The requirement was it has to
> >work
> > > >with all FS, not only NTFS. The solution was to write relatively simple
> >FS
> > > >filter driver which uses STATUS_REPARSE to redirect requests to the >
> >mounted
> > > >virtual drive. Works with no problem from w2k to Vista a there is no
> >need
> > > >to bother with mount manager :slight_smile:
> > > >
> > > >Anyway, your solution can be easier once you make it working if NTFS
> >only
> > > >limitation isn’t a problem for you.
> > > >
> > > >Best regards,
> > > >
> > > >Michal Vodicka
> > > >UPEK, Inc.
> > > >[xxxxx@upek.com, http://www.upek.com]
> > > >
> > > >
> > > > > ----------
> > > > > From:
> > >
> > > xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com]
> > > >on behalf of Bob Nelson[SMTP:xxxxx@oracle.com]
> > > > > Reply To: Windows System Software Devs Interest List
> > > > > Sent: Monday, July 10, 2006 10:41 PM
> > > > > To: Windows System Software Devs Interest List
> > > > > Subject: Re: [ntdev] Mounting on a directory
> > > > >
> > > > > OK, I figured I should try to answer question 1 on
> > > > > my own…
> > > > > I ended up writing a program to set the reparse point
> > > > > with a regular symlink (i.e. not a Volume-GUID) and it
> > > > > seems to work OK. Can anybody comment on whether
> > > > > or not it’s a reasonable thing to do?
> > > > >
> > > > > Still can’t get the mount manager / GUID stuff
> > > > > to work however.
> > > > >
> > > > > Thanks,
> > > > > -bob
> > > > >
> > > > > Bob Nelson wrote:
> > > > > > I have a virtual disk driver that runs on XP.
> > > > > > It currently creates a named device object with
> > > > > > a drive letter. The virtual disk can be formatted
> > > > > > and used via the drive letter. I would like to
> > > > > > add the capability to ‘mount’ the virtual disk
> > > > > > on a directory (a nested mount). The mountvol
> > > > > > utility requires a ‘Volume GUID’ in order to mount>
> > > > > > (set the reparse point).
> > > > > >
> > > > > > Questions:
> > > > > >
> > > > > > 1) Can I simply write a program to issue the
> > > > > > FSCTL_SET_REPARSE_POINT with my device’s symlink
> > > > > > instead of the Volume-GUID symlink as the reparse
> > > > > > data? Or does the IO manager look at the reparse
> > > > > > data for a mount point and require a Volume GUID?
> > > > > >
> > > > > > 2) If I need a Volume-GUID, what’s the correct process?
> > > > > > I’ve tried the following but do not get the mount
> > > > > > manager IOCTL’s sent to my driver.
> > > > > >
> > > > > > a) Create a device object based on a request
> > > > > > from user space via IoCreateDevice() as FILE_DEVICE_DISK.
> > > > > >
> > > > > > b) Create a symlink to it based on it’s name.
> > > > > >
> > > > > > c) In a backgroud system thread:
> > > > > >
> > > > > > 1) Call IoReportDetectedDevice
> > > > > > Status = IoReportDetectedDevice(
> > > > > > Globals.DriverObject,
> > > > > > InterfaceTypeUndefined,
> > > > > > 0,
> > > > > > 0,
> > > > > > NULL,
> > > > > > NULL,
> > > > > > FALSE,
> > > > > > &PnPDeviceObject); (Set to NULL)
> > > > > >
> > > > > > 2) Attach my device object to the newly created PnP Device
> >object.
> > > > > >
> > > > > > 3) Register as a disk
> > > > > > Status = IoRegisterDeviceInterface(
> > > > > > PnPDeviceObject,
> > > > > > &GUID_DEVINTERFACE_DISK,
> > > > > > NULL,
> > > > > > &DeviceExtension->DiskGuidName);
> > > > > >
> > > > > > The GUID returned was:
> > > > > >
> >??\ROOT#myvol#0000#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
> > > > > >
> > > > > > 4) Enable the interface
> > > > > >
> > > > > > 5) Register as a Volume device
> > > > > > Status = IoRegisterDeviceInterface(
> > > > > > PnPDeviceObject,
> > > > > > &MOUNTDEV_MOUNTED_DEVICE_GUID,
> > > > > > NULL,>
> > > > > > &DeviceExtension->VolumeGuidName);
> > > > > >
> > > > > > The GUID returned was:
> > > > > >
> >??\ROOT#myvol#0000#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}
> > > > > >
> > > > > > 6) Enable the interface
> > > > > >
> > > > > >
> > > > > > A short time later I get the following two debug messages:
> > > > > > CreateTargetEntry() RegisterDeviceNotification() failed. Win32
> > > > > > Error:1066
> > > > > > DmServerServiceHandlerEx() CreateTargetEntry() failed: 1066.
> > > > > >
> > > > > > The only IOCTL I get from the mount manager is
> > > > > > IOCTL_MOUNTDEV_QUERY_DEVICE_NAME to which I respond with>
> > > > > > my device name (e.g. \Device\MyVol\test_vol).
> > > > > >
> > > > > > What am I doing wrong?
> > > > > >
> > > > > > Thanks in advance,
> > > > > > -bob
> > > > > >
> > > > > > —
> > > > > > 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
> > > > >
> > > >
> > > >—
> > > >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
> > >
> >
> >—
> >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
>