- Move IoGetBaseFileSystemDeviceObject to device.c and make it check for FO_DIRECT_DEVICE_OPEN, which it wasn't before (and also code it in a less confusing way like the other IoGetXxxDeviceObject APIs)

- Mask out the DO_VERIFY_VOLUME flag when mounting a device.

svn path=/trunk/; revision=22767
This commit is contained in:
Alex Ionescu 2006-07-02 06:28:29 +00:00
parent 130980ccde
commit fcb77c4c3d
2 changed files with 39 additions and 44 deletions

View file

@ -1167,6 +1167,41 @@ IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
return DeviceObject;
}
/*
* @implemented
*/
PDEVICE_OBJECT
NTAPI
IoGetBaseFileSystemDeviceObject(IN PFILE_OBJECT FileObject)
{
PDEVICE_OBJECT DeviceObject;
/*
* If the FILE_OBJECT's VPB is defined,
* get the device from it.
*/
if ((FileObject->Vpb) && (FileObject->Vpb->DeviceObject))
{
/* Use the VPB's Device Object's */
DeviceObject = FileObject->Vpb->DeviceObject;
}
else if (!(FileObject->Flags & FO_DIRECT_DEVICE_OPEN) &&
(FileObject->DeviceObject->Vpb) &&
(FileObject->DeviceObject->Vpb->DeviceObject))
{
/* Use the VPB's File System Object */
DeviceObject = FileObject->DeviceObject->Vpb->DeviceObject;
}
else
{
/* Use the FO's Device Object */
DeviceObject = FileObject->DeviceObject;
}
/* Return the device object we found */
return DeviceObject;
}
/*
* @implemented
*/

View file

@ -35,7 +35,8 @@ INIT_FUNCTION
NTAPI
IoInitVpbImplementation(VOID)
{
KeInitializeSpinLock(&IoVpbLock);
/* Just initialize the VPB Lock */
KeInitializeSpinLock(&IoVpbLock);
}
VOID
@ -348,7 +349,8 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject,
/* Initialize the event to wait on */
KeInitializeEvent(&Event, NotificationEvent, FALSE);
/* Get the actual device to mount */
/* Remove the verify flag and get the actual device to mount */
DeviceObject->Flags &= ~DO_VERIFY_VOLUME;
while (AttachedDeviceObject->AttachedDevice)
{
/* Get the next one */
@ -779,48 +781,6 @@ IoUnregisterFileSystem(IN PDEVICE_OBJECT DeviceObject)
KeLeaveCriticalRegion();
}
/*
* @implemented
*/
PDEVICE_OBJECT
NTAPI
IoGetBaseFileSystemDeviceObject(IN PFILE_OBJECT FileObject)
{
PDEVICE_OBJECT DeviceObject = NULL;
PVPB Vpb = NULL;
/*
* If the FILE_OBJECT's VPB is defined,
* get the device from it.
*/
if (NULL != (Vpb = FileObject->Vpb))
{
if (NULL != (DeviceObject = Vpb->DeviceObject))
{
/* Vpb->DeviceObject DEFINED! */
return DeviceObject;
}
}
/*
* If that failed, try the VPB
* in the FILE_OBJECT's DeviceObject.
*/
DeviceObject = FileObject->DeviceObject;
if (NULL == (Vpb = DeviceObject->Vpb))
{
/* DeviceObject->Vpb UNDEFINED! */
return DeviceObject;
}
/*
* If that pointer to the VPB is again
* undefined, return directly the
* device object from the FILE_OBJECT.
*/
return ((NULL == Vpb->DeviceObject) ? DeviceObject : Vpb->DeviceObject);
}
/*
* @implemented
*/