文件控制块主要用来表示一个ReactOS打开文件的对象。下面就来仔细地分析文件控制块的结构,如下:@H_403_3@
#001 typedef struct _VFATFCB@H_403_3@
#002 {@H_403_3@
@H_403_3@
ROS的文件头部,主要包括文件流的描述和系统使用的变量。@H_403_3@
#003 /* FCB header required by ROS/NT */@H_403_3@
#004 FSRTL_COMMON_FCB_HEADER RFCB;@H_403_3@
@H_403_3@
#005 SECTION_OBJECT_POINTERS SectionObjectPointers;@H_403_3@
#006 ERESOURCE MainResource;@H_403_3@
#007 ERESOURCE PagingIoResource;@H_403_3@
#008 /* end FCB header required by ROS/NT */@H_403_3@
#009 @H_403_3@
@H_403_3@
#010 /* directory entry for this file or directory */@H_403_3@
#011 DIR_ENTRY entry;@H_403_3@
#012 @H_403_3@
@H_403_3@
#013 /* Pointer to attributes in entry */@H_403_3@
#014 PUCHAR Attributes;@H_403_3@
#015 @H_403_3@
@H_403_3@
#016 /* long file name,points into PathNameBuffer */@H_403_3@
#017 UNICODE_STRING LongNameU;@H_403_3@
#018 @H_403_3@
@H_403_3@
#019 /* short file name */@H_403_3@
#020 UNICODE_STRING ShortNameU;@H_403_3@
#021 @H_403_3@
@H_403_3@
#022 /* directory name,points into PathNameBuffer */@H_403_3@
#023 UNICODE_STRING DirNameU;@H_403_3@
#024 @H_403_3@
@H_403_3@
#025 /* path + long file name 260 max*/@H_403_3@
#026 UNICODE_STRING PathNameU;@H_403_3@
#027 @H_403_3@
@H_403_3@
#028 /* buffer for PathNameU */@H_403_3@
#029 PWCHAR PathNameBuffer;@H_403_3@
#030 @H_403_3@
@H_403_3@
#031 /* buffer for ShortNameU */@H_403_3@
#032 WCHAR ShortNameBuffer[13];@H_403_3@
#033 @H_403_3@
@H_403_3@
#034 /* */@H_403_3@
#035 LONG RefCount;@H_403_3@
#036 @H_403_3@
@H_403_3@
#037 /* List of FCB's for this volume */@H_403_3@
#038 LIST_ENTRY FcbListEntry;@H_403_3@
#039 @H_403_3@
@H_403_3@
#040 /* pointer to the parent fcb */@H_403_3@
#041 struct _VFATFCB* parentFcb;@H_403_3@
#042 @H_403_3@
@H_403_3@
控制块的标志保存。@H_403_3@
#043 /* Flags for the fcb */@H_403_3@
#044 ULONG Flags;@H_403_3@
#045 @H_403_3@
@H_403_3@
#046 /* pointer to the file object which has initialized the fcb */@H_403_3@
#047 PFILE_OBJECT FileObject;@H_403_3@
#048 @H_403_3@
@H_403_3@
#049 /* Directory index for the short name entry */@H_403_3@
#050 ULONG dirIndex;@H_403_3@
#051 @H_403_3@
@H_403_3@
#052 /* Directory index where the long name starts */@H_403_3@
#053 ULONG startIndex;@H_403_3@
#054 @H_403_3@
@H_403_3@
#055 /* Share access for the file object */@H_403_3@
#056 SHARE_ACCESS FCBShareAccess;@H_403_3@
#057 @H_403_3@
@H_403_3@
#058 /* Incremented on IRP_MJ_CREATE,decremented on IRP_MJ_CLEANUP */@H_403_3@
#059 ULONG OpenHandleCount;@H_403_3@
#060 @H_403_3@
@H_403_3@
路径名称和长文件名称在HASH表里的位置。@H_403_3@
#061 /* Entry into the hash table for the path + long name */@H_403_3@
#062 HASHENTRY Hash;@H_403_3@
#063 @H_403_3@
@H_403_3@
路径名称和短文件名称在HASH表里的位置。@H_403_3@
#064 /* Entry into the hash table for the path + short name */@H_403_3@
#065 HASHENTRY ShortHash;@H_403_3@
#066 @H_403_3@
@H_403_3@
#067 /* List of byte-range locks for this file */@H_403_3@
#068 FILE_LOCK FileLock;@H_403_3@
#069 @H_403_3@
@H_403_3@
保存最后读写的簇和位置。@H_403_3@
#070 /*@H_403_3@
#071 * Optimalization: caching of last read/write cluster+offset pair. Can't@H_403_3@
#072 * be in VFATCCB because it must be reset everytime the allocated clusters@H_403_3@
#073 * change.@H_403_3@
#074 */@H_403_3@
#075 FAST_MUTEX LastMutex;@H_403_3@
#076 ULONG LastCluster;@H_403_3@
#077 ULONG LastOffset;@H_403_3@
#078} VFATFCB,*PVFATFCB;@H_403_3@