20#define UDF_BUG_CHECK_ID UDF_FILE_READ
24#define OVERFLOW_READ_THRESHHOLD (0xE00)
26#define OVERFLOW_READ_THRESHHOLD (0xA00)
29#define OVERFLOW_READ_THRESHHOLD (0x1000)
79 Irp->IoStatus.Status = RC;
80 Irp->IoStatus.Information = 0;
127 UDFPrint((
"Getting too close to stack limit pass request to Fsp\n"));
139 Resource =
Fcb->NTRequiredFCB->CommonFCBHeader.Resource;
193 UDFPrint((
"UDFStackOverflowRead: \n"));
238 SIZE_T NumberBytesRead = 0;
267 UDFPrint((
" FSRTL_FSP_TOP_LEVEL_IRP\n"));
270 UDFPrint((
" FSRTL_CACHE_TOP_LEVEL_IRP\n"));
273 UDFPrint((
" FSRTL_MOD_WRITE_TOP_LEVEL_IRP\n"));
277 UDFPrint((
" FSRTL_FAST_IO_TOP_LEVEL_IRP\n"));
281 UDFPrint((
" NULL TOP_LEVEL_IRP\n"));
287 UDFPrint((
" RECURSIVE_IRP, TOP = %x\n", TopIrp));
294 MmPrint((
" Enter Irp, MDL=%x\n",
Irp->MdlAddress));
295 if(
Irp->MdlAddress) {
349 CanWait ?
"W" :
"w", PagingIo ?
"Pg" :
"pg",
350 NonBufferedIo ?
"NBuf" :
"buff", SynchronousIo ?
"Snc" :
"Asc"));
385 UDFPrint((
" UDF_IRP_CONTEXT_FLUSH2_REQUIRED\n"));
391#ifdef UDF_DELAYED_CLOSE
399 UDFPrint((
" UDF_IRP_CONTEXT_FLUSH_REQUIRED\n"));
404 PtrResourceAcquired = &(
Vcb->VCBResource);
409 PtrResourceAcquired =
NULL;
414 PtrResourceAcquired = &(
Vcb->VCBResource);
452 NonBufferedIo =
TRUE;
518 UDFPrint((
" TruncatedLength = %x\n", TruncatedLength));
536#define UDF_REQ_NOT_VIA_CACHE_MGR(ptr) (!MmIsRecursiveIoFault() && ((ptr)->ImageSectionObject != NULL))
555 MmPrint((
" CcFlushCache()\n"));
584 PtrResourceAcquired2 = &(
NtReqFcb->PagingIoResource);
593 PtrResourceAcquired2 = &(
NtReqFcb->PagingIoResource);
602 PtrResourceAcquired = &(
NtReqFcb->MainResource);
619#ifdef UDF_DISABLE_SYSTEM_CACHE_MANAGER
620 NonBufferedIo =
TRUE;
623 if(
Fcb &&
Fcb->FileInfo &&
Fcb->FileInfo->Dloc) {
624 AdPrint((
"UDFCommonRead: DataLoc %x, Mapping %x\n", &
Fcb->FileInfo->Dloc->DataLoc,
Fcb->FileInfo->Dloc->DataLoc.Mapping));
628 if (!NonBufferedIo) {
638 MmPrint((
" CcInitializeCacheMap()\n"));
643 MmPrint((
" CcSetReadAheadGranularity()\n"));
677 RC =
Irp->IoStatus.Status;
678 NumberBytesRead =
Irp->IoStatus.Information;
684 MmPrint((
" Read NonBufferedIo\n"));
688 UDFPrint((
"FSRTL_MOD_WRITE_TOP_LEVEL_IRP => CanWait\n"));
692 UDFPrint((
"FSRTL_CACHE_TOP_LEVEL_IRP => CanWait\n"));
707 MmPrint((
" !PASSIVE_LEVEL\n"));
712 MmPrint((
" Locked => CanWait\n"));
725 PtrResourceAcquired2 = &(
NtReqFcb->PagingIoResource);
739 CacheLocked, (
PCHAR)SystemBuffer, &NumberBytesRead);
784 if(PtrResourceAcquired2) {
787 if(PtrResourceAcquired) {
789 (PtrResourceAcquired ==
820 if (SynchronousIo && !PagingIo &&
NT_SUCCESS(RC)) {
832 Irp->IoStatus.Status = RC;
833 Irp->IoStatus.Information = NumberBytesRead;
834 UDFPrint((
" NumberBytesRead = %x\n", NumberBytesRead));
838 MmPrint((
" Complete Irp, MDL=%x\n",
Irp->MdlAddress));
839 if(
Irp->MdlAddress) {
852ULONG LockBufferCounter = 0;
853ULONG BuildMdlCounter = 0;
878 UDFPrint((
"UDFGetCallersBuffer: \n"));
881 if(
Irp->MdlAddress) {
882 MmPrint((
" UDFGetCallersBuffer: MmGetSystemAddressForMdl(Irp->MdlAddress) MDL=%x\n",
Irp->MdlAddress));
888#ifndef POST_LOCK_PAGES
889 MmPrint((
" UDFGetCallersBuffer: MmGetSystemAddressForMdl(PtrIrpContext->PtrMdl) MDL=%x\n", PtrIrpContext->
PtrMdl));
893 MmPrint((
" UDFGetCallersBuffer: TransitionBuffer\n"));
898 MmPrint((
" MmProbeAndLockPages()\n"));
910 MmPrint((
" MmGetSystemAddressForMdlSafer()\n"));
914 MmPrint((
" UDFGetCallersBuffer: Irp->UserBuffer\n"));
915 ReturnedBuffer =
Irp->UserBuffer;
918 return(ReturnedBuffer);
946 UDFPrint((
"UDFLockCallersBuffer: \n"));
952 if (!(
Irp->MdlAddress)) {
969 MmPrint((
" IoAllocateMdl()\n"));
977 MmPrint((
" Alloc MDL=%x\n", PtrMdl));
987#ifndef POST_LOCK_PAGES
989 MmPrint((
" MmProbeAndLockPages()\n"));
992 MmPrint((
" MmProbeAndLockPages() failed\n"));
1000 PtrIrpContext->
PtrMdl = PtrMdl;
1003 MmPrint((
" UDFLockCallersBuffer: do nothing, MDL=%x\n",
Irp->MdlAddress));
1011 MmPrint((
" Free MDL=%x\n", PtrMdl));
1042 UDFPrint((
"UDFUnlockCallersBuffer: \n"));
1050 UDFPrint((
" UDF_IRP_CONTEXT_BUFFER_LOCKED MDL=%x, Irp MDL=%x\n", PtrIrpContext->
PtrMdl,
Irp->MdlAddress));
1052 MmPrint((
" UDFUnlockCallersBuffer: free TransitionBuffer\n"));
1069 LockBufferCounter--;
1083 if(
Irp->MdlAddress) {
1086 UDFPrint((
" UDF_IRP_CONTEXT_BUFFER_LOCKED MDL=%x, Irp MDL=%x\n", PtrIrpContext->
PtrMdl,
Irp->MdlAddress));
1133 if (ReadCompletion) {
1134 MmPrint((
" CcMdlReadComplete() MDL=%x\n",
Irp->MdlAddress));
1138 MmPrint((
" CcMdlWriteComplete() MDL=%x\n",
Irp->MdlAddress));
1150 Irp->IoStatus.Status = RC;
1151 Irp->IoStatus.Information = 0;
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
VOID NTAPI CcMdlReadComplete(IN PFILE_OBJECT FileObject, IN PMDL MdlChain)
VOID NTAPI CcMdlWriteComplete(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PMDL MdlChain)
VOID NTAPI CcSetReadAheadGranularity(IN PFILE_OBJECT FileObject, IN ULONG Granularity)
VOID NTAPI CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, OUT OPTIONAL PIO_STATUS_BLOCK IoStatus)
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
VOID UDFCloseAllDelayed(IN PVCB Vcb)
#define NT_SUCCESS(StatCode)
_In_ PIO_STACK_LOCATION IrpSp
NTSTATUS UDFExceptionHandler(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
BOOLEAN __fastcall UDFIsIrpTopLevel(PIRP Irp)
VOID UDFLogEvent(NTSTATUS UDFEventLogId, NTSTATUS RC)
NTSTATUS UDFPostRequest(IN PtrUDFIrpContext PtrIrpContext, IN PIRP Irp)
PtrUDFIrpContext UDFAllocateIrpContext(PIRP Irp, PDEVICE_OBJECT PtrTargetDeviceObject)
VOID UDFReleaseIrpContext(PtrUDFIrpContext PtrIrpContext)
ULONG UDFIsResourceAcquired(IN PERESOURCE Resource)
BOOLEAN UDFAcquireResourceSharedWithCheck(IN PERESOURCE Resource)
long UDFExceptionFilter(PtrUDFIrpContext PtrIrpContext, PEXCEPTION_POINTERS PtrExceptionPointers)
#define CollectStatistics(VCB, Field)
__inline VOID UDFNotifyFullReportChange(PVCB V, PUDF_FILE_INFO FI, ULONG E, ULONG A)
#define CollectStatisticsEx(VCB, Field, a)
#define CollectStatistics2(VCB, Field)
#define UDFReleaseResource(Resource)
#define KeInitializeEvent(pEvt, foo, foo2)
#define UDFAcquireResourceShared(Resource, CanWait)
#define KeSetEvent(pEvt, foo, foo2)
#define DbgWaitForSingleObject(o, to)
#define UDFAcquireResourceExclusive(Resource, CanWait)
#define KeGetCurrentIrql()
#define UDFAcquireSharedWaitForExclusive(Resource, CanWait)
#define UDF_ERROR_INTERNAL_ERROR
FAST_IO_POSSIBLE NTAPI UDFIsFastIoPossible(IN PtrUDFFCB Fcb)
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT OUT PBCB OUT PVBO ByteOffset
BOOLEAN NTAPI FsRtlCheckLockForReadAccess(IN PFILE_LOCK FileLock, IN PIRP Irp)
ULONG UDFFlushLogicalVolume(IN PtrUDFIrpContext PtrIrpContext, IN PIRP Irp, IN PVCB Vcb, IN ULONG FlushFlags)
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
#define FSRTL_FSP_TOP_LEVEL_IRP
#define FSRTL_CACHE_TOP_LEVEL_IRP
#define FSRTL_MOD_WRITE_TOP_LEVEL_IRP
#define FSRTL_FAST_IO_TOP_LEVEL_IRP
VOID NTAPI CcInitializeCacheMap(IN PFILE_OBJECT FileObject, IN PCC_FILE_SIZES FileSizes, IN BOOLEAN PinAccess, IN PCACHE_MANAGER_CALLBACKS Callbacks, IN PVOID LazyWriteContext)
#define EXCEPTION_EXECUTE_HANDLER
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
#define FILE_USE_FILE_POINTER_POSITION
_In_ ULONG _In_ ULONG _In_ ULONG Length
__inline PVOID MmGetSystemAddressForMdlSafer(IN PMDL Mdl)
BOOLEAN NTAPI CcCopyRead(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus)
#define IoCompleteRequest
PIRP NTAPI IoGetTopLevelIrp(VOID)
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
#define STATUS_FILE_LOCK_CONFLICT
OSSTATUS UDFTRead(IN void *_Vcb, IN void *Buffer, IN SIZE_T Length, IN uint32 LBA, OUT PSIZE_T ReadBytes, IN uint32 Flags)
OSSTATUS UDFReadData(IN PVCB Vcb, IN BOOLEAN Translate, IN LONGLONG Offset, IN ULONG Length, IN BOOLEAN Direct, OUT PCHAR Buffer, OUT PSIZE_T ReadBytes)
#define UDFCloseAllSystemDelayedInDir(Vcb, FI)
#define _SEH2_AbnormalTermination()
#define _SEH2_EXCEPT(...)
#define _SEH2_GetExceptionInformation()
NTSTATUS NTAPI UDFRead(PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS UDFLockCallersBuffer(PtrUDFIrpContext PtrIrpContext, PIRP Irp, BOOLEAN IsReadOperation, uint32 Length)
VOID UDFMdlComplete(PtrUDFIrpContext PtrIrpContext, PIRP Irp, PIO_STACK_LOCATION IrpSp, BOOLEAN ReadCompletion)
NTSTATUS UDFPostStackOverflowRead(IN PtrUDFIrpContext PtrIrpContext, IN PIRP Irp, IN PtrUDFFCB Fcb)
#define OVERFLOW_READ_THRESHHOLD
PVOID UDFGetCallersBuffer(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
NTSTATUS UDFUnlockCallersBuffer(PtrUDFIrpContext PtrIrpContext, PIRP Irp, PVOID SystemBuffer)
NTSTATUS UDFCommonRead(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
VOID NTAPI UDFStackOverflowRead(IN PVOID Context, IN PKEVENT Event)
#define KeFlushIoBuffers(_Mdl, _ReadOperation, _DmaOperation)
#define STATUS_END_OF_FILE
VOID NTAPI FsRtlPostStackOverflow(IN PVOID Context, IN PKEVENT Event, IN PFSRTL_STACK_OVERFLOW_ROUTINE StackOverflowRoutine)
#define UDF_IRP_CONTEXT_BUFFER_LOCKED
#define UDF_IRP_CONTEXT_RES1_ACQ
#define UDF_IRP_CONTEXT_FLUSH2_REQUIRED
#define UDF_IRP_CONTEXT_FLUSH_REQUIRED
#define UDF_FCB_PAGE_FILE
#define UDF_IRP_CONTEXT_CAN_BLOCK
#define UDF_IRP_CONTEXT_FORCED_POST
struct _UDFIrpContext * PtrUDFIrpContext
struct _UDFContextControlBlock * PtrUDFCCB
#define UDF_NODE_TYPE_VCB
#define UDF_FCB_DIRECTORY
#define UDF_IRP_CONTEXT_RES2_ACQ
struct _FCB::@729::@732 Fcb
ERESOURCE PagingIoResource
struct _IO_STACK_LOCATION::@3974::@3979 Write
struct _IO_STACK_LOCATION::@3974::@3978 Read
union _IO_STACK_LOCATION::@1575 Parameters
#define UDF_VCB_FLAGS_VOLUME_MOUNTED
#define UDF_VCB_FLAGS_RAW_DISK
#define UDF_VCB_SKIP_EJECT_CHECK
#define UDFIsFileCached__(Vcb, FileInfo, Offset, Length, ForWrite)
__inline OSSTATUS UDFReadFile__(IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN int64 Offset, IN SIZE_T Length, IN BOOLEAN Direct, OUT int8 *Buffer, OUT PSIZE_T ReadBytes)
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_ACCESS_DENIED
#define STATUS_INVALID_PARAMETER
#define STATUS_INVALID_USER_BUFFER
#define STATUS_INSUFFICIENT_RESOURCES
#define UDF_CHECK_PAGING_IO_RESOURCE(NTReqFCB)
OSSTATUS WCacheEODirect__(IN PW_CACHE Cache, IN PVOID Context)
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
#define FILE_ACTION_MODIFIED_STREAM
#define FILE_ACTION_MODIFIED
#define FO_FILE_FAST_IO_READ
#define FILE_NOTIFY_CHANGE_LAST_ACCESS
#define IO_DISK_INCREMENT
#define FO_SYNCHRONOUS_IO
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)