develooper Front page | perl.perl6.users | Postings from January 2020

Re: stolen uint's

Thread Previous | Thread Next
From:
ToddAndMargo via perl6-users
Date:
January 29, 2020 23:32
Subject:
Re: stolen uint's
Message ID:
d590b76b-7dbb-75d1-0541-bbd5bd7db1ab@zoho.com
On 2020-01-29 15:22, Trey Harris wrote:
> 
> 
> On Wed, Jan 29, 2020 at 17:52 ToddAndMargo via perl6-users 
> <perl6-users@perl.org <mailto:perl6-users@perl.org>> wrote:
> 
>     On 2020-01-29 14:20, Trey Harris wrote:
>      > I don’t care about IpData or ValueData—those are completely
>     unremarkable
>      > fields. Showing me more code relating to them—or any other fields
>      > besides cData—isn’t helpful to understanding how the 3-bytes UTF
>     + null
>      > cData field works.
> 
>     hi Trey,
> 
>     I think what I am missing is your "3-bytes UTF + null" question.
> 
>     It is only four bytes long when addressed as a REG_DWORD
>     (32 bit unsigned integer).  There is no nul at the end.
> 
>     The bounds are 0x0..0xFFFF_FFFF.  No boxing allowed
> 
>     $cbData = 4;
> 
> 
>     If your are addressing is as a REG_SZ (registry string),
>     it can be as many bytes as you want when.  You just have
>     to terminate it with a 0x0000
> 
>     $cbData = $lpData.elems * 2;  # words are two bytes long
> 
>     Does that help?
> 
> 
> Could you show the API definition again, please? The copy I see says 
> that field is a `DWORD cbData`. I don’t see the “as many bytes as you 
> want when. You just have to terminate it with a 0x0000” part of the 
> definition. Could you highlight it?


https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regsetvalueexw

    lpData

        The data to be stored.

        For string-based types, such as REG_SZ, the string must
        be null-terminated.

    cbData

        The size of the information pointed to by the lpData
        parameter, in bytes. If the data is of type REG_SZ,
        REG_EXPAND_SZ, or REG_MULTI_SZ, cbData must include
        the size of the terminating null character or
        characters.

Any better?

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About