// HPFS disk structure definitions // Based on information from Doug Azzarito's "HPFS internals" lectures // // Author: J. van Wijk // // JvW 17-06-95 Initial version, split off from DHPFS.C // JvW 24-07-95 Moved sector definitions from DHPFS.C // JvW 14-08-95 Moved LSN constants from DHPFS.C // JvW 16-10-95 Added some more structure fields (2nd HPFS Internals) // JvW 14-12-96 Added DASD limit threshold fields (3rd HPFS Internals) // JvW 28-12-96 Changed to HPFS definition portion for DFS // #ifndef DFSHPFS_H #define DFSHPFS_H #define LSN_SUPER ((LSN) 0x10) #define LEN_SUPER ((LSN) 0x64) #define LSN_SPARE ((LSN) 0x11) #define LEN_SPARE ((LSN) 0x30) #define LSN_RESRV ((LSN) 0x12) // not sure about this one... #define LEN_RESRV ((LSN) 0x02) typedef struct s_sptr // size & pointer { ULONG size; LSN ptr; } SPTR; // end of struct "s_sptr" #define SG_SUPER 8 #define SV_SUPER (char)0x49,(char)0xe8,(char)0x95,(char)0xf9, \ (char)0xc5,(char)0xe9,(char)0x53,(char)0xfa typedef struct s_super // HPFS super-block { char Signature[SG_SUPER]; BYTE VerMajor; BYTE VerMinor; BYTE Reserved[2]; LSN RootFnode; ULONG TotalSec; ULONG BadSec; LSN BitmapInd; LSN BitmapIndRsp; LSN BadList; LSN BadListRsp; ULONG ChkdskDate; ULONG OptimDate; ULONG DirBandSec; LSN DirBand; LSN DirBandEnd; LSN DirBandMap; char VolumeName[0x20]; LSN UserIdTable; } S_SUPER; // end of struct "s_super" #define SG_SPARE 8 #define SV_SPARE (char)0x49,(char)0x18,(char)0x91,(char)0xf9, \ (char)0xc5,(char)0x29,(char)0x52,(char)0xfa typedef struct s_spare // HPFS spare-block { char Signature[SG_SPARE]; BYTE StatusFlag; BYTE HPFS386Flag; BYTE MMContiguityFactor; BYTE Reserved; LSN HotFixList; ULONG HotFixes; ULONG HotFixMax; ULONG SpareDirUsed; ULONG SpareDirMax; LSN CodePageInfo; ULONG CodePages; ULONG SuChecksum; ULONG SpChecksum; BYTE Reserv_2[0x3c]; LSN SpareDir[0x65]; } S_SPARE; // end of struct "s_spare" #define HPFS_BADSECS ((ULONG) 0x1ff) typedef struct s_badsel { LSN Next; // LSN of next bad-sector elem LSN Bads[ HPFS_BADSECS]; // Bad sectors LSN's } S_BADSEL; // end of struct "s_alleaf" typedef struct s_alblk { BYTE Flag; BYTE Reserved[3]; BYTE FreeEntries; BYTE UsedEntries; USHORT OfsFirstFree; } S_ALBLK; // end of struct "s_alblk" typedef struct s_alleaf { ULONG RelSecData; // start sector in datastream ULONG LengthData; // nr of sectors in this block LSN DataBlock; // LSN of first block sector } S_ALLEAF; // end of struct "s_alleaf" typedef struct s_alnode { ULONG RelSecNext; // start sector next child-Node LSN ChildBlock; // LSN of first block sector } S_ALNODE; // end of struct "s_alnode" typedef union u_aldata { S_ALLEAF Leaf[0x08]; // either 8 blocks of leaf data S_ALNODE Node[0x0c]; // or 12 blocks of node data } U_ALDATA; // end of union "u_aldata" #define SG_FNODE 4 #define SV_FNODE (char)0xae,(char)0x0a,(char)0xe4,(char)0xf7 #define SG_FNDEL 4 #define SV_FNDEL (char)0x00,(char)0x00,(char)0x00,(char)0x00 typedef struct s_fnode // Fnode, dir or file { char Signature[SG_FNODE]; BYTE Reserved[8]; BYTE NameLength; char Name[0x0f]; LSN ParentDir; SPTR AclExtern; USHORT AclFnLength; BYTE AclFlag; BYTE Reserv_2; SPTR EAsExtern; USHORT EAsFnLength; BYTE EAsFlag; BYTE DirFlag; S_ALBLK AlInfo; U_ALDATA Al; ULONG FileLength; // Valid Data Length written ULONG RequiredEAs; BYTE Reserv_3[0x10]; // reserved UserId USHORT OfsAclControl; BYTE FirstDasdAlertThresh; // percentage used 1st alert BYTE DeltaDasdAlertThresh; // percentage delta next alerts ULONG DasdLimit; // HPFS386, limit sectors ULONG DasdUsage; // HPFS386, usage sectors BYTE EasOrAcl[0x13c]; } S_FNODE; // end of struct "s_fnode" typedef struct s_dirent { USHORT Length; // length of directory entry BYTE Flag; // DirEntry flag bits BYTE FatAttrib; // FAT Attributes LSN Fnode; // LSN of FNODE ULONG LastModDate; // Last Modification date ULONG FileSize; // Allocated file size ULONG LastAccessTime; // Last Access Time ULONG CreationTime; // Creation Time ULONG EALength; // Extended Atribute length BYTE FlexFlag; // Flex Area Flag BYTE CodePageIndex; // Code Page index in info BYTE NameLength; // Length of filename char FileName[1]; // FileName, variable length } S_DIRENT; // end of struct "s_dirent" #define SG_DIRBL 4 #define SV_DIRBL (char)0xae,(char)0x0a,(char)0xe4,(char)0x77 typedef struct s_dirbl // Directory block { char Signature[SG_DIRBL]; ULONG OfsFirstFree; ULONG ChangeCount; LSN ParentDir; LSN This; S_DIRENT FirstEntry; // Variable length DirEntries } S_DIRBL; // end of struct "s_dirbl" #define SG_ALLOC 4 #define SV_ALLOC (char)0xae,(char)0x0a,(char)0xe4,(char)0x37 typedef struct s_alloc // Allocation sector { char Signature[SG_ALLOC]; LSN This; LSN Parent; S_ALBLK AlInfo; U_ALDATA Al; BYTE Reserved[0x0C]; } S_ALLOC; // end of struct "s_alloc" typedef struct s_cpib { USHORT Country; // country code USHORT CodePageId; // Codepage number ULONG CpChecksum; // Codepage checksum LSN CpData; // Codepage data sector USHORT VolCpId; // Volume-specific Id USHORT DbcsRanges; // nr of DBCS ranges in Cp } S_CPIB; // end of struct "s_cpib" #define SG_CPINF 4 #define SV_CPINF (char)0xf7,(char)0x21,(char)0x45,(char)0x49 typedef struct s_cpinf // Codepage info { char Signature[SG_CPINF]; ULONG CpCount; // codepages in this sector ULONG FirstCpib; // first CP info block LSN NextCpInfo; // next codepage info sector S_CPIB Cpib[0x1f]; // Array of Cp info blocks } S_CPINF; // end of struct "s_cpinf" typedef struct s_dbcs // DBCS range pairs { BYTE start; BYTE end; } S_DBCS; // end of struct "s_dbcs" typedef struct s_cpdb { USHORT Country; // country code USHORT CodePageId; // Codepage number USHORT DbcsRanges; // nr of DBCS ranges in Cp char Table[0x80]; // conversion table S_DBCS Dbcs[1]; // DBCS range pairs } S_CPDB; // end of struct "s_cpdb" #define SG_CPDAT 4 #define SV_CPDAT (char)0xf7,(char)0x21,(char)0x45,(char)0x89 typedef struct s_cpdat // Codepage data table { char Signature[SG_CPDAT]; USHORT CpCount; // codepages in this sector USHORT FirstCpdb; // first CP data block ULONG Checksum[3]; // CpData checksums USHORT OfsCpdb[3]; // CpData offsets S_CPDB Cpdb; // Cpdb data blocks (1st !!) } S_CPDAT; // end of struct "s_cpdat" typedef struct s_uinf { BYTE Byte1; // UserId byte 1 BYTE Byte2; // UserId byte 2 BYTE Byte3; // UserId byte 3 BYTE Byte4; // UserId byte 4 } S_UINF; // end of struct "s_uinf" #define SG_UITAB 4 #define SV_UITAB (char)0xff,(char)0xff,(char)0xfa,(char)0xfa typedef struct s_uitab // UserId table (HPFS-386) { ULONG UiCount; // Userid entry count (+1) char Signature[SG_UITAB]; S_UINF UiInfo[0x3e]; // Array of UserId data } S_UITAB; // end of struct "s_uitab" typedef struct s_aclblk // UI info in Fnode { ULONG access; // access info, RXWCD flags? S_UINF userid; // HPFS386 userid key ULONG reserv_1; // unknown, usualy zero ULONG reserv_2; // unknown, usualy zero ULONG reserv_3; // unknown, usualy zero } S_ACLBLK; // end of struct "s_aclblk" #endif