Better handle of wrong arguments in IoRegisterDeviceInterface
Modified: trunk/reactos/ntoskrnl/io/deviface.c
_____
Modified: trunk/reactos/ntoskrnl/io/deviface.c
--- trunk/reactos/ntoskrnl/io/deviface.c 2005-05-05 15:38:32 UTC
(rev 15001)
+++ trunk/reactos/ntoskrnl/io/deviface.c 2005-05-05 15:39:09 UTC
(rev 15002)
@@ -585,6 +585,12 @@
ULONG i;
NTSTATUS Status;
+ if (!(PhysicalDeviceObject->Flags & DO_BUS_ENUMERATED_DEVICE))
+ {
+ DPRINT("PhysicalDeviceObject 0x%p is not a valid Pdo\n",
PhysicalDeviceObject);
+ return STATUS_INVALID_PARAMETER_1;
+ }
+
Status = RtlStringFromGUID(InterfaceClassGuid, &GuidString);
if (!NT_SUCCESS(Status))
{
@@ -606,6 +612,7 @@
ASSERT(PdoNameInfo->Name.Length);
/* Create base key name for this interface:
HKLM\SYSTEM\CurrentControlSet\DeviceClasses\{GUID}\##?#ACPI#PNP0501#1#{G
UID} */
+ ASSERT(PhysicalDeviceObject->DeviceObjectExtension->DeviceNode);
InstancePath =
&PhysicalDeviceObject->DeviceObjectExtension->DeviceNode->InstancePath;
BaseKeyName.Length = wcslen(BaseKeyString) * sizeof(WCHAR);
BaseKeyName.MaximumLength = BaseKeyName.Length