Charles Davis : ntdll: Partially implement CDROM_GetControl() on Mac OS.

Alexandre Julliard julliard at winehq.org
Tue Oct 20 10:33:39 CDT 2009


Module: wine
Branch: master
Commit: d22abc20a325bd54497319018a926e58db4792f0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d22abc20a325bd54497319018a926e58db4792f0

Author: Charles Davis <cdavis at mymail.mines.edu>
Date:   Mon Oct 19 12:15:11 2009 -0600

ntdll: Partially implement CDROM_GetControl() on Mac OS.

Only the speed is returned.

---

 dlls/ntdll/cdrom.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/dlls/ntdll/cdrom.c b/dlls/ntdll/cdrom.c
index 3e520ec..d9ab7e2 100644
--- a/dlls/ntdll/cdrom.c
+++ b/dlls/ntdll/cdrom.c
@@ -670,10 +670,20 @@ static NTSTATUS CDROM_GetStatusCode(int io)
  *		CDROM_GetControl
  *
  */
-static NTSTATUS CDROM_GetControl(int dev, CDROM_AUDIO_CONTROL* cac)
+static NTSTATUS CDROM_GetControl(int dev, int fd, CDROM_AUDIO_CONTROL* cac)
 {
-    cac->LbaFormat = 0; /* FIXME */
+#ifdef __APPLE__
+    uint16_t speed;
+    int io = ioctl( fd, DKIOCCDGETSPEED, &speed );
+    if (io != 0) return CDROM_GetStatusCode( io );
+    /* DKIOCCDGETSPEED returns the speed in kilobytes per second,
+     * so convert to logical blocks (assumed to be ~2 KB).
+     */
+    cac->LogicalBlocksPerSecond = speed/2;
+#else
     cac->LogicalBlocksPerSecond = 1; /* FIXME */
+#endif
+    cac->LbaFormat = 0; /* FIXME */
     return  STATUS_NOT_SUPPORTED;
 }
 
@@ -2762,7 +2772,7 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
         sz = sizeof(CDROM_AUDIO_CONTROL);
         if (lpInBuffer != NULL || nInBufferSize != 0) status = STATUS_INVALID_PARAMETER;
         else if (nOutBufferSize < sz) status = STATUS_BUFFER_TOO_SMALL;
-        else status = CDROM_GetControl(dev, lpOutBuffer);
+        else status = CDROM_GetControl(dev, fd, lpOutBuffer);
         break;
 
     case IOCTL_CDROM_GET_DRIVE_GEOMETRY:




More information about the wine-cvs mailing list