📄 cd.h
字号:
)
#define CdRvdDescType(R,F) ( \
FlagOn( (F), VCB_STATE_HSG ) ? \
((PRAW_HSG_VD) (R))->DescType : \
((PRAW_ISO_VD) (R))->DescType \
)
#define CdRvdEsc(R,F) ( \
FlagOn( (F), VCB_STATE_HSG ) ? \
((PRAW_HSG_VD) (R))->CharSet : \
((PRAW_ISO_VD) (R))->CharSet \
)
#define CdRvdVolId(R,F) ( \
FlagOn( (F), VCB_STATE_HSG ) ? \
((PRAW_HSG_VD) (R))->VolumeId : \
((PRAW_ISO_VD) (R))->VolumeId \
)
#define CdRvdBlkSz(R,F) ( \
FlagOn( (F), VCB_STATE_HSG ) ? \
((PRAW_HSG_VD) (R))->LogicalBlkSzI :\
((PRAW_ISO_VD) (R))->LogicalBlkSzI \
)
#define CdRvdPtLoc(R,F) ( \
FlagOn( (F), VCB_STATE_HSG ) ? \
((PRAW_HSG_VD) (R))->PathTabLocI[0]:\
((PRAW_ISO_VD) (R))->PathTabLocI[0] \
)
#define CdRvdPtSz(R,F) ( \
FlagOn( (F), VCB_STATE_HSG ) ? \
((PRAW_HSG_VD) (R))->PathTableSzI : \
((PRAW_ISO_VD) (R))->PathTableSzI \
)
#define CdRvdDirent(R,F) ( \
FlagOn( (F), VCB_STATE_HSG ) ? \
((PRAW_HSG_VD) (R))->RootDe : \
((PRAW_ISO_VD) (R))->RootDe \
)
#define CdRvdVolSz(R,F) ( \
FlagOn( (F), VCB_STATE_HSG ) ? \
((PRAW_HSG_VD) (R))->VolSpaceI : \
((PRAW_ISO_VD) (R))->VolSpaceI \
)
//
// This structure is used to overlay a region of a disk sector
// to retrieve a single directory entry. There is a difference
// in the file flags between the ISO and HSG version and a
// additional byte in the ISO for the offset from Greenwich time.
//
// The disk structure is aligned on a word boundary, so any 32
// bit fields will be represented as an array of 16 bit fields.
//
typedef struct _RAW_DIRENT {
UCHAR DirLen;
UCHAR XarLen;
UCHAR FileLoc[4];
UCHAR FileLocMot[4];
UCHAR DataLen[4];
UCHAR DataLenMot[4];
UCHAR RecordTime[6];
UCHAR FlagsHSG;
UCHAR FlagsISO;
UCHAR IntLeaveSize;
UCHAR IntLeaveSkip;
UCHAR Vssn[2];
UCHAR VssnMot[2];
UCHAR FileIdLen;
UCHAR FileId[MAX_FILE_ID_LENGTH];
} RAW_DIRENT;
typedef RAW_DIRENT RAW_DIR_REC;
typedef RAW_DIRENT *PRAW_DIR_REC;
typedef RAW_DIRENT *PRAW_DIRENT;
#define CD_ATTRIBUTE_HIDDEN (0x01)
#define CD_ATTRIBUTE_DIRECTORY (0x02)
#define CD_ATTRIBUTE_ASSOC (0x04)
#define CD_ATTRIBUTE_MULTI (0x80)
#define CD_BASE_YEAR (1900)
#define MIN_RAW_DIRENT_LEN (FIELD_OFFSET( RAW_DIRENT, FileId ) + 1)
#define BYTE_COUNT_8_DOT_3 (24)
#define SHORT_NAME_SHIFT (5)
//
// The following macro recovers the correct flag field.
//
#define CdRawDirentFlags(IC,RD) ( \
FlagOn( (IC)->Vcb->VcbState, VCB_STATE_HSG) ? \
(RD)->FlagsHSG : \
(RD)->FlagsISO \
)
//
// The following macro converts from CD time to NT time. On ISO
// 9660 media, we now pay attention to the GMT offset (integer
// increments of 15 minutes offset from GMT). HSG does not record
// this field.
//
// The restriction to the interval [-48, 52] comes from 9660 8.4.26.1
//
// VOID
// CdConvertCdTimeToNtTime (
// IN PIRP_CONTEXT IrpContext,
// IN PCHAR CdTime,
// OUT PLARGE_INTEGER NtTime
// );
//
#define GMT_OFFSET_TO_NT ((LONGLONG) 15 * 60 * 1000 * 1000 * 10)
#define CdConvertCdTimeToNtTime(IC,CD,NT) { \
TIME_FIELDS _TimeField; \
CHAR GmtOffset; \
_TimeField.Year = (CSHORT) *((PCHAR) CD) + CD_BASE_YEAR; \
_TimeField.Month = (CSHORT) *(Add2Ptr( CD, 1, PCHAR )); \
_TimeField .Day = (CSHORT) *(Add2Ptr( CD, 2, PCHAR )); \
_TimeField.Hour = (CSHORT) *(Add2Ptr( CD, 3, PCHAR )); \
_TimeField.Minute = (CSHORT) *(Add2Ptr( CD, 4, PCHAR )); \
_TimeField.Second = (CSHORT) *(Add2Ptr( CD, 5, PCHAR )); \
_TimeField.Milliseconds = (CSHORT) 0; \
RtlTimeFieldsToTime( &_TimeField, NT ); \
if (!FlagOn((IC)->Vcb->VcbState, VCB_STATE_HSG) && \
((GmtOffset = *(Add2Ptr( CD, 6, PCHAR ))) != 0 ) && \
(GmtOffset >= -48 && GmtOffset <= 52)) { \
(NT)->QuadPart += -GmtOffset * GMT_OFFSET_TO_NT; \
} \
}
//
// The on-disk representation of a Path Table entry differs between
// the ISO version and the HSG version. The fields are the same
// and the same size, but the positions are different.
//
typedef struct _RAW_PATH_ISO {
UCHAR DirIdLen;
UCHAR XarLen;
USHORT DirLoc[2];
USHORT ParentNum;
UCHAR DirId[MAX_FILE_ID_LENGTH];
} RAW_PATH_ISO;
typedef RAW_PATH_ISO *PRAW_PATH_ISO;
typedef RAW_PATH_ISO RAW_PATH_ENTRY;
typedef RAW_PATH_ISO *PRAW_PATH_ENTRY;
typedef struct _RAW_PATH_HSG {
USHORT DirLoc[2];
UCHAR XarLen;
UCHAR DirIdLen;
USHORT ParentNum;
UCHAR DirId[MAX_FILE_ID_LENGTH];
} RAW_PATH_HSG;
typedef RAW_PATH_HSG *PRAW_PATH_HSG;
#define MIN_RAW_PATH_ENTRY_LEN (FIELD_OFFSET( RAW_PATH_ENTRY, DirId ) + 1)
//
// The following macros are used to recover the different fields of the
// Path Table entries. The macro to recover the disk location of the
// directory must copy it into a different variable for alignment reasons.
//
// CdRawPathIdLen - Length of directory name in bytes
// CdRawPathXar - Number of Xar blocks
// CdRawPathLoc - Address of unaligned ulong for disk offset in blocks
//
#define CdRawPathIdLen(IC, RP) ( \
FlagOn( (IC)->Vcb->VcbState, VCB_STATE_HSG ) ? \
((PRAW_PATH_HSG) (RP))->DirIdLen : \
(RP)->DirIdLen \
)
#define CdRawPathXar(IC, RP) ( \
FlagOn( (IC)->Vcb->VcbState, VCB_STATE_HSG ) ? \
((PRAW_PATH_HSG) (RP))->XarLen : \
(RP)->XarLen \
)
#define CdRawPathLoc(IC, RP) ( \
FlagOn( (IC)->Vcb->VcbState, VCB_STATE_HSG ) ? \
((PRAW_PATH_HSG) (RP))->DirLoc : \
(RP)->DirLoc \
)
//
// System use are for XA data. The following is the system use area for
// directory entries on XA data disks.
//
typedef struct _SYSTEM_USE_XA {
//
// Owner ID. Not used in this version.
//
UCHAR OwnerId[4];
//
// Extent attributes. Only interested if mode2 form2 or digital audio.
// This is stored big endian. We will define the attribute flags so
// we can ignore this fact.
//
USHORT Attributes;
//
// XA signature. This value must be 'XA'.
//
USHORT Signature;
//
// File Number.
//
UCHAR FileNumber;
//
// Not used in this version.
//
UCHAR Reserved[5];
} SYSTEM_USE_XA;
typedef SYSTEM_USE_XA *PSYSTEM_USE_XA;
#define SYSTEM_USE_XA_FORM1 (0x0008)
#define SYSTEM_USE_XA_FORM2 (0x0010)
#define SYSTEM_USE_XA_DA (0x0040)
#define SYSTEM_XA_SIGNATURE (0x4158)
typedef enum _XA_EXTENT_TYPE {
Form1Data = 0,
Mode2Form2Data,
CDAudio
} XA_EXTENT_TYPE;
typedef XA_EXTENT_TYPE *PXA_EXTENT_TYPE;
#endif // _CDFS_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -