Hi,
I’m developping a driver virtual disk file system.
When the disc is removed (dismounting), i’am not make call IoDeleteDevice , finally my driver keep the DEVICE_OBJECT for next use (remounting),it returns STATUS_DEVICE_NOT_READY for this DEVICE_OBJECT removed.
When a new virtual disk filesystem is mounted the handle DEVICE_OBJECT is reused without repeating calls IoCreateDevice, and virtual disk filesystem is re enabled.
If not available handle , function IoCreateDevice is called once.
For dismounting: instead calls IoDeleteDevice I makes disabling virtual disk filesystem DEVICE_OBJECT (return STATUS_DEVICE_NOT_READY for all access in this virtual disk filesystem)
but I do not know how purge all FILE_OBJECT opend in this disk dismounted DEVICE_OBJECT ?
My question:
how to purge all FILE_OBJECT a virtual disk file system DEVICE_OBJECT?
The solution is push stack the PFILE_OBJECT every event IRP_MJ_CREATE called and pop stack every event IRP_MJ_CLOSE called.
I will use the battery functions HeadList InsertTailList.
But I do not know how to close and delete the FILE_OBJECT opened.
I already try function for cancelling FILE_OBJECT , crash blue-screen,
i had called this function on FILE_OBJECT cleanuped but not closed.
I call on IoDeleteDevice on all virutal disk filesystem only when my driver is unloaded.
Thank you.
So you are simulating (or actually have) removable media really. I’d suggest
that you read how FAT handles this - in particular the Verify path is of
interest to you. If it were I’d build a checked version and watch the flows
in the debugger since there are other distinct failure conditions that your
device needs to return to provoke both your filesystem and the IoManager
into the correct actions.
As for your specific question - you don’t need to keep a list of all the the
file object that have been opened (although you may need that for other
reasons). All you need to do is to keep a list of all the
SECTION_OBJECT_POINTERS you have used (since that is what CcPurge needs).
Traditionally there will be one of these per FCB (or SCB) - that data
structure you pointed FileObject->FsContext at in create.
wrote in message news:xxxxx@ntfsd…
> Hi,
>
> I’m developping a driver virtual disk file system.
> When the disc is removed (dismounting), i’am not make call IoDeleteDevice
> , finally my driver keep the DEVICE_OBJECT for next use (remounting),it
> returns STATUS_DEVICE_NOT_READY for this DEVICE_OBJECT removed.
>
> When a new virtual disk filesystem is mounted the handle DEVICE_OBJECT
> is reused without repeating calls IoCreateDevice, and virtual disk
> filesystem is re enabled.
> If not available handle , function IoCreateDevice is called once.
>
> For dismounting: instead calls IoDeleteDevice I makes disabling virtual
> disk filesystem DEVICE_OBJECT (return STATUS_DEVICE_NOT_READY for all
> access in this virtual disk filesystem)
> but I do not know how purge all FILE_OBJECT opend in this disk dismounted
> DEVICE_OBJECT ?
>
> My question:
> how to purge all FILE_OBJECT a virtual disk file system DEVICE_OBJECT?
>
> The solution is push stack the PFILE_OBJECT every event IRP_MJ_CREATE
> called and pop stack every event IRP_MJ_CLOSE called.
> I will use the battery functions HeadList InsertTailList.
>
> But I do not know how to close and delete the FILE_OBJECT opened.
>
> I already try function for cancelling FILE_OBJECT , crash blue-screen,
> i had called this function on FILE_OBJECT cleanuped but not closed.
>
> I call on IoDeleteDevice on all virutal disk filesystem only when my
> driver is unloaded.
>
> Thank you.
>
Quote : All you need to do is to keep a list of all the SECTION_OBJECT_POINTERS you have used.
Yes but if remounted in the same handle DEVICE_OBJECT : a virtual disk file system which contain different files compared of old virtual disk previously dismounted.
that’s why I need to purge all FILE_OBJECT.
Why? That’s what the VPB is for.
wrote in message news:xxxxx@ntfsd…
> Quote : All you need to do is to keep a list of all the
> SECTION_OBJECT_POINTERS you have used.
>
> Yes but if remounted in the same handle DEVICE_OBJECT : a virtual disk
> file system which contain different files compared of old virtual disk
> previously dismounted.
> that’s why I need to purge all FILE_OBJECT.
>
i want purge all FILE_OBJECT opened when i dismount virtual disk file system.