X-Git-Url: http://git.jankratochvil.net/?a=blobdiff_plain;f=ntoskrnl%2Fio%2Fdevice.c;h=40551eb45dd7f99e7c922f2a994b90c07d396ea6;hb=c6b8d7e5eb3b5672e7b7d8372e7cf00dbeeba68d;hp=6e8b6966c64068147f2cd5978ba76f1174722235;hpb=1da901ebecfaed95b005817b49a87bb0da5a59f3;p=reactos.git diff --git a/ntoskrnl/io/device.c b/ntoskrnl/io/device.c index 6e8b696..40551eb 100644 --- a/ntoskrnl/io/device.c +++ b/ntoskrnl/io/device.c @@ -76,9 +76,15 @@ IoDeleteDevice(PDEVICE_OBJECT DeviceObject) #endif /* !LIBCAPTIVE */ } +#ifndef LIBCAPTIVE + /* W32 expects CreatedDeviceObject->DeviceExtension to follow *CreatedDeviceObject! + * Undocumented by W32! + * See also IoCreateDevice(). + */ /* free device extension */ if (DeviceObject->DeviceObjectExtension) ExFreePool (DeviceObject->DeviceObjectExtension); +#endif /* LIBCAPTIVE */ /* remove device from driver device list */ Previous = DeviceObject->DriverObject->DeviceObject; @@ -626,6 +632,12 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject, assert_irql(PASSIVE_LEVEL); + assert(sizeof(CreatedDeviceObject->Queue.Wcb) == 40); + assert(sizeof(CreatedDeviceObject->DeviceQueue) == 20); + assert(sizeof(CreatedDeviceObject->Dpc) == 32); + assert(sizeof(CreatedDeviceObject->DeviceLock) == 16); + assert(sizeof(DEVICE_OBJECT) == 184); + if (DeviceName != NULL) { DPRINT("IoCreateDevice(DriverObject %x, DeviceName %S)\n",DriverObject, @@ -636,6 +648,15 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject, DPRINT("IoCreateDevice(DriverObject %x)\n",DriverObject); } +#ifdef LIBCAPTIVE + /* W32 expects CreatedDeviceObject->DeviceExtension to follow *CreatedDeviceObject! + * Undocumented by W32! + * See also IoDeleteDevice(). + */ + /* TODO:thread */ + IoDeviceObjectType->NonpagedPoolCharge = sizeof (DEVICE_OBJECT) + DeviceExtensionSize; +#endif /* LIBCAPTIVE */ + if (DeviceName != NULL) { InitializeObjectAttributes(&ObjectAttributes,DeviceName,0,NULL,NULL); @@ -654,6 +675,15 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject, (PVOID*)&CreatedDeviceObject); } +#ifdef LIBCAPTIVE + /* W32 expects CreatedDeviceObject->DeviceExtension to follow *CreatedDeviceObject! + * Undocumented by W32! + * See also IoDeleteDevice(). + */ + /* TODO:thread */ + IoDeviceObjectType->NonpagedPoolCharge = sizeof (DEVICE_OBJECT); /* restore */ +#endif /* LIBCAPTIVE */ + *DeviceObject = NULL; if (!NT_SUCCESS(Status)) @@ -680,10 +710,20 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject, CreatedDeviceObject->CurrentIrp = NULL; CreatedDeviceObject->Flags = 0; CreatedDeviceObject->Characteristics = DeviceCharacteristics; + CreatedDeviceObject->Timer = NULL; + CreatedDeviceObject->Vpb = NULL; +#ifndef LIBCAPTIVE CreatedDeviceObject->DeviceExtension = ExAllocatePoolWithTag(NonPagedPool, DeviceExtensionSize, TAG_DEVICE_EXTENSION); +#else /* !LIBCAPTIVE */ + /* W32 expects CreatedDeviceObject->DeviceExtension to follow *CreatedDeviceObject! + * Undocumented by W32! + * See also IoDeleteDevice(). + */ + CreatedDeviceObject->DeviceExtension = (void *)(CreatedDeviceObject+1); +#endif /* LIBCAPTIVE */ if (DeviceExtensionSize > 0 && CreatedDeviceObject->DeviceExtension == NULL) { ExFreePool(CreatedDeviceObject);