On 2019-12-29 00:28, ToddAndMargo via perl6-users wrote:
On Fri, Dec 27, 2019 at 6:06 AM ToddAndMargo via perl6-users <perl6-users@perl.org <mailto:perl6-users@perl.org>> wrote:

    Hi All,

    https://docs.perl6.org/language/nativecall

           "As you may have predicted by now, a NULL pointer
           is represented by the type object of the struct type."

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

           C++
           LSTATUS RegQueryValueExW(
             HKEY    hKey,
             LPCWSTR lpValueName,
             LPDWORD lpReserved,
             LPDWORD lpType,
             LPBYTE  lpData,
             LPDWORD lpcbData
           );

           lpReserved
           This parameter is reserved and must be NULL.

    With "native", how do I satisfy the "NULL" requirement?

    constant WCHAR   := uint16;

    constant DWORD   := int32;


    sub RegQueryValueExW( DWORD, WCHARS, DWORD, DWORD, DWORD is rw,
    DWORD is
    rw ) is native("Kernel32.dll") returns DWORD { * };

    $RtnCode = RegQueryValueExW( $Handle, $lpValueName, int32, REG_DWORD,
    $lpData, $lpcbData );

    "int32" returns:

          Cannot unbox a type object (int32) to int in method
          CALL-ME at C:\rakudo\share\perl6\sources
    \947BDAB9F96E0E5FCCB383124F9
          23A6BF6F8D76B (NativeCall) line 587


    Many thanks,
    -T


On 2019-12-27 06:10, Brad Gilbert wrote:
A Null pointer is just a pointer that points to the address 0.

So if you are dealing with it as an integer it will be 0.

Hi Brad,

Disregard my last post.  I found a booboo somewhere else.
You were correct about the zero.

Thank you!

-T

Reply via email to