Hi , i`m a beginner of minifilter. I want to change file size. I have searched many topic?but still get nothing
First, in IRP_MJ_SET_INFORMATION pre function,
ntst = FltCreateFileEx(FltObjects->Filter,
Data->Iopb->TargetInstance,
&hfile,
&ptmpfo,
GENERIC_READ,
&oa,
&iosb,
NULL,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_OPEN_IF,
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_ALERT,
NULL,
0,
IO_IGNORE_SHARE_ACCESS_CHECK
);
and then,
FltQueryInformationFile(Data->Iopb->TargetInstance,
ptmpfo,
&stFileInfo,
sizeof(FILE_STANDARD_INFORMATION),
FileStandardInformation,
NULL);
these two functions work fine, I can get the standard information, such as, the EndOfFile.QuadPart. But the strange thing is the Directory is TRUE. The file is a txt, not a directory. then, I allocate a pointer :
FILE_STANDARD_INFORMATION *myStan = NULL;
size_t totalSize = sizeof(FILE_STANDARD_INFORMATION);
myStan = (FILE_STANDARD_INFORMATION *)ExAllocatePool(PagedPool, totalSize);
i put everything into myStan from stFileInfo,then :
FltSetInformationFile(FltObjects->Instance,
ptmpfo,
myStan,
sizeof(FILE_STANDARD_INFORMATION),
FileStandardInformation);
the function return 0xC000000DL STATUS_INVALID_PARAMETER.
My os is vmware win7_32, NTFS,and the file is a txt. I really don`t konw why.
Could somebody help me? Thanks!