[ros-diffs] [hpoussin] 20103: Fix the case when IRP_MN_QUERY_DEVICE_TEXT returns nothing

hpoussin at svn.reactos.com hpoussin at svn.reactos.com
Mon Dec 12 17:44:14 CET 2005


Fix the case when IRP_MN_QUERY_DEVICE_TEXT returns nothing
Set DN_DRIVER_LOADED and DN_STARTED flags
Modified: trunk/reactos/ntoskrnl/io/device.c
Modified: trunk/reactos/ntoskrnl/io/pnpmgr.c
Modified: trunk/reactos/ntoskrnl/io/pnproot.c
  _____  

Modified: trunk/reactos/ntoskrnl/io/device.c
--- trunk/reactos/ntoskrnl/io/device.c	2005-12-12 09:06:40 UTC (rev
20102)
+++ trunk/reactos/ntoskrnl/io/device.c	2005-12-12 16:44:09 UTC (rev
20103)
@@ -163,7 +163,10 @@

    }
 
    ObDereferenceObject(Fdo);
-   
+
+   if (NT_SUCCESS(Status))
+       DeviceNode->Flags |= DN_STARTED;
+
    return Status;
 }
 
  _____  

Modified: trunk/reactos/ntoskrnl/io/pnpmgr.c
--- trunk/reactos/ntoskrnl/io/pnpmgr.c	2005-12-12 09:06:40 UTC (rev
20102)
+++ trunk/reactos/ntoskrnl/io/pnpmgr.c	2005-12-12 16:44:09 UTC (rev
20103)
@@ -1753,7 +1753,7 @@

    RtlInitUnicodeString(&ValueName, L"DeviceDesc");
    if (ZwQueryValueKey(InstanceKey, &ValueName,
KeyValueBasicInformation, NULL, 0, &RequiredLength) ==
STATUS_OBJECT_NAME_NOT_FOUND)
    {
-      if (NT_SUCCESS(IoStatusBlock.Status) &&
+      if (NT_SUCCESS(Status) &&
          IoStatusBlock.Information &&
          (*(PWSTR)IoStatusBlock.Information != 0))
       {
@@ -1768,16 +1768,15 @@
       }
       else
       {
-         UNICODE_STRING DeviceDesc;
-         RtlInitUnicodeString(&DeviceDesc, L"Unknown Device");
-         DPRINT("Driver didn't return DeviceDesc (Status %x), so place
unknown device there\n", Status);
+         UNICODE_STRING DeviceDesc = RTL_CONSTANT_STRING(L"Unknown
device");
+         DPRINT("Driver didn't return DeviceDesc (Status 0x%08lx), so
place unknown device there\n", Status);
 
          Status = ZwSetValueKey(InstanceKey,
             &ValueName,
             0,
             REG_SZ,
-            &DeviceDesc,
-            (wcslen((PWSTR)&DeviceDesc) + 1) * sizeof(WCHAR));
+            DeviceDesc.Buffer,
+            DeviceDesc.MaximumLength);
 
          if (!NT_SUCCESS(Status))
          {
@@ -2014,6 +2013,7 @@
              * device is started */
             DPRINT("%wZ is using NULL driver\n",
&DeviceNode->InstancePath);
             IopDeviceNodeSetFlag(DeviceNode, DNF_STARTED);
+            DeviceNode->Flags |= DN_STARTED;
          }
          return STATUS_SUCCESS;
       }
@@ -2095,8 +2095,11 @@
       if (NT_SUCCESS(Status) || Status == STATUS_IMAGE_ALREADY_LOADED)
       {
          if (Status != STATUS_IMAGE_ALREADY_LOADED)
+         {
+            DeviceNode->Flags |= DN_DRIVER_LOADED;
             Status = IopInitializeDriverModule(DeviceNode,
ModuleObject,
                &DeviceNode->ServiceName, FALSE, &DriverObject);
+         }
          else
          {
             /* get existing DriverObject pointer */
  _____  

Modified: trunk/reactos/ntoskrnl/io/pnproot.c
--- trunk/reactos/ntoskrnl/io/pnproot.c	2005-12-12 09:06:40 UTC (rev
20102)
+++ trunk/reactos/ntoskrnl/io/pnproot.c	2005-12-12 16:44:09 UTC (rev
20103)
@@ -579,7 +579,7 @@

 
   if (!NT_SUCCESS(Status))
   {
-    /* FIXME: */
+    Device->DeviceDescription.Buffer = NULL;
   }
 
   DPRINT("Got device description: %S\n", DeviceDesc->Buffer);
@@ -1184,8 +1184,8 @@
 {
   DPRINT("Called\n");
 
-  DriverObject->MajorFunction[IRP_MJ_PNP] = (PDRIVER_DISPATCH)
PnpRootPnpControl;
-  DriverObject->MajorFunction[IRP_MJ_POWER] = (PDRIVER_DISPATCH)
PnpRootPowerControl;
+  DriverObject->MajorFunction[IRP_MJ_PNP] = PnpRootPnpControl;
+  DriverObject->MajorFunction[IRP_MJ_POWER] = PnpRootPowerControl;
   DriverObject->DriverExtension->AddDevice = PnpRootAddDevice;
 
   return STATUS_SUCCESS;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20051212/2136f014/attachment.html


More information about the Ros-diffs mailing list