当前位置: 首页>>代码示例>>C#>>正文


C# BlobBuilder.WriteUInt32方法代码示例

本文整理汇总了C#中BlobBuilder.WriteUInt32方法的典型用法代码示例。如果您正苦于以下问题:C# BlobBuilder.WriteUInt32方法的具体用法?C# BlobBuilder.WriteUInt32怎么用?C# BlobBuilder.WriteUInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BlobBuilder的用法示例。


在下文中一共展示了BlobBuilder.WriteUInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SerializeStandalonePdbStream

        /// <summary>
        /// Serialized #Pdb stream.
        /// </summary>
        protected override void SerializeStandalonePdbStream(BlobBuilder builder)
        {
            int startPosition = builder.Position;

            // the id will be filled in later
            _pdbIdBlob = builder.ReserveBytes(MetadataSizes.PdbIdSize);
            
            builder.WriteUInt32((uint)_entryPointToken);

            builder.WriteUInt64(MetadataSizes.ExternalTablesMask);
            MetadataWriterUtilities.SerializeRowCounts(builder, MetadataSizes.ExternalRowCounts);

            int endPosition = builder.Position;
            Debug.Assert(MetadataSizes.CalculateStandalonePdbStreamSize() == endPosition - startPosition);
        }
开发者ID:tzetang,项目名称:corefx,代码行数:18,代码来源:MetadataSerializer.cs

示例2: SerializeTypeDefTable

 private void SerializeTypeDefTable(BlobBuilder writer, MetadataSizes metadataSizes)
 {
     foreach (TypeDefRow typeDef in _typeDefTable)
     {
         writer.WriteUInt32(typeDef.Flags);
         writer.WriteReference((uint)GetHeapOffset(typeDef.Name), metadataSizes.StringIndexSize);
         writer.WriteReference((uint)GetHeapOffset(typeDef.Namespace), metadataSizes.StringIndexSize);
         writer.WriteReference(typeDef.Extends, metadataSizes.TypeDefOrRefCodedIndexSize);
         writer.WriteReference(typeDef.FieldList, metadataSizes.FieldDefIndexSize);
         writer.WriteReference(typeDef.MethodList, metadataSizes.MethodDefIndexSize);
     }
 }
开发者ID:MichalStrehovsky,项目名称:corefx,代码行数:12,代码来源:MetadataBuilder.Tables.cs

示例3: WriteRelocSection

        private void WriteRelocSection(Stream peStream, SectionHeader relocSection, int entryPointAddress)
        {
            peStream.Position = relocSection.PointerToRawData;
            var writer = new BlobBuilder(relocSection.SizeOfRawData);
            writer.WriteUInt32((((uint)entryPointAddress + 2) / 0x1000) * 0x1000);
            writer.WriteUInt32(_properties.Requires64bits && !_properties.RequiresAmdInstructionSet ? 14u : 12u);
            uint offsetWithinPage = ((uint)entryPointAddress + 2) % 0x1000;
            uint relocType = _properties.Requires64bits ? 10u : 3u;
            ushort s = (ushort)((relocType << 12) | offsetWithinPage);
            writer.WriteUInt16(s);
            if (_properties.Requires64bits && !_properties.RequiresAmdInstructionSet)
            {
                writer.WriteUInt32(relocType << 12);
            }

            writer.WriteUInt16(0); // next chunk's RVA
            writer.PadTo(relocSection.SizeOfRawData);
            writer.WriteContentTo(peStream);
        }
开发者ID:noahfalk,项目名称:roslyn,代码行数:19,代码来源:PeWriter.cs

