Author: ekohl Date: Sat Nov 14 20:41:59 2015 New Revision: 69891
URL: http://svn.reactos.org/svn/reactos?rev=69891&view=rev Log: [FASTFAT] VfatGetAllInformation: Return as much information as possible, but do not fail if the name string does not fit into the buffer.
Modified: trunk/reactos/drivers/filesystems/fastfat/finfo.c
Modified: trunk/reactos/drivers/filesystems/fastfat/finfo.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat... ============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/finfo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/finfo.c [iso-8859-1] Sat Nov 14 20:41:59 2015 @@ -340,6 +340,7 @@
if (*FCB->Attributes & FILE_ATTRIBUTE_READONLY) { +DPRINT1("\n"); return STATUS_CANNOT_DELETE; }
@@ -347,16 +348,19 @@ (FCB->LongNameU.Length == sizeof(WCHAR) && FCB->LongNameU.Buffer[0] == L'.') || (FCB->LongNameU.Length == 2 * sizeof(WCHAR) && FCB->LongNameU.Buffer[0] == L'.' && FCB->LongNameU.Buffer[1] == L'.')) { - // we cannot delete a '.', '..' or the root directory - return STATUS_ACCESS_DENIED; - } - + /* we cannot delete a '.', '..' or the root directory */ + +DPRINT1("\n"); + return STATUS_CANNOT_DELETE; +// return STATUS_ACCESS_DENIED; + }
if (!MmFlushImageSection (FileObject->SectionObjectPointer, MmFlushForDelete)) { /* can't delete a file if its mapped into a process */
DPRINT("MmFlushImageSection returned FALSE\n"); +DPRINT1("\n"); return STATUS_CANNOT_DELETE; }
@@ -364,6 +368,7 @@ { /* can't delete a non-empty directory */
+DPRINT1("\n"); return STATUS_DIRECTORY_NOT_EMPTY; }
@@ -1076,8 +1081,8 @@ ASSERT(Info); ASSERT(Fcb);
- if (*BufferLength < sizeof(FILE_ALL_INFORMATION) + Fcb->PathNameU.Length + sizeof(WCHAR)) - return(STATUS_BUFFER_OVERFLOW); + if (*BufferLength < sizeof(FILE_ALL_INFORMATION)) + return STATUS_BUFFER_OVERFLOW;
/* Basic Information */ Status = VfatGetBasicInformation(FileObject, Fcb, DeviceObject, &Info->BasicInformation, BufferLength); @@ -1098,11 +1103,12 @@ /* Alignment Information: The IO-Manager adds this information */ /* Name Information */ Status = VfatGetNameInformation(FileObject, Fcb, DeviceObject, &Info->NameInformation, BufferLength); - if (!NT_SUCCESS(Status)) return Status; - - *BufferLength = InitialBufferLength - (sizeof(FILE_ALL_INFORMATION) + Fcb->PathNameU.Length + sizeof(WCHAR)); - - return STATUS_SUCCESS; + + *BufferLength = InitialBufferLength - sizeof(FILE_ALL_INFORMATION); + if (InitialBufferLength > sizeof(FILE_ALL_INFORMATION)) + *BufferLength -= min(InitialBufferLength - sizeof(FILE_ALL_INFORMATION), Fcb->PathNameU.Length); + + return Status; }
static