line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alien::Packages::Msi; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1013
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
41
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION @ISA); |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
634
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Alien::Packages::Msi - deals with package information of Microsoft Installer |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
$VERSION = "0.003"; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
require Alien::Packages::Base; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
@ISA = qw(Alien::Packages::Base); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 ISA |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Alien::Packages::Msi |
22
|
|
|
|
|
|
|
ISA Alien::Packages::Base |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head2 usable |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Returns true when Win32::TieRegistry is available and can connect to C. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my ( $haveWin32TieRegistry, $win32TieRegistry ); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub usable |
35
|
|
|
|
|
|
|
{ |
36
|
1
|
50
|
|
1
|
1
|
9
|
unless ( defined($win32TieRegistry) ) |
37
|
|
|
|
|
|
|
{ |
38
|
1
|
|
|
|
|
4
|
$haveWin32TieRegistry = 0; |
39
|
1
|
|
|
|
|
6
|
eval { |
40
|
1
|
|
|
|
|
1593
|
require Win32::TieRegistry; |
41
|
0
|
|
|
|
|
0
|
$win32TieRegistry = $Win32::TieRegistry::Registry->Clone(); |
42
|
0
|
|
|
|
|
0
|
$win32TieRegistry->Delimiter("/"); |
43
|
0
|
0
|
|
|
|
0
|
my $machKey = $win32TieRegistry->Open( |
44
|
|
|
|
|
|
|
"LMachine", |
45
|
|
|
|
|
|
|
{ |
46
|
|
|
|
|
|
|
Access => Win32::TieRegistry::KEY_READ(), |
47
|
|
|
|
|
|
|
Delimiter => "/" |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
) or die "Can't open HKEY_LOCAL_MACHINE key: $^E\n"; |
50
|
0
|
|
|
|
|
0
|
$haveWin32TieRegistry = 1; |
51
|
|
|
|
|
|
|
}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
|
|
20
|
return $haveWin32TieRegistry; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 list_packages |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Scans the packages below |
60
|
|
|
|
|
|
|
C |
61
|
|
|
|
|
|
|
and returns the values of DisplayName and DisplayVersion for each key |
62
|
|
|
|
|
|
|
below C<*/Products/*/>. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub list_packages |
67
|
|
|
|
|
|
|
{ |
68
|
0
|
|
|
0
|
1
|
|
my $self = $_[0]; |
69
|
0
|
|
|
|
|
|
my @packages; |
70
|
|
|
|
|
|
|
|
71
|
0
|
0
|
|
|
|
|
my $machKey = $win32TieRegistry->Open( |
72
|
|
|
|
|
|
|
"LMachine", |
73
|
|
|
|
|
|
|
{ |
74
|
|
|
|
|
|
|
Access => Win32::TieRegistry::KEY_READ(), |
75
|
|
|
|
|
|
|
Delimiter => "/" |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
) or die "Can't open HKEY_LOCAL_MACHINE key: $^E\n"; |
78
|
0
|
|
|
|
|
|
my $regInstallRoot = |
79
|
|
|
|
|
|
|
$machKey->Open("SOFTWARE/Microsoft/Windows/CurrentVersion/Installer/UserData"); |
80
|
0
|
|
|
|
|
|
foreach my $user ( keys %$regInstallRoot ) |
81
|
|
|
|
|
|
|
{ |
82
|
0
|
|
|
|
|
|
my $userProdKey = $regInstallRoot->Open( $user . "Products" ); |
83
|
0
|
|
|
|
|
|
foreach my $product ( keys %$userProdKey ) |
84
|
|
|
|
|
|
|
{ |
85
|
0
|
|
|
|
|
|
my $instPropKey = $userProdKey->Open( $product . "InstallProperties" ); |
86
|
0
|
|
|
|
|
|
my %pkginfo = ( |
87
|
|
|
|
|
|
|
Package => $product, |
88
|
|
|
|
|
|
|
Description => $instPropKey->{DisplayName}, |
89
|
|
|
|
|
|
|
Version => $instPropKey->{DisplayVersion}, |
90
|
|
|
|
|
|
|
); |
91
|
0
|
|
|
|
|
|
$pkginfo{Package} =~ s|/$||; |
92
|
0
|
|
|
|
|
|
push( @packages, \%pkginfo ); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
return @packages; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 list_fileowners |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Returns an empty hash - MSI doesn't register installed files by MSI |
102
|
|
|
|
|
|
|
packages (or better: I do not know where it stores this information). |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub list_fileowners |
107
|
|
|
|
|
|
|
{ |
108
|
0
|
|
|
0
|
1
|
|
my ( $self, @files ) = @_; |
109
|
0
|
|
|
|
|
|
my %file_owners; |
110
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
return %file_owners; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 AUTHOR |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Jens Rehsack, C<< >> |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Copyright 2010 Jens Rehsack. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
123
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
124
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
1; |