/* * FUNCTION: Retrieve the basic file information */ static NTSTATUS CdfsGetBasicInformation(PFILE_OBJECT FileObject, PFCB Fcb, PDEVICE_OBJECT DeviceObject, PFILE_BASIC_INFORMATION BasicInfo, PULONG BufferLength) { DPRINT("CdfsGetBasicInformation() called\n"); UNREFERENCED_PARAMETER(FileObject); UNREFERENCED_PARAMETER(DeviceObject); if (*BufferLength < sizeof(FILE_BASIC_INFORMATION)) return STATUS_BUFFER_OVERFLOW; CdfsDateTimeToSystemTime(Fcb, &BasicInfo->CreationTime); CdfsDateTimeToSystemTime(Fcb, &BasicInfo->LastAccessTime); CdfsDateTimeToSystemTime(Fcb, &BasicInfo->LastWriteTime); CdfsDateTimeToSystemTime(Fcb, &BasicInfo->ChangeTime); CdfsFileFlagsToAttributes(Fcb, &BasicInfo->FileAttributes); *BufferLength -= sizeof(FILE_BASIC_INFORMATION); return(STATUS_SUCCESS); }
static NTSTATUS CdfsGetBothDirectoryInformation(PFCB Fcb, PDEVICE_EXTENSION DeviceExt, PFILE_BOTH_DIR_INFORMATION Info, ULONG BufferLength) { ULONG Length; DPRINT("CdfsGetBothDirectoryInformation() called\n"); UNREFERENCED_PARAMETER(DeviceExt); Length = wcslen(Fcb->ObjectName) * sizeof(WCHAR); if ((sizeof (FILE_BOTH_DIR_INFORMATION) + Length) > BufferLength) return(STATUS_BUFFER_OVERFLOW); Info->FileNameLength = Length; Info->NextEntryOffset = ROUND_UP(sizeof(FILE_BOTH_DIR_INFORMATION) + Length, sizeof(ULONG)); RtlCopyMemory(Info->FileName, Fcb->ObjectName, Length); /* Convert file times */ CdfsDateTimeToSystemTime(Fcb, &Info->CreationTime); Info->LastWriteTime = Info->CreationTime; Info->ChangeTime = Info->CreationTime; /* Convert file flags */ CdfsFileFlagsToAttributes(Fcb, &Info->FileAttributes); if (CdfsFCBIsDirectory(Fcb)) { Info->EndOfFile.QuadPart = 0; Info->AllocationSize.QuadPart = 0; } else { Info->EndOfFile.QuadPart = Fcb->Entry.DataLengthL; /* Make AllocSize a rounded up multiple of the sector size */ Info->AllocationSize.QuadPart = ROUND_UP(Fcb->Entry.DataLengthL, BLOCKSIZE); } // Info->FileIndex=; Info->EaSize = 0; /* Copy short name */ ASSERT(Fcb->ShortNameU.Length / sizeof(WCHAR) <= 12); Info->ShortNameLength = (CCHAR)Fcb->ShortNameU.Length; RtlCopyMemory(Info->ShortName, Fcb->ShortNameU.Buffer, Fcb->ShortNameU.Length); return(STATUS_SUCCESS); }
/* * FUNCTION: Retrieve the file network open information */ static NTSTATUS CdfsGetNetworkOpenInformation(PFCB Fcb, PFILE_NETWORK_OPEN_INFORMATION NetworkInfo, PULONG BufferLength) { ASSERT(NetworkInfo); ASSERT(Fcb); if (*BufferLength < sizeof(FILE_NETWORK_OPEN_INFORMATION)) return(STATUS_BUFFER_OVERFLOW); CdfsDateTimeToSystemTime(Fcb, &NetworkInfo->CreationTime); CdfsDateTimeToSystemTime(Fcb, &NetworkInfo->LastAccessTime); CdfsDateTimeToSystemTime(Fcb, &NetworkInfo->LastWriteTime); CdfsDateTimeToSystemTime(Fcb, &NetworkInfo->ChangeTime); if (CdfsFCBIsDirectory(Fcb)) { NetworkInfo->AllocationSize.QuadPart = 0LL; NetworkInfo->EndOfFile.QuadPart = 0LL; } else { NetworkInfo->AllocationSize = Fcb->RFCB.AllocationSize; NetworkInfo->EndOfFile = Fcb->RFCB.FileSize; } CdfsFileFlagsToAttributes(Fcb, &NetworkInfo->FileAttributes); *BufferLength -= sizeof(FILE_NETWORK_OPEN_INFORMATION); return(STATUS_SUCCESS); }
/* * FUNCTION: Retrieve all file information */ static NTSTATUS CdfsGetAllInformation(PFILE_OBJECT FileObject, PFCB Fcb, PFILE_ALL_INFORMATION Info, PULONG BufferLength) { ULONG NameLength; ASSERT(Info); ASSERT(Fcb); NameLength = Fcb->PathName.Length; if (*BufferLength < sizeof(FILE_ALL_INFORMATION) + NameLength) return(STATUS_BUFFER_OVERFLOW); /* Basic Information */ CdfsDateTimeToSystemTime(Fcb, &Info->BasicInformation.CreationTime); CdfsDateTimeToSystemTime(Fcb, &Info->BasicInformation.LastAccessTime); CdfsDateTimeToSystemTime(Fcb, &Info->BasicInformation.LastWriteTime); CdfsDateTimeToSystemTime(Fcb, &Info->BasicInformation.ChangeTime); CdfsFileFlagsToAttributes(Fcb, &Info->BasicInformation.FileAttributes); /* Standard Information */ if (CdfsFCBIsDirectory(Fcb)) { Info->StandardInformation.AllocationSize.QuadPart = 0LL; Info->StandardInformation.EndOfFile.QuadPart = 0LL; Info->StandardInformation.Directory = TRUE; } else { Info->StandardInformation.AllocationSize = Fcb->RFCB.AllocationSize; Info->StandardInformation.EndOfFile = Fcb->RFCB.FileSize; Info->StandardInformation.Directory = FALSE; } Info->StandardInformation.NumberOfLinks = 0; Info->StandardInformation.DeletePending = FALSE; /* Internal Information */ Info->InternalInformation.IndexNumber.QuadPart = Fcb->IndexNumber.QuadPart; /* EA Information */ Info->EaInformation.EaSize = 0; /* Access Information */ /* The IO-Manager adds this information */ /* Position Information */ Info->PositionInformation.CurrentByteOffset.QuadPart = FileObject->CurrentByteOffset.QuadPart; /* Mode Information */ /* The IO-Manager adds this information */ /* Alignment Information */ /* The IO-Manager adds this information */ /* Name Information */ Info->NameInformation.FileNameLength = NameLength; RtlCopyMemory(Info->NameInformation.FileName, Fcb->PathName.Buffer, NameLength + sizeof(WCHAR)); *BufferLength -= (sizeof(FILE_ALL_INFORMATION) + NameLength + sizeof(WCHAR)); return STATUS_SUCCESS; }