can I acquire the MainResource in filter driver?

I want to use the functions such as CcCopyRead, CcCopyWrite in my filter
driver, but call CcCopyRead need to acquire FCB shared, and I don’t know
how to get FCB, FileObject->FsContext is FSRTL_COMMON_FCB_HEADER, what’s
FileObjext->FsContext2?

I am working under Fat32!

Thanks a lot!

Hi Jonathan,

Nope, filter drivers are not supposed to acquire resources provided by file
systems. There is a hierarchy in which the resources are supposed to be
acquired and the memory manager, cache manager and fs take lot of efforts to
maintain this hierarchy. If you try to acquire a resource at the filter
level, u will destroy this hierarchy there by leading to deadlock.

One more thing, why do u want to use CcCopyRead and CcCopyWrite in the
filter driver. These functions are used by the file system driver to
interact with cache manager to provide caching support. It is not clear to
me, what advantages are u going to get by calling these functions. Why not
just call ZwReadFile/ZwWriteFile to read and write data, if the file is
opened in caching mode the fs will take care to read/write the data from the
cache (if its available there).

thanks
-Kiran

P.S. FSRTL_COMMON_FCB_HEADER->Resource is the main resource, but u should
not touch it in the filter driver

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Jonathan
Sent: Monday, October 27, 2003 12:20 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] can I acquire the MainResource in filter driver?

I want to use the functions such as CcCopyRead, CcCopyWrite in my filter
driver, but call CcCopyRead need to acquire FCB shared, and I don’t know
how to get FCB, FileObject->FsContext is FSRTL_COMMON_FCB_HEADER, what’s
FileObjext->FsContext2?

I am working under Fat32!

Thanks a lot!


You are currently subscribed to ntfsd as: xxxxx@calsoftinc.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

I am writing a filter driver for dynamic encryption, but I am confusing
about the Cache/NonCached/Paging I/O, so I want to control them.

In the Rajeev Nagar’s “NT File System Internals”, he say that we can use
the Copy Interface and MDL Interface.

Hello Jonathan,

Comments interspersed…

thanks
-Kiran

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Jonathan
Sent: Monday, October 27, 2003 3:07 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] RE: can I acquire the MainResource in filter driver?

I am writing a filter driver for dynamic encryption, but I am confusing
about the Cache/NonCached/Paging I/O, so I want to control them.
[Kiran] What is the situation where you require to call Cc* functions from
the filter driver. I am still confused about that.

In the Rajeev Nagar’s “NT File System Internals”, he say that we can use
the Copy Interface and MDL Interface.

[Kiran] I think you are referring to page 260 in Rajeev Nagar’s book (Cache
Manager Clients). There it is clearly mentioned [Kiran] that the filter
drivers are indirect clients of cache manager and they interact with cache
manager (via file system) [Kiran] using specialized file system interfaces.
Here I am cut pasting a few lines from the book:

[Kiran] “Filter drivers, or other drivers that use the NT file system
interfaces for
[Kiran] specialized purposes, are indirect clients of the Cache Manager.
Consider a filter
[Kiran] driver that provides hard disk caching for data stored on slower
media such
[Kiran] as magnetic tape or optical media. Such a driver uses the services
of local
[Kiran] file system to store the cached information. Therefore, filter
driver is an
[Kiran] indirect client of the Cache Manager, since the file system
supporting the filter
[Kiran] driver uses the copy interface to transfer data into and from system
memory.”


You are currently subscribed to ntfsd as: xxxxx@calsoftinc.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

If you are confused about them, how do you hope to contol them ?

----- Original Message -----
From: “Jonathan”
To: “Windows File Systems Devs Interest List”
Sent: Monday, October 27, 2003 11:37 AM
Subject: [ntfsd] RE: can I acquire the MainResource in filter driver?

> I am writing a filter driver for dynamic encryption, but I am confusing
> about the Cache/NonCached/Paging I/O, so I want to control them.
>
> In the Rajeev Nagar’s “NT File System Internals”, he say that we can use
> the Copy Interface and MDL Interface.
>
> —
> You are currently subscribed to ntfsd as: xxxxx@rdsor.ro
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Why are you calling these functions which are usually for FSD itself only?

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

----- Original Message -----
From: “Jonathan”
To: “Windows File Systems Devs Interest List”
Sent: Monday, October 27, 2003 9:50 AM
Subject: [ntfsd] can I acquire the MainResource in filter driver?

> I want to use the functions such as CcCopyRead, CcCopyWrite in my filter
> driver, but call CcCopyRead need to acquire FCB shared, and I don’t know
> how to get FCB, FileObject->FsContext is FSRTL_COMMON_FCB_HEADER, what’s
> FileObjext->FsContext2?
>
> I am working under Fat32!
>
> Thanks a lot!
>
> —
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

> In the Rajeev Nagar’s “NT File System Internals”, he say that we can use

the Copy Interface and MDL Interface.

This does not mean that you can use CcCopyRead. CcCopyRead is used inside the
FSD to implement the copy interface, and is the default implementation of the
copy interface. It cannot be used to call the copy interface.

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

the book is mainly on file system driver development, although parts of it
is related to filter drivers. you must read the book carefully.

Ampsi

----- Original Message -----
From: “Jonathan”
To: “Windows File Systems Devs Interest List”
Sent: Monday, October 27, 2003 17:37
Subject: [ntfsd] RE: can I acquire the MainResource in filter driver?

I am writing a filter driver for dynamic encryption, but I am confusing
about the Cache/NonCached/Paging I/O, so I want to control them.

In the Rajeev Nagar’s “NT File System Internals”, he say that we can use
the Copy Interface and MDL Interface.


You are currently subscribed to ntfsd as: xxxxx@hotmail.com
To unsubscribe send a blank email to xxxxx@lists.osr.com