Page 1 of 1

ISO9660 Question

Posted: Mon Jun 07, 2010 5:17 pm
by Wolf9466
I was following the tutorial in the wiki, and I just had a quick question. I have read in the root directory, and I take the Location of Extent and Data length values, and I go to it, but how to I scan the root directory for a file name?

Re: ISO9660 Question

Posted: Tue Jun 08, 2010 4:00 am
by StephanvanSchaik
Wolf9466 wrote:I was following the tutorial in the wiki, and I just had a quick question. I have read in the root directory, and I take the Location of Extent and Data length values, and I go to it, but how to I scan the root directory for a file name?
When the root directory is loaded you have to search for the directory/file entries. The first one is at the start of the root directory block, and all others follow that extent directly with a potential gap. Offset 0 (in bytes) of a directory entry represents the size of that entry. Offset 32 (in bytes) represents the size occupied by the filename following at offset 33. The next directory entry can be found by using the number located at offset 0 as it should be added to the offset of the root directory extent. There's one thing I haven't explained yet and that is the potential gap. This gap exists when your root directory is bigger than 2kB. Normally each logical block on a CD-ROM is 2048 bytes. In case the root directory uses two or more blocks, there might be a gap at the end of each block. This is simply due the fact that directory entries are never split up and that they should be located in the next block if they won't fit in the current block.


Regards,
Stephan J.R. van Schaik.

Re: ISO9660 Question

Posted: Tue Jun 08, 2010 2:51 pm
by Wolf9466
So, say I have the root directory structure read in, how would I find a file by name that is in the root directory?
(I'm sorry, I didn't really understand your post well, could you post a snippet of code, maybe?)