Re: Mounting on a directory

Tech-Archive recommends: Fix windows errors by optimizing your registry



1) You must have a PnP PDO. The one way to create it is
IoReportDetectedDevice with all NULLs as hardware resource arguments.
2) Register MOUNTDEV_MOUNTED_DEVICE_GUID on this PDO.
3) Handle the IOCTL_MOUNTDEV_xxx requests, especially the "query ID" one.

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

"Bob" <Bob@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F0D76D10-86D3-44B3-A1A3-DE4397BE83E9@xxxxxxxxxxxxxxxx
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

.



Relevant Pages

  • Re: Mounting on a directory
    ... Create a PDO, say, with IoReportDetectedDevice. ... Write an INF that loads for my PDO and installs my low level filter. ... Then I wouldn't have to bother with PnP notifications, volumes, mount points ... Create a device object based on a request ...
    (microsoft.public.development.device.drivers)
  • Register MountMgr,but crash
    ... I have a Volume Manager driver which creates a volume device object on which ... I want to register this DO to Mount Manager,and to let Mount ...
    (microsoft.public.development.device.drivers)
  • Register standalone volume DO to Mount Mgr
    ... I have a Volume Manager driver which creates a volume device object on which ... I want to register this DO to Mount Manager,and to let Mount ...
    (microsoft.public.development.device.drivers)
  • Mounting on a directory
    ... I have a virtual disk driver that runs on XP. ... and used via the drive letter. ... on a directory (a nested mount). ... Create a device object based on a request ...
    (microsoft.public.development.device.drivers)
  • Re: [PATCH 1/5] fsnotify/vfsmount: add fsnotify fields to struct vfsmount
    ... The idea is to provide a mechanism to watch for "all events", ... namespace aware way: for that, a process registers interest in all mount ... Mount as user will open up additional use cases. ... register interest in events generated by only a particular set of processes. ...
    (Linux-Kernel)