一番最低のレベルではあるものの、データの抜き出しに一応成功したとはいえ、タイトル単位で抜き出せない事には意味が無い。
そのためには、UDF(Universal Disk Format)を勉強することに…
2007年2月末時点では、
- UDF 2.6
- ECMA-167 3rd Edition
が最新らしい。
とりあえず、
- Volume and Boot Blockから始まり、Volume Structureが続く
- Volume and Boot Blockは、Volume Structure Descriptorから始まり、StandardIdentifierの値によってDescriptorの意味を示す(ECMA-167 Part2)
- Volume Structureは、Descriptor Tagから始まり、TagIdentifierの値によってDescriptorの意味を示す(ECMA-167 Part3)
- Descriptorデータはバイト単位で記録され、ワードデータの場合、Little Endianで記録される(ECMA-167 Part1 7.1)
- DVDメディアのセクタ長は2048バイト
- セクタ番号は、0から始める
くらいは、理解していないと話しにならない模様。
※packが2048バイト固定だったのは、ここから来ている??
Volume and Boot Block
[volume recognition sequence] {
<CD-ROM Volume Descriptor Set> 0+1
[Extended Area] {
<Beginning Extended Area Descriptor> 1+
{ <Volume Structure Descriptor> | <Boot Descriptor> } n+
<Terminating Extended Area Descriptor> 1+
} 0+
}
Volume Structure Descriptorは、2048バイト長のデータで、以下の構造となっている
struct {
Uint8 StructureType;
byte StandardIdentifier[5];
Uint8 StructureVersion;
byte StructureData[2041];
};
StandardIdentifierの値は、以下の通り
"BEA01" |
Beginning Extended Area Descriptor |
"TEA01" |
Terminating Extended Area Descriptor |
"BOOT2" |
Boot Descriptor |
"CD001" |
Volume Structure Descriptor |
"CDW02" |
Volume Structure Descriptor |
"NSR02" |
Volume Structure Descriptor(NSR Descriptor) |
"NSR03" |
Volume Structure Descriptor(NSR Descriptor) |
Volume Structure
Descriptor Tagは16バイト長のデータで、以下の構造となっている
struct tag {
Uint16 TagIdentifier;
Uint16 DescriptorVersion;
byte TagChecksum;
byte Reserved;
Uint16 TagSerialNumber;
Uint16 DescriptorCRC;
Uint16 DescriptorCRCLength;
Uint32 TagLocation;
};
- Descriptorの意味は、TagIdentifierで区別される、具体的な値はUDFのドキュメントには記載されておらず、ECMA-167を参照する必要がある
- TagChecksumは、tagの0~3、5~15バイト目の各値を加算した値の下位8bit
- 16バイト目以降の有効データ長は、DescriptorCRCLengthと一致する
- TagLocationには自身のセクタ値を記録する。つまり、複数のディスクを使用している環境でもセクタの配置を追いかける事が可能
TagIdentifierの値は、以下の通り
1 |
Primary Volume Descriptor |
|
2 |
Anchor Volume Descriptor Pointer |
|
3 |
Volume Descriptor Pointer |
|
4 |
Implementation Use Volume Descriptor |
|
5 |
Partition Descriptor |
|
6 |
Logivcal Volume Descriptor |
|
7 |
Unallocated Space Descriptor |
|
8 |
Terminating Descriptor |
|
9 |
Logical Volume Integrity Descriptor |
|
256 |
File Set Descriptor |
|
257 |
File Identifier Descriptor |
※ |
258 |
Allocation Extent Descriptor |
|
259 |
Indirect Entry |
|
260 |
Terminal Entry |
|
261 |
File Entry |
|
262 |
Extended Attribute Header Descriptor |
※ |
263 |
Unallocated Space Entry |
|
264 |
Space Bitmap Descriptor |
|
265 |
Partition Integrity Entry |
|
266 |
Extended File Entry |
|
※ File Identifier Descriptorと、Extended Attribute Header Descriptorは、セクタの先頭以外の場所に配置可能 → 他のDescriptorのデータ的な使われ方が可能
Volume Descriptorは、
- Primary Volume Descriptor
- Implementation Use Volume Descriptor
- Partition Descriptor
- Logivcal Volume Descriptor
- Unallocated Space Descriptor
- Terminating Descriptor
の順で配置される。
さらに、
- その他のDescriptor
- Anchor Volume Descriptor Pointer
- 論理セクタ0
と続くらしい。
Allocation descriptors
あるデータが配置されている位置、長さを指定するための記述子で、
- Short Allocation Descriptor (short_ad)
- Long Allocation Descriptor (short_ad)
- Extended Allocation Descriptor (ext_ad)
の三種類がある。
short_ad
struct long_ad {
Uint32 ExtentLength;
Uint32 ExtentPoint;
};
- ExtentLengthは、
- 下位30bitは、データの長さを表す
- 上位2ビットは、Allocation状態を表す
- 0: Extent recorded and allocatted(記録済みで確保済み)
- 1: Extent not recorded but allocatted(未記録だが確保済み)
- 2: Extent not recorded and not allocatted(未記録で未確保)
- 3: The extent is the next extent of allocation dcescriptor(次のAllocation descriptorsの位置)
- ExtentPointは、(一般に)論理セクタ番号を示す
long_ad
short_adが自パーティションに対して位置、長さを指定するのに対し、long_adは、他のパーティションの位置、長さを指定出来ると言う事らしい。
ExtentLengthの意味は、short_adと同じ。
struct lb_ad {
Uint32 LogicalBlockNumber;
Uint16 PartitionReferenceNumber;
};
struct long_ad {
Uint32 ExtentLength;
lb_ad ExtentLocation;
byte ImplementationUse[6];
};
ext_ad
こんなのも定義されている。
struct ext_ad {
Uint32 ExtentLength;
Uint32 RecordedLength;
Uint32 InformationLength;
lb_ad ExtentLocation;
byte ImplementationUse[2];
};
最終更新:2007年03月14日 16:23