mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 01:42:30 +00:00
[NTOSKRNL] Implement IopCheckTopDeviceHint()
This commit is contained in:
parent
670a7ac718
commit
779d87b483
|
@ -1299,6 +1299,13 @@ IopGetFileInformation(
|
||||||
OUT PULONG ReturnedLength
|
OUT PULONG ReturnedLength
|
||||||
);
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
NTAPI
|
||||||
|
IopVerifyDeviceObjectOnStack(
|
||||||
|
IN PDEVICE_OBJECT BaseDeviceObject,
|
||||||
|
IN PDEVICE_OBJECT TopDeviceObjectHint
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// I/O Timer Routines
|
// I/O Timer Routines
|
||||||
//
|
//
|
||||||
|
|
|
@ -266,6 +266,54 @@ IopDoNameTransmogrify(IN PIRP Irp,
|
||||||
ExFreePool(DataBuffer);
|
ExFreePool(DataBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
IopCheckTopDeviceHint(IN OUT PDEVICE_OBJECT * DeviceObject,
|
||||||
|
IN POPEN_PACKET OpenPacket,
|
||||||
|
BOOLEAN DirectOpen)
|
||||||
|
{
|
||||||
|
PDEVICE_OBJECT LocalDevice;
|
||||||
|
DEVICE_TYPE DeviceType;
|
||||||
|
|
||||||
|
LocalDevice = *DeviceObject;
|
||||||
|
|
||||||
|
/* Direct open is not allowed */
|
||||||
|
if (DirectOpen)
|
||||||
|
{
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Validate we have a file system device */
|
||||||
|
DeviceType = LocalDevice->DeviceType;
|
||||||
|
if (DeviceType != FILE_DEVICE_DISK_FILE_SYSTEM &&
|
||||||
|
DeviceType != FILE_DEVICE_CD_ROM_FILE_SYSTEM &&
|
||||||
|
DeviceType != FILE_DEVICE_TAPE_FILE_SYSTEM &&
|
||||||
|
DeviceType != FILE_DEVICE_NETWORK_FILE_SYSTEM &&
|
||||||
|
DeviceType != FILE_DEVICE_DFS_FILE_SYSTEM)
|
||||||
|
{
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Verify the hint and if it's OK, return it */
|
||||||
|
if (IopVerifyDeviceObjectOnStack(LocalDevice, OpenPacket->TopDeviceObjectHint))
|
||||||
|
{
|
||||||
|
*DeviceObject = OpenPacket->TopDeviceObjectHint;
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Failure case here */
|
||||||
|
/* If we thought was had come through a mount point,
|
||||||
|
* actually update we didn't and return the error
|
||||||
|
*/
|
||||||
|
if (OpenPacket->TraversedMountPoint)
|
||||||
|
{
|
||||||
|
OpenPacket->TraversedMountPoint = FALSE;
|
||||||
|
return STATUS_MOUNT_POINT_NOT_RESOLVED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Otherwise, just return the fact the hint is invalid */
|
||||||
|
return STATUS_INVALID_DEVICE_OBJECT_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
IopParseDevice(IN PVOID ParseObject,
|
IopParseDevice(IN PVOID ParseObject,
|
||||||
|
|
Loading…
Reference in a new issue