return STATUS_SUCCESS;
}
+#endif /* LIBCAPTIVE */
VOID STDCALL
IoDeleteDevice(PDEVICE_OBJECT DeviceObject)
/* remove the timer if it exists */
if (DeviceObject->Timer)
{
+#ifndef LIBCAPTIVE
IoStopTimer(DeviceObject);
ExFreePool(DeviceObject->Timer);
+#else /* !LIBCAPTIVE */
+ KeBugCheck(0);
+#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;
ObDereferenceObject (DeviceObject);
}
+#ifndef LIBCAPTIVE
PDEVICE_OBJECT
STDCALL
DPRINT("IoDetachDevice(TargetDevice %x) - UNIMPLEMENTED\n", TargetDevice);
}
+#endif /* LIBCAPTIVE */
PDEVICE_OBJECT
STDCALL
return(Current);
}
+#ifndef LIBCAPTIVE
+
PDEVICE_OBJECT
STDCALL
IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject)
UNIMPLEMENTED;
}
+#endif /* LIBCAPTIVE */
NTSTATUS STDCALL
IopCreateDevice(PVOID ObjectBody,
return(STATUS_SUCCESS);
}
-#endif /* LIBCAPTIVE */
-
NTSTATUS STDCALL
IoCreateDevice(PDRIVER_OBJECT DriverObject,
ULONG DeviceExtensionSize,
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);
+ assert(sizeof(DEVICE_OBJECT) == 0xB8);
+
if (DeviceName != NULL)
{
DPRINT("IoCreateDevice(DriverObject %x, DeviceName %S)\n",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);
(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))
}
CreatedDeviceObject->Type = DeviceType;
+ /* 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 =
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);
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;