Imported Upstream version 6.4.0.137

Former-commit-id: 943baa9f16a098c33e129777827f3a9d20da00d6
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-07-26 19:53:28 +00:00
parent e9207cf623
commit ef583813eb
2712 changed files with 74169 additions and 40587 deletions

View File

@@ -11,8 +11,6 @@
using System;
using System.IO;
#if !READ_ONLY
namespace Mono.Cecil.PE {
class BinaryStreamWriter : BinaryWriter {
@@ -89,5 +87,3 @@ namespace Mono.Cecil.PE {
}
}
}
#endif

View File

@@ -160,8 +160,6 @@ namespace Mono.Cecil.PE {
return value;
}
#if !READ_ONLY
public void WriteByte (byte value)
{
if (position == buffer.Length)
@@ -334,8 +332,5 @@ namespace Mono.Cecil.PE {
Buffer.BlockCopy (current, 0, buffer, 0, current_length);
this.buffer = buffer;
}
#endif
}
}

View File

@@ -11,8 +11,6 @@
using System;
using System.IO;
#if !READ_ONLY
using Mono.Cecil.Cil;
using Mono.Cecil.Metadata;
@@ -360,6 +358,11 @@ namespace Mono.Cecil.PE {
WriteUInt32 (characteristics);
}
uint GetRVAFileOffset (Section section, RVA rva)
{
return section.PointerToRawData + rva - section.VirtualAddress;
}
void MoveTo (uint pointer)
{
BaseStream.Seek (pointer, SeekOrigin.Begin);
@@ -367,7 +370,7 @@ namespace Mono.Cecil.PE {
void MoveToRVA (Section section, RVA rva)
{
BaseStream.Seek (section.PointerToRawData + rva - section.VirtualAddress, SeekOrigin.Begin);
BaseStream.Seek (GetRVAFileOffset (section, rva), SeekOrigin.Begin);
}
void MoveToRVA (TextSegment segment)
@@ -811,6 +814,14 @@ namespace Mono.Cecil.PE {
return pe_header_size + SizeOfOptionalHeader () + (sections * section_header_size);
}
public void PatchMvid (Guid guid)
{
uint offset = GetRVAFileOffset (text, text_map.GetRVA (TextSegment.GuidHeap));
BaseStream.Seek (offset, SeekOrigin.Begin);
var arr = guid.ToByteArray ();
BaseStream.Write (arr, 0, arr.Length);
}
void PatchWin32Resources (ByteBuffer resources)
{
PatchResourceDirectoryTable (resources);
@@ -851,5 +862,3 @@ namespace Mono.Cecil.PE {
}
}
}
#endif

View File

@@ -10,8 +10,6 @@
using System;
#if !READ_ONLY
using RVA = System.UInt32;
namespace Mono.Cecil.PE {
@@ -108,5 +106,3 @@ namespace Mono.Cecil.PE {
}
}
}
#endif