From db6e84c404f7b7896d2eb3bd95d1c1ed1436bfbe Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 20 Jul 2002 11:44:37 +0000 Subject: [PATCH] Implemented FileAllInformation. svn path=/trunk/; revision=3268 --- reactos/drivers/fs/cdfs/finfo.c | 87 ++++++++++++++++++++++++++++++--- reactos/drivers/fs/vfat/finfo.c | 80 +++++++++++++++++++++++++++++- 2 files changed, 159 insertions(+), 8 deletions(-) diff --git a/reactos/drivers/fs/cdfs/finfo.c b/reactos/drivers/fs/cdfs/finfo.c index a71f8ed0799..11fa70a7543 100644 --- a/reactos/drivers/fs/cdfs/finfo.c +++ b/reactos/drivers/fs/cdfs/finfo.c @@ -16,11 +16,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: finfo.c,v 1.3 2002/07/20 00:57:15 ekohl Exp $ +/* $Id: finfo.c,v 1.4 2002/07/20 11:44:24 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: services/fs/cdfs/dirctl.c + * FILE: services/fs/cdfs/finfo.c * PURPOSE: CDROM (ISO 9660) filesystem driver * PROGRAMMER: Art Yerkes * Eric Kohl @@ -144,9 +144,9 @@ CdfsGetNameInformation(PFILE_OBJECT FileObject, return STATUS_BUFFER_OVERFLOW; NameInfo->FileNameLength = NameLength; - memcpy(NameInfo->FileName, - Fcb->PathName, - NameLength + sizeof(WCHAR)); + RtlCopyMemory(NameInfo->FileName, + Fcb->PathName, + NameLength + sizeof(WCHAR)); *BufferLength -= (sizeof(FILE_NAME_INFORMATION) + NameLength + sizeof(WCHAR)); @@ -176,6 +176,7 @@ CdfsGetInternalInformation(PFCB Fcb, return(STATUS_SUCCESS); } + static NTSTATUS CdfsGetNetworkOpenInformation(PFCB Fcb, PFILE_NETWORK_OPEN_INFORMATION NetworkInfo, @@ -209,6 +210,74 @@ CdfsGetNetworkOpenInformation(PFCB Fcb, } +static NTSTATUS +CdfsGetAllInformation(PFILE_OBJECT FileObject, + PFCB Fcb, + PFILE_ALL_INFORMATION Info, + PULONG BufferLength) +/* + * FUNCTION: Retrieve the all file information + */ +{ + ULONG NameLength; + + assert(Info); + assert(Fcb); + + NameLength = wcslen(Fcb->PathName) * sizeof(WCHAR); + if (*BufferLength < sizeof(FILE_ALL_INFORMATION) + NameLength) + return(STATUS_BUFFER_OVERFLOW); + + /* Basic Information */ + CdfsDateTimeToFileTime(Fcb, + &Info->BasicInformation.CreationTime); + CdfsDateTimeToFileTime(Fcb, + &Info->BasicInformation.LastAccessTime); + CdfsDateTimeToFileTime(Fcb, + &Info->BasicInformation.LastWriteTime); + CdfsDateTimeToFileTime(Fcb, + &Info->BasicInformation.ChangeTime); + CdfsFileFlagsToAttributes(Fcb, + &Info->BasicInformation.FileAttributes); + + /* Standard Information */ + Info->StandardInformation.AllocationSize = Fcb->RFCB.AllocationSize; + Info->StandardInformation.EndOfFile = Fcb->RFCB.FileSize; + Info->StandardInformation.NumberOfLinks = 0; + Info->StandardInformation.DeletePending = FALSE; + Info->StandardInformation.Directory = Fcb->Entry.FileFlags & 0x02 ? TRUE : FALSE; + + /* Internal Information */ + /* FIXME: get a real index, that can be used in a create operation */ + Info->InternalInformation.IndexNumber.QuadPart = 0; + + /* 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, + NameLength + sizeof(WCHAR)); + + *BufferLength -= (sizeof(FILE_ALL_INFORMATION) + NameLength + sizeof(WCHAR)); + + return STATUS_SUCCESS; +} + + NTSTATUS STDCALL CdfsQueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp) @@ -278,8 +347,14 @@ CdfsQueryInformation(PDEVICE_OBJECT DeviceObject, &BufferLength); break; - case FileAlternateNameInformation: case FileAllInformation: + Status = CdfsGetAllInformation(FileObject, + Fcb, + SystemBuffer, + &BufferLength); + break; + + case FileAlternateNameInformation: Status = STATUS_NOT_IMPLEMENTED; break; diff --git a/reactos/drivers/fs/vfat/finfo.c b/reactos/drivers/fs/vfat/finfo.c index b036c00435f..935d695464a 100644 --- a/reactos/drivers/fs/vfat/finfo.c +++ b/reactos/drivers/fs/vfat/finfo.c @@ -1,4 +1,4 @@ -/* $Id: finfo.c,v 1.13 2002/07/20 00:57:36 ekohl Exp $ +/* $Id: finfo.c,v 1.14 2002/07/20 11:44:37 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -274,6 +274,77 @@ VfatGetNetworkOpenInformation(PVFATFCB Fcb, } +static NTSTATUS +VfatGetAllInformation(PFILE_OBJECT FileObject, + PVFATFCB Fcb, + PFILE_ALL_INFORMATION Info, + PULONG BufferLength) +/* + * FUNCTION: Retrieve the all file information + */ +{ + ULONG NameLength; + + assert (Info); + assert (Fcb); + + NameLength = wcslen(Fcb->PathName) * sizeof(WCHAR); + if (*BufferLength < sizeof(FILE_ALL_INFORMATION) + NameLength) + return(STATUS_BUFFER_OVERFLOW); + + /* Basic Information */ + FsdDosDateTimeToFileTime(Fcb->entry.CreationDate, + Fcb->entry.CreationTime, + &Info->BasicInformation.CreationTime); + FsdDosDateTimeToFileTime(Fcb->entry.AccessDate, + 0, + &Info->BasicInformation.LastAccessTime); + FsdDosDateTimeToFileTime(Fcb->entry.UpdateDate, + Fcb->entry.UpdateTime, + &Info->BasicInformation.LastWriteTime); + FsdDosDateTimeToFileTime(Fcb->entry.UpdateDate, + Fcb->entry.UpdateTime, + &Info->BasicInformation.ChangeTime); + Info->BasicInformation.FileAttributes = Fcb->entry.Attrib; + + /* Standard Information */ + Info->StandardInformation.AllocationSize = Fcb->RFCB.AllocationSize; + Info->StandardInformation.EndOfFile = Fcb->RFCB.FileSize; + Info->StandardInformation.NumberOfLinks = 0; + Info->StandardInformation.DeletePending = Fcb->Flags & FCB_DELETE_PENDING ? TRUE : FALSE; + Info->StandardInformation.Directory = Fcb->entry.Attrib & 0x10 ? TRUE : FALSE; + + /* Internal Information */ + /* FIXME: get a real index, that can be used in a create operation */ + Info->InternalInformation.IndexNumber.QuadPart = 0; + + /* 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, + NameLength + sizeof(WCHAR)); + + *BufferLength -= (sizeof(FILE_ALL_INFORMATION) + NameLength + sizeof(WCHAR)); + + return STATUS_SUCCESS; +} + + NTSTATUS VfatQueryInformation(PVFAT_IRP_CONTEXT IrpContext) /* * FUNCTION: Retrieve the specified file information @@ -344,9 +415,14 @@ NTSTATUS VfatQueryInformation(PVFAT_IRP_CONTEXT IrpContext) SystemBuffer, &BufferLength); break; + case FileAllInformation: + RC = VfatGetAllInformation(IrpContext->FileObject, + FCB, + SystemBuffer, + &BufferLength); + break; case FileAlternateNameInformation: - case FileAllInformation: RC = STATUS_NOT_IMPLEMENTED; break; default: