[ros-diffs] [hpoussin] 15002: Better handle of wrong arguments in IoRegisterDeviceInterface

hpoussin at svn.reactos.com hpoussin at svn.reactos.com
Thu May 5 17:39:10 CEST 2005


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050505/08479730/attachment.html


More information about the Ros-diffs mailing list