I was wondering if anyone knew of a way in which I can just make a byte for byte copy of the data on a CD via programming? Are there some system calls available that can do this stuff?
I have a CD that is somehow corrupted or otherwise damaged, making some of the files inaccessible through explorer, etc. I know that there is information on there, and I would like to be able to make a copy of it (even in its damaged state) but of course I can't do that through the file system.
A CD frame is 2352 bytes. For a data CD, this is 2048 bytes of data + miscellaneous headers and ECC, but you can read most of the raw frame data. The drive may trim off a few bytes. So bypassing the ISO 9660 filesystem and reading the CD in raw mode is your best bet. Reads will fail with an error on unrecoverable frames, but you may be able to seek past them and just start reading the next frame.
On linux you would open the low level SCSI device, issue an ioctl to set CDROMREADRAW and use read and lseek as required.
Description of CD programming guts is here.
This page has info on reading CDROM on Windows, but does not explain whether it is returning raw data or not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With