https://git.reactos.org/?p=reactos.git;a=commitdiff;h=769157f6ff016be3ea0e3086a61d946262be8f7d

commit 769157f6ff016be3ea0e3086a61d946262be8f7d
Author:     Pierre Schweitzer <[email protected]>
AuthorDate: Wed Oct 3 13:52:05 2018 +0200
Commit:     Pierre Schweitzer <[email protected]>
CommitDate: Wed Oct 3 13:52:05 2018 +0200

    [NTOSKRNL] Allow FileNameInformation not to be implemented in storage stack
---
 ntoskrnl/io/iomgr/file.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/ntoskrnl/io/iomgr/file.c b/ntoskrnl/io/iomgr/file.c
index 0fbac2cc91..1112686225 100644
--- a/ntoskrnl/io/iomgr/file.c
+++ b/ntoskrnl/io/iomgr/file.c
@@ -1981,9 +1981,26 @@ IopQueryNameInternal(IN PVOID ObjectBody,
     }
     if (NT_ERROR(Status))
     {
-        /* Fail on errors only, allow warnings */
-        ExFreePoolWithTag(LocalInfo, TAG_IO);
-        return Status;
+        /* Allow status that would mean it's not implemented in the storage 
stack */
+        if (Status != STATUS_INVALID_PARAMETER && Status != 
STATUS_INVALID_DEVICE_REQUEST &&
+            Status != STATUS_NOT_IMPLEMENTED && Status != 
STATUS_INVALID_INFO_CLASS)
+        {
+            ExFreePoolWithTag(LocalInfo, TAG_IO);
+            return Status;
+        }
+
+        /* In such case, zero output */
+        LocalReturnLength = FIELD_OFFSET(FILE_NAME_INFORMATION, FileName);
+        LocalFileInfo->FileNameLength = 0;
+        LocalFileInfo->FileName[0] = OBJ_NAME_PATH_SEPARATOR;
+    }
+    else
+    {
+        /* We'll at least return the name length */
+        if (LocalReturnLength < FIELD_OFFSET(FILE_NAME_INFORMATION, FileName))
+        {
+            LocalReturnLength = FIELD_OFFSET(FILE_NAME_INFORMATION, FileName);
+        }
     }
 
     /* If the provided buffer is too small, return the required size */

Reply via email to