Implemented IOCTL_CDROM_GET_DRIVE_GEOMETRY.

Some fixes to enable mounting of cdroms.

svn path=/trunk/; revision=2838
This commit is contained in:
Eric Kohl 2002-04-10 17:02:22 +00:00
parent 62b86daaf8
commit f1bc2201f0
4 changed files with 52 additions and 3 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS ATAPI miniport driver * PROJECT: ReactOS ATAPI miniport driver
@ -2003,6 +2003,7 @@ AtapiErrorToScsi(PVOID DeviceExtension,
DPRINT1("IDE error: %02x\n", ErrorReg); DPRINT1("IDE error: %02x\n", ErrorReg);
ScsiStatus = 0; ScsiStatus = 0;
SrbStatus = SRB_STATUS_ERROR;
#if 0 #if 0
UCHAR SectorCount, SectorNum, CylinderLow, CylinderHigh; UCHAR SectorCount, SectorNum, CylinderLow, CylinderHigh;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -467,6 +467,7 @@ CdromClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
{ {
/* Set ISO9660 defaults */ /* Set ISO9660 defaults */
DiskDeviceExtension->DiskGeometry->BytesPerSector = 2048; DiskDeviceExtension->DiskGeometry->BytesPerSector = 2048;
DiskDeviceExtension->DiskGeometry->MediaType = RemovableMedia;
DiskDeviceExtension->SectorShift = 11; DiskDeviceExtension->SectorShift = 11;
DiskDeviceExtension->PartitionLength.QuadPart = (ULONGLONG)0x7fffffff; DiskDeviceExtension->PartitionLength.QuadPart = (ULONGLONG)0x7fffffff;
} }
@ -526,6 +527,31 @@ CdromClassDeviceControl(IN PDEVICE_OBJECT DeviceObject,
switch (ControlCode) 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: default:
DPRINT1("Unhandled control code: %lx\n", ControlCode); DPRINT1("Unhandled control code: %lx\n", ControlCode);
Status = STATUS_INVALID_DEVICE_REQUEST; Status = STATUS_INVALID_DEVICE_REQUEST;

View file

@ -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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -26,6 +26,7 @@ extern "C"
#include <ntos/types.h> #include <ntos/types.h>
#include <ntos/time.h> #include <ntos/time.h>
#include <ntos/cdrom.h>
#include <ntos/disk.h> #include <ntos/disk.h>
#include <ntos/registry.h> #include <ntos/registry.h>
#include <ntos/port.h> #include <ntos/port.h>

View file

@ -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 <ekohl@rz-online.de>
* 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 */