VOID FspFileNodeDelete(FSP_FILE_NODE *FileNode) { PAGED_CODE(); FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(FileNode->FsvolDeviceObject); FsRtlUninitializeFileLock(&FileNode->FileLock); FsRtlTeardownPerStreamContexts(&FileNode->Header); FspMetaCacheInvalidateItem(FsvolDeviceExtension->DirInfoCache, FileNode->NonPaged->DirInfo); FspMetaCacheInvalidateItem(FsvolDeviceExtension->SecurityCache, FileNode->Security); FspDeviceDereference(FileNode->FsvolDeviceObject); if (0 != FileNode->ExternalFileName) FspFree(FileNode->ExternalFileName); ExDeleteResourceLite(&FileNode->NonPaged->PagingIoResource); ExDeleteResourceLite(&FileNode->NonPaged->Resource); FspFree(FileNode->NonPaged); FspFree(FileNode); }
VOID FspIopCompleteIrpEx(PIRP Irp, NTSTATUS Result, BOOLEAN DeviceDereference) { PAGED_CODE(); ASSERT(STATUS_PENDING != Result); ASSERT(0 == (FSP_STATUS_PRIVATE_BIT & Result)); if (0 != FspIrpRequest(Irp)) { FspIopDeleteRequest(FspIrpRequest(Irp)); FspIrpSetRequest(Irp, 0); } /* get the device object out of the IRP before completion */ PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp); PDEVICE_OBJECT DeviceObject = IrpSp->DeviceObject; /* * HACK: * * We update the Create statistics here to avoid doing it in multiple places. */ if (IRP_MJ_CREATE == IrpSp->MajorFunction) { /* only update statistics if we actually have a reference to the DeviceObject */ if (DeviceDereference) { FSP_DEVICE_EXTENSION *DeviceExtension = FspDeviceExtension(DeviceObject); if (FspFsvolDeviceExtensionKind == FspDeviceExtension(DeviceObject)->Kind) { FSP_STATISTICS *Statistics = FspStatistics( ((FSP_FSVOL_DEVICE_EXTENSION *)DeviceExtension)->Statistics); FspStatisticsInc(Statistics, Specific.CreateHits); if (STATUS_SUCCESS == Result) FspStatisticsInc(Statistics, Specific.SuccessfulCreates); else FspStatisticsInc(Statistics, Specific.FailedCreates); } } } if (STATUS_SUCCESS != Result && STATUS_REPARSE != Result && STATUS_OPLOCK_BREAK_IN_PROGRESS != Result && STATUS_BUFFER_OVERFLOW != Result && STATUS_SHARING_VIOLATION != Result) Irp->IoStatus.Information = 0; Irp->IoStatus.Status = Result; IoCompleteRequest(Irp, FSP_IO_INCREMENT); if (DeviceDereference) FspDeviceDereference(DeviceObject); }