20#define UDF_BUG_CHECK_ID UDF_FILE_CLOSE
23#define TREE_ITEM_LIST_GRAN 32
81 Irp->IoStatus.Status = RC;
82 Irp->IoStatus.Information = 0;
163 AdPrint((
"UDFCommonClose: \n"));
233#ifdef UDF_DELAYED_CLOSE
245 AdPrint((
" Cant queue Close Irp, status=%x\n", RC));
252 (
Fcb->NTRequiredFCB->AcqFlushCount)) {
253 AdPrint((
" post NOT_TOP_LEVEL Irp\n"));
270 AdPrint((
"UDF: Closing volume\n"));
271 AdPrint((
"UDF: ReferenceCount: %x\n",
Fcb->ReferenceCount));
308 AdPrint((
"UDF: Closing volume, reset write status\n"));
334 AdPrint((
"Closing file: ??? \n"));
337 AdPrint((
"UDF: ReferenceCount: %x\n",
Fcb->ReferenceCount));
381 Irp->IoStatus.Information = 0;
412 LONG RefCount, ComRefCount;
417 AdPrint((
"UDFCleanUpFcbChain\n"));
511#ifndef UDF_READ_ONLY_BUILD
533#ifndef UDF_READ_ONLY_BUILD
545 fi->Dloc->CommonFcb =
NULL;
563 if(
NtReqFcb->CommonFCBHeader.Resource) {
567 NtReqFcb->CommonFCBHeader.Resource =
647 for(;TreeLength && fi;TreeLength--) {
651 ASSERT(
Fcb->NTRequiredFCB->CommonRefCount);
676 AdPrint((
" UDFDoDelayedClose\n"));
697 AdPrint((
" UDFDelayedClose\n"));
762 AdPrint((
" UDFCloseAllDelayed\n"));
766 GlobalDataAcquired =
TRUE;
777 if (NextIrpContextLite->
Fcb->
Vcb ==
Vcb) {
792 if (NextIrpContextLite->
Fcb->
Vcb ==
Vcb) {
800 if(GlobalDataAcquired)
820 UDFPrint((
" UDFBuildTreeItemsList():\n"));
821 if(!(*PassedList) || !(*FoundList)) {
827 (*PassedListSize) = 0;
836 (*FoundListSize) = 0;
840 for(
i=0;
i<(*PassedListSize);
i++) {
853 (*PassedList)[(*PassedListSize)-1] =
FileInfo;
865 (*FoundList)[(*FoundListSize)-1] =
FileInfo;
869 if((SDirInfo =
FileInfo->Dloc->SDirInfo))
871 PassedList, PassedListSize, FoundList, FoundListSize);
874 if((hDirNdx =
FileInfo->Dloc->DirIndex)) {
886 PassedList, PassedListSize, FoundList, FoundListSize);
910 Fcb->ReferenceCount &&
911 Fcb->NTRequiredFCB->SectionObject.DataSectionObject) {
925 ULONG PassedListSize = 0;
927 ULONG FoundListSize = 0;
939 UDFPrint((
" UDFCloseAllXXXDelayedInDir(): Acquire DelayedCloseResource\n"));
949 &PassedList, &PassedListSize, &FoundList, &FoundListSize);
952 UDFPrint((
" UDFBuildTreeItemsList(): error %x\n", RC));
956 if(!FoundList || !FoundListSize) {
963 UDFPrint((
" Can't alloc ListPtrArray for %x items\n", FoundListSize));
967 for(
i=0;
i<FoundListSize;
i++) {
971 CurFileInfo = FoundList[
i];
975 UDFPrint((
" Can't alloc ListPtrEntry for items %x\n",
i));
978 CurFileInfo->
ListPtr->FileInfo = CurFileInfo;
979 CurFileInfo->
ListPtr->EntryRefCount = 0;
981 CurFileInfo->
ListPtr->EntryRefCount++;
982 ListPtrArray[
i] = CurFileInfo->
ListPtr;
1000 for(
i=FoundListSize;
i>0;
i--) {
1005 CurListPtr = ListPtrArray[
i-1];
1006 CurFileInfo = CurListPtr->
FileInfo;
1008 (
Fcb = CurFileInfo->
Fcb)) {
1014 MmPrint((
" CcFlushCache()\n"));
1017 if(
NtReqFcb->SectionObject.ImageSectionObject) {
1018 MmPrint((
" MmFlushImageSection()\n"));
1021 if(
NtReqFcb->SectionObject.DataSectionObject) {
1022 MmPrint((
" CcPurgeCacheSection()\n"));
1026 MmPrint((
" Skip item: deleted\n"));
1038 AcquiredVcb =
FALSE;
1041 Vcb->VCBFlags &= ~UDF_VCB_FLAGS_NO_DELAYED_CLOSE;
1046 for(
i=FoundListSize;
i>0;
i--) {
1051 CurListPtr = ListPtrArray[
i-1];
1052 CurFileInfo = CurListPtr->
FileInfo;
1056 (NextIrpContextLite = CurFileInfo->
Fcb->IrpContextLite)) {
1073 AcquiredVcb =
FALSE;
1116 AdPrint((
" UDFQueueDelayedClose\n"));
1129 if(
Fcb->IrpContextLite ||
1148 Fcb->IrpContextLite = IrpContextLite;
1185 Fcb->FCBFlags &= ~UDF_FCB_DELAY_CLOSE;
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define InterlockedIncrement
#define InterlockedDecrement
BOOL Delete(LPCTSTR ServiceName)
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
#define IOCTL_CDRW_RESET_WRITE_STATUS
VOID NTAPI UDFDelayedClose(PVOID unused)
NTSTATUS UDFCloseAllXXXDelayedInDir(IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN BOOLEAN System)
VOID UDFCloseAllDelayed(IN PVCB Vcb)
NTSTATUS NTAPI UDFClose(PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS UDFQueueDelayedClose(PtrUDFIrpContext IrpContext, PtrUDFFCB Fcb)
VOID UDFDoDelayedClose(IN PtrUDFIrpContextLite NextIrpContextLite)
ULONG UDFCleanUpFcbChain(IN PVCB Vcb, IN PUDF_FILE_INFO fi, IN ULONG TreeLength, IN BOOLEAN VcbAcquired)
BOOLEAN(* PCHECK_TREE_ITEM)(IN PUDF_FILE_INFO FileInfo)
NTSTATUS UDFCommonClose(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
NTSTATUS UDFBuildTreeItemsList(IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN PCHECK_TREE_ITEM CheckItemProc, IN PUDF_DATALOC_INFO **PassedList, IN PULONG PassedListSize, IN PUDF_DATALOC_INFO **FoundList, IN PULONG FoundListSize)
BOOLEAN UDFIsLastClose(PUDF_FILE_INFO FileInfo)
#define TREE_ITEM_LIST_GRAN
BOOLEAN UDFIsInDelayedCloseQueue(PUDF_FILE_INFO FileInfo)
PDIR_INDEX_HDR UDFGetDirIndexByFileInfo(IN PUDF_FILE_INFO FileInfo)
PDIR_INDEX_ITEM UDFDirIndexScan(PUDF_DIR_SCAN_CONTEXT Context, PUDF_FILE_INFO *_FileInfo)
BOOLEAN UDFDirIndexInitScan(IN PUDF_FILE_INFO DirInfo, OUT PUDF_DIR_SCAN_CONTEXT Context, IN uint_di Index)
#define NT_SUCCESS(StatCode)
_In_ PIO_STACK_LOCATION IrpSp
NTSTATUS UDFExceptionHandler(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
VOID __fastcall UDFCleanUpFCB(PtrUDFFCB Fcb)
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)
VOID __fastcall UDFCleanUpCCB(PtrUDFCCB Ccb)
VOID UDFInitializeIrpContextFromLite(OUT PtrUDFIrpContext *IrpContext, IN PtrUDFIrpContextLite IrpContextLite)
long UDFExceptionFilter(PtrUDFIrpContext PtrIrpContext, PEXCEPTION_POINTERS PtrExceptionPointers)
NTSTATUS UDFInitializeIrpContextLite(OUT PtrUDFIrpContextLite *IrpContextLite, IN PtrUDFIrpContext IrpContext, IN PtrUDFFCB Fcb)
NTSTATUS NTAPI UDFPhSendIOCTL(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN OverrideVerify, OUT PIO_STATUS_BLOCK Iosb OPTIONAL)
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define UDFReleaseResource(Resource)
#define IsListEmpty(ListHead)
#define ValidateFileInfo(fi)
#define UDFDeleteResource(Resource)
#define UDFAcquireResourceShared(Resource, CanWait)
#define UDFAcquireResourceExclusive(Resource, CanWait)
#define UDFInterlockedDecrement(addr)
#define UDFInterlockedIncrement(addr)
#define UDF_ERROR_INTERNAL_ERROR
VOID NTAPI FsRtlUninitializeFileLock(IN PFILE_LOCK FileLock)
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
BOOLEAN NTAPI CcPurgeCacheSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN UninitializeCacheMaps)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define EXCEPTION_EXECUTE_HANDLER
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
#define IoCompleteRequest
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
#define STATUS_DELETE_PENDING
VOID UDFDeassignAcl(IN PtrUDFNTRequiredFCB NtReqFcb, IN BOOLEAN AutoInherited)
#define UDF_CLOSE_NTREQFCB_DELETED
BOOLEAN UDFCheckForDismount(IN PtrUDFIrpContext IrpContext, IN PVCB Vcb, IN BOOLEAN VcbAcquired)
#define UDF_CLOSE_FCB_DELETED
#define _SEH2_AbnormalTermination()
#define _SEH2_EXCEPT(...)
#define _SEH2_GetExceptionInformation()
BOOLEAN NTAPI MmFlushImageSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN MMFLUSH_TYPE FlushType)
base of all file and directory entries
#define UDF_NODE_TYPE_NT_REQ_FCB
#define UDF_IRP_CONTEXT_NOT_TOP_LEVEL
#define UDF_CCB_READ_ONLY
#define UDF_FCB_POSTED_RENAME
struct _UDFContextControlBlock * PtrUDFCCB
#define UDF_RESIDUAL_REFERENCE
#define UDF_NTREQ_FCB_DELETED
#define UDF_NODE_TYPE_FCB
#define UDF_NTREQ_FCB_MODIFIED
#define UDF_NODE_TYPE_VCB
#define UDF_FCB_DELETE_ON_CLOSE
#define UDF_FCB_DIRECTORY
#define UDF_IRP_CONTEXT_READ_ONLY
#define UDF_FCB_DELETE_PARENT
#define UDF_FCB_DELAY_CLOSE
struct _FCB::@729::@732 Fcb
struct _UDFVolumeControlBlock * Vcb
struct _UDFIrpContextLite * IrpContextLite
LIST_ENTRY DelayedCloseLinks
_UDFFileControlBlock * Fcb
_UDFFileControlBlock * Fcb
PDEVICE_OBJECT TargetDeviceObject
struct _FE_LIST_ENTRY * ListPtr
struct _UDFFileControlBlock * Fcb
struct _UDF_FILE_INFO * ParentFile
#define CONTAINING_RECORD(address, type, field)
#define UDF_VCB_FLAGS_NO_DELAYED_CLOSE
#define UDF_VCB_FLAGS_VOLUME_MOUNTED
#define UDF_VCB_FLAGS_RAW_DISK
#define UDF_VCB_FLAGS_BEING_DISMOUNTED
OSSTATUS UDFCloseFile__(IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo)
OSSTATUS UDFFlushFile__(IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN ULONG FlushFlags)
uint32 UDFCleanUpFile__(IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo)
OSSTATUS UDFUnlinkFile__(IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN BOOLEAN FreeSpace)
#define UDFReferenceFile__(fi)
__inline PDIR_INDEX_ITEM UDFDirIndex(IN PDIR_INDEX_HDR hDirNdx, IN uint_di i)
#define UDFIsAStreamDir(FI)
struct _FE_LIST_ENTRY * PFE_LIST_ENTRY
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
#define UDF_CHECK_PAGING_IO_RESOURCE(NTReqFCB)
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
#define ExIsResourceAcquiredExclusive
#define IO_DISK_INCREMENT