FileEndOfFileInformation for Memory Mapping File

I always think A Paging IRP_MJ_SET_INFORMATION (the class is FileEndOfFileInformation) don’t infect the filesize.
But,if I use these code to test:
{
CString strLog=“C:\testxyx.txt”;
HANDLE hFile;
hFile=CreateFile(strLog,GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ,NULL,CREATE_NEW,
FILE_ATTRIBUTE_NORMAL,NULL);
HANDLE hMap=CreateFileMapping(
hFile,
NULL,
PAGE_READWRITE,
0,
0x1000,//the size
NULL);

}

It will issue a IRP_MJ_CREATE,and then issue a Paging IRP_MJ_SET_INFORMATION (the class is FileEndOfFileInformation) to set the filesize (is 0x1000).

A Paging IRP_MJ_SET_INFORMATION (the class is FileEndOfFileInformation) infect the filesize!
In my filter,How can I know a Paging IRP_MJ_SET_INFORMATION (the class is FileEndOfFileInformation) is to set valid data length or to set filesize?

For rhe Irp you have in this case IrpSp->Parameters.SetFile.AdvanceOnly is
FALSE.

wrote in message news:xxxxx@ntfsd…
>I always think A Paging IRP_MJ_SET_INFORMATION (the class is
>FileEndOfFileInformation) don’t infect the filesize.
> But,if I use these code to test:
> {
> CString strLog=“C:\testxyx.txt”;
> HANDLE hFile;
> hFile=CreateFile(strLog,GENERIC_READ|GENERIC_WRITE,
> FILE_SHARE_READ,NULL,CREATE_NEW,
> FILE_ATTRIBUTE_NORMAL,NULL);
> HANDLE hMap=CreateFileMapping(
> hFile,
> NULL,
> PAGE_READWRITE,
> 0,
> 0x1000,//the size
> NULL);
> …
> }
>
> It will issue a IRP_MJ_CREATE,and then issue a Paging
> IRP_MJ_SET_INFORMATION (the class is FileEndOfFileInformation) to set the
> filesize (is 0x1000).
>
>
> A Paging IRP_MJ_SET_INFORMATION (the class is FileEndOfFileInformation)
> infect the filesize!
> In my filter,How can I know a Paging IRP_MJ_SET_INFORMATION (the class is
> FileEndOfFileInformation) is to set valid data length or to set filesize?
>

I think the Paging IO will not effect the filesize.So,the Paging IRP_MJ_SET_INFORMATION will not effect the filesize.And I think the Paging IRP_MJ_SET_INFORMATION is just to the allocation size.
But in IRP_MJ_SET_INFORMATION ,thare are 3 class: allocation size,filesize and valid data length.

So,maybe I’m wrong?The paging IRP_MJ_SET_INFORMATION with the FileEndOfFileInformation class will effect the filesize?

You could consult the fastfat sources in the IFS/WDK :wink:

wrote in message news:xxxxx@ntfsd…
>I think the Paging IO will not effect the filesize.So,the Paging
>IRP_MJ_SET_INFORMATION will not effect the filesize.And I think the Paging
>IRP_MJ_SET_INFORMATION is just to the allocation size.
> But in IRP_MJ_SET_INFORMATION ,thare are 3 class: allocation size,filesize
> and valid data length.
>
> So,maybe I’m wrong?The paging IRP_MJ_SET_INFORMATION with the
> FileEndOfFileInformation class will effect the filesize?
>