Improved logging by including registry path for packages found.
This commit is contained in:
parent
0f9795bf86
commit
2c0cdab529
44
pkgtool.pm
44
pkgtool.pm
|
@ -836,13 +836,14 @@ sub read_pkg_patches ($$$)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub read_packages ($$$$)
|
sub read_packages ($$$$$)
|
||||||
{
|
{
|
||||||
my ($packages, $registry, $wow6432, $userdata) = @_;
|
my ($packages, $key, $registry, $wow6432, $userdata) = @_;
|
||||||
|
|
||||||
foreach my $name ($registry->SubKeyNames) {
|
foreach my $name ($registry->SubKeyNames) {
|
||||||
my $sub = $registry->{$name};
|
my $sub = $registry->{$name};
|
||||||
next unless defined $sub;
|
next unless defined $sub;
|
||||||
|
my $regname = $key.$name;
|
||||||
if ($userdata) {
|
if ($userdata) {
|
||||||
$sub = $sub->{'InstallProperties'};
|
$sub = $sub->{'InstallProperties'};
|
||||||
next unless defined $sub;
|
next unless defined $sub;
|
||||||
|
@ -867,7 +868,8 @@ sub read_packages ($$$$)
|
||||||
$winid = $8.$7.$6.$5.$4.$3.$2.$1.$12.$11.$10.$9.$16.$15.$14.$13.$18.$17.$20.$19.$22.$21.$24.$23.$26.$25.$28.$27.$30.$29.$32.$31;
|
$winid = $8.$7.$6.$5.$4.$3.$2.$1.$12.$11.$10.$9.$16.$15.$14.$13.$18.$17.$20.$19.$22.$21.$24.$23.$26.$25.$28.$27.$30.$29.$32.$31;
|
||||||
}
|
}
|
||||||
my $inst = {
|
my $inst = {
|
||||||
Name => $name,
|
Name => $name,
|
||||||
|
RegName => $regname,
|
||||||
WinID => $winid,
|
WinID => $winid,
|
||||||
Publisher => $pub,
|
Publisher => $pub,
|
||||||
DisplayName => $dispname,
|
DisplayName => $dispname,
|
||||||
|
@ -948,32 +950,38 @@ sub read_installed_packages ($)
|
||||||
|
|
||||||
delete $$db{Changed};
|
delete $$db{Changed};
|
||||||
my $packages = {};
|
my $packages = {};
|
||||||
my $uninst = $Registry->Open('HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\', { Access => 'KEY_READ' });
|
my $key = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\';
|
||||||
|
my $uninst = $Registry->Open($key, { Access => 'KEY_READ' });
|
||||||
if (! defined $uninst) {
|
if (! defined $uninst) {
|
||||||
print_log('global', ERROR, 'Cannot find registry entry: %s', 'HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall');
|
print_log('global', ERROR, 'Cannot find registry entry: %s', 'HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall');
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
read_packages($packages, $uninst, 0, 0);
|
read_packages($packages, $key, $uninst, 0, 0);
|
||||||
$uninst = $Registry->Open('HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\', { Access => 'KEY_READ' });
|
$key = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\';
|
||||||
|
$uninst = $Registry->Open($key, { Access => 'KEY_READ' });
|
||||||
if (defined $uninst) {
|
if (defined $uninst) {
|
||||||
read_packages($packages, $uninst, 1, 0);
|
read_packages($packages, $key, $uninst, 1, 0);
|
||||||
}
|
}
|
||||||
$uninst = $Registry->Open('HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\', { Access => 'KEY_READ' });
|
$key = 'HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\';
|
||||||
|
$uninst = $Registry->Open($key, { Access => 'KEY_READ' });
|
||||||
if (defined $uninst) {
|
if (defined $uninst) {
|
||||||
read_packages($packages, $uninst, 0, 0);
|
read_packages($packages, $key, $uninst, 0, 0);
|
||||||
}
|
}
|
||||||
$uninst = $Registry->Open('HKEY_CURRENT_USER\\Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\', { Access => 'KEY_READ' });
|
$key = 'HKEY_CURRENT_USER\\Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\';
|
||||||
|
$uninst = $Registry->Open($key, { Access => 'KEY_READ' });
|
||||||
if (defined $uninst) {
|
if (defined $uninst) {
|
||||||
read_packages($packages, $uninst, 1, 0);
|
read_packages($packages, $key, $uninst, 1, 0);
|
||||||
}
|
}
|
||||||
my $specpackages = {};
|
my $specpackages = {};
|
||||||
my $products = $Registry->Open('HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\', { Access => 'KEY_READ' });
|
$key = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\';
|
||||||
|
my $products = $Registry->Open($key, { Access => 'KEY_READ' });
|
||||||
if (defined $products) {
|
if (defined $products) {
|
||||||
read_packages($specpackages, $products, 0, 1);
|
read_packages($specpackages, $key, $products, 0, 1);
|
||||||
}
|
}
|
||||||
$products = $Registry->Open('HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\', { Access => 'KEY_READ' });
|
$key = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\';
|
||||||
|
$products = $Registry->Open($key, { Access => 'KEY_READ' });
|
||||||
if (defined $products) {
|
if (defined $products) {
|
||||||
read_packages($specpackages, $products, 1, 1);
|
read_packages($specpackages, $key, $products, 1, 1);
|
||||||
}
|
}
|
||||||
$$db{Installed} = $packages;
|
$$db{Installed} = $packages;
|
||||||
$$db{InstalledSpec} = $specpackages;
|
$$db{InstalledSpec} = $specpackages;
|
||||||
|
@ -1491,11 +1499,13 @@ sub match_package_def ($$$)
|
||||||
my $dispver = $$inst{DisplayVersion};
|
my $dispver = $$inst{DisplayVersion};
|
||||||
$dispver = defined $dispver && $dispver ne '' ? ' ('.$dispver.')' : '';
|
$dispver = defined $dispver && $dispver ne '' ? ' ('.$dispver.')' : '';
|
||||||
|
|
||||||
print_log('global', DEBUG4, 'Trying to match package %s%s%s%s to definition %s',
|
print_log('global', DEBUG4, 'Trying definition %s for package %s%s%s%s at %s',
|
||||||
|
$$def{description},
|
||||||
$dispname,
|
$dispname,
|
||||||
defined $$inst{SystemComponent} ? ' SC='.$$inst{SystemComponent} : '',
|
defined $$inst{SystemComponent} ? ' SC='.$$inst{SystemComponent} : '',
|
||||||
defined $$inst{WindowsInstaller} ? ' WI='.$$inst{WindowsInstaller} : '',
|
defined $$inst{WindowsInstaller} ? ' WI='.$$inst{WindowsInstaller} : '',
|
||||||
$dispver, $$def{description});
|
$dispver,
|
||||||
|
$$inst{RegName});
|
||||||
my $matchlist = $$def{'match'};
|
my $matchlist = $$def{'match'};
|
||||||
foreach my $matchentry (@$matchlist) {
|
foreach my $matchentry (@$matchlist) {
|
||||||
my $expression = $$matchentry{expression};
|
my $expression = $$matchentry{expression};
|
||||||
|
|
Loading…
Reference in a new issue