示例4: WriteCorHeader

        private static void WriteCorHeader(Stream peStream, CorHeader corHeader)
        {
            var writer = new BlobBuilder(CorHeaderSize);
            writer.WriteUInt32(CorHeaderSize);
            writer.WriteUInt16(corHeader.MajorRuntimeVersion);
            writer.WriteUInt16(corHeader.MinorRuntimeVersion); 
            writer.WriteUInt32((uint)corHeader.MetadataDirectory.RelativeVirtualAddress); 
            writer.WriteUInt32((uint)corHeader.MetadataDirectory.Size);
            writer.WriteUInt32((uint)corHeader.Flags);
            writer.WriteUInt32((uint)corHeader.EntryPointTokenOrRelativeVirtualAddress);
            writer.WriteUInt32((uint)(corHeader.ResourcesDirectory.Size == 0 ? 0 : corHeader.ResourcesDirectory.RelativeVirtualAddress)); // 28
            writer.WriteUInt32((uint)corHeader.ResourcesDirectory.Size);
            writer.WriteUInt32((uint)(corHeader.StrongNameSignatureDirectory.Size == 0 ? 0 : corHeader.StrongNameSignatureDirectory.RelativeVirtualAddress)); // 36
            writer.WriteUInt32((uint)corHeader.StrongNameSignatureDirectory.Size);
            writer.WriteUInt32((uint)corHeader.CodeManagerTableDirectory.RelativeVirtualAddress); 
            writer.WriteUInt32((uint)corHeader.CodeManagerTableDirectory.Size); 
            writer.WriteUInt32((uint)corHeader.VtableFixupsDirectory.RelativeVirtualAddress); 
            writer.WriteUInt32((uint)corHeader.VtableFixupsDirectory.Size); 
            writer.WriteUInt32((uint)corHeader.ExportAddressTableJumpsDirectory.RelativeVirtualAddress);
            writer.WriteUInt32((uint)corHeader.ExportAddressTableJumpsDirectory.Size);
            writer.WriteUInt64(0);
            Debug.Assert(writer.Count == CorHeaderSize);
            Debug.Assert(writer.Count % 4 == 0);

            writer.WriteContentTo(peStream);
        }
开发者ID:noahfalk,项目名称:roslyn,代码行数:26,代码来源:PeWriter.cs

示例5: WriteImportAddressTable

        private void WriteImportAddressTable(Stream peStream, int importTableRva)
        {
            var writer = new BlobBuilder(SizeOfImportAddressTable);
            int ilRVA = importTableRva + 40;
            int hintRva = ilRVA + (_is32bit ? 12 : 16);

            // Import Address Table
            if (_is32bit)
            {
                writer.WriteUInt32((uint)hintRva); // 4
                writer.WriteUInt32(0); // 8
            }
            else
            {
                writer.WriteUInt64((uint)hintRva); // 8
                writer.WriteUInt64(0); // 16
            }

            Debug.Assert(writer.Count == SizeOfImportAddressTable);
            writer.WriteContentTo(peStream);
        }
开发者ID:noahfalk,项目名称:roslyn,代码行数:21,代码来源:PeWriter.cs

示例6: WriteSectionHeader

        private static void WriteSectionHeader(BlobBuilder builder, Section section, SerializedSection serializedSection)
        {
            if (serializedSection.VirtualSize == 0)
            {
                return;
            }

            for (int j = 0, m = section.Name.Length; j < 8; j++)
            {
                if (j < m)
                {
                    builder.WriteByte((byte)section.Name[j]);
                }
                else
                {
                    builder.WriteByte(0);
                }
            }

            builder.WriteUInt32((uint)serializedSection.VirtualSize);
            builder.WriteUInt32((uint)serializedSection.RelativeVirtualAddress);
            builder.WriteUInt32((uint)serializedSection.SizeOfRawData);
            builder.WriteUInt32((uint)serializedSection.PointerToRawData);

            // PointerToRelocations (TODO: not supported):
            builder.WriteUInt32(0);

            // PointerToLinenumbers (TODO: not supported):
            builder.WriteUInt32(0);

            // NumberOfRelocations (TODO: not supported):
            builder.WriteUInt16(0);

            // NumberOfLinenumbers (TODO: not supported):
            builder.WriteUInt16(0);

            builder.WriteUInt32((uint)section.Characteristics);
        }
开发者ID:Rookieek,项目名称:roslyn,代码行数:38,代码来源:PEBuilder.cs

