use
vars
qw($VERSION @ISA)
;
$VERSION
=
"0.001"
;
@ISA
=
qw(Alien::Packages::Base)
;
my
(
$haveWin32TieRegistry
,
$win32TieRegistry
);
sub
usable
{
unless
(
defined
(
$win32TieRegistry
) )
{
$haveWin32TieRegistry
= 0;
eval
{
$win32TieRegistry
=
$Win32::TieRegistry::Registry
->Clone();
$win32TieRegistry
->Delimiter(
"/"
);
my
$machKey
=
$win32TieRegistry
->Open(
"LMachine"
,
{
Access
=> Win32::TieRegistry::KEY_READ(),
Delimiter
=>
"/"
}
) or
die
"Can't open HKEY_LOCAL_MACHINE key: $^E\n"
;
$haveWin32TieRegistry
= 1;
};
}
return
$haveWin32TieRegistry
;
}
sub
list_packages
{
my
$self
=
$_
[0];
my
@packages
;
my
$machKey
=
$win32TieRegistry
->Open(
"LMachine"
,
{
Access
=> Win32::TieRegistry::KEY_READ(),
Delimiter
=>
"/"
}
) or
die
"Can't open HKEY_LOCAL_MACHINE key: $^E\n"
;
my
$regInstallRoot
=
$machKey
->Open(
"SOFTWARE/Microsoft/Windows/CurrentVersion/Installer/UserData"
);
foreach
my
$user
(
keys
%$regInstallRoot
)
{
my
$userProdKey
=
$regInstallRoot
->Open(
$user
.
"Products"
);
foreach
my
$product
(
keys
%$userProdKey
)
{
my
$instPropKey
=
$userProdKey
->Open(
$product
.
"InstallProperties"
);
my
%pkginfo
= (
Package
=>
$product
,
Description
=>
$instPropKey
->{DisplayName},
Version
=>
$instPropKey
->{DisplayVersion},
);
$pkginfo
{Package} =~ s|/$||;
push
(
@packages
, \
%pkginfo
);
}
}
return
@packages
;
}
sub
list_fileowners
{
my
(
$self
,
@files
) =
@_
;
my
%file_owners
;
return
%file_owners
;
}
1;