… | |
… | |
51 | |
51 | |
52 | # guess |
52 | # guess |
53 | sysread IMAGE, my $buf, 2352*100; |
53 | sysread IMAGE, my $buf, 2352*100; |
54 | # find two volume descriptors... there _should_ be two ;) |
54 | # find two volume descriptors... there _should_ be two ;) |
55 | # ISO has <type>CD001, we ignore high sierra |
55 | # ISO has <type>CD001, we ignore high sierra |
56 | $buf =~ /\001CD001/g or die "unable to guess: no volume descriptor found"; |
56 | $buf =~ /\001CD001\001/g or die "unable to guess: no volume descriptor found"; |
57 | my $ofs1 = $-[0]; |
57 | my $ofs1 = $-[0]; |
58 | $buf =~ /[\001\002\377]CD001/g or die "unable to guess: no second volume descriptor found"; |
58 | $buf =~ /[\000\001\002\377]CD001\001/g or die "unable to guess: no second volume descriptor found"; |
59 | my $ofs2 = $-[0]; |
59 | my $ofs2 = $-[0]; |
60 | $size = $ofs2 - $ofs1; |
60 | $size = $ofs2 - $ofs1; |
61 | $offset = $ofs1 - 16 * 2048; # adjust offset so that sector 16 is the first volume header always. |
61 | $offset = $ofs1 - 16 * 2048; # adjust offset so that sector 16 is the first volume header always. |
62 | printf "\nGuessed blocksize %d and offset 0x%04x\n", $size, $offset; |
62 | printf "\nGuessed blocksize %d and offset 0x%04x\n", $size, $offset; |
63 | } |
63 | } |