本文整理汇总了C#中Microsoft.Cci.UtilityDataStructures.MemoryReader.ReadUInt64方法的典型用法代码示例。如果您正苦于以下问题:C# MemoryReader.ReadUInt64方法的具体用法?C# MemoryReader.ReadUInt64怎么用?C# MemoryReader.ReadUInt64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Cci.UtilityDataStructures.MemoryReader
的用法示例。
在下文中一共展示了MemoryReader.ReadUInt64方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadOptionalHeaderNTAdditionalFields64
bool ReadOptionalHeaderNTAdditionalFields64(
ref MemoryReader memReader
)
//^ requires this.ReaderState >= ReaderState.Initialized;
{
if (memReader.RemainingBytes < PEFileConstants.SizeofOptionalHeaderNTAdditionalFields64) {
this.ErrorContainer.AddBinaryError(memReader.Offset, MetadataReaderErrorKind.OptionalHeaderNTAdditionalFields64TooSmall);
return false;
}
this.OptionalHeaderNTAdditionalFields.ImageBase = memReader.ReadUInt64();
this.OptionalHeaderNTAdditionalFields.SectionAlignment = memReader.ReadInt32();
this.OptionalHeaderNTAdditionalFields.FileAlignment = memReader.ReadUInt32();
this.OptionalHeaderNTAdditionalFields.MajorOperatingSystemVersion = memReader.ReadUInt16();
this.OptionalHeaderNTAdditionalFields.MinorOperatingSystemVersion = memReader.ReadUInt16();
this.OptionalHeaderNTAdditionalFields.MajorImageVersion = memReader.ReadUInt16();
this.OptionalHeaderNTAdditionalFields.MinorImageVersion = memReader.ReadUInt16();
this.OptionalHeaderNTAdditionalFields.MajorSubsystemVersion = memReader.ReadUInt16();
this.OptionalHeaderNTAdditionalFields.MinorSubsystemVersion = memReader.ReadUInt16();
this.OptionalHeaderNTAdditionalFields.Win32VersionValue = memReader.ReadUInt32();
this.OptionalHeaderNTAdditionalFields.SizeOfImage = memReader.ReadInt32();
this.OptionalHeaderNTAdditionalFields.SizeOfHeaders = memReader.ReadInt32();
this.OptionalHeaderNTAdditionalFields.CheckSum = memReader.ReadUInt32();
this.OptionalHeaderNTAdditionalFields.Subsystem = (Subsystem)memReader.ReadUInt16();
this.OptionalHeaderNTAdditionalFields.DllCharacteristics = (DllCharacteristics)memReader.ReadUInt16();
this.OptionalHeaderNTAdditionalFields.SizeOfStackReserve = memReader.ReadUInt64();
this.OptionalHeaderNTAdditionalFields.SizeOfStackCommit = memReader.ReadUInt64();
this.OptionalHeaderNTAdditionalFields.SizeOfHeapReserve = memReader.ReadUInt64();
this.OptionalHeaderNTAdditionalFields.SizeOfHeapCommit = memReader.ReadUInt64();
this.OptionalHeaderNTAdditionalFields.LoaderFlags = memReader.ReadUInt32();
this.OptionalHeaderNTAdditionalFields.NumberOfRvaAndSizes = memReader.ReadInt32();
return true;
}
示例2: ReadMetadataTableInformation
bool ReadMetadataTableInformation(
ref MemoryReader memReader
)
//^ requires this.ReaderState >= ReaderState.CORModule;
{
if (memReader.RemainingBytes < MetadataStreamConstants.SizeOfMetadataTableHeader) {
this.ErrorContainer.AddMetadataStreamError(this.MetadataStreamName, 0, MetadataReaderErrorKind.MetadataTableHeaderTooSmall);
return false;
}
this.MetadataTableHeader.Reserved = memReader.ReadUInt32();
this.MetadataTableHeader.MajorVersion = memReader.ReadByte();
this.MetadataTableHeader.MinorVersion = memReader.ReadByte();
this.MetadataTableHeader.HeapSizeFlags = (HeapSizeFlag)memReader.ReadByte();
this.MetadataTableHeader.RowId = memReader.ReadByte();
this.MetadataTableHeader.ValidTables = (TableMask)memReader.ReadUInt64();
this.MetadataTableHeader.SortedTables = (TableMask)memReader.ReadUInt64();
ulong presentTables = (ulong)this.MetadataTableHeader.ValidTables;
ulong validTablesForVersion = 0;
int version = this.MetadataTableHeader.MajorVersion << 16 | this.MetadataTableHeader.MinorVersion;
switch (version) {
case 0x00010000:
validTablesForVersion = (ulong)TableMask.V1_0_TablesMask;
break;
case 0x00010001:
validTablesForVersion = (ulong)TableMask.V1_1_TablesMask;
break;
case 0x00020000:
validTablesForVersion = (ulong)TableMask.V2_0_TablesMask;
break;
default:
this.ErrorContainer.AddMetadataStreamError(this.MetadataStreamName, 4, MetadataReaderErrorKind.UnknownVersionOfMetadata);
return false;
}
if ((presentTables & ~validTablesForVersion) != 0) {
this.ErrorContainer.AddMetadataStreamError(this.MetadataStreamName, 8, MetadataReaderErrorKind.UnknownTables);
return false;
}
if (this.MetadataStreamKind == MetadataStreamKind.Compressed && (presentTables & (ulong)TableMask.CompressedStreamNotAllowedMask) != 0) {
this.ErrorContainer.AddMetadataStreamError(this.MetadataStreamName, 8, MetadataReaderErrorKind.IllegalTablesInCompressedMetadataStream);
return false;
}
ulong requiredSortedTables = presentTables & validTablesForVersion & (ulong)TableMask.SortedTablesMask;
if ((requiredSortedTables & (ulong)this.MetadataTableHeader.SortedTables) != requiredSortedTables) {
this.ErrorContainer.AddMetadataStreamError(this.MetadataStreamName, 16, MetadataReaderErrorKind.SomeRequiredTablesNotSorted);
//Carry on regardless. There are/were compiler out there that sort the required tables, but fail to set the bit in SortedTables.
}
int numberOfTables = this.MetadataTableHeader.GetNumberOfTablesPresent();
if (memReader.RemainingBytes < numberOfTables * sizeof(Int32)) {
this.ErrorContainer.AddMetadataStreamError(this.MetadataStreamName, memReader.Offset, MetadataReaderErrorKind.TableRowCountSpaceTooSmall);
return false;
}
this.MetadataTableRowCount = new uint[numberOfTables];
uint[] metadataTableRowCount = this.MetadataTableRowCount;
for (int i = 0; i < numberOfTables; ++i) {
metadataTableRowCount[i] = memReader.ReadUInt32();
}
return true;
}
示例3: GetDefaultValue
internal IMetadataConstant GetDefaultValue(
MetadataObject metadataObject
) {
uint constRowId = this.PEFileReader.ConstantTable.GetConstantRowId(metadataObject.TokenValue);
if (constRowId == 0)
return Dummy.Constant;
ConstantRow constRow = this.PEFileReader.ConstantTable[constRowId];
MemoryBlock constValueMemoryBlock = this.PEFileReader.BlobStream.GetMemoryBlockAt(constRow.Value);
MemoryReader memoryReader = new MemoryReader(constValueMemoryBlock);
switch (constRow.Type) {
case ElementType.Boolean: {
byte val = memoryReader.ReadByte();
return new ConstantExpression(this.PlatformType.SystemBoolean, val != 0);
}
case ElementType.Char:
return new ConstantExpression(this.PlatformType.SystemChar, memoryReader.ReadChar());
case ElementType.Int8:
return new ConstantExpression(this.PlatformType.SystemInt8, memoryReader.ReadSByte());
case ElementType.Int16:
return new ConstantExpression(this.PlatformType.SystemInt16, memoryReader.ReadInt16());
case ElementType.Int32:
return new ConstantExpression(this.PlatformType.SystemInt32, memoryReader.ReadInt32());
case ElementType.Int64:
return new ConstantExpression(this.PlatformType.SystemInt64, memoryReader.ReadInt64());
case ElementType.UInt8:
return new ConstantExpression(this.PlatformType.SystemUInt8, memoryReader.ReadByte());
case ElementType.UInt16:
return new ConstantExpression(this.PlatformType.SystemUInt16, memoryReader.ReadUInt16());
case ElementType.UInt32:
return new ConstantExpression(this.PlatformType.SystemUInt32, memoryReader.ReadUInt32());
case ElementType.UInt64:
return new ConstantExpression(this.PlatformType.SystemUInt64, memoryReader.ReadUInt64());
case ElementType.Single:
return new ConstantExpression(this.PlatformType.SystemFloat32, memoryReader.ReadSingle());
case ElementType.Double:
return new ConstantExpression(this.PlatformType.SystemFloat64, memoryReader.ReadDouble());
case ElementType.String: {
int byteLen = memoryReader.Length;
string/*?*/ value;
if (byteLen == -1) {
value = null;
} else if (byteLen == 0) {
value = string.Empty;
} else {
value = memoryReader.ReadUTF16WithSize(byteLen);
}
return new ConstantExpression(this.PlatformType.SystemString, value);
}
case ElementType.Class:
return new ConstantExpression(this.PlatformType.SystemObject, null);
}
// MDError...
return Dummy.Constant;
}