Ejemplo n.º 1
0
        private ModuleMetadata CreateModuleMetadata(string path, bool prefetchEntireImage)
        {
            // TODO: exception handling?
            var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);

            var options = PEStreamOptions.PrefetchMetadata;

            if (prefetchEntireImage)
            {
                options |= PEStreamOptions.PrefetchEntireImage;
            }

            return(ModuleMetadata.CreateFromImageStream(fileStream, options));
        }
Ejemplo n.º 2
0
 public void CreateFromImageStream()
 {
     Assert.Throws <ArgumentNullException>(() => ModuleMetadata.CreateFromImageStream(peStream: null));
     Assert.Throws <ArgumentException>(() => ModuleMetadata.CreateFromImageStream(new TestStream(canRead: false, canSeek: true)));
     Assert.Throws <ArgumentException>(() => ModuleMetadata.CreateFromImageStream(new TestStream(canRead: true, canSeek: false)));
 }