I’m still asking you the same question I asked in
https://www.nntp.perl.org/group/perl.perl6.users/2020/01/msg8029.html

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.

Could you please confine your answer to cData, and only in the case where
it’s UTF + Null and not a numeric value? It creates such bizarre
restrictions on what it can hold that I’m trying to wrap my head around how
it works in practice. That’s all I want to know.

Also, you could show code where a ‘uint’ becomes an ‘int’ unbidden, or say
you were mistaken and confused the uppercased auto-boxed ‘Int’ for the
lowercased native ‘int’.

Finally, you could also explain if the multis suggested for solving your
type-checking issue are what you wanted or not.

Thank you.

On Wed, Jan 29, 2020 at 16:40 ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

> On 2020-01-29 13:01, Trey Harris wrote:
> >
> > On Wed, Jan 29, 2020 at 15:28 ToddAndMargo via perl6-users
> > <perl6-users@perl.org <mailto:perl6-users@perl.org>> wrote:
> >
> >     "Todd" would convert to
> >           84 00 111 00 100 00 100 00 00 00
> >
> >
> > I’m sorry, you misunderstood me. I wasn’t asking how to convert text
> > into UTF. I was asking for an example of the 3-byte UTF plus 32-bit null
> > cbData field. “Todd\0” is not 3-bytes + null, it’s 4 bytes + null. (You
> > can see that from your groupings above—every two pairs make an octet,
> > and there are 5 pairs. That’s 40 bits, not 32.)
> >
> > Also, I assume you used that because it’s your name—could you use an
> > example from the actual registry dataset like what you’re processing,
> > please, and not one that you’ve invented yourself? I’m trying to see how
> > it’s _used_ in real life, not how you’re imagining it could be used.
>
>
> Hi Trey,
>
> In the following example, I am not messing
> with a key that Widows actually uses, but should,
> don't you think?
>
>      The registry hive is: HKEY_LOCAL_MACHINE
>      The key location is:  SOFTWARE\Microsoft\Windows NT\CurrentVersion
>      The key is:           BestLookingEngineer
>      The key type is:      REG_SZ  (means a string)
>      and the "True" turns on debugging
>
> perl6 -I. -e "use NativeConstants; use WinReg :WinRegSetValue; say
> WinRegSetValue( HKEY_LOCAL_MACHINE, Q[SOFTWARE\Microsoft\Windows
> NT\CurrentVersion], Q[BestLookingEngineer], REG_SZ, 'Todd', True );"
>
>
> WinRegSetValue Debug
>       ValueType  REG_SZ  (1)
>         KeyName  BestLookingEngineer
>     lpValueName  66 101 115 116 76 111 111 107 105 110 103 69 110 103
> 105 110 101 101 114 0
>          dsType  1
>       ValueData  Todd
>          lpData  84 111 100 100 0
>    lpData.elems  5
>          cdData  10
>
>
> lpValueName is comes from
>
>      sub to-UTF16-c-str( Str $RakuStr ) returns CArray[uint16] is
> export( :to-UTF16-c-str )  {
>         # Converts a UTF8 Raku string into a UTF16 little endian C string
>         # Note: C Strings are always terminated with a nul.  WinAPI will
> malfunction without it
>
>         my $CStr = CArray[uint16].new();
>         $CStr = CArray[uint16].new( $RakuStr.encode.list, 0 );  # add a
> nul to the end
>
>         return $CStr;
>       }
>
>
> I have yet to figure out a way to break
>
>     my $CStr = CArray[uint16].new();
>
> into bytes for analysis, but it is UTF16 little endian.
> The "W" at the end of "RegSetValueExW" requires it.
>
> In the real world, I check the LUA key
>
>
>
> [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
>
>       "EnableLUA"=dword:00000000
>
> to make sure it is zero, so I can mount and dismount
> hidden drive partitions.  The same module will
> unset the LUA for you on a prompt.
>
> -T
>

Reply via email to