Nikolay Sivov (@nsivov) commented about dlls/kernel32/tests/actctx.c:
ok_(__FILE__, line)(data.hActCtx == NULL, "data.hActCtx=%p\n", data.hActCtx); ok_(__FILE__, line)(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%lu, expected %lu\n", data.ulAssemblyRosterIndex, exid);
- header = (struct guidsection_header*)data.lpSectionBase;
- ok(header->magic == 0x64487347, "got wrong magic 0x%08lx\n", header->magic);
- ok(header->size == sizeof(*header), "got size %ld\n", header->size);
- ok(header->count == count, "got count %ld, expected %ld\n", header->count, count);
- ok(header->index_offset == sizeof(*header), "got index offset %lu\n", header->index_offset);
- index = (struct guid_index*)((BYTE*)data.lpSectionBase + header->index_offset);
- ok(index[0].data_offset == sizeof(*header) + count * sizeof(*index), "got data offset %ld\n", index[0].data_offset);
- ok(index[0].rosterindex == exid, "got roster index %ld, expected %lu\n", index[0].rosterindex, exid);
- ok(index[1].data_offset == index[0].data_offset + index[0].data_len, "got data offset %lu, expected %lu\n",
index[1].data_offset, index[0].data_offset + index[0].data_len);
- ok(index[1].rosterindex == exid, "got roster index %ld, expected %lu\n", index[1].rosterindex, exid);
I was thinking of having some helper that would validate guid index, and another one for string index (unrelated to your fix). There is no need to pass in number of entries, it's fine to use what's in the header. Then we'd call for index validation for all sections, it's possible there are more issues like what you've found.