internal static PEFileReader CreatePEFileReaderFromFile(string path) { using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete)) { var binaryDocumentMemoryBlock = MemoryMappedFile.CreateMemoryMappedFile(stream, path); PEFileReader peFileReader = new PEFileReader(binaryDocumentMemoryBlock); Contract.ThrowIfTrue(peFileReader.ReaderState < ReaderState.Metadata); return(peFileReader); } }