📄 udfstruc.h
字号:
//
// This is the mapping table. A PCB will be dynamically sized
// according to the number of partitions forming the volume.
//
PARTITION Partition[0];
} PCB, *PPCB;
//
// Indicate what kinds of partitions are contained for quick checks.
//
#define PCB_FLAG_PHYSICAL_PARTITION 0x0001
#define PCB_FLAG_VIRTUAL_PARTITION 0x0002
#define PCB_FLAG_SPARABLE_PARTITION 0x0004
//
// The Vmcb structure is a double mapped structure for mapping
// between VBNs and LBNs using the MCB structures. The whole structure
// is also protected by a private mutex. This record must be allocated
// from non-paged pool.
//
//
// We use an #if to snip out historical code in the Vmcb package that
// dealt with write issues, leaving it for the future.
//
#define VMCB_WRITE_SUPPORT 0
typedef struct _VMCB {
KMUTEX Mutex;
MCB VbnIndexed; // maps VBNs to LBNs
MCB LbnIndexed; // maps LBNs to VBNs
ULONG MaximumLbn;
ULONG SectorSize;
#if VMCB_WRITE_SUPPORT
RTL_GENERIC_TABLE DirtyTable;
#endif // VMCB_WRITE_SUPPORT
} VMCB, *PVMCB;
//
// The Vcb (Volume control block) record corresponds to every
// volume mounted by the file system. They are ordered in a queue off
// of UdfData.VcbQueue.
//
// The Vcb will be in several conditions during its lifespan.
//
// NotMounted - Disk is not currently mounted (i.e. removed
// from system) but cleanup and close operations are
// supported.
//
// MountInProgress - State of the Vcb from the time it is
// created until it is successfully mounted or the mount
// fails.
//
// Mounted - Volume is currently in the mounted state.
//
// Invalid - User has invalidated the volume. Only legal operations
// are cleanup and close.
//
// DismountInProgress - We have begun the process of tearing down the
// Vcb. It can be deleted when all the references to it
// have gone away.
//
typedef enum _VCB_CONDITION {
VcbNotMounted = 0,
VcbMountInProgress,
VcbMounted,
VcbInvalid,
VcbDismountInProgress
} VCB_CONDITION;
typedef struct _VCB {
//
// The type and size of this record (must be UDFS_NTC_VCB)
//
NODE_TYPE_CODE NodeTypeCode;
NODE_BYTE_SIZE NodeByteSize;
//
// Vpb for this volume.
//
PVPB Vpb;
//
// Pcb for this volume.
//
PPCB Pcb;
//
// Device object for the driver below us.
//
PDEVICE_OBJECT TargetDeviceObject;
//
// Link into queue of Vcb's in the UdfData structure. We will create a union with
// a LONGLONG to force the Vcb to be quad-aligned.
//
union {
LIST_ENTRY VcbLinks;
LONGLONG Alignment;
};
//
// State flags and condition for the Vcb.
//
ULONG VcbState;
VCB_CONDITION VcbCondition;
//
// File object used to lock the volume.
//
PFILE_OBJECT VolumeLockFileObject;
//
// Media change count from device driver for bulletproof detection
// of media movement
//
ULONG MediaChangeCount;
//
// Logical block size for this volume.
//
ULONG SectorSize;
//
// Associated shift size
//
ULONG SectorShift;
//
// LSN of the bounds that CD-UDF defines.
//
// S - start of the session that contains the AVD @ +256
// N - end of the disc, another chance to find AVD @ -256,
// and discovery of the VAT ICB.
//
// N may be unset until late in the mount sequence for a volume, since
// the device may not respond to CD-style TOC requests, and only then
// be a guess based on the partitons we find. S will be zero except in
// the case of CD-UDF. In a mounted system, S will correspond to where
// we started finding the volume descriptors that let us proceed.
//
ULONG BoundS;
ULONG BoundN;
//
// Various counts for this Vcb.
//
// VcbCleanup - Open handles left on this system.
// VcbReference - Number of reasons this Vcb is still present.
// VcbUserReference - Number of user file objects still present.
//
ULONG VcbCleanup;
ULONG VcbReference;
ULONG VcbUserReference;
//
// These are the number of times a mounted Vcb will be referenced on behalf
// of the system. See commentary in udfdata.h.
//
ULONG VcbResidualReference;
ULONG VcbResidualUserReference;
//
// Fcb for the Volume Dasd file, root directory and the Vmcb-mapped Metadata stream.
// The VAT Fcb is only created on CD UDF media, for the Virtual Allocation Table.
//
struct _FCB *VolumeDasdFcb;
struct _FCB *RootIndexFcb;
struct _FCB *MetadataFcb;
struct _FCB *VatFcb;
//
// Vmcb for the metadata stream
//
VMCB Vmcb;
//
// Vcb resource. This is used to synchronize open/cleanup/close operations.
//
ERESOURCE VcbResource;
//
// File resource. This is used to synchronize all file operations except
// open/cleanup/close.
//
ERESOURCE FileResource;
//
// Vcb fast mutex. This is used to synchronize the fields in the Vcb
// when modified when the Vcb is not held exclusively. Included here
// are the count fields and Fcb table.
//
// We also use this to synchronize changes to the Fcb reference field.
//
FAST_MUTEX VcbMutex;
PVOID VcbLockThread;
//
// The following is used to synchronize the dir notify package.
//
PNOTIFY_SYNC NotifySync;
//
// The following is the head of a list of notify Irps.
//
LIST_ENTRY DirNotifyList;
//
// Fcb table. Synchronized with the Vcb fast mutex.
//
RTL_GENERIC_TABLE FcbTable;
} VCB, *PVCB;
#define VCB_STATE_LOCKED (0x00000001)
#define VCB_STATE_REMOVABLE_MEDIA (0x00000002)
#define VCB_STATE_NOTIFY_REMOUNT (0x00000004)
#define VCB_STATE_METHOD_2_FIXUP (0x00000008)
//
// The Volume Device Object is an I/O system device object with a
// workqueue and an VCB record appended to the end. There are multiple
// of these records, one for every mounted volume, and are created during
// a volume mount operation. The work queue is for handling an overload
// of work requests to the volume.
//
typedef struct _VOLUME_DEVICE_OBJECT {
DEVICE_OBJECT DeviceObject;
//
// The following field tells how many requests for this volume have
// either been enqueued to ExWorker threads or are currently being
// serviced by ExWorker threads. If the number goes above
// a certain threshold, put the request on the overflow queue to be
// executed later.
//
ULONG PostedRequestCount;
//
// The following field indicates the number of IRP's waiting
// to be serviced in the overflow queue.
//
ULONG OverflowQueueCount;
//
// The following field contains the queue header of the overflow queue.
// The Overflow queue is a list of IRP's linked via the IRP's ListEntry
// field.
//
LIST_ENTRY OverflowQueue;
//
// The following spinlock protects access to all the above fields.
//
KSPIN_LOCK OverflowQueueSpinLock;
//
// This is the file system specific volume control block.
//
VCB Vcb;
} VOLUME_DEVICE_OBJECT, *PVOLUME_DEVICE_OBJECT;
//
// Udfs file id is a large integer. This corresponds to the FileInternalInformation
// query type and is used for internal FCB indexing.
//
typedef LARGE_INTEGER FILE_ID, *PFILE_ID;
//
// Lcb (Link Control Block), which corresponds to a link from a directory (or in
// the future, other container objects) to a file (UDF File Identifier). There is
// one of these for each name tuple in a prefix table.
//
typedef struct _LCB {
//
// Type and size of this record (must be UDFS_NTC_LCB)
//
NODE_TYPE_CODE NodeTypeCode;
NODE_BYTE_SIZE NodeByteSize;
//
// Pointer to the Parent Fcb for this entry and queue for Parent to
// find all referencing Lcbs. Corresponds to Fcb->ChildLcbQueue.
//
LIST_ENTRY ParentFcbLinks;
struct _FCB *ParentFcb;
//
// Pointer to Child (referenced) Fcb for this entry and queue for Child
// to find all referencing Lcbs. Corresponds to Fcb->ParentLcbQueue.
//
LIST_ENTRY ChildFcbLinks;
struct _FCB *ChildFcb;
//
// Number of extra realtime references made to this Lcb.
//
ULONG Reference;
//
// Flags indicating the state of this Lcb.
//
ULONG Flags;
//
// File attributes to be merged with the child Fcb. UDF seperates interesting
// information into the FID and FE so, properly, the name link (corresponding to
// a FID) must record some extra information.
//
ULONG FileAttributes;
//
// Splay links in the prefix tree.
//
RTL_SPLAY_LINKS Links;
//
// The name of this link.
//
UNICODE_STRING FileName;
} LCB, *PLCB;
#define LCB_FLAG_IGNORE_CASE 0x00000001
#define LCB_FLAG_SHORT_NAME 0x00000002
#define LCB_FLAG_POOL_ALLOCATED 0x00000004
//
// We build a lookaside of Lcb capable of holding a reasonably sized name.
//
#define SIZEOF_LOOKASIDE_LCB ( sizeof( LCB ) + ( sizeof( WCHAR ) * 16 ))
//
// The following two structures are the separate union structures for
// data and index Fcb's.
//
typedef enum _FCB_CONDITION {
FcbGood = 1,
FcbBad,
FcbNeedsToBeVerified
} FCB_CONDITION;
typedef struct _FCB_NONPAGED {
//
// Type and size of this record must be UDFS_NTC_FCB_NONPAGED
//
NODE_TYPE_CODE NodeTypeCode;
NODE_BYTE_SIZE NodeByteSize;
//
// The following field contains a record of special pointers used by
// MM and Cache to manipluate section objects. Note that the values
// are set outside of the file system. However the file system on an
// open/create will set the file object's SectionObject field to
// point to this field
//
SECTION_OBJECT_POINTERS SegmentObject;
//
// This is the resource structure for this Fcb.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -