Sorry. Not a WINAPI expert, nor do I want to be. ;) The $nSize variable looks fishy. Can it ever contain a value that's <= 2? If so, you're in for a surprise one day. ;)
Bedtime. ~Paul On Sun, Jan 19, 2020 at 12:28 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On 2020-01-18 21:20, Paul Procacci wrote: > > Perfect. Obviously didn't know that. My assumption that only the first > > byte gets checked was obviously wrong. > > > > Thanks gents. > > > This is the way I dig out the ascii characters > from the word array. $nSize comes back from > function call. > > loop (my $Index=0; $Index < $nSize - 2 ; $Index += 2) { > my $i = chr( $lpBuffer[ $Index ] ); > if $i eq chr(0) { last; } > $ErrorString ~= $i; > } > > The `$Index += 2` skips over the second byte in the > WORD array. > > So far, WinAPI call have always sent me back > ascii characters in the first byte and a zero > in the second. > > 84 0 104 0 101 0 32 0 103 0 114 0 111 0 117 0 112 0 32 0 101 0 108 0 101 > 0 109 0 101 0 110 0 116 0 32 0 99 0 111 0 117 0 108 0 100 0 32 0 110 0 > 111 0 116 0 32 0 98 0 101 0 32 0 114 0 101 0 109 0 111 0 118 0 101 0 100 > 0 46 0 13 0 10 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 > -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 > -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 > -- __________________ :(){ :|:& };: