diff options
author | Jb Evain <jbevain@gmail.com> | 2011-10-27 16:53:07 +0400 |
---|---|---|
committer | Jb Evain <jbevain@gmail.com> | 2011-10-27 16:53:07 +0400 |
commit | 8771de6415d3fa5e34b12fd90519a5405c02e8b2 (patch) | |
tree | 0a1707ab3fc77c49d3f5f6f51628089ccffb1d19 /Mono.Cecil.PE/ImageWriter.cs | |
parent | ecdd7454b53a4d6b57c9eb2a500b91025a63b401 (diff) |
First pass at a branch with reduced memory usage; Keeps an open handle on the file, dispose your modules
Diffstat (limited to 'Mono.Cecil.PE/ImageWriter.cs')
-rw-r--r-- | Mono.Cecil.PE/ImageWriter.cs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Mono.Cecil.PE/ImageWriter.cs b/Mono.Cecil.PE/ImageWriter.cs index 6f921d9..b5cdbe9 100644 --- a/Mono.Cecil.PE/ImageWriter.cs +++ b/Mono.Cecil.PE/ImageWriter.cs @@ -95,9 +95,8 @@ namespace Mono.Cecil.PE { if (rsrc == null) return; - var raw_resources = new byte [rsrc.Data.Length]; - Buffer.BlockCopy (rsrc.Data, 0, raw_resources, 0, rsrc.Data.Length); - win32_resources = new ByteBuffer (raw_resources); + var reader = module.Image.GetReaderAt (rsrc.VirtualAddress); + win32_resources = new ByteBuffer (reader.ReadBytes ((int) rsrc.SizeOfRawData)); } Section GetImageResourceSection () |