📄 udf.h
字号:
#define UnicodeToUpper(c) (c)
#define INT16 LONG
#define UINT16 ULONG
#define UNICODE_CHAR WCHAR
#define PERIOD (L'.')
#define SPACE (L' ')
#define CRC_MARK (L'#')
#define ILLEGAL_CHAR_MARK (L'_')
//
// Place a non-tail recursable depth limit on ICB hierarchies. We cannot read
// ICB hierarchies that are deeper than this.
//
#define UDF_ICB_RECURSION_LIMIT 10
//
// Entity ID (REGID) Suffixes are used in UDF to encode extra information away from
// the string data in the Identifier. See UDF 2.1.4.2.
//
//
// A Domain Suffix is encoded for the Logical Volume Descriptor and File Set Descriptor
//
typedef struct _UDF_SUFFIX_DOMAIN {
USHORT UdfRevision;
UCHAR Flags;
UCHAR Reserved[5];
} UDF_SUFFIX_DOMAIN, *PUDF_SUFFIX_DOMAIN;
#define UDF_SUFFIX_DOMAIN_FLAG_HARD_WRITEPROTECT 0x01
#define UDF_SUFFIX_DOMAIN_FLAG_SOFT_WRITEPROTECT 0x02
//
// A UDF Suffix is encoded for extended attributes, Implementation Use Volume
// Descriptors and VATs (among others).
//
typedef struct _UDF_SUFFIX_UDF {
USHORT UdfRevision;
UCHAR OSClass;
UCHAR OSIdentifier;
UCHAR Reserved[4];
} UDF_SUFFIX_UDF, *PUDF_SUFFIX_UDF;
//
// An Implementation Suffix is encoded for almost every other structure containing
// an Entity ID.
//
typedef struct _UDF_SUFFIX_IMPLEMENTATION {
UCHAR OSClass;
UCHAR OSIdentifier;
UCHAR ImplementationUse[6];
} UDF_SUFFIX_IMPLEMENTATION, *PUDF_SUFFIX_IMPLEMENTATION;
//
// OS Classes and Identifiers are defined by OSTA as of UDF 1.50
//
// We also take the minor liberty of defining an invalid set for
// the purposes of hinting internally that we don't care about them.
// It is unlikely that UDF will ever hit 255, even though these are
// technically avaliable for allocation.
//
#define OSCLASS_INVALID 255
#define OSIDENTIFIER_INVALID 255
#define OSCLASS_UNDEFINED 0
#define OSCLASS_DOS 1
#define OSCLASS_OS2 2
#define OSCLASS_MACOS 3
#define OSCLASS_UNIX 4
#define OSCLASS_WIN9X 5
#define OSCLASS_WINNT 6
#define OSIDENTIFIER_DOS_DOS 0
#define OSIDENTIFIER_OS2_OS2 0
#define OSIDENTIFIER_MACOS_MACOS7 0
#define OSIDENTIFIER_UNIX_GENERIC 0
#define OSIDENTIFIER_UNIX_AIX 1
#define OSIDENTIFIER_UNIX_SOLARIS 2
#define OSIDENTIFIER_UNIX_HPUX 3
#define OSIDENTIFIER_UNIX_IRIX 4
#define OSIDENTIFIER_UNIX_LINUX 5
#define OSIDENTIFIER_UNIX_MKLINUX 6
#define OSIDENTIFIER_UNIX_FREEBSD 7
#define OSIDENTIFIER_WIN9X_WIN95 0
#define OSIDENTIFIED_WINNT_WINNT 0
//
// Character Set Lists are actually just a 32bit word where each bit N on/off specifies
// that Character Set N is used on the volume. Per UDF, the only character set we
// recognize is CS0, so construct a bitmask Character Set List for that. (1/7.2.11)
//
#define UDF_CHARSETLIST 0x00000001
//
// Generic partition map for UDF. This allows partition maps to be typed and the
// UDF entity identifier for the various type 2 maps to be inspected.
//
typedef struct _PARTMAP_UDF_GENERIC {
UCHAR Type; // Partition Map Type = 2
UCHAR Length; // Partition Map Length = 64
UCHAR Reserved2[2]; // Reserved Padding
REGID PartID; // Paritition Entity Identifier
UCHAR Reserved24[28]; // Reserved Padding
} PARTMAP_UDF_GENERIC, *PPARTMAP_UDF_GENERIC;
//
// UDF 1.50 CD UDF Partition Types
//
//////////
// UDF Virtual Partitions are identified via a type 2 partition map of the following form.
//////////
typedef struct _PARTMAP_VIRTUAL {
UCHAR Type; // Partition Map Type = 2
UCHAR Length; // Partition Map Length = 64
UCHAR Reserved2[2]; // Reserved Padding
REGID PartID; // Paritition Entity Identifier
// == UdfVirtualPartitionDomainIdentifier
USHORT VolSetSeq; // Volume Set Sequence
USHORT Partition; // Related Partition
UCHAR Reserved40[24]; // Reserved Padding
} PARTMAP_VIRTUAL, *PPARTMAP_VIRTUAL;
//
// A VAT minimally contains a mapping for a single block, the REGID identifying
// the VAT, and the identification of a previous VAT ICB location. We also identify
// an arbitrary sanity limit that the VAT isn't bigger than 8mb since it is extremely
// difficult to imagine such a VAT existing in practice since each sector describes
// (on most of our media) 2048/4 = 512 entries ... meaning at 8mb the VAT would
// describe ~2^21 blocks.
//
#define UDF_CDUDF_TRAILING_DATA_SIZE (sizeof(REGID) + sizeof(ULONG))
#define UDF_CDUDF_MINIMUM_VAT_SIZE (sizeof(ULONG) + UDF_CDUDF_TRAILING_DATA_SIZE)
#define UDF_CDUDF_MAXIMUM_VAT_SIZE (UDF_CDUDF_MINIMUM_VAT_SIZE + (8 * 1024 * 1024))
//////////
// UDF Sparable Partitions are identified via a type 2 partition map of the following form.
//////////
typedef struct _PARTMAP_SPARABLE {
UCHAR Type; // Partition Map Type = 2
UCHAR Length; // Partition Map Length = 64
UCHAR Reserved2[2]; // Reserved Padding
REGID PartID; // Paritition Entity Identifier
// == UdfSparablePartitionDomainIdentifier
USHORT VolSetSeq; // Volume Set Sequence
USHORT Partition; // Related Partition
USHORT PacketLength; // Packet Length == 32 (number of data blocks
// per packet)
UCHAR NumSparingTables; // Number of pparing tables on the media
UCHAR Reserved43; // Reserved Padding
ULONG TableSize; // Size of sparing tables
ULONG TableLocation[4]; // Location of each sparing table (each
// sparing table should be in a distinct packet)
} PARTMAP_SPARABLE, *PPARTMAP_SPARABLE;
//
// Sparing tables lead off with this header structure.
//
typedef struct _SPARING_TABLE_HEADER {
DESTAG Destag; // Ident = 0
REGID RegID; // == UdfSparingTableIdentifier
USHORT TableEntries; // Number of entries in the table
USHORT Reserved50; // Reserved Padding
ULONG Sequence; // Sequence Number (incremented on rewrite of table)
} *PSPARING_TABLE_HEADER, SPARING_TABLE_HEADER;
//
// Sparing table map entries.
//
typedef struct _SPARING_TABLE_ENTRY {
ULONG Original; // Original LBN
ULONG Mapped; // Mapped PSN
} *PSPARING_TABLE_ENTRY, SPARING_TABLE_ENTRY;
//
// Fixed values for original sectors, indicating that either the
// mapped packet is avaliable for sparing use or is defective.
//
#define UDF_SPARING_AVALIABLE 0xffffffff
#define UDF_SPARING_DEFECTIVE 0xfffffff0
//
// The unit of media in each sparing packet is fixed at 32 physical sectors.
//
#define UDF_SPARING_PACKET_LENGTH CDRW_PACKET_LENGTH
#endif // _UDF_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -