SwapBuffer ReadLen Query

Hello,
I am working on SwapBuffer. I need to know why read length is always 24?
How can we change this to 60?
I want to compare first 60 characters to “Fixed Sequence” if true then only
“XOR”,how can i do this?

please help!!!

>>I need to know why read length is always 24?

What do you mean by “always”. How did you test it? You’ll get what the app has asked

you can surly change it inside parameters.read.Length to a value of your choice.

I opened the file using notepad, winword (2003) and word 2007.
When the file is of size less than 24 bytes, then I get buffer length = file length.
If the file is more than 24 bytes then I get only 24 bytes.

I tried to change the read length (paramters.read.Length)in pre-op (IRP_MJ_READ) but the PC crashes.

Buffer size for all the different application is always 24 bytes.

Also if I try to print this buffer, and if I try to print more than 24 bytes (in the buffer) the PC crashes.

REALLY APPRECIATE A QUICK REPLY…

I quickly check this on a XP SP2 VM with FileSpy,

create a .txt file of size 512 bytes, open it with wordpad, and I clearly see wordpad.exe requesting read of 0xFFE and getting 0x200 (512 bytes) as expected. So no the scenario you mentioned is not what I see. I checked with winword.exe as well and can not see what you mentioned.

Additionally if you are monitoring length not rounded on sector size, it means you are checking cached read request, do you really want to do that?

>I tried to change the read length (paramters.read.Length)in pre-op (IRP_MJ_READ) but the PC crashes.
Ist) You must be doing something wrong
IInd) The wrong mentioned in Ist could be that you forgot to increase the buffer size but changed the length, now when FS will copy data in to it, you have really high chances of crash.

In case you did change the buffer, post your code here.

>Also if I try to print this buffer, and if I try to print more than 24 bytes (in the buffer) the PC crashes.

Where in pre read? the buffer will have nothing significant in it at this time.(should be garbage or zero may be).

PLEASE avoid posting in caps, as it will do nothing better for your post. One will post when they have time, and changing the case does not effect that, right?

Tried reading files using different applications; all the file reads are in the post-read in swapbuffers;

.txt file (size is 174 bytes) opened with notepad, Read.Length is 24 (offset is 0),
.txt file (size is 174 bytes) opened with MS word 2003, Read.Length is 174 (offset is 0).
.txt file (size is 174 bytes) opened with Wordpad, Read.Length is a number of multiple reads which are 24, 24, 5, 5, 2, 4094 bytes, in this sequence (and the offset is 0).

>Additionally if you are monitoring length not rounded on sector size, it means you are checking cached read request, do you really want to do that?
How do I prevent this?

>>I tried to change the read length (paramters.read.Length)in pre-op (IRP_MJ_READ) but the PC crashes.
>Ist) You must be doing something wrong
>IInd) The wrong mentioned in Ist could be that you forgot to increase the buffer size but changed the length, now when FS will copy data in to it, you have really high chances of crash.

I tried to increase the read length to a fixed size which is the sector size (512 Bytes), but it is crashing for reads where the original read length is less than the new Read Length. e.g. if original read length was 24 and I converted this to 512.

Is it possible that when I am returning the buffer to the requesting layer (after the read completion), the upper layer cannot handle the larger read.

If I reduce the read length, then it works, but the data that is shown in the application is truncated.

>In case you did change the buffer, post your code here.
I shall post the buffer