示例7: WriteCoffHeader

        private void WriteCoffHeader(BlobBuilder builder, ImmutableArray<SerializedSection> sections, out Blob stampFixup)
        {
            // Machine
            builder.WriteUInt16((ushort)(Machine == 0 ? Machine.I386 : Machine));

            // NumberOfSections
            builder.WriteUInt16((ushort)sections.Length);

            // TimeDateStamp:
            stampFixup = builder.ReserveBytes(sizeof(uint));

            // PointerToSymbolTable (TODO: not supported):
            // The file pointer to the COFF symbol table, or zero if no COFF symbol table is present. 
            // This value should be zero for a PE image.
            builder.WriteUInt32(0);

            // NumberOfSymbols (TODO: not supported):
            // The number of entries in the symbol table. This data can be used to locate the string table, 
            // which immediately follows the symbol table. This value should be zero for a PE image.
            builder.WriteUInt32(0);

            // SizeOfOptionalHeader:
            // The size of the optional header, which is required for executable files but not for object files. 
            // This value should be zero for an object file (TODO).
            builder.WriteUInt16((ushort)(Is32Bit ? 224 : 240));

            // Characteristics
            builder.WriteUInt16((ushort)ImageCharacteristics);
        }
开发者ID:Rookieek,项目名称:roslyn,代码行数:29,代码来源:PEBuilder.cs

示例8: WriteRuntimeStartupStub

        private void WriteRuntimeStartupStub(BlobBuilder sectionBuilder, int importAddressTableRva, ulong baseAddress)
        {
            // entry point code, consisting of a jump indirect to _CorXXXMain
            if (Is32Bit)
            {
                // Write zeros (nops) to pad the entry point code so that the target address is aligned on a 4 byte boundary.
                // Note that the section is aligned to FileAlignment, which is at least 512, so we can align relatively to the start of the section.
                sectionBuilder.Align(4);

                sectionBuilder.WriteUInt16(0);
                sectionBuilder.WriteByte(0xff);
                sectionBuilder.WriteByte(0x25); //4
                sectionBuilder.WriteUInt32((uint)importAddressTableRva + (uint)baseAddress); //8
            }
            else
            {
                // Write zeros (nops) to pad the entry point code so that the target address is aligned on a 8 byte boundary.
                // Note that the section is aligned to FileAlignment, which is at least 512, so we can align relatively to the start of the section.
                sectionBuilder.Align(8);

                sectionBuilder.WriteUInt32(0);
                sectionBuilder.WriteUInt16(0);
                sectionBuilder.WriteByte(0xff);
                sectionBuilder.WriteByte(0x25); //8
                sectionBuilder.WriteUInt64((ulong)importAddressTableRva + baseAddress); //16
            }
        }
开发者ID:nbilling,项目名称:corefx,代码行数:27,代码来源:ManagedTextSection.cs

示例9: SerializeExportedTypeTable

 private void SerializeExportedTypeTable(BlobBuilder writer, MetadataSizes metadataSizes)
 {
     foreach (ExportedTypeRow exportedType in _exportedTypeTable)
     {
         writer.WriteUInt32((uint)exportedType.Flags);
         writer.WriteUInt32(exportedType.TypeDefId);
         writer.WriteReference((uint)GetHeapOffset(exportedType.TypeName), metadataSizes.StringIndexSize);
         writer.WriteReference((uint)GetHeapOffset(exportedType.TypeNamespace), metadataSizes.StringIndexSize);
         writer.WriteReference(exportedType.Implementation, metadataSizes.ImplementationCodedIndexSize);
     }
 }
开发者ID:MichalStrehovsky,项目名称:corefx,代码行数:11,代码来源:MetadataBuilder.Tables.cs

示例10: SerializeFileTable

 private void SerializeFileTable(BlobBuilder writer, MetadataSizes metadataSizes)
 {
     foreach (FileTableRow fileReference in _fileTable)
     {
         writer.WriteUInt32(fileReference.Flags);
         writer.WriteReference((uint)GetHeapOffset(fileReference.FileName), metadataSizes.StringIndexSize);
         writer.WriteReference((uint)GetHeapOffset(fileReference.HashValue), metadataSizes.BlobIndexSize);
     }
 }
开发者ID:MichalStrehovsky,项目名称:corefx,代码行数:9,代码来源:MetadataBuilder.Tables.cs

