Don't always return STATUS_BUFFER_TOO_SMALL when an error occurs in ZwQueryValueKey.
authorHervé Poussineau <hpoussin@reactos.org>
Fri, 14 Oct 2005 13:04:11 +0000 (13:04 +0000)
committerHervé Poussineau <hpoussin@reactos.org>
Fri, 14 Oct 2005 13:04:11 +0000 (13:04 +0000)
The "if" was triggered because ValueInformation->DataLength is 0xcdcdcdcd at the return of the function

svn path=/trunk/; revision=18442

reactos/ntoskrnl/io/pnpmgr.c

index bc30f00..5eaf416 100644 (file)
@@ -322,15 +322,18 @@ IoGetDeviceProperty(
         *ResultLength = ValueInformation->DataLength;
         ZwClose(KeyHandle);
 
-        if (ValueInformation->DataLength > BufferLength)
-          Status = STATUS_BUFFER_TOO_SMALL;
-
         if (!NT_SUCCESS(Status))
         {
           ExFreePool(ValueInformation);
           return Status;
         }
 
+        if (ValueInformation->DataLength > BufferLength)
+        {
+          ExFreePool(ValueInformation);
+          return STATUS_BUFFER_TOO_SMALL;
+        }
+
         /* FIXME: Verify the value (NULL-terminated, correct format). */
 
         RtlCopyMemory(PropertyBuffer, ValueInformation->Data,