Implemented IOCTL_CDROM_GET_DRIVE_GEOMETRY.
authorEric Kohl <eric.kohl@reactos.org>
Wed, 10 Apr 2002 17:02:22 +0000 (17:02 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Wed, 10 Apr 2002 17:02:22 +0000 (17:02 +0000)
Some fixes to enable mounting of cdroms.

svn path=/trunk/; revision=2838

reactos/drivers/storage/atapi/atapi.c
reactos/drivers/storage/cdrom/cdrom.c
reactos/include/ddk/ntddk.h
reactos/include/ntos/cdrom.h [new file with mode: 0644]

index 33687c0..4233dbd 100644 (file)
@@ -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;
index 05a7d43..d6b69bd 100644 (file)
@@ -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;
index 2ea7236..48afd72 100644 (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
  * PROJECT:        ReactOS kernel
@@ -26,6 +26,7 @@ extern "C"
 
 #include <ntos/types.h>
 #include <ntos/time.h>
+#include <ntos/cdrom.h>
 #include <ntos/disk.h>
 #include <ntos/registry.h>
 #include <ntos/port.h>
diff --git a/reactos/include/ntos/cdrom.h b/reactos/include/ntos/cdrom.h
new file mode 100644 (file)
index 0000000..badc7f4
--- /dev/null
@@ -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 */