Re: how do I read registry key?
My Latest with Wolf's recommendations. Now I can open and close the key, but still am getting an invalid parameter trying to read the key K:\Windows\NtUtil>perl6 -I. -e "use WinMount :GetLUA; say GetLUA();" RegOpenKeyExW RegOpenKeyExW RtnCode 0 RegQueryValueExW 1 2 RegQueryValueExW RtnCode 87 (87 = ERROR_INVALID_PARAMETER) lpData pointer 0 lpcbData data length 0 RegCloseKey RegCloseKey RtnCode 0 True # unit module WinMount; # WinMount.pm6 #`{ Utilities to mount and dismound drive partitions Note: LUA must be unset (0x) for mount to function prpoperly raku -I. -c WinMount.pm6 } use NativeCall; use WinPopUps :WinMsg; # Reference to types and values: http://dsource.org/projects/tango/ticket/820 constant BYTE:= uint8; constant WCHAR := uint16; constant DWORD := int32; constant REGSAM := int32; constant WCHARS := CArray[WCHAR]; constant BYTES := CArray[BYTE]; constant HKEY_CURRENT_USER = 0x8001; constant HKEY_LOCAL_MACHINE = 0x8002; constant KEY_QUERY_VALUE = 1; constant ERROR_SUCCESS = 0; # Yeah, I know. The Win-Api uses 0 for success and other values to indicate errors constant REG_SZ = 1; constant KEY_READ = 0x20019; constant KEY_SET_VALUE = 0x0002; constant REG_DWORD = 0x0004; sub to-c-str( Str $str ) returns CArray[WCHAR] is export( :to-c-str ) { my @str := CArray[WCHAR].new; for ( $str.comb ).kv -> $i, $char { @str[$i] = $char.ord; } @str[ $str.chars ] = 0; @str; } sub wstr( Str $str ) returns WCHARS is export( :wstr ) { CArray[WCHAR].new( $str.comb.map: *.ord ) } sub GetLUA() is export( :GetLUA ) { #`{ Returns the LUA value in the registry to True (0x0001) or False (0x) [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] "EnableLUA"=dword: https://docs.perl6.org/language/nativecall Win32 return codes: https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499- } my Str $SubName = &?ROUTINE.name; my Str $OS = $*KERNEL.name; if not $OS eq "win32" { say "Sorry, $SubName only work in Windows."; exit; } my Bool $LUA = True; my $RtnCode; my Str $SubKey = Q[SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\]; my Str $Key = Q[EnableLUA]; my $lpSubKey= wstr( $SubKey ); my $lpValueName = wstr( $Key ); # my $lpSubKey= CArray[uint8].new($Key.encode.list); # my $lpValueName = CArray[uint8].new($SubKey.encode.list); my int32 $Handle; my int32 $ulOptions = 0; my int32 $lpData; my int32 $lpcbData; my int32 $lpReserved = 1; #`{ Open the key: https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regopenkeyexw https://docs.microsoft.com/en-us/windows/win32/sysinfo/registry-key-security-and-access-rights C++ LSTATUS RegOpenKeyExW( HKEYhKey, # Hive name (HKEY_LOCAL_MACHINE) LPCWSTR lpSubKey, # path to the key(/SOFTWARE/Microsoft/Windows/CurrentVersion/Policies/System/EnableLUA) DWORD ulOptions, # 0 REGSAM samDesired,# KEY_READ (0x20019), KEY_SET_VALUE (0x0002) PHKEY phkResult # A pointer to a variable that receives a handle to the opened key ); } say "RegOpenKeyExW"; sub RegOpenKeyExW( DWORD, WCHARS, DWORD, DWORD, DWORD is rw) is native("Kernel32.dll") returns DWORD { * }; $RtnCode = RegOpenKeyExW( HKEY_LOCAL_MACHINE, $lpSubKey, $ulOptions, KEY_READ, $Handle ); say "RegOpenKeyExW RtnCode $RtnCode\n"; #`{ Read the key: use RegQueryValueExW if you know key and value name https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regqueryvalueexw C++ LSTATUS RegQueryValueExW( HKEYhKey, # Hive name (HKEY_LOCAL_MACHINE) LPCWSTR lpValueName, # path to the key(\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA) LPDWORD lpReserved,# give it "int32" without the quotes to give it a NULL LPDWORD lpType,# Registry Value Type (REG_DWORD which is 32 bit) LPBYTE lpData,# Pointer to the return value LPDWORD lpcbData # number of bytes in the return value ); } say "RegQueryValueExW"; sub RegQueryValueExW( DWORD, WCHARS, DWORD, DWORD, DWORD is rw, DWORD is rw ) is native("Kernel32.dll") returns DWORD { * }; say "1"; $RtnCode = RegQueryValueExW( $Handle, $lpValueName, $lpReserved, REG_DWORD, $lpData, $lpcbData ); say "2"; say "RegQueryValueExW RtnCode $RtnCod
Re: how do I read registry key?
On 2019-12-27 00:45, WFB wrote: Hi Todd, According to this: https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499- Return code 161 means: ERROR_BAD_PATHNAME. Changing your code fixed that: my Str $SubKey = 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System'; my $lpValueName = wstr('EnableLUA'); Then the return code of the RegQueryValueExW is 87. According to the page above, that means ERROR_INVALID_PARAMETER. Because of that I looked at the RegQueryValueExW help page you linked and noticed that it says: |lpReserved| This parameter is reserved and must be *NULL*. In your code there is a 1 given. Unfortunately, just a 0 does not helped. Here, I have no idea how a NULL is given. Regards, Wolf Hi Wolf, The guys over on comp.lang.c++ gave me the same link to the error codes. I will try your fixes tomorrow when I get some free time. Thank you! -T
Re: how do I read registry key?
Hi Todd, According to this: https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499- Return code 161 means: ERROR_BAD_PATHNAME. Changing your code fixed that: my Str $SubKey = 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System'; my $lpValueName = wstr('EnableLUA'); Then the return code of the RegQueryValueExW is 87. According to the page above, that means ERROR_INVALID_PARAMETER. Because of that I looked at the RegQueryValueExW help page you linked and noticed that it says: lpReserved This parameter is reserved and must be *NULL*. In your code there is a 1 given. Unfortunately, just a 0 does not helped. Here, I have no idea how a NULL is given. Regards, Wolf On Fri, 27 Dec 2019 at 08:22, WFB wrote: > I would love to look into that, however, my son needs all my free time and > I do have very little knowledge about NativeCall. > I hope I will find time in the next days to learn more of this stuff, but > I will not much help :-( > > > On Fri, 27 Dec 2019 at 07:31, ToddAndMargo via perl6-users < > perl6-users@perl.org> wrote: > >> This is how far I have gotten: >> >> Note that is I use a "0" in >> >> $RtnCode = RegQueryValueExW( HKEY_LOCAL_MACHINE, $lpValueName, 1, >> REG_DWORD, $lpData, $lpcbData ); >> >> The program dies with no return code. >> >> -T >> >> >> >> K:\Windows\NtUtil>perl6 -I. -e "use WinMount :GetLUA; say >> GetLUA();" >> RegOpenKeyExW >> RegOpenKeyExW RtnCode 161 >> >> RegQueryValueExW >> 1 >> 2 >> RegQueryValueExW RtnCode 87 >> lpData pointer 0 >> lpcbData data length 0 >> >> RegCloseKey >> RegCloseKey RtnCode 6 >> >> True >> >> >> >> >> >> # unit module WinMount; >> # WinMount.pm6 >> >> #`{ >> >> Utilities to mount and dismound drive partitions >> Note: LUA must be unset (0x) for mount to function >> prpoperly >> >> raku -I. -c WinMount.pm6 >> >> } >> >> use NativeCall; >> use WinPopUps :WinMsg; >> >> >> # Reference to types and values: >> http://dsource.org/projects/tango/ticket/820 >> >> constant BYTE:= uint8; >> constant WCHAR := uint16; >> constant DWORD := int32; >> constant REGSAM := int32; >> constant WCHARS := CArray[WCHAR]; >> constant BYTES := CArray[BYTE]; >> >> constant HKEY_CURRENT_USER = 0x8001; >> constant HKEY_LOCAL_MACHINE = 0x8002; >> constant KEY_QUERY_VALUE = 1; >> constant ERROR_SUCCESS = 0; # Yeah, I know. The Win-Api >> uses 0 for success and other values to indicate errors >> constant REG_SZ = 1; >> >> constant KEY_READ = 0x20019; >> constant KEY_SET_VALUE = 0x0002; >> constant REG_DWORD = 0x0004; >> >> >> >> sub to-c-str( Str $str ) returns CArray[WCHAR] is export( >> :to-c-str ) { >> my @str := CArray[WCHAR].new; >> for ( $str.comb ).kv -> $i, $char { @str[$i] = $char.ord; } >> @str[ $str.chars ] = 0; >> @str; >> } >> >> >> sub wstr( Str $str ) returns WCHARS is export( :wstr ) { >> CArray[WCHAR].new( $str.comb.map: *.ord ) >> } >> >> >> sub GetLUA() is export( :GetLUA ) { >> >> #`{ >> >> Returns the LUA value in the registry to True (0x0001) or >> False (0x) >> >> >> >> [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] >>"EnableLUA"=dword: >> >> https://docs.perl6.org/language/nativecall >> >> } >> >> my Str $SubName = &?ROUTINE.name; >> my Str $OS = $*KERNEL.name; >> if not $OS eq "win32" { say "Sorry, $SubName only work in >> Windows."; exit; } >> >> my Bool $LUA = True; >> my $RtnCode; >> >> my Str $SubKey = >> '\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System'; >> my Str $Key = $SubKey ~ '\EnableLUA'; >> >> my $lpSubKey= wstr( $SubKey ); >> my $lpValueName = wstr( $Key ); >> # my $lpSubKey= CArray[uint8].new($Key.encode.list); >> # my $lpValueName = CArray[uint8].new($SubKey.encode.list); >> >> >> my int32 $Handle; >> my int32 $ulOptions = 0; >> my int32 $lpData; >> my int32 $lpcbData; >> >> >> #`{ >> Open the key: >> >> >> https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regopenkeyexw >> >> >> https://docs.microsoft.com/en-us/windows/win32/sysinfo/registry-key-security-and-access-rights >> C++ >> LSTATUS RegOpenKeyExW( >> HKEYhKey, # Hive name (HKEY_LOCAL_MACHINE) >> LPCWSTR lpSu
Re: how do I read registry key?
I would love to look into that, however, my son needs all my free time and I do have very little knowledge about NativeCall. I hope I will find time in the next days to learn more of this stuff, but I will not much help :-( On Fri, 27 Dec 2019 at 07:31, ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > This is how far I have gotten: > > Note that is I use a "0" in > > $RtnCode = RegQueryValueExW( HKEY_LOCAL_MACHINE, $lpValueName, 1, > REG_DWORD, $lpData, $lpcbData ); > > The program dies with no return code. > > -T > > > > K:\Windows\NtUtil>perl6 -I. -e "use WinMount :GetLUA; say > GetLUA();" > RegOpenKeyExW > RegOpenKeyExW RtnCode 161 > > RegQueryValueExW > 1 > 2 > RegQueryValueExW RtnCode 87 > lpData pointer 0 > lpcbData data length 0 > > RegCloseKey > RegCloseKey RtnCode 6 > > True > > > > > > # unit module WinMount; > # WinMount.pm6 > > #`{ > > Utilities to mount and dismound drive partitions > Note: LUA must be unset (0x) for mount to function > prpoperly > > raku -I. -c WinMount.pm6 > > } > > use NativeCall; > use WinPopUps :WinMsg; > > > # Reference to types and values: > http://dsource.org/projects/tango/ticket/820 > > constant BYTE:= uint8; > constant WCHAR := uint16; > constant DWORD := int32; > constant REGSAM := int32; > constant WCHARS := CArray[WCHAR]; > constant BYTES := CArray[BYTE]; > > constant HKEY_CURRENT_USER = 0x8001; > constant HKEY_LOCAL_MACHINE = 0x8002; > constant KEY_QUERY_VALUE = 1; > constant ERROR_SUCCESS = 0; # Yeah, I know. The Win-Api > uses 0 for success and other values to indicate errors > constant REG_SZ = 1; > > constant KEY_READ = 0x20019; > constant KEY_SET_VALUE = 0x0002; > constant REG_DWORD = 0x0004; > > > > sub to-c-str( Str $str ) returns CArray[WCHAR] is export( > :to-c-str ) { > my @str := CArray[WCHAR].new; > for ( $str.comb ).kv -> $i, $char { @str[$i] = $char.ord; } > @str[ $str.chars ] = 0; > @str; > } > > > sub wstr( Str $str ) returns WCHARS is export( :wstr ) { > CArray[WCHAR].new( $str.comb.map: *.ord ) > } > > > sub GetLUA() is export( :GetLUA ) { > > #`{ > > Returns the LUA value in the registry to True (0x0001) or > False (0x) > > > > [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] >"EnableLUA"=dword: > > https://docs.perl6.org/language/nativecall > > } > > my Str $SubName = &?ROUTINE.name; > my Str $OS = $*KERNEL.name; > if not $OS eq "win32" { say "Sorry, $SubName only work in > Windows."; exit; } > > my Bool $LUA = True; > my $RtnCode; > > my Str $SubKey = > '\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System'; > my Str $Key = $SubKey ~ '\EnableLUA'; > > my $lpSubKey= wstr( $SubKey ); > my $lpValueName = wstr( $Key ); > # my $lpSubKey= CArray[uint8].new($Key.encode.list); > # my $lpValueName = CArray[uint8].new($SubKey.encode.list); > > > my int32 $Handle; > my int32 $ulOptions = 0; > my int32 $lpData; > my int32 $lpcbData; > > > #`{ > Open the key: > > > https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regopenkeyexw > > > https://docs.microsoft.com/en-us/windows/win32/sysinfo/registry-key-security-and-access-rights > C++ > LSTATUS RegOpenKeyExW( > HKEYhKey, # Hive name (HKEY_LOCAL_MACHINE) > LPCWSTR lpSubKey, # path to the > key(/SOFTWARE/Microsoft/Windows/CurrentVersion/Policies/System/EnableLUA) > DWORD ulOptions, # 0 > REGSAM samDesired,# KEY_READ (0x20019), > KEY_SET_VALUE (0x0002) > PHKEY phkResult # A pointer to a variable that > receives a handle to the opened key > ); > } > say "RegOpenKeyExW"; > sub RegOpenKeyExW( DWORD, WCHARS, DWORD, DWORD, DWORD is rw) > is native("Kernel32.dll") returns DWORD { * }; > $RtnCode = RegOpenKeyExW( HKEY_LOCAL_MACHINE, $lpSubKey, > $ulOptions, KEY_READ, $Handle ); > say "RegOpenKeyExW RtnCode $RtnCode\n"; > > > > #`{ > Read the key: > use RegQueryValueExW if you know key and value name > > > https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regqueryvalueexw > C+
Re: how do I read registry key?
This is how far I have gotten: Note that is I use a "0" in $RtnCode = RegQueryValueExW( HKEY_LOCAL_MACHINE, $lpValueName, 1, REG_DWORD, $lpData, $lpcbData ); The program dies with no return code. -T K:\Windows\NtUtil>perl6 -I. -e "use WinMount :GetLUA; say GetLUA();" RegOpenKeyExW RegOpenKeyExW RtnCode 161 RegQueryValueExW 1 2 RegQueryValueExW RtnCode 87 lpData pointer 0 lpcbData data length 0 RegCloseKey RegCloseKey RtnCode 6 True # unit module WinMount; # WinMount.pm6 #`{ Utilities to mount and dismound drive partitions Note: LUA must be unset (0x) for mount to function prpoperly raku -I. -c WinMount.pm6 } use NativeCall; use WinPopUps :WinMsg; # Reference to types and values: http://dsource.org/projects/tango/ticket/820 constant BYTE:= uint8; constant WCHAR := uint16; constant DWORD := int32; constant REGSAM := int32; constant WCHARS := CArray[WCHAR]; constant BYTES := CArray[BYTE]; constant HKEY_CURRENT_USER = 0x8001; constant HKEY_LOCAL_MACHINE = 0x8002; constant KEY_QUERY_VALUE = 1; constant ERROR_SUCCESS = 0; # Yeah, I know. The Win-Api uses 0 for success and other values to indicate errors constant REG_SZ = 1; constant KEY_READ = 0x20019; constant KEY_SET_VALUE = 0x0002; constant REG_DWORD = 0x0004; sub to-c-str( Str $str ) returns CArray[WCHAR] is export( :to-c-str ) { my @str := CArray[WCHAR].new; for ( $str.comb ).kv -> $i, $char { @str[$i] = $char.ord; } @str[ $str.chars ] = 0; @str; } sub wstr( Str $str ) returns WCHARS is export( :wstr ) { CArray[WCHAR].new( $str.comb.map: *.ord ) } sub GetLUA() is export( :GetLUA ) { #`{ Returns the LUA value in the registry to True (0x0001) or False (0x) [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] "EnableLUA"=dword: https://docs.perl6.org/language/nativecall } my Str $SubName = &?ROUTINE.name; my Str $OS = $*KERNEL.name; if not $OS eq "win32" { say "Sorry, $SubName only work in Windows."; exit; } my Bool $LUA = True; my $RtnCode; my Str $SubKey = '\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System'; my Str $Key = $SubKey ~ '\EnableLUA'; my $lpSubKey= wstr( $SubKey ); my $lpValueName = wstr( $Key ); # my $lpSubKey= CArray[uint8].new($Key.encode.list); # my $lpValueName = CArray[uint8].new($SubKey.encode.list); my int32 $Handle; my int32 $ulOptions = 0; my int32 $lpData; my int32 $lpcbData; #`{ Open the key: https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regopenkeyexw https://docs.microsoft.com/en-us/windows/win32/sysinfo/registry-key-security-and-access-rights C++ LSTATUS RegOpenKeyExW( HKEYhKey, # Hive name (HKEY_LOCAL_MACHINE) LPCWSTR lpSubKey, # path to the key(/SOFTWARE/Microsoft/Windows/CurrentVersion/Policies/System/EnableLUA) DWORD ulOptions, # 0 REGSAM samDesired,# KEY_READ (0x20019), KEY_SET_VALUE (0x0002) PHKEY phkResult # A pointer to a variable that receives a handle to the opened key ); } say "RegOpenKeyExW"; sub RegOpenKeyExW( DWORD, WCHARS, DWORD, DWORD, DWORD is rw) is native("Kernel32.dll") returns DWORD { * }; $RtnCode = RegOpenKeyExW( HKEY_LOCAL_MACHINE, $lpSubKey, $ulOptions, KEY_READ, $Handle ); say "RegOpenKeyExW RtnCode $RtnCode\n"; #`{ Read the key: use RegQueryValueExW if you know key and value name https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regqueryvalueexw C++ LSTATUS RegQueryValueExW( HKEYhKey, # Hive name (HKEY_LOCAL_MACHINE) LPCWSTR lpValueName, # path to the key(\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA) LPDWORD lpReserved,# give it "int32" without the quotes to give it a NULL LPDWORD lpType,# Registry Value Type (REG_DWORD which is 32 bit) LPBYTE lpData,# Pointer to the return value LPDWORD lpcbData # number of bytes in the return value ); } say "RegQueryValueExW"; sub RegQueryVa
Re: how do I read registry key?
On 2019-12-25 21:48, WFB wrote: BTW, hat would be also a great module for pushing to https://modules.raku.org/. Not sure my code is good enough for that. :'(
Re: how do I read registry key?
On 2019-12-25 21:48, WFB wrote: On Wed, 25 Dec 2019 at 23:10, ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: Hi All, Windows https://docs.microsoft.com/en-us/windows/win32/sysinfo/retrieving-data-from-the-registry How do I use this to read retrieve a value of a registry key? Many thanks, -T Hi Todd, Two things comes to mind for solving this. First, you use the Windows Commandline command REG together with "run". See REG /? for more information. Or second, use NativeCall to use the Windows API calls similar to your MessageBox module. Your link shows the needed API calls. BTW, hat would be also a great module for pushing to https://modules.raku.org/. Greetings, Wolf Hi Wolf, I am trying to do it with native call. So far, I get $ perl6 -I. -e "use WinMount :GetLUA; say GetLUA();" ===SORRY!=== Error while compiling /home/CDs/Windows/NtUtil/WinMount.pm6 (WinMount) Calling RegQueryValueExW(Str, NativeCall::Types::CArray[uint16], int, NativeCall::Types::CArray[uint16]) will never work with declared signature (NativeCall::Types::CArray[uint16] $, NativeCall::Types::CArray[uint16] $, int32, NativeCall::Types::CArray[uint16] $ --> int32) at /home/CDs/Windows/NtUtil/WinMount.pm6 (WinMount):69 -->$DWord = ⏏RegQueryValueExW( "HKEY_LOCAL_MACHINE", I am doing something wrong: constant WCHAR = uint16; sub to-c-str( Str $str ) returns CArray[WCHAR] { my @str := CArray[WCHAR].new; for ( $str.comb ).kv -> $i, $char { @str[$i] = $char.ord; } @str[ $str.chars ] = 0; @str; } sub GetLUA() is export( :GetLUA ) { #`{ Returns the LUA value in the registry to True (0x0001) or False (0x) [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] "EnableLUA"=dword: use RegQueryValueExW if you know key and value name https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regqueryvalueexw https://docs.perl6.org/language/nativecall C++ LSTATUS RegQueryValueExW( HKEYhKey, # Hive name (HKEY_LOCAL_MACHINE) LPCWSTR lpValueName, # path to the key(/SOFTWARE/Microsoft/Windows/CurrentVersion/Policies/System/EnableLUA) LPDWORD lpReserved,# give it "int32" without the quotes to give it a NULL LPDWORD lpType,# Registry Value Type (REG_DWORD which is 32 bit) LPBYTE lpData,# Pointer to the return value LPDWORD lpcbData # number of bytes in the return value ); } my Str $SubName = &?ROUTINE.name; my Str $OS = $*KERNEL.name; if not $OS eq "win32" { say "Sorry, $SubName only work in Windows."; exit; } constant hKey = CArray[WCHAR]; constant lpValueName= CArray[WCHAR]; constant INT= int32; constant lpType = CArray[WCHAR]; constant lpData = Pointer[void]; constant lpcbData = uint32; my Bool $LUA = True; my int32 $DWord; my int32 $DLen; sub RegQueryValueExW( hKey, lpValueName, INT, lpType ) is native('user32') returns INT { * }; $DWord = RegQueryValueExW( "HKEY_LOCAL_MACHINE", to-c-str( "/SOFTWARE/Microsoft/Windows/CurrentVersion/Policies/System/EnableLUA" ), int32, to-c-str( "REG_DWORD" ) ); if $DWord == 0 { $LUA = False; } return $LUA; }
Re: how do I read registry key?
On Wed, 25 Dec 2019 at 23:10, ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > Hi All, > > Windows > > > https://docs.microsoft.com/en-us/windows/win32/sysinfo/retrieving-data-from-the-registry > > How do I use this to read retrieve a value of a registry key? > > Many thanks, > -T > Hi Todd, Two things comes to mind for solving this. First, you use the Windows Commandline command REG together with "run". See REG /? for more information. Or second, use NativeCall to use the Windows API calls similar to your MessageBox module. Your link shows the needed API calls. BTW, hat would be also a great module for pushing to https://modules.raku.org/. Greetings, Wolf
how do I read registry key?
Hi All, Windows https://docs.microsoft.com/en-us/windows/win32/sysinfo/retrieving-data-from-the-registry How do I use this to read retrieve a value of a registry key? Many thanks, -T