Author: ekohl
Date: Sun Jan 2 19:37:08 2011
New Revision: 50264
URL:
http://svn.reactos.org/svn/reactos?rev=50264&view=rev
Log:
[NPFS]
- Add support for FileFullDirectoryInformation and FileBothDirectoryInformation.
- Fix an off-by-one bug in the buffer size calculation.
- Zero-initialize the return buffer.
Modified:
trunk/reactos/drivers/filesystems/npfs/dirctl.c
Modified: trunk/reactos/drivers/filesystems/npfs/dirctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs/d…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs/dirctl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs/dirctl.c [iso-8859-1] Sun Jan 2 19:37:08 2011
@@ -35,6 +35,8 @@
NTSTATUS Status = STATUS_SUCCESS;
PFILE_NAMES_INFORMATION NamesBuffer;
PFILE_DIRECTORY_INFORMATION DirectoryBuffer;
+ PFILE_FULL_DIR_INFORMATION FullDirBuffer;
+ PFILE_BOTH_DIR_INFORMATION BothDirBuffer;
Stack = IoGetCurrentIrpStackLocation(Irp);
@@ -132,6 +134,8 @@
if (PipeIndex >= FileIndex)
{
+ RtlZeroMemory(Buffer, BufferLength);
+
switch (FileInformationClass)
{
case FileDirectoryInformation:
@@ -145,7 +149,37 @@
RtlCopyMemory(DirectoryBuffer->FileName,
PipeFcb->PipeName.Buffer,
PipeFcb->PipeName.Length);
- *Size = sizeof(FILE_DIRECTORY_INFORMATION) +
PipeFcb->PipeName.Length - 1;
+ *Size = sizeof(FILE_DIRECTORY_INFORMATION) +
PipeFcb->PipeName.Length - sizeof(WCHAR);
+ Status = STATUS_SUCCESS;
+ break;
+
+ case FileFullDirectoryInformation:
+ FullDirBuffer = (PFILE_FULL_DIR_INFORMATION)Buffer;
+ FullDirBuffer->NextEntryOffset = 0;
+ FullDirBuffer->FileIndex = PipeIndex;
+ FullDirBuffer->FileAttributes = FILE_ATTRIBUTE_NORMAL;
+ FullDirBuffer->EndOfFile.QuadPart =
PipeFcb->CurrentInstances;
+ FullDirBuffer->AllocationSize.LowPart =
PipeFcb->MaximumInstances;
+ FullDirBuffer->FileNameLength = PipeFcb->PipeName.Length;
+ RtlCopyMemory(FullDirBuffer->FileName,
+ PipeFcb->PipeName.Buffer,
+ PipeFcb->PipeName.Length);
+ *Size = sizeof(FILE_FULL_DIR_INFORMATION) +
PipeFcb->PipeName.Length - sizeof(WCHAR);
+ Status = STATUS_SUCCESS;
+ break;
+
+ case FileBothDirectoryInformation:
+ BothDirBuffer = (PFILE_BOTH_DIR_INFORMATION)Buffer;
+ BothDirBuffer->NextEntryOffset = 0;
+ BothDirBuffer->FileIndex = PipeIndex;
+ BothDirBuffer->FileAttributes = FILE_ATTRIBUTE_NORMAL;
+ BothDirBuffer->EndOfFile.QuadPart =
PipeFcb->CurrentInstances;
+ BothDirBuffer->AllocationSize.LowPart =
PipeFcb->MaximumInstances;
+ BothDirBuffer->FileNameLength = PipeFcb->PipeName.Length;
+ RtlCopyMemory(BothDirBuffer->FileName,
+ PipeFcb->PipeName.Buffer,
+ PipeFcb->PipeName.Length);
+ *Size = sizeof(FILE_BOTH_DIR_INFORMATION) +
PipeFcb->PipeName.Length - sizeof(WCHAR);
Status = STATUS_SUCCESS;
break;
@@ -157,7 +191,7 @@
RtlCopyMemory(NamesBuffer->FileName,
PipeFcb->PipeName.Buffer,
PipeFcb->PipeName.Length);
- *Size = sizeof(FILE_NAMES_INFORMATION) +
PipeFcb->PipeName.Length - 1;
+ *Size = sizeof(FILE_NAMES_INFORMATION) +
PipeFcb->PipeName.Length - sizeof(WCHAR);
Status = STATUS_SUCCESS;
break;