Commit in reactos/ntoskrnl/io on MAIN
device.c+15-11.83 -> 1.84
Add support for FILE_AUTOGENERATED_DEVICE_NAME to IoCreateDevice.

reactos/ntoskrnl/io
device.c 1.83 -> 1.84
diff -u -r1.83 -r1.84
--- device.c	6 Nov 2004 04:12:59 -0000	1.83
+++ device.c	15 Nov 2004 11:41:33 -0000	1.84
@@ -1,4 +1,4 @@
-/* $Id: device.c,v 1.83 2004/11/06 04:12:59 ion Exp $
+/* $Id: device.c,v 1.84 2004/11/15 11:41:33 ekohl Exp $
  *
  * COPYRIGHT:      See COPYING in the top level directory
  * PROJECT:        ReactOS kernel
@@ -19,6 +19,8 @@
 
 #define TAG_DEVICE_EXTENSION   TAG('D', 'E', 'X', 'T')
 
+static ULONG IopDeviceObjectNumber = 0;
+
 /* PRIVATE FUNCTIONS **********************************************************/
 
 NTSTATUS FASTCALL
@@ -532,6 +534,8 @@
    BOOLEAN Exclusive,
    PDEVICE_OBJECT *DeviceObject)
 {
+   WCHAR AutoNameBuffer[20];
+   UNICODE_STRING AutoName;
    PDEVICE_OBJECT CreatedDeviceObject;
    PDEVOBJ_EXTENSION DeviceObjectExtension;
    OBJECT_ATTRIBUTES ObjectAttributes;
@@ -549,6 +553,16 @@
       DPRINT("IoCreateDevice(DriverObject %x)\n",DriverObject);
    }
    
+   if (DeviceCharacteristics & FILE_AUTOGENERATED_DEVICE_NAME)
+   {
+      swprintf(AutoNameBuffer,
+               L"\\Device\\%08lx",
+               InterlockedIncrement(&IopDeviceObjectNumber));
+      RtlInitUnicodeString(&AutoName,
+                           AutoNameBuffer);
+      DeviceName = &AutoName;
+   }
+   
    if (DeviceName != NULL)
    {
       InitializeObjectAttributes(&ObjectAttributes, DeviceName, 0, NULL, NULL);
CVSspam 0.2.8