various bugfixes to IoQueryDeviceDescription and friends. The floppy driver now loads and finds the drive properly.

svn path=/trunk/; revision=9741
This commit is contained in:
Vizzini 2004-06-20 04:50:02 +00:00
parent 0064a17a7c
commit aeb397b5ab

View file

@ -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 @@ IopQueryDeviceDescription(
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 @@ IopQueryDeviceDescription(
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 @@ IopQueryDeviceDescription(
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 @@ IopQueryDeviceDescription(
/* 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 @@ IopQueryDeviceDescription(
*Query->PeripheralType,
PeripheralNumber,
PeripheralInformation);
#else
Status = STATUS_SUCCESS;
#endif
}
/* Free the allocated memory */
@ -492,12 +494,15 @@ IopQueryBusDescription(
/* 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 @@ IoQueryDeviceDescription(PINTERFACE_TYPE BusType,
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 */