129{
143
144
145
147#ifdef UDF_DBG
149#endif
151
153#ifdef UDF_DBG
156#endif
157
158
159 TmPrint((
"UDFCommonCleanup\n"));
160
161
162
164
167
169
170
175
179
180#ifdef UDF_DBG
182 AdPrint((
" %s\n", CanWait ?
"Wt" :
"nw"));
184#endif
187
188
189
190
191
192
193
194
195
196
198
200 AdPrint((
"Cleaning up Volume\n"));
202
206
208 }
210
211
212
213
216
218 }
219
220
222 Vcb->VolumeLockFileObject =
NULL;
223 Vcb->VolumeLockPID = -1;
224 Vcb->VCBFlags &= ~UDF_VCB_FLAGS_VOLUME_LOCKED;
225 Vcb->Vpb->Flags &= ~VPB_LOCKED;
227 }
228
229 MmPrint((
" CcUninitializeCacheMap()\n"));
231
234
235
237 }
238
239
240
242
244 }
245
246#ifdef UDF_DBG
248 if(DirNdx) {
252 } else {
253 AdPrint((
"Cleaning up file: ??? \n"));
254 }
255 }
256#endif
258
259 if(
Fcb->FileInfo->ParentFile) {
262 } else {
264 }
265 AcquiredParentFCB =
TRUE;
266
270
274
276 }
278
279#ifndef UDF_READ_ONLY_BUILD
282
286
291 }
292 }
293#endif
294
296
301 }
302
304
305#ifndef UDF_READ_ONLY_BUILD
308
309
312
313
314
315
316 if((lc <= 1) &&
319 }
320
321
325 if(
Fcb->FileInfo->ParentFile) {
328 } else {
330 }
331 AcquiredParentFCB =
FALSE;
334
335
336
338
339#ifdef UDF_DELAYED_CLOSE
340
343#endif
344
347 if(
Fcb->FileInfo->ParentFile) {
350 } else {
352 }
353 AcquiredParentFCB =
TRUE;
357
358
359
360 if(lc <= 1) {
361
363
364
365 NtReqFcb->CommonFCBHeader.FileSize.QuadPart =
366 NtReqFcb->CommonFCBHeader.ValidDataLength.QuadPart = 0;
368
370 }
371 }
372#endif
373
374#ifdef UDF_DELAYED_CLOSE
375 if ((
Fcb->ReferenceCount == 1) &&
376
379 }
380#endif
381
382 NextFileInfo =
Fcb->FileInfo;
383
384#ifndef UDF_READ_ONLY_BUILD
385
388
389
393
394 Fcb->FCBFlags &= ~UDF_FCB_DELETE_ON_CLOSE;
395 goto DiscardDelete;
396 }
397 } else
398 if (lc <= 1) {
399
402
403
405 if(AcquiredPagingIo) {
407 }
408 }
409
414 }
415
418 AdPrint((
"Error flushing file !!!\n"));
419 }
420
422
423
424
425
426
427
428
429
430 if(NextFileInfo->
Dloc &&
433
436
437
439
440 }
441 goto NotifyDelete;
442
443 } else {
444
445
446
448
449 goto DiscardDelete_1;
450 }
451 } else {
452DiscardDelete_1:
453
454
456 ForcedCleanUp =
TRUE;
458 Fcb->FCBFlags &= ~UDF_FCB_DELETE_ON_CLOSE;
461 }
462NotifyDelete:
463
464
465 if(lc < 1) {
467 }
468
473 } else {
477 }
478 } else
480DiscardDelete:
484 0,
486 }
487#endif
488
490
492 }
493
494
495 if(lc > 1) {
496 ForcedCleanUp =
FALSE;
497 }
498
500 (
NtReqFcb->SectionObject.DataSectionObject) ) {
501 BOOLEAN LastNonCached = (!
Fcb->CachedOpenHandleCount &&
503
504
505
506
507
509 if( LastNonCached
510 ||
512 !ForcedCleanUp) ) {
513
514#ifndef UDF_READ_ONLY_BUILD
516
517 if( (OldFileSize =
NtReqFcb->CommonFCBHeader.ValidDataLength.QuadPart) <
519
520
521
522
523
525 }
526#endif
527 MmPrint((
" CcFlushCache()\n"));
532 }
533 }
534
535
536 if(ForcedCleanUp || LastNonCached) {
537 if(
NtReqFcb->SectionObject.DataSectionObject) {
538 MmPrint((
" CcPurgeCacheSection()\n"));
540 }
541
542
543 }
544
545 }
546
547#ifndef UDF_READ_ONLY_BUILD
548
552
553)) &&
558
564
570 }
571
578 }
579 }
581
584
586 } else
588 ASize =
589 NtReqFcb->CommonFCBHeader.AllocationSize.QuadPart;
591 }
592 }
593
599
600 }
601
610 }
611 }
612#endif
613
615 ForcedCleanUp) {
616
617 MmPrint((
" CcUninitializeCacheMap()\n"));
619 } else {
620 MmPrint((
" CcUninitializeCacheMap()\n"));
622 }
623
624
625
629
630 if(
Fcb->FileInfo->ParentFile) {
633 } else {
635 }
636 AcquiredParentFCB =
FALSE;
637
641 RC = RC2;
642
644
645
646
647
649
651
653
655
657
658 if(AcquiredFCB) {
661 }
662
663 if(AcquiredParentFCB) {
664 if(
Fcb->FileInfo->ParentFile) {
667 } else {
669 }
670 }
671
672 if(AcquiredVcb) {
675 }
676
678
679 Irp->IoStatus.Status = RC;
680 Irp->IoStatus.Information = 0;
682
684 }
685
687 return(RC);
688}
VOID UDFSetFileXTime(IN PUDF_FILE_INFO FileInfo, IN LONGLONG *CrtTime, IN LONGLONG *AccTime, IN LONGLONG *AttrTime, IN LONGLONG *ChgTime)
VOID UDFAttributesToUDF(IN PDIR_INDEX_ITEM FileDirNdx, IN tag *FileEntry, IN ULONG NTAttr)
ULONG UDFAttributesToNT(IN PDIR_INDEX_ITEM FileDirNdx, IN tag *FileEntry)
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
NTSTATUS UDFCloseFileInfoChain(IN PVCB Vcb, IN PUDF_FILE_INFO fi, IN ULONG TreeLength, IN BOOLEAN VcbAcquired)
PDIR_INDEX_HDR UDFGetDirIndexByFileInfo(IN PUDF_FILE_INFO FileInfo)
_In_ PIO_STACK_LOCATION IrpSp
BOOLEAN UDFAcquireResourceExclusiveWithCheck(IN PERESOURCE Resource)
VOID UDFReleaseIrpContext(PtrUDFIrpContext PtrIrpContext)
#define UDFNotifyVolumeEvent(FileObject, EventCode)
__inline VOID UDFNotifyFullReportChange(PVCB V, PUDF_FILE_INFO FI, ULONG E, ULONG A)
#define KeQuerySystemTime(t)
#define UDFInterlockedDecrement(addr)
FAST_IO_POSSIBLE NTAPI UDFIsFastIoPossible(IN PtrUDFFCB Fcb)
_In_ PLARGE_INTEGER NtTime
NTSTATUS UDFMarkStreamsForDeletion(IN PVCB Vcb, IN PtrUDFFCB Fcb, IN BOOLEAN ForDel)
NTSTATUS NTAPI FsRtlFastUnlockAll(IN PFILE_LOCK FileLock, IN PFILE_OBJECT FileObject, IN PEPROCESS Process, IN PVOID Context OPTIONAL)
VOID NTAPI CcSetFileSizes(IN PFILE_OBJECT FileObject, IN PCC_FILE_SIZES FileSizes)
BOOLEAN NTAPI CcUninitializeCacheMap(IN PFILE_OBJECT FileObject, IN OPTIONAL PLARGE_INTEGER TruncateSize, IN OPTIONAL PCACHE_UNINITIALIZE_EVENT UninitializeEvent)
BOOLEAN NTAPI CcPurgeCacheSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN UninitializeCacheMaps)
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
#define FILE_ATTRIBUTE_ARCHIVE
#define FSRTL_VOLUME_UNLOCK
VOID NTAPI FsRtlNotifyCleanup(IN PNOTIFY_SYNC NotifySync, IN PLIST_ENTRY NotifyList, IN PVOID FsContext)
VOID NTAPI FsRtlNotifyFullChangeDirectory(IN PNOTIFY_SYNC NotifySync, IN PLIST_ENTRY NotifyList, IN PVOID FsContext, IN PSTRING FullDirectoryName, IN BOOLEAN WatchTree, IN BOOLEAN IgnoreBuffer, IN ULONG CompletionFilter, IN PIRP NotifyIrp, IN PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback OPTIONAL, IN PSECURITY_SUBJECT_CONTEXT SubjectContext OPTIONAL)
VOID NTAPI IoRemoveShareAccess(IN PFILE_OBJECT FileObject, IN PSHARE_ACCESS ShareAccess)
PEPROCESS NTAPI IoGetRequestorProcess(IN PIRP Irp)
OSSTATUS UDFResetDeviceDriver(IN PVCB Vcb, IN PDEVICE_OBJECT TargetDeviceObject, IN BOOLEAN Unlock)
#define UDFRemoveFromSystemDelayedQueue(Fcb)
#define UDFRemoveFromDelayedQueue(Fcb)
#define _SEH2_AbnormalTermination()
#define STATUS_CANNOT_DELETE
#define UDF_CCB_CREATE_TIME_SET
#define UDF_CCB_ATTRIBUTES_SET
#define UDF_IRP_CONTEXT_CAN_BLOCK
struct _UDFContextControlBlock * PtrUDFCCB
#define UDF_CCB_ACCESS_TIME_SET
#define UDF_FCB_ROOT_DIRECTORY
#define UDF_NTREQ_FCB_DELETED
#define UDF_CCB_MODIFY_TIME_SET
#define UDF_NODE_TYPE_VCB
#define UDF_FCB_DELETE_ON_CLOSE
#define UDF_FCB_DIRECTORY
#define UDF_FCB_DELETE_PARENT
#define UDF_FCB_DELAY_CLOSE
#define UDF_CCB_WRITE_TIME_SET
#define UDF_CCB_DELETE_ON_CLOSE
PDEVICE_OBJECT TargetDeviceObject
struct _UDF_FILE_INFO * SDirInfo
#define UDF_VCB_IC_UPDATE_MODIFY_TIME
#define UDF_VCB_FLAGS_VOLUME_MOUNTED
#define UDF_VCB_IC_UPDATE_ATTR_TIME
#define UDF_VCB_FLAGS_VOLUME_READ_ONLY
#define UDF_VCB_IC_UPDATE_ARCH_BIT
#define UDF_VCB_IC_UPDATE_ACCESS_TIME
#define UDF_VCB_FLAGS_OUR_DEVICE_DRIVER
uint16 UDFGetFileLinkCount(IN PUDF_FILE_INFO FileInfo)
OSSTATUS UDFFlushFile__(IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN ULONG FlushFlags)
OSSTATUS UDFUnlinkFile__(IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN BOOLEAN FreeSpace)
void UDFSetFileSizeInDirNdx(IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN int64 *ASize)
OSSTATUS UDFResizeFile__(IN PVCB Vcb, IN OUT PUDF_FILE_INFO FileInfo, IN int64 NewLength)
OSSTATUS UDFPretendFileDeleted__(IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo)
#define UDFIsSDirDeleted(FI)
#define UDFGetFileAllocationSize(Vcb, FileInfo)
#define UDFIsDirEmpty__(fi)
__inline PDIR_INDEX_ITEM UDFDirIndex(IN PDIR_INDEX_HDR hDirNdx, IN uint_di i)
#define UDFIsAStreamDir(FI)
#define UDFIsADirectory(FileInfo)
#define STATUS_INVALID_PARAMETER
#define FILE_ACTION_MODIFIED_STREAM
#define FILE_ACTION_MODIFIED
#define FO_FILE_FAST_IO_READ
#define FILE_NOTIFY_CHANGE_STREAM_NAME
#define FILE_ACTION_REMOVED_STREAM
#define FILE_NOTIFY_CHANGE_LAST_ACCESS
#define FILE_NOTIFY_CHANGE_ATTRIBUTES
#define FILE_ACTION_REMOVED
#define FILE_NOTIFY_CHANGE_FILE_NAME
#define FO_CLEANUP_COMPLETE
#define FO_FILE_SIZE_CHANGED
#define FO_CACHE_SUPPORTED
#define FILE_NOTIFY_CHANGE_LAST_WRITE
#define FILE_NOTIFY_CHANGE_DIR_NAME
_In_opt_ PLARGE_INTEGER NewFileSize