`msi_save_string_table` disagrees with `msi_load_string_table` for long strings
msi_save_string_table
encodes long strings with a dummy entry that stores the a length of 0 followed by the high 16 bits of the length in the refcount field, and then a second entry that stores the low 16 bits of the length and the actual refcount. However msi_load_string_table
expects long strings to be encoded as an entry with length 0 followed by the actual refcount and then a second entry with the low 16 bits of the length followed by its high 16 bits.
Showed visually:
function | short 0 | short 1 | short 2 | short 3 |
---|---|---|---|---|
msi_save_string_table |
0 | high length | low length | refcount |
msi_load_string_table |
0 | refcount | low length | high length |
This was researched as part of https://github.com/mdsteele/rust-msi/pull/18 and it seems the correct encoding is the one expected by msi_load_string_table
.