def _find_firstheader(nsis_file):
firstheader_offset = 0
pos = 0
while True:
chunk = nsis_file.read(32768 if firstheader_offset else 512)
if len(chunk) < _firstheader_pack.size:
return None
if firstheader_offset == 0:
firstheader = FirstHeader._make(
_firstheader_pack.unpack_from(chunk))
firstheader.header_offset = pos
firstheader.data_offset = pos + _firstheader_pack.size
if firstheader.siginfo == FH_SIG and \
firstheader.magics == FH_MAGICS:
# NSIS header found.
return firstheader
pos += len(chunk)
评论列表
文章目录