def _update_new_data(self, off, data_to_insert):
"""
Update the _new_data string in the specified offset.
The data to be inserted overwrites previous data and should be given as a list of values.
:param off: start offset in _new_data to insert data into
:param data_to_insert: data to insert to _new_data
:return: void
"""
BITSStateFile._log_instance_message('updating new_data in offset %s' % hex(off))
self._new_data = override_data(self._new_data, off, data_to_insert)
if _os_ver == 10:
decoded_queue_footer = BITSStateFile.QUEUE_FOOTER_HEX[_os_ver].decode('hex')
crc32_off = self._new_data.find(decoded_queue_footer) + len(decoded_queue_footer)
crc32_value = struct.pack("i", crc32(self._new_data[:crc32_off]))
self._new_data = override_data(self._new_data, crc32_off, crc32_value)
评论列表
文章目录