Hi, Nicholas,
Thank you very much for your kindly reply.
What I am trying to do is like:
FilterPagingIoWrite()
{
-
Perform some preprocessing on the request:
Encrypt the data in the MDL described buffer
-
Send the write down to the filesystem:
without modifying any parameters in the intercepted Irp.
-
Perform some postprocessing on the request:
I want to keep the last less than 16 bytes in my file unencrypted
}
====================================================
My codes relate to FsContext is as follows:
WriteDispath(…)
{
…
// No other place references FsContext except here
ValidDataLeng = FsContext->ValidDataLength;
FileSize = FsContext->FileSize;
…
}
And now I know I have misunderstood what FsContext->ValidDataLength means,it is
actually something similar to file size, am I right? I just want to determine
whether this is the last page to be written and how long the valid data is. Since,
file size during write paging io may be untrustable, this solution is silly.
Chen Zemao
If you want to add a header to the end of the file, the correct place to
do this is at the time that the file size is increased. This not during
the paging I/O write calls, but at two other times:
- IRP_MJ_SET_INFORMATION calls that modify the file EOF/allocation
size.
- NON-paging I/O cached or non-cached write calls (both IRP and Fast
I/O entry points) that write beyond EOF - EOF will be extended
automatically.
When your filter detects that one of these entry points has extended
EOF, take your private file-size change lock, adjust EOF upward by 16
bytes, send down the request with the modified EOF and let it succeeed,
write your header by rolling your own paging I/O writes (so the header
doesn’t get into the cache), then release your lock.
Whenever the user queries the file size (via IRP_MJ_GET_INFORMATION or
directory queries), you must lower the returned size by 16 bytes to make
it appear to him to be the same size that he set.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Zm Chen
Sent: Thursday, March 27, 2003 5:42 AM
To: File Systems Developers
Subject: [ntfsd] Re: ntfsd digest: March 26, 2003
Hi, Nicholas,
Thank you very much for your kindly reply.
What I am trying to do is like:
FilterPagingIoWrite()
{
-
Perform some preprocessing on the request:
Encrypt the data in the MDL described buffer
-
Send the write down to the filesystem:
without modifying any parameters in the intercepted Irp.
-
Perform some postprocessing on the request:
I want to keep the last less than 16 bytes in my file
unencrypted }
====================================================
My codes relate to FsContext is as follows:
WriteDispath(…)
{
…
// No other place references FsContext except here
ValidDataLeng = FsContext->ValidDataLength;
FileSize = FsContext->FileSize;
…
}
And now I know I have misunderstood what
FsContext->ValidDataLength means,it is
actually something similar to file size, am I right? I just
want to determine
whether this is the last page to be written and how long the
valid data is. Since, file size during write paging io may be
untrustable, this solution is silly.
Chen Zemao
You are currently subscribed to ntfsd as: xxxxx@nryan.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
ValidDataLength field is not what you want. You should check the FileSize field.
The possible problem here is that FastFat might not have filled this field. If you
look at FAT sources, you’ll see that if it needs the file size, it checks whether
HighPart of the FileSize field is a HINT_LOOKUP_ALLOCATION, and looks up the
allocation for the file.
Regards, Dejan.
Zm Chen wrote:
Hi, Nicholas,
Thank you very much for your kindly reply.
What I am trying to do is like:
FilterPagingIoWrite()
{
-
Perform some preprocessing on the request:
Encrypt the data in the MDL described buffer
-
Send the write down to the filesystem:
without modifying any parameters in the intercepted Irp.
-
Perform some postprocessing on the request:
I want to keep the last less than 16 bytes in my file unencrypted
}
====================================================
My codes relate to FsContext is as follows:
WriteDispath(…)
{
…
// No other place references FsContext except here
ValidDataLeng = FsContext->ValidDataLength;
FileSize = FsContext->FileSize;
…
}
And now I know I have misunderstood what FsContext->ValidDataLength means,it is
actually something similar to file size, am I right? I just want to determine
whether this is the last page to be written and how long the valid data is. Since,
file size during write paging io may be untrustable, this solution is silly.
Chen Zemao
You are currently subscribed to ntfsd as: xxxxx@alfasp.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
–
Kind regards, Dejan M. MVP for DDK
http://www.alfasp.com E-mail: xxxxx@alfasp.com
Alfa Transparent File Encryptor - Transparent file encryption services.
Alfa File Protector - File protection and hiding library for Win32 developers.
Alfa File Monitor - File monitoring library for Win32 developers.