Commit in reactos/ntoskrnl/io on MAIN
resource.c+15-101.15 -> 1.16
various bugfixes to IoQueryDeviceDescription and friends.  The floppy driver now loads and finds the drive properly.

reactos/ntoskrnl/io
resource.c 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- resource.c	30 May 2004 18:30:03 -0000	1.15
+++ resource.c	20 Jun 2004 04:50:02 -0000	1.16
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: resource.c,v 1.15 2004/05/30 18:30:03 navaraf Exp $
+/* $Id: resource.c,v 1.16 2004/06/20 04:50:02 vizzini Exp $
  *
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/io/resource.c
@@ -132,7 +132,7 @@
    UNICODE_STRING ControllerRootRegName = RootKey;
    UNICODE_STRING ControllerRegName;
    HANDLE ControllerKeyHandle;
-   PKEY_FULL_INFORMATION ControllerFullInformation;
+   PKEY_FULL_INFORMATION ControllerFullInformation = NULL;
    PKEY_VALUE_FULL_INFORMATION ControllerInformation[3] = {NULL, NULL, NULL};
    ULONG ControllerNumber;
    ULONG ControllerLoop;
@@ -252,7 +252,10 @@
             RtlInitUnicodeString(&ControllerString, Strings[ControllerLoop]);
 
             /* How much buffer space */
-            ZwQueryValueKey(ControllerKeyHandle, &ControllerString, KeyValueFullInformation, NULL, 0, &LenKeyFullInformation);
+            Status = ZwQueryValueKey(ControllerKeyHandle, &ControllerString, KeyValueFullInformation, NULL, 0, &LenKeyFullInformation);
+
+	    if(!NT_SUCCESS(Status) && Status != STATUS_BUFFER_TOO_SMALL && Status != STATUS_BUFFER_OVERFLOW)
+	      continue;
 
             /* Allocate it */
             ControllerInformation[ControllerLoop] = ExAllocatePoolWithTag(PagedPool, LenKeyFullInformation, TAG_IO_RESOURCE);
@@ -378,7 +381,10 @@
                RtlInitUnicodeString(&PeripheralString, Strings[PeripheralLoop]);
 
                /* How much buffer space */
-               ZwQueryValueKey(PeripheralKeyHandle, &PeripheralString, KeyValueFullInformation, NULL, 0, &LenKeyFullInformation);
+               Status = ZwQueryValueKey(PeripheralKeyHandle, &PeripheralString, KeyValueFullInformation, NULL, 0, &LenKeyFullInformation);
+
+	       if(!NT_SUCCESS(Status) && Status != STATUS_BUFFER_TOO_SMALL && Status != STATUS_BUFFER_OVERFLOW)
+		 continue;
 
                /* Allocate it */
                PeripheralInformation[PeripheralLoop] = ExAllocatePoolWithTag(PagedPool, LenKeyFullInformation, TAG_IO_RESOURCE);
@@ -394,7 +400,6 @@
             /* We now have everything the caller could possibly want */
             if (NT_SUCCESS(Status))
             {
-#if 0
                Status = Query->CalloutRoutine(
                   Query->Context,
                   &ControllerRootRegName,
@@ -407,9 +412,6 @@
                   *Query->PeripheralType,
                   PeripheralNumber,
                   PeripheralInformation);
-#else
-               Status = STATUS_SUCCESS;
-#endif
             }
 
             /* Free the allocated memory */
@@ -492,12 +494,15 @@
    /* How much buffer space */
    Status = ZwQueryKey(RootKeyHandle, KeyFullInformation, NULL, 0, &LenFullInformation);
 
-   if (!NT_SUCCESS(Status))
+   if (!NT_SUCCESS(Status) && Status != STATUS_BUFFER_TOO_SMALL && Status != STATUS_BUFFER_OVERFLOW)
       return Status;
 
    /* Allocate it */
    FullInformation = ExAllocatePoolWithTag(PagedPool, LenFullInformation, TAG_IO_RESOURCE);
 
+   if(!FullInformation)
+     return STATUS_NO_MEMORY;
+
    /* Get the Information */
    Status = ZwQueryKey(RootKeyHandle, KeyFullInformation, FullInformation, LenFullInformation, &LenFullInformation);
 
@@ -764,7 +769,7 @@
    OBJECT_ATTRIBUTES ObjectAttributes;
    UNICODE_STRING RootRegKey;
    HANDLE RootRegHandle;
-   WCHAR RootRegString[] = L"\\REGISTRY\\MACHINE\\HARDWARE\\DESCRIPTION\\SYSTEM\\";
+   WCHAR RootRegString[] = L"\\REGISTRY\\MACHINE\\HARDWARE\\DESCRIPTION\\SYSTEM";
    IO_QUERY Query;
 
    /* Set up the String */
CVSspam 0.2.8