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

Re: Request for Enhancement: Native Call error

Thread Previous | Thread Next
From:
ToddAndMargo via perl6-users
Date:
January 3, 2020 19:24
Subject:
Re: Request for Enhancement: Native Call error
Message ID:
4357b582-6ff9-fb73-e29c-9f3866dfe9c1@zoho.com
>> 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