#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;
{
PDEVICE_OBJECT CreatedDeviceObject;
OBJECT_ATTRIBUTES ObjectAttributes;
- HANDLE DeviceHandle;
NTSTATUS Status;
assert_irql(PASSIVE_LEVEL);
assert(sizeof(CreatedDeviceObject->Dpc) == 32);
assert(sizeof(CreatedDeviceObject->DeviceLock) == 16);
assert(sizeof(DEVICE_OBJECT) == 184);
+ assert(sizeof(DEVICE_OBJECT) == 0xB8);
if (DeviceName != NULL)
{
#ifdef LIBCAPTIVE
/* W32 expects CreatedDeviceObject->DeviceExtension to follow *CreatedDeviceObject!
* Undocumented by W32!
+ * See also IoDeleteDevice().
*/
/* TODO:thread */
IoDeviceObjectType->NonpagedPoolCharge = sizeof (DEVICE_OBJECT) + DeviceExtensionSize;
if (DeviceName != NULL)
{
InitializeObjectAttributes(&ObjectAttributes,DeviceName,0,NULL,NULL);
- Status = ObCreateObject(&DeviceHandle,
+ Status = ObCreateObject(NULL,
0,
&ObjectAttributes,
IoDeviceObjectType,
}
else
{
- Status = ObCreateObject(&DeviceHandle,
+ Status = ObCreateObject(NULL,
0,
NULL,
IoDeviceObjectType,
#ifdef LIBCAPTIVE
/* W32 expects CreatedDeviceObject->DeviceExtension to follow *CreatedDeviceObject!
* Undocumented by W32!
+ * See also IoDeleteDevice().
*/
/* TODO:thread */
IoDeviceObjectType->NonpagedPoolCharge = sizeof (DEVICE_OBJECT); /* restore */
}
CreatedDeviceObject->Type = DeviceType;
- CreatedDeviceObject->Size = sizeof (*CreatedDeviceObject);
+ /* W32 (ntfs) expects CreatedDeviceObject->Size to cover even 'DeviceExtensionSize'.
+ * Undocumented by W32!
+ */
+ CreatedDeviceObject->Size = sizeof (DEVICE_OBJECT) + DeviceExtensionSize;
CreatedDeviceObject->ReferenceCount = 0; /* or 1? it is floating unused this way */
CreatedDeviceObject->DriverObject = DriverObject;
CreatedDeviceObject->CurrentIrp = NULL;
CreatedDeviceObject->Flags = 0;
CreatedDeviceObject->Characteristics = DeviceCharacteristics;
+ CreatedDeviceObject->Timer = NULL;
+ CreatedDeviceObject->Vpb = NULL;
#ifndef LIBCAPTIVE
CreatedDeviceObject->DeviceExtension =
#else /* !LIBCAPTIVE */
/* W32 expects CreatedDeviceObject->DeviceExtension to follow *CreatedDeviceObject!
* Undocumented by W32!
+ * See also IoDeleteDevice().
*/
CreatedDeviceObject->DeviceExtension = (void *)(CreatedDeviceObject+1);
#endif /* LIBCAPTIVE */
DeviceExtensionSize);
}
+#ifdef LIBCAPTIVE
+ /* Magic value expected by ntfs.sys NT5.1sp1 _NtfsInitializeIrpContext()
+ */
+ if (DeviceExtensionSize>=0x2A)
+ *(USHORT *)(((UCHAR *)CreatedDeviceObject->DeviceExtension)+0x28)=0x0701;
+#endif /* LIBCAPTIVE */
+
CreatedDeviceObject->AttachedDevice = NULL;
CreatedDeviceObject->DeviceType = DeviceType;
CreatedDeviceObject->StackSize = 1;