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/


Accessing the user data...

OSR_Community_UserOSR_Community_User Member Posts: 110,217
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 page locks. How can I solve this problem.

Other doubt is, is it possible to update the registry at boot time?



Thanks in advance

Ashish Maliye

Comments

  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    >Right now I just want to increase the stored value by one (ASCII value). I
    am
    >doing the following.
    >StoreUserMdl = Irp -> MdlAddress;

    Do not touch the MDL allocated for you by the IO manager. Allocate your
    own and copy the data to it. In the completion routine, free your MDL and
    restore the IO manager's one.

    Max
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    Hi Max,
    Thank you for your valuable suggestion. Actually, I want to encrypt the
    data while writing on the disk, and decrypt it on reading. For the time
    being I just want to increment the value by one while writing on the disk
    and on reading decrement the value by one. How can I update the data stored
    in the user buffers described by MDL.

    Ashish Maliye


    -----Original Message-----
    From: Maxim S. Shatskih <[email protected]>
    To: File Systems Developers <[email protected]>
    Date: Tuesday, April 04, 2000 2:39 PM
    Subject: [ntfsd] Re: Accessing the user data...


    >>Right now I just want to increase the stored value by one (ASCII value). I
    >am
    >>doing the following.
    >>StoreUserMdl = Irp -> MdlAddress;
    >
    >Do not touch the MDL allocated for you by the IO manager. Allocate your
    >own and copy the data to it. In the completion routine, free your MDL and
    >restore the IO manager's one.
    >
    > Max
    >
    Original Message-----
    From: Amit Gorantiwar <[email protected]>
    To: File Systems Developers <[email protected]>
    Date: Tuesday, April 04, 2000 1:35 PM
    Subject: [ntfsd] Accessing the user data...


    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 page locks.
    How can I solve this problem.

    Other doubt is, is it possible to update the registry at boot time?



    Thanks in advance

    Ashish Maliye
    >
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    > in the user buffers described by MDL.

    Map them to system space and play with them.

    Max
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!
Internals & Software Drivers 30 Nov 2020 LIVE ONLINE
Writing WDF Drivers 7 Dec 2020 LIVE ONLINE
Developing Minifilters Early 2021 LIVE ONLINE