R
Rene Nyffenegger
Hello
When I run the code appended further down, the call
to RegOpenKeyEx fails and regLastError() returns
"The parameter is incorrect".
As far as I can see, all is correct, but obviously, it isn't.
If someone gave me a helpful tip, I'd be very grateful.
Rene Nyffenegger
---------------->8----------->8---------->8------------
use warnings;
use strict;
use Win32API::Registry qw
ALL);
my $handleSubKey=0;
my $handleSw =0;
my $company = "FooBar";
my $disp=0;
if ( ! RegOpenKeyEx(
HKEY_CURRENT_USER,
"Software",
0, # should be zero
KEY_ALL_ACCESS,
$handleSw) ) {
print regLastError();
}
print "handleSw: $handleSw\n";
if ( RegCreateKeyExW (
$handleSw,
$company,
0,
"",
REG_OPTION_NON_VOLATILE ,
KEY_ALL_ACCESS,
0,
$handleSubKey,
$disp)) {
print "$company existed already\n"
if $disp == REG_OPENED_EXISTING_KEY;
print "$company didn't exist, now created\n"
if $disp == REG_CREATED_NEW_KEY;
}
else {
print regLastError();
}
When I run the code appended further down, the call
to RegOpenKeyEx fails and regLastError() returns
"The parameter is incorrect".
As far as I can see, all is correct, but obviously, it isn't.
If someone gave me a helpful tip, I'd be very grateful.
Rene Nyffenegger
---------------->8----------->8---------->8------------
use warnings;
use strict;
use Win32API::Registry qw
my $handleSubKey=0;
my $handleSw =0;
my $company = "FooBar";
my $disp=0;
if ( ! RegOpenKeyEx(
HKEY_CURRENT_USER,
"Software",
0, # should be zero
KEY_ALL_ACCESS,
$handleSw) ) {
print regLastError();
}
print "handleSw: $handleSw\n";
if ( RegCreateKeyExW (
$handleSw,
$company,
0,
"",
REG_OPTION_NON_VOLATILE ,
KEY_ALL_ACCESS,
0,
$handleSubKey,
$disp)) {
print "$company existed already\n"
if $disp == REG_OPENED_EXISTING_KEY;
print "$company didn't exist, now created\n"
if $disp == REG_CREATED_NEW_KEY;
}
else {
print regLastError();
}