Improved logging by including registry path for packages found.
This commit is contained in:
parent
0f9795bf86
commit
2c0cdab529
42
pkgtool.pm
42
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) {
|
||||
my $sub = $registry->{$name};
|
||||
next unless defined $sub;
|
||||
my $regname = $key.$name;
|
||||
if ($userdata) {
|
||||
$sub = $sub->{'InstallProperties'};
|
||||
next unless defined $sub;
|
||||
|
@ -868,6 +869,7 @@ sub read_packages ($$$$)
|
|||
}
|
||||
my $inst = {
|
||||
Name => $name,
|
||||
RegName => $regname,
|
||||
WinID => $winid,
|
||||
Publisher => $pub,
|
||||
DisplayName => $dispname,
|
||||
|
@ -948,32 +950,38 @@ sub read_installed_packages ($)
|
|||
|
||||
delete $$db{Changed};
|
||||
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) {
|
||||
print_log('global', ERROR, 'Cannot find registry entry: %s', 'HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall');
|
||||
return undef;
|
||||
}
|
||||
read_packages($packages, $uninst, 0, 0);
|
||||
$uninst = $Registry->Open('HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\', { Access => 'KEY_READ' });
|
||||
read_packages($packages, $key, $uninst, 0, 0);
|
||||
$key = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\';
|
||||
$uninst = $Registry->Open($key, { Access => 'KEY_READ' });
|
||||
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) {
|
||||
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) {
|
||||
read_packages($packages, $uninst, 1, 0);
|
||||
read_packages($packages, $key, $uninst, 1, 0);
|
||||
}
|
||||
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) {
|
||||
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) {
|
||||
read_packages($specpackages, $products, 1, 1);
|
||||
read_packages($specpackages, $key, $products, 1, 1);
|
||||
}
|
||||
$$db{Installed} = $packages;
|
||||
$$db{InstalledSpec} = $specpackages;
|
||||
|
@ -1491,11 +1499,13 @@ sub match_package_def ($$$)
|
|||
my $dispver = $$inst{DisplayVersion};
|
||||
$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,
|
||||
defined $$inst{SystemComponent} ? ' SC='.$$inst{SystemComponent} : '',
|
||||
defined $$inst{WindowsInstaller} ? ' WI='.$$inst{WindowsInstaller} : '',
|
||||
$dispver, $$def{description});
|
||||
$dispver,
|
||||
$$inst{RegName});
|
||||
my $matchlist = $$def{'match'};
|
||||
foreach my $matchentry (@$matchlist) {
|
||||
my $expression = $$matchentry{expression};
|
||||
|
|
Loading…
Reference in a new issue