Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTFSD
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Help regarding filter driver..

OSR_Community_UserOSR_Community_User Member Posts: 110,217
Hi Friends,


Thanks again for helping me. Now I am able to update the data of the MDL.

I referred Disk Performance monitor to develop my filter driver. As I sad I want to encrypt the data while writing and decrypt the data on reading. I observed driver is trapping the read and write request to the disk. Problem is there is some inconsistency between the read and write request.

Suppose I want to open a file from a drive on the very first time driver gets read request, but next time if I want to open the same file it is not getting any request. But every time I want to save the file, driver gets the write request. How can I eliminate this inconsistency , which is creating a great problem for doing encryption and decryption properly.








Hello friends,

I had written a small filter driver. Which is attached to all the partitions of the hard disk. Driver is receiving all the read and write request to the disk. Now I want to update the use data. I set device object flag to DO_DIRECT_IO. Right now I just want to increase the stored value by one ASCII value. I am doing the following.

StoreUserMdl = Irp -> MdlAddress;

while ( StoreUserMdl != NULL )

{

UserData = (PCHAR) ( * (PCHAR) StoreUserMdl -> StartVa + StoreUserMdl -> ByteOffset );

if ( irpStack -> MajorFunction == IRP_MJ_WRITE )

for ( Count = 0; Count <= StoreUserMdl -> ByteCount; Count ++ )

++ * ( UserData + Count );

StoreUserMdl = StoreUserMdl -> Next;

}

On loading driver page fault occurs. I think it is because of some page locks. I am not very clear about the MDL mechanism, and also not very confident with my approach. Is it a correct way of accessing the user data? or I have to do some thing else.

Comments

  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    how to set FILE_NO_BUFFERING from a filter driver?

    Ho Mun Chuen
    @@ "Not everything that counts can be counted;
    <" )~ and not everything that can be counted counts"
    /\/\ ..... Albert Einstein
    ----- Original Message -----
    From: Giga Giguashvili <[email protected]>
    To: File Systems Developers <[email protected]>
    Sent: Tuesday, April 18, 2000 3:00 AM
    Subject: [ntfsd] Re: Help regarding filter driver..


    Hi,

    Your problem is called buffering. After the system reads data from the
    file, on furhter requests, processes
    get the cached data. On writes, dirty pages get flushed to the file,
    that's why saving file causes writes.


    I don't know an effective solution for this problem, but assuming you
    encrypt only small amount of
    files on the disk, you may open files with FILE_NO_BUFFERING option.


    Regards,
    Giga


    Amit Gorantivar wrote:


    Hi Friends,

    Thanks again for helping me. Now I am able to update the data of the
    MDL.


    I referred Disk Performance monitor to develop my filter driver. As I
    sad I want to encrypt the data while writing and decrypt the data on
    reading. I observed driver is trapping the read and write request to the
    disk. Problem is there is some inconsistency between the read and write
    request.


    Suppose I want to open a file from a drive on the very first time driver
    gets read request, but next time if I want to open the same file it is
    not getting any request. But every time I want to save the file, driver
    gets the write request. How can I eliminate this inconsistency , which
    is creating a great problem for doing encryption and decryption
    properly.




    Hello friends,


    I had written a small filter driver. Which is attached to all the
    partitions of the hard disk. Driver is receiving all the read and write
    request to the disk. Now I want to update the use data. I set device
    object flag to DO_DIRECT_IO. Right now I just want to increase the
    stored value by one ASCII value. I am doing the following.


    StoreUserMdl = Irp -> MdlAddress;


    while ( StoreUserMdl != NULL )


    {


    UserData = (PCHAR) ( * (PCHAR) StoreUserMdl -> StartVa + StoreUserMdl ->
    ByteOffset );


    if ( irpStack -> MajorFunction == IRP_MJ_WRITE )


    for ( Count = 0; Count <= StoreUserMdl -> ByteCount; Count ++ )


    ++ * ( UserData + Count );

    StoreUserMdl = StoreUserMdl -> Next;

    }


    On loading driver page fault occurs. I think it is because of some page
    locks. I am not very clear about the MDL mechanism, and also not very
    confident with my approach. Is it a correct way of accessing the user
    data? or I have to do some thing else.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Writing WDF Drivers 7 Dec 2020 LIVE ONLINE
Internals & Software Drivers 25 Jan 2021 LIVE ONLINE
Developing Minifilters 8 March 2021 LIVE ONLINE