mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
Put in alphabetical order, remove IopCreateDevice, and remove incorrect implementation tag for EFi functions
svn path=/trunk/; revision=14650
This commit is contained in:
parent
8c8090fc65
commit
d4449cd58d
4 changed files with 325 additions and 357 deletions
|
@ -113,22 +113,6 @@ IopInitializeDevice(
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
|
||||||
IopCreateDevice(
|
|
||||||
PVOID ObjectBody,
|
|
||||||
PVOID Parent,
|
|
||||||
PWSTR RemainingPath,
|
|
||||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
|
||||||
{
|
|
||||||
DPRINT("IopCreateDevice(ObjectBody %x, Parent %x, RemainingPath %S)\n",
|
|
||||||
ObjectBody, Parent, RemainingPath);
|
|
||||||
|
|
||||||
if (RemainingPath != NULL && wcschr(RemainingPath + 1, '\\') != NULL)
|
|
||||||
return STATUS_OBJECT_PATH_NOT_FOUND;
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
IopGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName,
|
IopGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName,
|
||||||
|
@ -237,6 +221,31 @@ IoAttachDevice(PDEVICE_OBJECT SourceDevice,
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IoAttachDeviceByPointer
|
||||||
|
*
|
||||||
|
* Status
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
NTSTATUS
|
||||||
|
STDCALL
|
||||||
|
IoAttachDeviceByPointer(IN PDEVICE_OBJECT SourceDevice,
|
||||||
|
IN PDEVICE_OBJECT TargetDevice)
|
||||||
|
{
|
||||||
|
PDEVICE_OBJECT AttachedDevice;
|
||||||
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
DPRINT("IoAttachDeviceByPointer(SourceDevice %x, TargetDevice %x)\n",
|
||||||
|
SourceDevice, TargetDevice);
|
||||||
|
|
||||||
|
/* Do the Attach */
|
||||||
|
AttachedDevice = IoAttachDeviceToDeviceStack(SourceDevice, TargetDevice);
|
||||||
|
if (AttachedDevice == NULL) Status = STATUS_NO_SUCH_DEVICE;
|
||||||
|
|
||||||
|
/* Return the status */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IoAttachDeviceToDeviceStack
|
* IoAttachDeviceToDeviceStack
|
||||||
*
|
*
|
||||||
|
@ -261,31 +270,6 @@ IoAttachDeviceToDeviceStack(PDEVICE_OBJECT SourceDevice,
|
||||||
DPRINT("IoAttachDeviceToDeviceStack DONE: %x\n", LocalAttach);
|
DPRINT("IoAttachDeviceToDeviceStack DONE: %x\n", LocalAttach);
|
||||||
return LocalAttach;
|
return LocalAttach;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* IoAttachDeviceByPointer
|
|
||||||
*
|
|
||||||
* Status
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
STDCALL
|
|
||||||
IoAttachDeviceByPointer(IN PDEVICE_OBJECT SourceDevice,
|
|
||||||
IN PDEVICE_OBJECT TargetDevice)
|
|
||||||
{
|
|
||||||
PDEVICE_OBJECT AttachedDevice;
|
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
|
||||||
|
|
||||||
DPRINT("IoAttachDeviceByPointer(SourceDevice %x, TargetDevice %x)\n",
|
|
||||||
SourceDevice, TargetDevice);
|
|
||||||
|
|
||||||
/* Do the Attach */
|
|
||||||
AttachedDevice = IoAttachDeviceToDeviceStack(SourceDevice, TargetDevice);
|
|
||||||
if (AttachedDevice == NULL) Status = STATUS_NO_SUCH_DEVICE;
|
|
||||||
|
|
||||||
/* Return the status */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
|
@ -333,288 +317,6 @@ IoAttachDeviceToDeviceStackSafe(IN PDEVICE_OBJECT SourceDevice,
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* IoDeleteDevice
|
|
||||||
*
|
|
||||||
* Status
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
VOID STDCALL
|
|
||||||
IoDeleteDevice(PDEVICE_OBJECT DeviceObject)
|
|
||||||
{
|
|
||||||
PDEVICE_OBJECT Previous;
|
|
||||||
|
|
||||||
if (DeviceObject->Flags & DO_SHUTDOWN_REGISTERED)
|
|
||||||
IoUnregisterShutdownNotification(DeviceObject);
|
|
||||||
|
|
||||||
/* Remove the timer if it exists */
|
|
||||||
if (DeviceObject->Timer)
|
|
||||||
{
|
|
||||||
IopRemoveTimerFromTimerList(DeviceObject->Timer);
|
|
||||||
ExFreePool(DeviceObject->Timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remove device from driver device list */
|
|
||||||
Previous = DeviceObject->DriverObject->DeviceObject;
|
|
||||||
if (Previous == DeviceObject)
|
|
||||||
{
|
|
||||||
DeviceObject->DriverObject->DeviceObject = DeviceObject->NextDevice;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while (Previous->NextDevice != DeviceObject)
|
|
||||||
Previous = Previous->NextDevice;
|
|
||||||
Previous->NextDevice = DeviceObject->NextDevice;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* I guess this should be removed later... but it shouldn't cause problems */
|
|
||||||
DeviceObject->DeviceObjectExtension->ExtensionFlags |= DOE_DELETE_PENDING;
|
|
||||||
ObDereferenceObject(DeviceObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
NTSTATUS
|
|
||||||
STDCALL
|
|
||||||
IoEnumerateDeviceObjectList(IN PDRIVER_OBJECT DriverObject,
|
|
||||||
IN PDEVICE_OBJECT *DeviceObjectList,
|
|
||||||
IN ULONG DeviceObjectListSize,
|
|
||||||
OUT PULONG ActualNumberDeviceObjects)
|
|
||||||
{
|
|
||||||
ULONG ActualDevices = 1;
|
|
||||||
PDEVICE_OBJECT CurrentDevice = DriverObject->DeviceObject;
|
|
||||||
|
|
||||||
DPRINT1("IoEnumerateDeviceObjectList\n");
|
|
||||||
|
|
||||||
/* Find out how many devices we'll enumerate */
|
|
||||||
while ((CurrentDevice = CurrentDevice->NextDevice))
|
|
||||||
{
|
|
||||||
ActualDevices++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Go back to the first */
|
|
||||||
CurrentDevice = DriverObject->DeviceObject;
|
|
||||||
|
|
||||||
/* Start by at least returning this */
|
|
||||||
*ActualNumberDeviceObjects = ActualDevices;
|
|
||||||
|
|
||||||
/* Check if we can support so many */
|
|
||||||
if ((ActualDevices * 4) > DeviceObjectListSize)
|
|
||||||
{
|
|
||||||
/* Fail because the buffer was too small */
|
|
||||||
return STATUS_BUFFER_TOO_SMALL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if the caller only wanted the size */
|
|
||||||
if (DeviceObjectList)
|
|
||||||
{
|
|
||||||
/* Loop through all the devices */
|
|
||||||
while (ActualDevices)
|
|
||||||
{
|
|
||||||
/* Reference each Device */
|
|
||||||
ObReferenceObject(CurrentDevice);
|
|
||||||
|
|
||||||
/* Add it to the list */
|
|
||||||
*DeviceObjectList = CurrentDevice;
|
|
||||||
|
|
||||||
/* Go to the next one */
|
|
||||||
CurrentDevice = CurrentDevice->NextDevice;
|
|
||||||
ActualDevices--;
|
|
||||||
DeviceObjectList++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the status */
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
PDEVICE_OBJECT
|
|
||||||
STDCALL
|
|
||||||
IoGetDeviceAttachmentBaseRef(IN PDEVICE_OBJECT DeviceObject)
|
|
||||||
{
|
|
||||||
/* Return the attached Device */
|
|
||||||
return (DeviceObject->DeviceObjectExtension->AttachedTo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
NTSTATUS
|
|
||||||
STDCALL
|
|
||||||
IoGetDiskDeviceObject(IN PDEVICE_OBJECT FileSystemDeviceObject,
|
|
||||||
OUT PDEVICE_OBJECT *DiskDeviceObject)
|
|
||||||
{
|
|
||||||
PDEVOBJ_EXTENSION DeviceExtension;
|
|
||||||
PVPB Vpb;
|
|
||||||
KIRQL OldIrql;
|
|
||||||
|
|
||||||
/* Make sure there's a VPB */
|
|
||||||
if (!FileSystemDeviceObject->Vpb) return STATUS_INVALID_PARAMETER;
|
|
||||||
|
|
||||||
/* Acquire it */
|
|
||||||
IoAcquireVpbSpinLock(&OldIrql);
|
|
||||||
|
|
||||||
/* Get the Device Extension */
|
|
||||||
DeviceExtension = FileSystemDeviceObject->DeviceObjectExtension;
|
|
||||||
|
|
||||||
/* Make sure this one has a VPB too */
|
|
||||||
Vpb = DeviceExtension->Vpb;
|
|
||||||
if (!Vpb) return STATUS_INVALID_PARAMETER;
|
|
||||||
|
|
||||||
/* Make sure someone it's mounted */
|
|
||||||
if ((!Vpb->ReferenceCount) || (Vpb->Flags & VPB_MOUNTED)) return STATUS_VOLUME_DISMOUNTED;
|
|
||||||
|
|
||||||
/* Return the Disk Device Object */
|
|
||||||
*DiskDeviceObject = Vpb->RealDevice;
|
|
||||||
|
|
||||||
/* Release the lock */
|
|
||||||
IoReleaseVpbSpinLock(OldIrql);
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
PDEVICE_OBJECT
|
|
||||||
STDCALL
|
|
||||||
IoGetLowerDeviceObject(IN PDEVICE_OBJECT DeviceObject)
|
|
||||||
{
|
|
||||||
PDEVOBJ_EXTENSION DeviceExtension = DeviceObject->DeviceObjectExtension;
|
|
||||||
PDEVICE_OBJECT LowerDeviceObject = NULL;
|
|
||||||
|
|
||||||
/* Make sure it's not getting deleted */
|
|
||||||
if (DeviceExtension->ExtensionFlags & (DOE_UNLOAD_PENDING |
|
|
||||||
DOE_DELETE_PENDING |
|
|
||||||
DOE_REMOVE_PENDING |
|
|
||||||
DOE_REMOVE_PROCESSED))
|
|
||||||
{
|
|
||||||
/* Get the Lower Device Object */
|
|
||||||
LowerDeviceObject = DeviceExtension->AttachedTo;
|
|
||||||
|
|
||||||
/* Reference it */
|
|
||||||
ObReferenceObject(LowerDeviceObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return it */
|
|
||||||
return LowerDeviceObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* IoGetRelatedDeviceObject
|
|
||||||
*
|
|
||||||
* Remarks
|
|
||||||
* See "Windows NT File System Internals", page 633 - 634.
|
|
||||||
*
|
|
||||||
* Status
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
PDEVICE_OBJECT
|
|
||||||
STDCALL
|
|
||||||
IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
|
|
||||||
{
|
|
||||||
PDEVICE_OBJECT DeviceObject = FileObject->DeviceObject;
|
|
||||||
|
|
||||||
/* Get logical volume mounted on a physical/virtual/logical device */
|
|
||||||
if (FileObject->Vpb && FileObject->Vpb->DeviceObject)
|
|
||||||
{
|
|
||||||
DeviceObject = FileObject->Vpb->DeviceObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check if file object has an associated device object mounted by some
|
|
||||||
* other file system.
|
|
||||||
*/
|
|
||||||
if (FileObject->DeviceObject->Vpb &&
|
|
||||||
FileObject->DeviceObject->Vpb->DeviceObject)
|
|
||||||
{
|
|
||||||
DeviceObject = FileObject->DeviceObject->Vpb->DeviceObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the highest attached device */
|
|
||||||
return IoGetAttachedDevice(DeviceObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* IoGetDeviceObjectPointer
|
|
||||||
*
|
|
||||||
* Status
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
NTSTATUS
|
|
||||||
STDCALL
|
|
||||||
IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName,
|
|
||||||
IN ACCESS_MASK DesiredAccess,
|
|
||||||
OUT PFILE_OBJECT *FileObject,
|
|
||||||
OUT PDEVICE_OBJECT *DeviceObject)
|
|
||||||
{
|
|
||||||
/* Call the helper routine for a normal operation */
|
|
||||||
return IopGetDeviceObjectPointer(ObjectName,
|
|
||||||
DesiredAccess,
|
|
||||||
FileObject,
|
|
||||||
DeviceObject,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* IoDetachDevice
|
|
||||||
*
|
|
||||||
* Status
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
VOID
|
|
||||||
STDCALL
|
|
||||||
IoDetachDevice(PDEVICE_OBJECT TargetDevice)
|
|
||||||
{
|
|
||||||
DPRINT("IoDetachDevice(TargetDevice %x)\n", TargetDevice);
|
|
||||||
|
|
||||||
/* Remove the attachment */
|
|
||||||
TargetDevice->AttachedDevice->DeviceObjectExtension->AttachedTo = NULL;
|
|
||||||
TargetDevice->AttachedDevice = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* IoGetAttachedDevice
|
|
||||||
*
|
|
||||||
* Status
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
PDEVICE_OBJECT
|
|
||||||
STDCALL
|
|
||||||
IoGetAttachedDevice(PDEVICE_OBJECT DeviceObject)
|
|
||||||
{
|
|
||||||
PDEVICE_OBJECT Current = DeviceObject;
|
|
||||||
|
|
||||||
/* Get the last attached device */
|
|
||||||
while (Current->AttachedDevice)
|
|
||||||
{
|
|
||||||
Current = Current->AttachedDevice;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return it */
|
|
||||||
return Current;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* IoGetAttachedDeviceReference
|
|
||||||
*
|
|
||||||
* Status
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
PDEVICE_OBJECT
|
|
||||||
STDCALL
|
|
||||||
IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject)
|
|
||||||
{
|
|
||||||
PDEVICE_OBJECT Current = IoGetAttachedDevice(DeviceObject);
|
|
||||||
|
|
||||||
/* Reference the ATtached Device */
|
|
||||||
ObReferenceObject(Current);
|
|
||||||
return Current;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IoCreateDevice
|
* IoCreateDevice
|
||||||
*
|
*
|
||||||
|
@ -812,6 +514,289 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IoDeleteDevice
|
||||||
|
*
|
||||||
|
* Status
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
VOID
|
||||||
|
STDCALL
|
||||||
|
IoDeleteDevice(PDEVICE_OBJECT DeviceObject)
|
||||||
|
{
|
||||||
|
PDEVICE_OBJECT Previous;
|
||||||
|
|
||||||
|
if (DeviceObject->Flags & DO_SHUTDOWN_REGISTERED)
|
||||||
|
IoUnregisterShutdownNotification(DeviceObject);
|
||||||
|
|
||||||
|
/* Remove the timer if it exists */
|
||||||
|
if (DeviceObject->Timer)
|
||||||
|
{
|
||||||
|
IopRemoveTimerFromTimerList(DeviceObject->Timer);
|
||||||
|
ExFreePool(DeviceObject->Timer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remove device from driver device list */
|
||||||
|
Previous = DeviceObject->DriverObject->DeviceObject;
|
||||||
|
if (Previous == DeviceObject)
|
||||||
|
{
|
||||||
|
DeviceObject->DriverObject->DeviceObject = DeviceObject->NextDevice;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while (Previous->NextDevice != DeviceObject)
|
||||||
|
Previous = Previous->NextDevice;
|
||||||
|
Previous->NextDevice = DeviceObject->NextDevice;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* I guess this should be removed later... but it shouldn't cause problems */
|
||||||
|
DeviceObject->DeviceObjectExtension->ExtensionFlags |= DOE_DELETE_PENDING;
|
||||||
|
ObDereferenceObject(DeviceObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IoDetachDevice
|
||||||
|
*
|
||||||
|
* Status
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
VOID
|
||||||
|
STDCALL
|
||||||
|
IoDetachDevice(PDEVICE_OBJECT TargetDevice)
|
||||||
|
{
|
||||||
|
DPRINT("IoDetachDevice(TargetDevice %x)\n", TargetDevice);
|
||||||
|
|
||||||
|
/* Remove the attachment */
|
||||||
|
TargetDevice->AttachedDevice->DeviceObjectExtension->AttachedTo = NULL;
|
||||||
|
TargetDevice->AttachedDevice = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
NTSTATUS
|
||||||
|
STDCALL
|
||||||
|
IoEnumerateDeviceObjectList(IN PDRIVER_OBJECT DriverObject,
|
||||||
|
IN PDEVICE_OBJECT *DeviceObjectList,
|
||||||
|
IN ULONG DeviceObjectListSize,
|
||||||
|
OUT PULONG ActualNumberDeviceObjects)
|
||||||
|
{
|
||||||
|
ULONG ActualDevices = 1;
|
||||||
|
PDEVICE_OBJECT CurrentDevice = DriverObject->DeviceObject;
|
||||||
|
|
||||||
|
DPRINT1("IoEnumerateDeviceObjectList\n");
|
||||||
|
|
||||||
|
/* Find out how many devices we'll enumerate */
|
||||||
|
while ((CurrentDevice = CurrentDevice->NextDevice))
|
||||||
|
{
|
||||||
|
ActualDevices++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Go back to the first */
|
||||||
|
CurrentDevice = DriverObject->DeviceObject;
|
||||||
|
|
||||||
|
/* Start by at least returning this */
|
||||||
|
*ActualNumberDeviceObjects = ActualDevices;
|
||||||
|
|
||||||
|
/* Check if we can support so many */
|
||||||
|
if ((ActualDevices * 4) > DeviceObjectListSize)
|
||||||
|
{
|
||||||
|
/* Fail because the buffer was too small */
|
||||||
|
return STATUS_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if the caller only wanted the size */
|
||||||
|
if (DeviceObjectList)
|
||||||
|
{
|
||||||
|
/* Loop through all the devices */
|
||||||
|
while (ActualDevices)
|
||||||
|
{
|
||||||
|
/* Reference each Device */
|
||||||
|
ObReferenceObject(CurrentDevice);
|
||||||
|
|
||||||
|
/* Add it to the list */
|
||||||
|
*DeviceObjectList = CurrentDevice;
|
||||||
|
|
||||||
|
/* Go to the next one */
|
||||||
|
CurrentDevice = CurrentDevice->NextDevice;
|
||||||
|
ActualDevices--;
|
||||||
|
DeviceObjectList++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return the status */
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IoGetAttachedDevice
|
||||||
|
*
|
||||||
|
* Status
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
PDEVICE_OBJECT
|
||||||
|
STDCALL
|
||||||
|
IoGetAttachedDevice(PDEVICE_OBJECT DeviceObject)
|
||||||
|
{
|
||||||
|
PDEVICE_OBJECT Current = DeviceObject;
|
||||||
|
|
||||||
|
/* Get the last attached device */
|
||||||
|
while (Current->AttachedDevice)
|
||||||
|
{
|
||||||
|
Current = Current->AttachedDevice;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return it */
|
||||||
|
return Current;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IoGetAttachedDeviceReference
|
||||||
|
*
|
||||||
|
* Status
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
PDEVICE_OBJECT
|
||||||
|
STDCALL
|
||||||
|
IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject)
|
||||||
|
{
|
||||||
|
PDEVICE_OBJECT Current = IoGetAttachedDevice(DeviceObject);
|
||||||
|
|
||||||
|
/* Reference the ATtached Device */
|
||||||
|
ObReferenceObject(Current);
|
||||||
|
return Current;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
PDEVICE_OBJECT
|
||||||
|
STDCALL
|
||||||
|
IoGetDeviceAttachmentBaseRef(IN PDEVICE_OBJECT DeviceObject)
|
||||||
|
{
|
||||||
|
/* Return the attached Device */
|
||||||
|
return (DeviceObject->DeviceObjectExtension->AttachedTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IoGetDeviceObjectPointer
|
||||||
|
*
|
||||||
|
* Status
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
NTSTATUS
|
||||||
|
STDCALL
|
||||||
|
IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName,
|
||||||
|
IN ACCESS_MASK DesiredAccess,
|
||||||
|
OUT PFILE_OBJECT *FileObject,
|
||||||
|
OUT PDEVICE_OBJECT *DeviceObject)
|
||||||
|
{
|
||||||
|
/* Call the helper routine for a normal operation */
|
||||||
|
return IopGetDeviceObjectPointer(ObjectName,
|
||||||
|
DesiredAccess,
|
||||||
|
FileObject,
|
||||||
|
DeviceObject,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
NTSTATUS
|
||||||
|
STDCALL
|
||||||
|
IoGetDiskDeviceObject(IN PDEVICE_OBJECT FileSystemDeviceObject,
|
||||||
|
OUT PDEVICE_OBJECT *DiskDeviceObject)
|
||||||
|
{
|
||||||
|
PDEVOBJ_EXTENSION DeviceExtension;
|
||||||
|
PVPB Vpb;
|
||||||
|
KIRQL OldIrql;
|
||||||
|
|
||||||
|
/* Make sure there's a VPB */
|
||||||
|
if (!FileSystemDeviceObject->Vpb) return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
/* Acquire it */
|
||||||
|
IoAcquireVpbSpinLock(&OldIrql);
|
||||||
|
|
||||||
|
/* Get the Device Extension */
|
||||||
|
DeviceExtension = FileSystemDeviceObject->DeviceObjectExtension;
|
||||||
|
|
||||||
|
/* Make sure this one has a VPB too */
|
||||||
|
Vpb = DeviceExtension->Vpb;
|
||||||
|
if (!Vpb) return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
/* Make sure someone it's mounted */
|
||||||
|
if ((!Vpb->ReferenceCount) || (Vpb->Flags & VPB_MOUNTED)) return STATUS_VOLUME_DISMOUNTED;
|
||||||
|
|
||||||
|
/* Return the Disk Device Object */
|
||||||
|
*DiskDeviceObject = Vpb->RealDevice;
|
||||||
|
|
||||||
|
/* Release the lock */
|
||||||
|
IoReleaseVpbSpinLock(OldIrql);
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
PDEVICE_OBJECT
|
||||||
|
STDCALL
|
||||||
|
IoGetLowerDeviceObject(IN PDEVICE_OBJECT DeviceObject)
|
||||||
|
{
|
||||||
|
PDEVOBJ_EXTENSION DeviceExtension = DeviceObject->DeviceObjectExtension;
|
||||||
|
PDEVICE_OBJECT LowerDeviceObject = NULL;
|
||||||
|
|
||||||
|
/* Make sure it's not getting deleted */
|
||||||
|
if (DeviceExtension->ExtensionFlags & (DOE_UNLOAD_PENDING |
|
||||||
|
DOE_DELETE_PENDING |
|
||||||
|
DOE_REMOVE_PENDING |
|
||||||
|
DOE_REMOVE_PROCESSED))
|
||||||
|
{
|
||||||
|
/* Get the Lower Device Object */
|
||||||
|
LowerDeviceObject = DeviceExtension->AttachedTo;
|
||||||
|
|
||||||
|
/* Reference it */
|
||||||
|
ObReferenceObject(LowerDeviceObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return it */
|
||||||
|
return LowerDeviceObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IoGetRelatedDeviceObject
|
||||||
|
*
|
||||||
|
* Remarks
|
||||||
|
* See "Windows NT File System Internals", page 633 - 634.
|
||||||
|
*
|
||||||
|
* Status
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
PDEVICE_OBJECT
|
||||||
|
STDCALL
|
||||||
|
IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
|
||||||
|
{
|
||||||
|
PDEVICE_OBJECT DeviceObject = FileObject->DeviceObject;
|
||||||
|
|
||||||
|
/* Get logical volume mounted on a physical/virtual/logical device */
|
||||||
|
if (FileObject->Vpb && FileObject->Vpb->DeviceObject)
|
||||||
|
{
|
||||||
|
DeviceObject = FileObject->Vpb->DeviceObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if file object has an associated device object mounted by some
|
||||||
|
* other file system.
|
||||||
|
*/
|
||||||
|
if (FileObject->DeviceObject->Vpb &&
|
||||||
|
FileObject->DeviceObject->Vpb->DeviceObject)
|
||||||
|
{
|
||||||
|
DeviceObject = FileObject->DeviceObject->Vpb->DeviceObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return the highest attached device */
|
||||||
|
return IoGetAttachedDevice(DeviceObject);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
|
@ -852,7 +837,6 @@ IoSynchronousInvalidateDeviceRelations(
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1649,6 +1649,7 @@ IoCreateDriver (
|
||||||
PDRIVER_OBJECT DriverObject;
|
PDRIVER_OBJECT DriverObject;
|
||||||
UNICODE_STRING ServiceKeyName;
|
UNICODE_STRING ServiceKeyName;
|
||||||
HANDLE hDriver;
|
HANDLE hDriver;
|
||||||
|
ULONG i;
|
||||||
|
|
||||||
/* First, create a unique name for the driver if we don't have one */
|
/* First, create a unique name for the driver if we don't have one */
|
||||||
if (!DriverName) {
|
if (!DriverName) {
|
||||||
|
@ -1695,7 +1696,12 @@ IoCreateDriver (
|
||||||
DriverObject->DriverExtension = (PDRIVER_EXTENSION)(DriverObject + 1);
|
DriverObject->DriverExtension = (PDRIVER_EXTENSION)(DriverObject + 1);
|
||||||
DriverObject->DriverExtension->DriverObject = DriverObject;
|
DriverObject->DriverExtension->DriverObject = DriverObject;
|
||||||
DriverObject->DriverInit = InitializationFunction;
|
DriverObject->DriverInit = InitializationFunction;
|
||||||
/* FIXME: Invalidate all Major Functions b/c now they are NULL and might crash */
|
|
||||||
|
/* Invalidate all Major Functions */
|
||||||
|
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
|
||||||
|
{
|
||||||
|
DriverObject->MajorFunction[i] = IopInvalidDeviceRequest;
|
||||||
|
}
|
||||||
|
|
||||||
/* Set up the Service Key Name */
|
/* Set up the Service Key Name */
|
||||||
ServiceKeyName.Buffer = ExAllocatePool(PagedPool, LocalDriverName.Length + sizeof(WCHAR));
|
ServiceKeyName.Buffer = ExAllocatePool(PagedPool, LocalDriverName.Length + sizeof(WCHAR));
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/* $Id:$
|
/*
|
||||||
*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/io/efi.c
|
* FILE: ntoskrnl/io/efi.c
|
||||||
|
@ -15,9 +14,6 @@
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
/*
|
|
||||||
* @unimplemented
|
|
||||||
*/
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
NtAddBootEntry(
|
NtAddBootEntry(
|
||||||
|
@ -28,9 +24,7 @@ NtAddBootEntry(
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* @unimplemented
|
|
||||||
*/
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
NtDeleteBootEntry(
|
NtDeleteBootEntry(
|
||||||
|
@ -41,9 +35,7 @@ NtDeleteBootEntry(
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* @unimplemented
|
|
||||||
*/
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
NtEnumerateBootEntries(
|
NtEnumerateBootEntries(
|
||||||
|
@ -54,9 +46,7 @@ NtEnumerateBootEntries(
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* @unimplemented
|
|
||||||
*/
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
NtQueryBootEntryOrder(
|
NtQueryBootEntryOrder(
|
||||||
|
@ -67,9 +57,7 @@ NtQueryBootEntryOrder(
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* @unimplemented
|
|
||||||
*/
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
NtQueryBootOptions(
|
NtQueryBootOptions(
|
||||||
|
@ -80,9 +68,7 @@ NtQueryBootOptions(
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* @unimplemented
|
|
||||||
*/
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
NtSetBootEntryOrder(
|
NtSetBootEntryOrder(
|
||||||
|
@ -93,10 +79,7 @@ NtSetBootEntryOrder(
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @unimplemented
|
|
||||||
*/
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
NtSetBootOptions(
|
NtSetBootOptions(
|
||||||
|
@ -106,12 +89,8 @@ NtSetBootOptions(
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @unimplemented
|
|
||||||
*/
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
NtTranslateFilePath(
|
NtTranslateFilePath(
|
||||||
|
@ -124,5 +103,4 @@ NtTranslateFilePath(
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -417,7 +417,7 @@ IoInit (VOID)
|
||||||
IoDeviceObjectType->Security = NULL;
|
IoDeviceObjectType->Security = NULL;
|
||||||
IoDeviceObjectType->QueryName = NULL;
|
IoDeviceObjectType->QueryName = NULL;
|
||||||
IoDeviceObjectType->OkayToClose = NULL;
|
IoDeviceObjectType->OkayToClose = NULL;
|
||||||
IoDeviceObjectType->Create = IopCreateDevice;
|
IoDeviceObjectType->Create = NULL;
|
||||||
IoDeviceObjectType->DuplicationNotify = NULL;
|
IoDeviceObjectType->DuplicationNotify = NULL;
|
||||||
|
|
||||||
RtlInitUnicodeString(&IoDeviceObjectType->TypeName, L"Device");
|
RtlInitUnicodeString(&IoDeviceObjectType->TypeName, L"Device");
|
||||||
|
|
Loading…
Reference in a new issue