def DumpWithRead(self, output_filename):
"""Read the image and write all the data to a raw file."""
with open(output_filename, "wb") as outfd:
offset = 0
for start, length in self.runs:
if start > offset:
print("\nPadding from 0x%X to 0x%X\n" % (offset, start))
self.PadWithNulls(outfd, start - offset)
offset = start
end = start + length
while offset < end:
to_read = min(self.buffer_size, end - offset)
win32file.SetFilePointer(self.fd, offset, 0)
_, data = win32file.ReadFile(self.fd, to_read)
outfd.write(data)
offset += to_read
offset_in_mb = offset/1024/1024
if not offset_in_mb % 50:
sys.stdout.write("\n%04dMB\t" % offset_in_mb)
sys.stdout.write(".")
sys.stdout.flush()
评论列表
文章目录