📄 udfstruc.h
字号:
)
//
// Following structure is used to queue a request to the delayed close queue.
// This structure should be the minimum block allocation size.
//
typedef struct _IRP_CONTEXT_LITE {
//
// Type and size of this record (must be UDFS_NTC_IRP_CONTEXT_LITE)
//
NODE_TYPE_CODE NodeTypeCode;
NODE_BYTE_SIZE NodeByteSize;
//
// Fcb for the file object being closed.
//
PFCB Fcb;
//
// List entry to attach to delayed close queue.
//
LIST_ENTRY DelayedCloseLinks;
//
// User reference count for the file object being closed.
//
ULONG UserReference;
//
// Real device object. This represents the physical device closest to the media.
//
PDEVICE_OBJECT RealDevice;
} IRP_CONTEXT_LITE, *PIRP_CONTEXT_LITE;
//
// Context structure for asynchronous I/O calls. Most of these fields
// are actually only required for the ReadMultiple routines, but
// the caller must allocate one as a local variable anyway before knowing
// whether there are multiple requests are not. Therefore, a single
// structure is used for simplicity.
//
typedef struct _UDF_IO_CONTEXT {
//
// These two fields are used for multiple run Io
//
LONG IrpCount;
PIRP MasterIrp;
NTSTATUS Status;
BOOLEAN AllocatedContext;
union {
//
// This element handles the asynchronous non-cached Io
//
struct {
PERESOURCE Resource;
ERESOURCE_THREAD ResourceThreadId;
ULONG RequestedByteCount;
};
//
// and this element handles the synchronous non-cached Io.
//
KEVENT SyncEvent;
};
} UDF_IO_CONTEXT, *PUDF_IO_CONTEXT;
//
// Following structure is used to track the top level request. Each Udfs
// Fsd and Fsp entry point will examine the top level irp location in the
// thread local storage to determine if this request is top level and/or
// top level Udfs. The top level Udfs request will remember the previous
// value and update that location with a stack location. This location
// can be accessed by recursive Udfs entry points.
//
typedef struct _THREAD_CONTEXT {
//
// UDFS signature. Used to confirm structure on stack is valid.
//
ULONG Udfs;
//
// Previous value in top-level thread location. We restore this
// when done.
//
PIRP SavedTopLevelIrp;
//
// Top level Udfs IrpContext. Initial Udfs entry point on stack
// will store the IrpContext for the request in this stack location.
//
PIRP_CONTEXT TopLevelIrpContext;
} THREAD_CONTEXT, *PTHREAD_CONTEXT;
//
// Following structure is used to build up static data for parse tables
//
typedef struct _PARSE_KEYVALUE {
PCHAR Key;
ULONG Value;
} PARSE_KEYVALUE, *PPARSE_KEYVALUE;
//
// Some macros for supporting the use of a Generic Table
// containing all the FCB and indexed by their FileId.
//
// The ISO 13346 lb_addr of the ICB hierarchy of the object
//
// { ULONG BlockNo; USHORT PartitionId }
//
// is encoded in the LowPart (BlockNo) and low 16 bits of the
// HighPart (PartitionId). The top 16 bits are reserved and are
// currently used to indicate the type of the object being referenced
// (file or directory).
//
// NOTE: this FileId prevents us from being able crack the name of
// object since an ICB hierarchy's contained direct File Entrys do
// not (and cannot) contain backpointers to the containing directory.
// In order to be able to crack paths, we need to be able to do a
// directory/dirent offset, which cannot fit in 64bits of FileId.
// A FileId must be 64bits since we export this in the FileInternalInforation
// query.
//
// Also, even through we are restricted to a single partition in this
// implementation, getting those "spare" 16bits isn't good enough to let us
// point directly into a directory's File Identifier. Files and by extension
// directories can exceed 2^32 bytes/entries. Once we have pointed at the
// parent dir, we are out of bits.
//
// The Id field is a LARGE_INTEGER where the High and Low parts can be
// accessed separately.
//
// The following macros are used to access the Fid fields.
//
// CdQueryFidDirentOffset - Accesses the Dirent offset field
// CdQueryFidPathTableNumber - Accesses the PathTable offset field
// CdSetFidDirentOffset - Sets the Dirent offset field
// CdSetFidPathTableNumber - Sets the PathTable ordinal field
// CdFidIsDirectory - Queries if directory bit is set
// CdFidSetDirectory - Sets directory bit
//
#define FID_DIR_MASK 0x80000000 // high order bit means directory.
#define UdfSetFidFromLbAddr(I, LBA) { (I).LowPart = (LBA).Lbn; \
(I).HighPart = (ULONG) (LBA).Partition; }
#define UdfGetFidLbn(I) ((I).LowPart)
#define UdfGetFidPartition(I) ((USHORT) (((I).HighPart & ~FID_DIR_MASK) & MAXUSHORT))
#define UdfGetFidReservedZero(I) ((I).HighPart & ~(FID_DIR_MASK|MAXUSHORT))
#define UdfSetFidFile(I) ClearFlag( (I).HighPart, FID_DIR_MASK )
#define UdfSetFidDirectory(I) SetFlag( (I).HighPart, FID_DIR_MASK )
#define UdfIsFidFile(I) BooleanFlagOff( (I).HighPart, FID_DIR_MASK )
#define UdfIsFidDirectory(I) BooleanFlagOn( (I).HighPart, FID_DIR_MASK )
//
// Context structures for browsing through structures
//
//
// A mapped view is a useful bundle to hold information about a physical
// view of the disk.
//
typedef struct _MAPPED_PVIEW {
//
// A mapped extent and CC control block
//
PVOID View;
PBCB Bcb;
//
// Extent location
//
USHORT Partition;
ULONG Lbn;
ULONG Length;
} MAPPED_PVIEW, *PMAPPED_PVIEW;
//
// Enumeration contexts for various operations.
//
//
// The following is used for crawling ICB hierarchies searching
// for some notion of an active entry.
//
typedef struct _ICB_SEARCH_CONTEXT {
//
// Vcb the search is occuring on.
//
PVCB Vcb;
//
// Type of Icb being searched for.
//
USHORT IcbType;
//
// The Active is most prevailing ICB so far found.
//
MAPPED_PVIEW Active;
//
// The current logical block extent being read from the disk.
//
MAPPED_PVIEW Current;
} ICB_SEARCH_CONTEXT, *PICB_SEARCH_CONTEXT;
//
// The following is used for crawling Extended Attributes extending off of
// a direct ICB
//
typedef enum _EA_SEARCH_TYPE {
EaEnumBad = 0,
EaEnumISO,
EaEnumImplementation,
EaEnumApplication
} EA_SEARCH_TYPE, *PEA_SEARCH_TYPE;
typedef struct _EA_SEARCH_CONTEXT {
//
// Reference to an elaborated ICB_SEARCH_CONTEXT which gives us a handle
// onto a direct ICB to crawl.
//
PICB_SEARCH_CONTEXT IcbContext;
//
// The current Ea being looked at.
//
PVOID Ea;
//
// Bytes remaining in the EA view
//
ULONG Remaining;
//
// EA being searched for. We only support looking for ISO at this time.
//
ULONG EAType;
USHORT EASubType;
} EA_SEARCH_CONTEXT, *PEA_SEARCH_CONTEXT;
//
// The following is used to crawl the list of allocation extent descriptors attached
// to an ICB.
//
typedef struct _ALLOC_ENUM_CONTEXT {
//
// Reference to an elaborated ICB_ENUM_CONTEXT which gives us a handle
// onto a direct ICB to crawl.
//
PICB_SEARCH_CONTEXT IcbContext;
//
// The current allocation descriptor being looked at.
//
PVOID Alloc;
//
// Type of allocation descriptors in this enumeration
//
ULONG AllocType;
//
// Bytes remaining in this view.
//
ULONG Remaining;
} ALLOC_ENUM_CONTEXT, *PALLOC_ENUM_CONTEXT;
//
// The following is used to crawl a logical directory.
//
typedef struct _DIR_ENUM_CONTEXT {
//
// The current view in the enumeration.
//
PVOID View;
PBCB Bcb;
//
// Offset of the view from the beginning of the directory.
//
LARGE_INTEGER BaseOffset;
//
// Length of the view which is valid and the current
// offset in it.
//
ULONG ViewLength;
ULONG ViewOffset;
//
// Pointer to the current FID.
//
PNSR_FID Fid;
//
// Offset to the next fid from the beginning of the view.
//
ULONG NextFidOffset;
//
// Flags indicating the state of the enumeration.
//
ULONG Flags;
//
// Converted names from the FID. Case name is "case appropriate" for
// the operation.
//
UNICODE_STRING ObjectName;
UNICODE_STRING CaseObjectName;
//
// Real object name in pure form (not rendered to NT legal form)
//
UNICODE_STRING PureObjectName;
//
// Short name for the object.
//
UNICODE_STRING ShortObjectName;
//
// Currently allocated space for the name. The previous strings are
// carved out of this single buffer.
//
PVOID NameBuffer;
//
// Size of currently allocated name buffer for the lfn names.
//
USHORT AllocLength;
} DIR_ENUM_CONTEXT, *PDIR_ENUM_CONTEXT;
//
// Flags for noting where in the enumeration we are.
//
#define DIR_CONTEXT_FLAG_SEEN_NONCONSTANT 0x0001
#define DIR_CONTEXT_FLAG_SEEN_PARENT 0x0002
//
// Flag indicating current Fid was buffered into pool.
//
#define DIR_CONTEXT_FLAG_FID_BUFFERED 0x0004
#endif // _CDSTRUC_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -