Alfred Agrell (@Alcaro) commented about tools/widl/metadata.c:
+ size = strlen( str ) + 1; + if ((idx = find_index( &strings_idx, &strings, (const BYTE *)str, size, FALSE, &insert_idx ))) + return idx->offset; + + grow_buffer( &strings, size ); + memcpy( strings.ptr + offset, str, size ); + strings.offset += size; + strings.count++; + + insert_index( &strings_idx, insert_idx, offset, size ); + return offset; +} + +static inline int is_special_char( USHORT c ) +{ + return (c & 0x80 || (c >= 0x01 && c <= 0x08) || (c >= 0x0e && c <= 0x1f) || c == 0x27 || c == 0x2d || c == 0x7f); https://ecma-international.org/wp-content/uploads/ECMA-335_6th_edition_june_... section II.24.2.4 #US and #Blob heaps
Furthermore, there is an additional terminal byte (so all byte counts are odd, not even). This final byte holds the value 1 if and only if any UTF16 character within the string has any bit set in its top byte, or its low byte is any of the following: 0x01–0x08, 0x0E–0x1F, 0x27, 0x2D, 0x7F. Otherwise, it holds 0. The 1 signifies Unicode characters that require handling beyond that normally provided for 8-bit encoding sets.
So that should be c >= 0x0100, not c & 0x80. Weird rule, but clear enough. (We may also want a comment or two.) -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8037#note_103304