You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.88
Former-commit-id: 4b7216ffda08448e562271ce733688e761120fc5
This commit is contained in:
parent
7d05485754
commit
6123a772ed
22
external/cecil/Mono.Cecil.PE/ImageWriter.cs
vendored
22
external/cecil/Mono.Cecil.PE/ImageWriter.cs
vendored
@@ -87,21 +87,15 @@ namespace Mono.Cecil.PE {
|
||||
|
||||
void GetWin32Resources ()
|
||||
{
|
||||
var rsrc = GetImageResourceSection ();
|
||||
if (rsrc == null)
|
||||
if (!module.HasImage)
|
||||
return;
|
||||
|
||||
win32_resources = module.Image.GetReaderAt (rsrc.VirtualAddress, rsrc.SizeOfRawData, (s, reader) => new ByteBuffer (reader.ReadBytes ((int) s)));
|
||||
}
|
||||
DataDirectory win32_resources_directory = module.Image.Win32Resources;
|
||||
var size = win32_resources_directory.Size;
|
||||
|
||||
Section GetImageResourceSection ()
|
||||
{
|
||||
if (!module.HasImage)
|
||||
return null;
|
||||
|
||||
const string rsrc_section = ".rsrc";
|
||||
|
||||
return module.Image.GetSection (rsrc_section);
|
||||
if (size > 0) {
|
||||
win32_resources = module.Image.GetReaderAt (win32_resources_directory.VirtualAddress, size, (s, reader) => new ByteBuffer (reader.ReadBytes ((int) s)));
|
||||
}
|
||||
}
|
||||
|
||||
public static ImageWriter CreateWriter (ModuleDefinition module, MetadataBuilder metadata, Disposable<Stream> stream)
|
||||
@@ -846,10 +840,10 @@ namespace Mono.Cecil.PE {
|
||||
|
||||
void PatchResourceDataEntry (ByteBuffer resources)
|
||||
{
|
||||
var old_rsrc = GetImageResourceSection ();
|
||||
var rva = resources.ReadUInt32 ();
|
||||
resources.position -= 4;
|
||||
resources.WriteUInt32 (rva - old_rsrc.VirtualAddress + rsrc.VirtualAddress);
|
||||
|
||||
resources.WriteUInt32 (rva - module.Image.Win32Resources.VirtualAddress + rsrc.VirtualAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user