ffu_extract: pick store by blkSize sanity
This commit is contained in:
+14
-5
@@ -24,11 +24,20 @@ def load(ffu):
|
||||
sec = f.read(32)
|
||||
_, _, chunk_kb, _, cat, hsh = struct.unpack("<I12sIIII", sec)
|
||||
assert chunk_kb * 1024 == CHUNK
|
||||
# store header: ASCII PlatformId inside it; header starts 12B before
|
||||
st = f.find(b"Microsoft.MSM") - 12
|
||||
assert st > 0
|
||||
vals = struct.unpack("<11I", f[st + 204:st + 248])
|
||||
assert vals[0] == CHUNK, vals # blkSize sanity
|
||||
# store header: ASCII PlatformId inside it; header starts 12B before.
|
||||
# (manifest has one too — pick the occurrence with sane blkSize)
|
||||
st = -1
|
||||
i = 0
|
||||
while True:
|
||||
i = f.find(b"Microsoft.MSM", i)
|
||||
if i < 0:
|
||||
break
|
||||
vals = struct.unpack("<11I", f[i - 12 + 204:i - 12 + 248])
|
||||
if vals[0] == CHUNK:
|
||||
st = i - 12
|
||||
break
|
||||
i += 1
|
||||
assert st > 0, "store header not found"
|
||||
wcnt = vals[1]
|
||||
pos = st + 248
|
||||
disk = {} # diskchunk -> datachunk
|
||||
|
||||
Reference in New Issue
Block a user