From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:.NET metadata (ECMA-335)" |
|---|
| claim | "The #~ (or #-) stream starts with a 24-byte header: uint32 reserved 0, uint8 major 2, uint8 minor 0, uint8 HeapSizes, uint8 reserved 1, uint64 Valid (bit n = table n present), uint64 Sorted; then one uint32 row count per set Valid bit in table order, an extra uint32 if HeapSizes bit 0x40 is set, then the table rows." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:.NET metadata (ECMA-335)" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "MetadataTablesHeader" |
|---|
| size_min | 24 |
|---|
| fields | | offset | 0 |
|---|
| size | 4 |
|---|
| type | "uint32" |
|---|
| name | "Reserved" |
|---|
| notes | "0" |
|---|
|
| offset | 4 |
|---|
| size | 1 |
|---|
| type | "uint8" |
|---|
| name | "MajorVersion" |
|---|
| notes | "2 (1 in .NET 1.x files)" |
|---|
|
| offset | 5 |
|---|
| size | 1 |
|---|
| type | "uint8" |
|---|
| name | "MinorVersion" |
|---|
| notes | "0" |
|---|
|
| offset | 6 |
|---|
| size | 1 |
|---|
| type | "uint8" |
|---|
| name | "HeapSizes" |
|---|
| bits | | bit | "0" |
|---|
| name | "BigStrings" |
|---|
| notes | "#Strings indexes 4 bytes" |
|---|
|
|
|
| bit | "3" |
|---|
| name | "Padding" |
|---|
| notes | "ENC" |
|---|
|
| bit | "5" |
|---|
| name | "DeltaOnly" |
|---|
| notes | "ENC delta" |
|---|
|
| bit | "6" |
|---|
| name | "ExtraData" |
|---|
| notes | "a uint32 follows the row counts (CLR only)" |
|---|
|
|
|
|---|
|
| offset | 7 |
|---|
| size | 1 |
|---|
| type | "uint8" |
|---|
| name | "Reserved2" |
|---|
| notes | "1 (log2 of the largest rid in old docs)" |
|---|
|
| offset | 8 |
|---|
| size | 8 |
|---|
| type | "uint64" |
|---|
| name | "Valid" |
|---|
|
| offset | 16 |
|---|
| size | 8 |
|---|
| type | "uint64" |
|---|
| name | "Sorted" |
|---|
|
| offset | 24 |
|---|
| size | "variable" |
|---|
| type | "uint32[popcount(Valid)]" |
|---|
| name | "Rows" |
|---|
| notes | "high byte ignored by Mono and dnlib" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "TablesStream.Initialize" |
|---|
| repo | "https://github.com/0xd4d/dnlib" |
|---|
| commit | "9ab9b58ab31b99b3f6cdef36efec613fc11ddbe2" |
|---|
| path | "src/DotNet/MD/TablesStream.cs" |
|---|
| lines | "214-252" |
|---|
|
| type | "source" |
|---|
| detail | "MDStreamFlags bits" |
|---|
| repo | "https://github.com/0xd4d/dnlib" |
|---|
| commit | "9ab9b58ab31b99b3f6cdef36efec613fc11ddbe2" |
|---|
| path | "src/DotNet/MD/MDStreamFlags.cs" |
|---|
| lines | "10-25" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "HeapSizes 0x00 in 63794, 0x05 in 2117, 0x01 in 1587, 0x04 in 132 of 67630 managed PEs; version 2.0 in 67575, 1.0 in 55" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Tables stream header" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T15:23:45.856Z" |
|---|
| verifications | |
|---|