示例11: SerializeAssemblyRefTable

 private void SerializeAssemblyRefTable(BlobBuilder writer, MetadataSizes metadataSizes)
 {
     foreach (AssemblyRefTableRow row in _assemblyRefTable)
     {
         writer.WriteUInt16((ushort)row.Version.Major);
         writer.WriteUInt16((ushort)row.Version.Minor);
         writer.WriteUInt16((ushort)row.Version.Build);
         writer.WriteUInt16((ushort)row.Version.Revision);
         writer.WriteUInt32(row.Flags);
         writer.WriteReference((uint)GetHeapOffset(row.PublicKeyToken), metadataSizes.BlobIndexSize);
         writer.WriteReference((uint)GetHeapOffset(row.Name), metadataSizes.StringIndexSize);
         writer.WriteReference((uint)GetHeapOffset(row.Culture), metadataSizes.StringIndexSize);
         writer.WriteReference((uint)GetHeapOffset(row.HashValue), metadataSizes.BlobIndexSize);
     }
 }
开发者ID:MichalStrehovsky,项目名称:corefx,代码行数:15,代码来源:MetadataBuilder.Tables.cs

示例12: SerializeFieldRvaTable

        private void SerializeFieldRvaTable(BlobBuilder writer, MetadataSizes metadataSizes, int mappedFieldDataStreamRva)
        {
#if DEBUG
            for (int i = 1; i < _fieldRvaTable.Count; i++)
            {
                Debug.Assert(_fieldRvaTable[i - 1].Field < _fieldRvaTable[i].Field);
            }
#endif
            foreach (FieldRvaRow fieldRva in _fieldRvaTable)
            {
                writer.WriteUInt32((uint)mappedFieldDataStreamRva + fieldRva.Offset);
                writer.WriteReference(fieldRva.Field, metadataSizes.FieldDefIndexSize);
            }
        }
开发者ID:MichalStrehovsky,项目名称:corefx,代码行数:14,代码来源:MetadataBuilder.Tables.cs

示例13: SerializeFieldLayoutTable

        private void SerializeFieldLayoutTable(BlobBuilder writer, MetadataSizes metadataSizes)
        {
#if DEBUG
            for (int i = 1; i < _fieldLayoutTable.Count; i++)
            {
                Debug.Assert(_fieldLayoutTable[i - 1].Field < _fieldLayoutTable[i].Field);
            }
#endif
            foreach (FieldLayoutRow fieldLayout in _fieldLayoutTable)
            {
                writer.WriteUInt32(fieldLayout.Offset);
                writer.WriteReference(fieldLayout.Field, metadataSizes.FieldDefIndexSize);
            }
        }
开发者ID:MichalStrehovsky,项目名称:corefx,代码行数:14,代码来源:MetadataBuilder.Tables.cs

示例14: SerializeClassLayoutTable

        private void SerializeClassLayoutTable(BlobBuilder writer, MetadataSizes metadataSizes)
        {
#if DEBUG
            for (int i = 1; i < _classLayoutTable.Count; i++)
            {
                Debug.Assert(_classLayoutTable[i - 1].Parent < _classLayoutTable[i].Parent);
            }
#endif
            foreach (ClassLayoutRow classLayout in _classLayoutTable)
            {
                writer.WriteUInt16(classLayout.PackingSize);
                writer.WriteUInt32(classLayout.ClassSize);
                writer.WriteReference(classLayout.Parent, metadataSizes.TypeDefIndexSize);
            }
        }
开发者ID:MichalStrehovsky,项目名称:corefx,代码行数:15,代码来源:MetadataBuilder.Tables.cs

示例15: SerializeMethodDefTable

        private void SerializeMethodDefTable(BlobBuilder writer, MetadataSizes metadataSizes, int methodBodyStreamRva)
        {
            foreach (MethodRow method in _methodDefTable)
            {
                if (method.BodyOffset == -1)
                {
                    writer.WriteUInt32(0);
                }
                else
                {
                    writer.WriteUInt32((uint)(methodBodyStreamRva + method.BodyOffset));
                }

                writer.WriteUInt16(method.ImplFlags);
                writer.WriteUInt16(method.Flags);
                writer.WriteReference((uint)GetHeapOffset(method.Name), metadataSizes.StringIndexSize);
                writer.WriteReference((uint)GetHeapOffset(method.Signature), metadataSizes.BlobIndexSize);
                writer.WriteReference(method.ParamList, metadataSizes.ParameterIndexSize);
            }
        }
开发者ID:MichalStrehovsky,项目名称:corefx,代码行数:20,代码来源:MetadataBuilder.Tables.cs


注:本文中的BlobBuilder.WriteUInt32方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。