| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
using System; |
| 30 |
using Mono.Cecil.PE; |
| 31 |
|
| 32 |
namespace Mono.Cecil.Metadata { |
| 33 |
|
| 34 |
enum Table : byte { |
| 35 |
Module = 0x00, |
| 36 |
TypeRef = 0x01, |
| 37 |
TypeDef = 0x02, |
| 38 |
FieldPtr = 0x03, |
| 39 |
Field = 0x04, |
| 40 |
MethodPtr = 0x05, |
| 41 |
Method = 0x06, |
| 42 |
ParamPtr = 0x07, |
| 43 |
Param = 0x08, |
| 44 |
InterfaceImpl = 0x09, |
| 45 |
MemberRef = 0x0a, |
| 46 |
Constant = 0x0b, |
| 47 |
CustomAttribute = 0x0c, |
| 48 |
FieldMarshal = 0x0d, |
| 49 |
DeclSecurity = 0x0e, |
| 50 |
ClassLayout = 0x0f, |
| 51 |
FieldLayout = 0x10, |
| 52 |
StandAloneSig = 0x11, |
| 53 |
EventMap = 0x12, |
| 54 |
EventPtr = 0x13, |
| 55 |
Event = 0x14, |
| 56 |
PropertyMap = 0x15, |
| 57 |
PropertyPtr = 0x16, |
| 58 |
Property = 0x17, |
| 59 |
MethodSemantics = 0x18, |
| 60 |
MethodImpl = 0x19, |
| 61 |
ModuleRef = 0x1a, |
| 62 |
TypeSpec = 0x1b, |
| 63 |
ImplMap = 0x1c, |
| 64 |
FieldRVA = 0x1d, |
| 65 |
EncLog = 0x1e, |
| 66 |
EncMap = 0x1f, |
| 67 |
Assembly = 0x20, |
| 68 |
AssemblyProcessor = 0x21, |
| 69 |
AssemblyOS = 0x22, |
| 70 |
AssemblyRef = 0x23, |
| 71 |
AssemblyRefProcessor = 0x24, |
| 72 |
AssemblyRefOS = 0x25, |
| 73 |
File = 0x26, |
| 74 |
ExportedType = 0x27, |
| 75 |
ManifestResource = 0x28, |
| 76 |
NestedClass = 0x29, |
| 77 |
GenericParam = 0x2a, |
| 78 |
MethodSpec = 0x2b, |
| 79 |
GenericParamConstraint = 0x2c, |
| 80 |
} |
| 81 |
|
| 82 |
struct TableInformation { |
| 83 |
public uint Offset; |
| 84 |
public uint Length; |
| 85 |
public uint RowSize; |
| 86 |
} |
| 87 |
|
| 88 |
sealed class TableHeap : Heap { |
| 89 |
|
| 90 |
public long Valid; |
| 91 |
public long Sorted; |
| 92 |
|
| 93 |
public const int TableCount = 45; |
| 94 |
|
| 95 |
public readonly TableInformation [] Tables = new TableInformation [TableCount]; |
| 96 |
|
| 97 |
public TableInformation this [Table table] { |
| 98 |
get { return Tables [(int) table]; } |
| 99 |
} |
| 100 |
|
| 101 |
public TableHeap (Section section, uint start, uint size) |
| 102 |
: base (section, start, size) |
| 103 |
{ |
| 104 |
} |
| 105 |
|
| 106 |
public bool HasTable (Table table) |
| 107 |
{ |
| 108 |
return (Valid & (1L << (int) table)) != 0; |
| 109 |
} |
| 110 |
} |
| 111 |
} |