IoSynchronousPageWriteEx
NTSTATUS __stdcall IoSynchronousPageWriteEx(
FILE_OBJECT *FileObject,
MDL *MemoryDescriptorList,
LARGE_INTEGER *StartingOffset,
KEVENT *Event,
UINT8 IrpSpFlags,
PVOID IoAttributionContext,
IO_STATUS_BLOCK *IoStatusBlock){
_SECTION_OBJECT_POINTERS *SectionObjectPointer;
_DEVICE_OBJECT *RelatedDeviceObject;
IRP *Irp;
int IoPriorityThread;
__int64 v15;
_ETHREAD *CurrentThread;
_LARGE_INTEGER v18;
IRP *ReserveIrp;
VOID *retaddr;
SectionObjectPointer = FileObject->SectionObjectPointer;
if( SectionObjectPointer && SectionObjectPointer->SharedCacheMap )
{
__incgsdword(0x8134u);
__addgsdword(0x8138u, (MemoryDescriptorList->ByteCount + 4095) >> 12);
}
RelatedDeviceObject = IoGetRelatedDeviceObject(FileObject);
Irp = IopAllocateIrpExReturn(RelatedDeviceObject, *((_BYTE *)RelatedDeviceObject + 76), 0, retaddr);
if( !Irp )
{
if( (unsigned int)MmIsFileObjectAPagingFile(FileObject) )
{
_InterlockedIncrement(&IoSynchronousPageWriteIrpAllocationFailure);
ReserveIrp = IopAllocateReserveIrp(v18, *((_BYTE *)RelatedDeviceObject + 76), 1i64);
}
else
{
_InterlockedIncrement(&IoSynchronousPageWriteNonPagefileIrpAllocationFailure);
ReserveIrp = IopAllocateBackpocketIrp(RelatedDeviceObject, *((_BYTE *)RelatedDeviceObject + 76), 0);
}
Irp = ReserveIrp;
if( !ReserveIrp )
return -1073741670;
}
*((_BYTE *)Irp + 71) |= 0x20u;
*((_QWORD *)Irp + 1) = MemoryDescriptorList;
*((_DWORD *)Irp + 4) = 67;
IoPriorityThread = PsGetIoPriorityThread((__int64)KeGetCurrentThread());
if( IoPriorityThread < 2 )
{
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
if( (*((_DWORD *)CurrentThread + 29) & 0x400) != 0
|| *((_BYTE *)CurrentThread + 562) == 1
|| (*((_BYTE *)KeGetCurrentThread() + 1304) & 0x40) != 0
|| *((_QWORD *)KeGetCurrentThread() + 152) == 2i64 )
{
++IoPagingWriteLowPriorityCount;
}
else
{
++IoPagingWriteLowPriorityBumpedCount;
IoPriorityThread = 2;
}
}
*((_QWORD *)Irp + 9) = IoStatusBlock;
*((_BYTE *)Irp + 64) = 0;
*((_QWORD *)Irp + 10) = Event;
*((_DWORD *)Irp + 4) = ((IoPriorityThread << 17) + 0x20000) | 0x43;
*((_QWORD *)Irp + 14) = (char *)MemoryDescriptorList->StartVa + MemoryDescriptorList->ByteOffset;
*((_QWORD *)Irp + 24) = FileObject;
*((_QWORD *)Irp + 19) = KeGetCurrentThread();
*(_BYTE *)(v15 - 72) = 4;
*(_DWORD *)(v15 - 64) = MemoryDescriptorList->ByteCount;
*(LARGE_INTEGER *)(v15 - 48) = *StartingOffset;
*(_BYTE *)(v15 - 70) |= IrpSpFlags;
*(_QWORD *)(v15 - 24) = FileObject;
if( IoAttributionContext )
IopSetDiskIoAttributionExtension(Irp, *((_QWORD *)IoAttributionContext + 3));
else
IoSetDiskIoAttributionFromThread(Irp, *((_ETHREAD **)Irp + 19));
IopQueueThreadIrp(Irp);
return IofCallDriver(RelatedDeviceObject, Irp);
}Referenced by:
IoSynchronousPageWrite
MiIssueSynchronousFlush
MiSynchronousPageWrite
MiZeroPageWrite