Add support for FILE_AUTOGENERATED_DEVICE_NAME to IoCreateDevice.

svn path=/trunk/; revision=11664
This commit is contained in:
Eric Kohl 2004-11-15 11:41:33 +00:00
parent 3b5c8f81f3
commit d0da55a427

View file

@ -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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -19,6 +19,8 @@
#define TAG_DEVICE_EXTENSION TAG('D', 'E', 'X', 'T') #define TAG_DEVICE_EXTENSION TAG('D', 'E', 'X', 'T')
static ULONG IopDeviceObjectNumber = 0;
/* PRIVATE FUNCTIONS **********************************************************/ /* PRIVATE FUNCTIONS **********************************************************/
NTSTATUS FASTCALL NTSTATUS FASTCALL
@ -532,6 +534,8 @@ IoCreateDevice(
BOOLEAN Exclusive, BOOLEAN Exclusive,
PDEVICE_OBJECT *DeviceObject) PDEVICE_OBJECT *DeviceObject)
{ {
WCHAR AutoNameBuffer[20];
UNICODE_STRING AutoName;
PDEVICE_OBJECT CreatedDeviceObject; PDEVICE_OBJECT CreatedDeviceObject;
PDEVOBJ_EXTENSION DeviceObjectExtension; PDEVOBJ_EXTENSION DeviceObjectExtension;
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
@ -549,6 +553,16 @@ IoCreateDevice(
DPRINT("IoCreateDevice(DriverObject %x)\n",DriverObject); 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) if (DeviceName != NULL)
{ {
InitializeObjectAttributes(&ObjectAttributes, DeviceName, 0, NULL, NULL); InitializeObjectAttributes(&ObjectAttributes, DeviceName, 0, NULL, NULL);