Lines Matching full:contents
26 contents = open(filename, 'rb').read()
51 assert contents[0:8] == b'MSFT\x02\x00\x01\x00'
52 ntypes, = struct.unpack_from('<I', contents, 0x20)
54 '<II', contents, 0x54 + 4*ntypes + 11*16)
57 assert contents[custom_off:custom_off + 6] == b'\x08\x00\x3e\x00\x00\x00'
61 contents[custom_off + 6:custom_off + 6 + 0x3e])
63 assert contents[custom_off+6+0x3e:custom_off+6+0x3e+8] == \
66 assert contents[custom_off + 6 + 0x3e + 8:custom_off + 6 + 0x3e + 8 +
70 contents = (
71 contents[0:custom_off + 6] +
75 contents[custom_off + 0x54:])
77 contents = re.sub(
81 br'/* at a redacted point in time', contents)
82 contents = re.sub(
86 contents)
90 contents = contents.replace(b'#endif !_MIDL_USE_GUIDDEF_',
95 contents = contents.replace(b'0x801026c, /* MIDL Version 8.1.620 */',
97 open(filename, 'wb').write(contents)
102 contents = open(tlb_file, 'rb').read()
103 assert contents[0:8] == b'MSFT\x02\x00\x01\x00'
104 ntypes, = struct.unpack_from('<I', contents, 0x20)
105 type_off, type_len = struct.unpack_from('<II', contents, 0x54 + 4*ntypes)
108 '<II', contents, 0x54 + 4*ntypes + 5*16)
111 contents = array.array('B', contents)
113 return contents, ntypes, type_off, guid_off, guid_len
116 def recreate_guid_hashtable(contents, ntypes, guid_off, guid_len): argument
124 '<16sII', contents, guidind)
129 struct.pack_into('<I', contents, guidind + 0x14, nextguid)
132 '<II', contents, 0x54 + 4*ntypes + 4*16)
134 struct.pack_into('<I', contents, hash_off + 4*i, hashval)
138 contents = open(h_file, 'rb').read()
140 contents = re.sub(key, dynamic_guids[key], contents, flags=re.I)
141 open(h_file, 'wb').write(contents)
159 contents = open(iid_file, 'rb').read()
161 contents = re.sub(get_uuid_format_iid_file(key),
163 contents,
165 open(iid_file, 'wb').write(contents)
175 contents = open(proxy_file, 'rb').read()
177 contents = re.sub(get_uuid_format_proxy_file(key),
179 contents,
181 open(proxy_file, 'wb').write(contents)
184 def getguid(contents, offset): argument
186 g0, g1, g2, g3 = struct.unpack_from('<IHH8s', contents, offset)
191 def setguid(contents, offset, guid): argument
193 struct.pack_into('<IHH8s', contents, offset,
198 contents, ntypes, type_off, guid_off, guid_len = get_tlb_contents(tlb_file)
201 current_guid = getguid(contents, guid_off + i)
204 setguid(contents, guid_off + i, dynamic_guids[key])
206 recreate_guid_hashtable(contents, ntypes, guid_off, guid_len)
207 open(tlb_file, 'wb').write(contents)
243 contents = open(idl_template, 'rb').read()
244 contents = re.sub(b'PLACEHOLDER-GUID-', b'', contents, flags=re.I)
247 contents = re.sub(key, dynamic_guids[key], contents, flags=re.I)
248 open(idl, 'wb').write(contents)