Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read files from raw disk image (2352 bytes/sector)

Tags:

java

iso9660

I already asked something similar here several months ago, but of course the solution used in my update is not good, because I don't know at which offset starts the file I want, that code reads the entire file until it finds the wanted string and that's not convenient. That's why I searched for an ISO9660 File reader coded in Java and I came accross this project which reads perfectly ISO9660 files, but there are some file formats like bin and img that I'd like to be able to open.

Unfortunately, the code doesn't work because it expects the ISO9660 header \x01CD001\x01 at a prefixed offset (32768, right after the first 16 sectors, reserved for other purposes) as defined by the standard here and here:

7. The First Sixteen Sectors are Empty

The first sixteen sectors (sector numbers 0 to 15, inclusive) contain nothing but zeros. ISO9660 does not define the contents of these sectors, but for DOS they are apparently always written as zeros. They are apparently reserved for use by systems that can be booted from a CD-ROM.

In my case, i have img and bin disk images that have the \x01CD001\x01 header at offset 37656, 792 bytes after the end of the 18th sector. This makes the code throw an error.

Since there are softwares able to read the contents of a bin and img file without the need of cue or ccd file, what's the rule to fild the header in such cases? Is it a standard or do they brutally search the header through the bytes? If it's a standard where can I find any kind of documentation/implementation?

UPDATE: I found out that those files have a different sector size: 2352 bytes/sector, because they are raw copies of the CD-R.

like image 607
Vektor88 Avatar asked Mar 23 '14 11:03

Vektor88


1 Answers

Since I haven't found anything similar, and nobody gave an answer, I coded a solution by myself, you can find it here.

It's a library able to read files from disk images complying ISO9660 format. It both supports 2048 and 2352 bytes per sector images.

like image 54
Vektor88 Avatar answered Sep 28 '22 16:09

Vektor88