On Wed, Jan 29, 2020 at 14:01 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote:
> On 2020-01-29 06:34, Trey Harris wrote: > > I was going to ask about that (but it seemed out of Raku-world, and I > > don’t even play someone who knows about Windows on TV), but, okay, I’ll > > bite... what are some examples of the precisely 3-byte + 32-bit null UTF > > strings you imagine being encoded by this interface? I have never heard > > of such a small fixed-width UTF data structure before because it’s just > > so bizarre, and then mandating a null termination so you lose the 4th > > byte that would make this structure at least somewhat coherent as a > > UCS-4 codepoint... since there’s no such thing as UTF-24, I assume this > > is three UTF-8 bytes packed (which I guess is what you mean by “little > > endian C string”, but that becomes at best ill-defined abutted next to > > “UTF”)... But, what on earth is it being used for? > > > > I’m fascinated, in the way a cat is fascinated by a snake.... > > Trey, > > You are basically setting up a buffer of bytes > and then telling the WinAPI how long the > data in the buffer is as well as what type of > data the buffer contains. That is clear from the document linked at https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regsetvalueexw But what I was asking about and what I don’t understand is what you meant when you wrote: > where CbData can either be a UTF little endian C string, > terminated by a nul or a four byte little endian > unsigned integer (no two's complement allowed) depending > on the value of lpValueName (REG_SZ, REG_DWORD, etc.) Can you explain just this part: > where CbData can… be a UTF little endian C string, > terminated by a null That’s the part I’m fascinated by because it’s just so strange. What’s an example of a valid value of this type and not the “unsigned integer (no two’s complement allowed)”?