Herv, Poussineau <poussine@freesurf.fr>
Fill DriverName field in DRIVER_OBJECT structure.
Modified: trunk/reactos/ntoskrnl/io/create.c
Modified: trunk/reactos/ntoskrnl/io/driver.c

Modified: trunk/reactos/ntoskrnl/io/create.c
--- trunk/reactos/ntoskrnl/io/create.c	2005-01-12 10:23:25 UTC (rev 12952)
+++ trunk/reactos/ntoskrnl/io/create.c	2005-01-12 10:24:56 UTC (rev 12953)
@@ -86,8 +86,10 @@
   if (ParentObjectType != IoDeviceObjectType &&
       ParentObjectType != IoFileObjectType)
     {
-      CPRINT("Parent is a %S which is neither a file type nor a device type\n",
-	     BODY_TO_HEADER(Parent)->ObjectType->TypeName.Buffer);
+      DPRINT("Parent [%wZ] is a %S which is neither a file type nor a device type ; remaining path = %S\n",
+        &BODY_TO_HEADER(Parent)->Name,
+        BODY_TO_HEADER(Parent)->ObjectType->TypeName.Buffer,
+        RemainingPath);
       return(STATUS_UNSUCCESSFUL);
     }
 

Modified: trunk/reactos/ntoskrnl/io/driver.c
--- trunk/reactos/ntoskrnl/io/driver.c	2005-01-12 10:23:25 UTC (rev 12952)
+++ trunk/reactos/ntoskrnl/io/driver.c	2005-01-12 10:24:56 UTC (rev 12953)
@@ -181,6 +181,7 @@
    DPRINT("IopDeleteDriver(ObjectBody %x)\n", ObjectBody);
 
    ExFreePool(Object->DriverExtension);
+   RtlFreeUnicodeString(&Object->DriverName);
 
    OldIrql = KeRaiseIrqlToDpcLevel();
 
@@ -208,6 +209,7 @@
    UNICODE_STRING DriverName;
    OBJECT_ATTRIBUTES ObjectAttributes;
    NTSTATUS Status;
+   PWSTR Buffer = NULL;
 
    DPRINT("IopCreateDriverObject(%p '%wZ' %x %p %x)\n",
       DriverObject, ServiceName, FileSystem, DriverImageStart, DriverImageSize);
@@ -225,6 +227,10 @@
 
       RtlInitUnicodeString(&DriverName, NameBuffer);
       DPRINT("Driver name: '%wZ'\n", &DriverName);
+      
+      Buffer = (PWSTR)ExAllocatePool(NonPagedPool, DriverName.Length);
+      /* If we don't success, it is not a problem. Our driver
+       * object will not have associated driver name... */
    }
    else
    {
@@ -258,6 +264,12 @@
 
    Object->DriverStart = DriverImageStart;
    Object->DriverSize = DriverImageSize;
+   if (Buffer)
+   {
+      Object->DriverName.Buffer = Buffer;
+      Object->DriverName.Length = Object->DriverName.MaximumLength = DriverName.Length;
+      RtlCopyMemory(Object->DriverName.Buffer, DriverName.Buffer, DriverName.Length);
+   }
 
    *DriverObject = Object;