I’ve a routine of a filter driver that tries to modify the filesize of
some specified files. It works well under Win NT and Win 2K, but it causes
“page fault in nonpaged area” error under Win XP.
It seems the problem is due to the casting of “Irp->UserBuffer”.
…
…
case IRP_MN_QUERY_DIRECTORY:
pQueryDirectory = (PQUERY_DIRECTORY)¤tIrpStack->Parameters;
if ( pQueryDirectory )
{
switch ( … )
{
case FileBothDirectoryInformation:
…
…
pFBDInfo = (PFILE_BOTH_DIR_INFORMATION)Irp->UserBuffer;
while ( pFBDInfo->NextEntryOffset != 0 )
{
…
…
if ( Check for the specified files )
{
pFBDInfo->EndOfFile.HighPart = newFileLengthHigh;
pFBDInfo->EndOfFile.LowPart = newFileLengthLow;
pFBDInfo->AllocationSize.LowPart = newFileLengthLow;
pFBDInfo->AllocationSize.HighPart = newFileLengthHigh;
}
pFBDInfo = (PFILE_BOTH_DIR_INFORMATION)((PUCHAR)pFBDInfo +
pFBDInfo->NextEntryOffset);
}
if ( Check for the specified files )
{
pFBDInfo->EndOfFile.HighPart = newFileLengthHigh;
pFBDInfo->EndOfFile.LowPart = newFileLengthLow;
pFBDInfo->AllocationSize.LowPart = newFileLengthLow;
pFBDInfo->AllocationSize.HighPart = newFileLengthHigh;
}
…
…
return TRUE;
break;
Would anybody here help me to sort out the problem. A more comprehensive
sample is greatly appreciated.
Thanks in advance.
– Philip