@@ -1201,13 +1201,6 @@ type AssemblyRefOSTableRow struct {
12011201 AssemblyRef uint32 `json:"assembly_ref"` // an index into the AssemblyRef table
12021202}
12031203
1204- // File 0x26
1205- type FileTableRow struct {
1206- Flags uint32 `json:"flags"` // a 4-byte bitmask of type FileAttributes, §II.23.1.6
1207- Name uint32 `json:"name"` // an index into the String heap
1208- HashValue uint32 `json:"hash_value"` // an index into the Blob heap
1209- }
1210-
12111204// ExportedType 0x27
12121205type ExportedTypeTableRow struct {
12131206 Flags uint32 `json:"flags"` // a 4-byte bitmask of type TypeAttributes, §II.23.1.15
@@ -1435,3 +1428,40 @@ func (pe *File) parseMetadataGenericParamConstraintTable(off uint32) ([]GenericP
14351428 }
14361429 return rows , n , nil
14371430}
1431+
1432+ // File 0x26
1433+ type FileTableRow struct {
1434+ Flags uint32 `json:"flags"` // a 4-byte bitmask of type FileAttributes, §II.23.1.6
1435+ Name uint32 `json:"name"` // an index into the String heap
1436+ HashValue uint32 `json:"hash_value"` // an index into the Blob heap
1437+ }
1438+
1439+ // File 0x26
1440+ func (pe * File ) parseMetadataFileTable (off uint32 ) ([]FileTableRow , uint32 , error ) {
1441+ var err error
1442+ var indexSize uint32
1443+ var n uint32
1444+
1445+ rowCount := int (pe .CLR .MetadataTables [FileMD ].CountCols )
1446+ rows := make ([]FileTableRow , rowCount )
1447+ for i := 0 ; i < rowCount ; i ++ {
1448+ if rows [i ].Flags , err = pe .ReadUint32 (off ); err != nil {
1449+ return rows , n , err
1450+ }
1451+ off += 4
1452+ n += 4
1453+
1454+ if indexSize , err = pe .readFromMetadataStream (idxString , off , & rows [i ].Name ); err != nil {
1455+ return rows , n , err
1456+ }
1457+ off += indexSize
1458+ n += indexSize
1459+
1460+ if indexSize , err = pe .readFromMetadataStream (idxBlob , off , & rows [i ].HashValue ); err != nil {
1461+ return rows , n , err
1462+ }
1463+ off += indexSize
1464+ n += indexSize
1465+ }
1466+ return rows , n , nil
1467+ }
0 commit comments