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

Re: Request for Enhancement: Native Call error

Thread Previous | Thread Next
From:
WFB
Date:
January 7, 2020 08:11
Subject:
Re: Request for Enhancement: Native Call error
Message ID:
CAGXvwmdCYWgwQ1OU1SgaAT9Mv7jc4TOTiSVM1oboAycCoPca+g@mail.gmail.com
Hi Todd,

I think RegQueryValueExW is not the best choice for this to get the job
done. Back in the $work with a Windows box, I looked around and found the
RegGetValueW method:
https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-reggetvaluew

This method accept a type. No need to use an array with fixed size for the
return data.

Greetings
Wolf

On Fri, 3 Jan 2020 at 20:24, ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

> >> On Wed, 1 Jan 2020 at 03:48, ToddAndMargo via perl6-users
> >> <perl6-users@perl.org <mailto:perl6-users@perl.org>> wrote:
> >>
> >>     Hi All,
> >>
> >>     Request for Enhancement: Native Call error
> >>
> >>     perl6 -I. -e "use WinReg :WinReadRegKey; say WinReadRegKey(
> >>     HKEY_LOCAL_MACHINE,
> >>     Q[SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system],
> >>     Q[EnableLUA] );"
> >>
> >>     Native call expected argument that references a native integer, but
> got
> >>     P6int in method CALL-ME at
> >>
>  C:\rakudo\share\perl6\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B
> >>     (NativeCall) line 587 in sub WinReadRegKey at
> >>     K:\Windows\NtUtil\WinReg.pm6 (WinReg) line 177 in block <unit> at -e
> >>     line 1
> >>
> >>
> >>     "references a native integer, but got P6int" is NOT REALLY HELPFUL.
> >>     Would you please tell me which one threw this error?
> >>
> >>
> >>     Many thanks,
> >>     -T
>
> On 2020-01-01 07:06, WFB wrote:
> > Hi Todd,
> > Sounds like in WinReg.pm6 line 177 is a definition like :
> >   sub RegOpenKeyExW( DWORD, WCHARS, DWORD, DWORD, DWORD is rw) is
> > native("Kernel32.dll") returns DWORD { * };
> > and you put a "my $i = 0" variable instead of "my int32 $i = 0" in it
> > somewhere.
> >
> > Greetings,
> > Wolf
> >
> Hi Wolf,
>
> I did figure it out.  I would just like the error message
> to be a little more helpful.
>
>     sub RegQueryValueExW( DWORD, WCHARS, DWORD, DWORD, CArray[BYTE] is
> rw, DWORD is rw ) is native( "Kernel32.dll" ) is symbol(
> "RegQueryValueExW" ) returns DWORD { * };
>
>     $RtnCode = RegQueryValueExW( $Handle, $lpValueName, 0, $lpType,
> $lpData, $lpcbData );
>
> -T
>

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