You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.22
Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
parent
5f4a27cc8a
commit
7d05485754
@@ -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