Ejemplo n.º 1
0
        private void WriteStreamHeader(ref uint offset, TextSegment heap, string name)
        {
            uint length = (uint)this.text_map.GetLength(heap);

            if (length == 0u)
            {
                return;
            }
            base.WriteUInt32(offset);
            base.WriteUInt32(length);
            base.WriteBytes(ImageWriter.GetZeroTerminatedString(name));
            offset += length;
        }
Ejemplo n.º 2
0
        private void WriteMetadataHeader()
        {
            base.WriteUInt32(1112167234u);
            base.WriteUInt16(1);
            base.WriteUInt16(1);
            base.WriteUInt32(0u);
            byte[] zeroTerminatedString = ImageWriter.GetZeroTerminatedString(this.module.runtime_version);
            base.WriteUInt32((uint)zeroTerminatedString.Length);
            base.WriteBytes(zeroTerminatedString);
            base.WriteUInt16(0);
            base.WriteUInt16(this.GetStreamCount());
            uint num = this.text_map.GetRVA(TextSegment.TableHeap) - this.text_map.GetRVA(TextSegment.MetadataHeader);

            this.WriteStreamHeader(ref num, TextSegment.TableHeap, "#~");
            this.WriteStreamHeader(ref num, TextSegment.StringHeap, "#Strings");
            this.WriteStreamHeader(ref num, TextSegment.UserStringHeap, "#US");
            this.WriteStreamHeader(ref num, TextSegment.GuidHeap, "#GUID");
            this.WriteStreamHeader(ref num, TextSegment.BlobHeap, "#Blob");
        }