From f1bc2201f064366e1d9831cff95e96773741973e Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Wed, 10 Apr 2002 17:02:22 +0000 Subject: [PATCH] Implemented IOCTL_CDROM_GET_DRIVE_GEOMETRY. Some fixes to enable mounting of cdroms. svn path=/trunk/; revision=2838 --- reactos/drivers/storage/atapi/atapi.c | 3 ++- reactos/drivers/storage/cdrom/cdrom.c | 28 ++++++++++++++++++++++++++- reactos/include/ddk/ntddk.h | 3 ++- reactos/include/ntos/cdrom.h | 21 ++++++++++++++++++++ 4 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 reactos/include/ntos/cdrom.h diff --git a/reactos/drivers/storage/atapi/atapi.c b/reactos/drivers/storage/atapi/atapi.c index 33687c032e1..4233dbd76db 100644 --- a/reactos/drivers/storage/atapi/atapi.c +++ b/reactos/drivers/storage/atapi/atapi.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: atapi.c,v 1.18 2002/03/25 21:54:41 ekohl Exp $ +/* $Id: atapi.c,v 1.19 2002/04/10 17:01:47 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS ATAPI miniport driver @@ -2003,6 +2003,7 @@ AtapiErrorToScsi(PVOID DeviceExtension, DPRINT1("IDE error: %02x\n", ErrorReg); ScsiStatus = 0; + SrbStatus = SRB_STATUS_ERROR; #if 0 UCHAR SectorCount, SectorNum, CylinderLow, CylinderHigh; diff --git a/reactos/drivers/storage/cdrom/cdrom.c b/reactos/drivers/storage/cdrom/cdrom.c index 05a7d431f16..d6b69bdef33 100644 --- a/reactos/drivers/storage/cdrom/cdrom.c +++ b/reactos/drivers/storage/cdrom/cdrom.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: cdrom.c,v 1.7 2002/03/25 21:56:19 ekohl Exp $ +/* $Id: cdrom.c,v 1.8 2002/04/10 17:02:22 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -467,6 +467,7 @@ CdromClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject, { /* Set ISO9660 defaults */ DiskDeviceExtension->DiskGeometry->BytesPerSector = 2048; + DiskDeviceExtension->DiskGeometry->MediaType = RemovableMedia; DiskDeviceExtension->SectorShift = 11; DiskDeviceExtension->PartitionLength.QuadPart = (ULONGLONG)0x7fffffff; } @@ -526,6 +527,31 @@ CdromClassDeviceControl(IN PDEVICE_OBJECT DeviceObject, switch (ControlCode) { + case IOCTL_CDROM_GET_DRIVE_GEOMETRY: + DPRINT1("IOCTL_CDROM_GET_DRIVE_GEOMETRY\n"); + if (IrpStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(DISK_GEOMETRY)) + { + Status = STATUS_INVALID_PARAMETER; + } + else if (DeviceExtension->DiskGeometry == NULL) + { + DPRINT1("No cdrom geometry available!\n"); + Status = STATUS_NO_SUCH_DEVICE; + } + else + { + PDISK_GEOMETRY Geometry; + + Geometry = (PDISK_GEOMETRY) Irp->AssociatedIrp.SystemBuffer; + RtlMoveMemory(Geometry, + DeviceExtension->DiskGeometry, + sizeof(DISK_GEOMETRY)); + + Status = STATUS_SUCCESS; + Information = sizeof(DISK_GEOMETRY); + } + break; + default: DPRINT1("Unhandled control code: %lx\n", ControlCode); Status = STATUS_INVALID_DEVICE_REQUEST; diff --git a/reactos/include/ddk/ntddk.h b/reactos/include/ddk/ntddk.h index 2ea7236db39..48afd72745c 100644 --- a/reactos/include/ddk/ntddk.h +++ b/reactos/include/ddk/ntddk.h @@ -1,4 +1,4 @@ -/* $Id: ntddk.h,v 1.26 2002/01/14 01:41:08 ekohl Exp $ +/* $Id: ntddk.h,v 1.27 2002/04/10 17:01:10 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -26,6 +26,7 @@ extern "C" #include #include +#include #include #include #include diff --git a/reactos/include/ntos/cdrom.h b/reactos/include/ntos/cdrom.h new file mode 100644 index 00000000000..badc7f4a941 --- /dev/null +++ b/reactos/include/ntos/cdrom.h @@ -0,0 +1,21 @@ +/* $Id: cdrom.h,v 1.1 2002/04/10 17:00:52 ekohl Exp $ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: include/ntos/cdrom.h + * PURPOSE: CD-ROM related definitions used by all the parts of the system + * PROGRAMMER: Eric Kohl + * UPDATE HISTORY: + * 10/04/2002: Created + */ + +#ifndef __INCLUDE_NTOS_CDROM_H +#define __INCLUDE_NTOS_CDROM_H + + +#define IOCTL_CDROM_GET_DRIVE_GEOMETRY CTL_CODE(FILE_DEVICE_CD_ROM, 0x0013, METHOD_BUFFERED, FILE_READ_ACCESS) + + +#endif /* __INCLUDE_NTOS_CDROM_H */ + +/* EOF */