Hi everybody,
I’m developing a compression minifilter which, at this point, compresses and decompresses fine directly from the disk and directly to the disk. For example, when I use notepad to create and open a file or when I use explorer to copy a file into the filtered device and to copy it back to a normal device, everything’s fine.
When I’m finishing writing the file, I change the file size to only the size of actual data written on disk, and the file size returned from IRP_MJ_QUERY_INFORMATION, IRP_MJ_NETWORK_QUERY_OPEN and IRP_MJ_DIRECTORY_CONTROL completion rutines is the decompressed file size.
The problem I’m having is when I open a compressed file from, for example, wordpad:
If I have a file originally of 1000 bytes and I compress it and save it in 400 bytes, wordpad would only read the first 400 bytes. I’ve been using FileSpy and I noticed that every file size is correctly changed (also allocationsize), but when wordpad reaches 400 bytes it gets STATUS_END_OF_FILE as return from the FASTIO_READ.
The first solution I tried was to change filesize and alloctionsize in FCB when processing the create completion routine because those sizes where 400 and not 1000 bytes, and it worked, but I guess that’s a bit unsafe or I was doing it wrong because when I processed a write IRP and later wanted to read or write directly to the file I got STATUS_FILE_CORRUPT_ERROR. Then I tried using CcSetFileSizes but I got back to the same problem.
So I left FCB alone and tried to disable fastio, but I still got the same STATUS_END_OF_FILE to wordpad, but this time from non cached IRP_MJ_READ IRP, so, just for testing, I hard coded the values of IoStatus in the read completion routine to be successful in the cached case, but now wordpad gets stuck doing a IRP_MJ_READ from Offset 500, ToRead FFE, Read FFE again and again.
I’ve been looking at the FAQ and a lot of posts for a while, but I still don’t know what I’m doing wrong… or just what I’m not doing.
I hope someone can help me,
Thanks in advance,
Andr?s