patchCompact Disc Input and Control Library - Patches: patch #8302, Fix Win32 IOCTL SCSI_PASS_THROUGH...


patch #8302: Fix Win32 IOCTL SCSI_PASS_THROUGH mode

Submitted by:  None
Submitted on:  Sun 02 Feb 2014 02:48:58 PM UTC  
Category:  libcdio Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  Rocky Bernstein <rocky> Originator Email:  -email is unavailable-
Open/Closed:  Closed

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Wed 04 Jun 2014 05:20:41 AM UTC, comment #1: 

As before, this is fantasic! Thanks!

Rocky Bernstein <rocky>
Project AdministratorIn charge of this item.
Sun 02 Feb 2014 02:48:58 PM UTC, original submission:  

I tried libcdio on Windows and found that audio extraction only worked when using SCSI pass through in direct memory access mode (defining USE_PASSTHROUGH_DIRECT).

Buffered mode did not work, so I did some investigation to fix it. The main problem was that the maximum buffer size was defined to be 1024 bytes which is not enough to read CD sectors.

The attached patch includes the following changes:

- make buffer size unlimited again in buffered mode
- do not set Spt.Cdb[4] to buffer size as position of allocation size field depends on CDB size and is not always at byte 4, rely on caller to set the field as in direct mode
- fix memory leak in case of an error in buffered mode (p_sptwb was not freed)
- use stack allocated structure in direct mode to prevent constant reallocation of memory (note that before the patch, memory was allocated to include the buffer as well, which was pointless as an already allocated buffer is passed in direct mode)
- rename direct mode unsigned int parameters u_* to match buffered mode parameter names
- fix top comment to use correct parameter names and include u_cdb

Direct mode is functionally unchanged.

I tested both modes on different computers and they seem to work properly now.

Best regards,



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #30436:  libcdio-0.92-win32_ioctl.patch added by None (8KiB - text/x-diff)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rocky (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-06-04 rocky StatusNone => Done
        Assigned toNone => rocky
        Open/ClosedOpen => Closed
    2014-02-02 None Attached File- => Added libcdio-0.92-win32_ioctl.patch, #30436

    Back to the top

    Powered by Savane 3.7