line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Devel::Platform::Info::Win32; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
32938
|
use strict; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
140
|
|
4
|
6
|
|
|
6
|
|
38
|
use warnings; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
128
|
|
5
|
6
|
|
|
6
|
|
2752
|
use POSIX; |
|
6
|
|
|
|
|
28007
|
|
|
6
|
|
|
|
|
24
|
|
6
|
|
|
|
|
|
|
|
7
|
6
|
|
|
6
|
|
12497
|
use vars qw($VERSION); |
|
6
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
3006
|
|
8
|
|
|
|
|
|
|
$VERSION = '0.16'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#---------------------------------------------------------------------------- |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
1
|
|
|
1
|
1
|
10
|
my ($class) = @_; |
14
|
1
|
|
|
|
|
2
|
my $self = {}; |
15
|
1
|
|
|
|
|
2
|
bless $self, $class; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
3
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub get_info { |
21
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
0
|
$self->{info}{osflag} = $^O; |
24
|
0
|
|
|
|
|
0
|
my $inf = $self->_GetArchName(); |
25
|
0
|
|
|
|
|
0
|
$self->{info}{oslabel} = $inf->{osLabel}; |
26
|
0
|
|
|
|
|
0
|
$self->{info}{osvers} = $inf->{version}; |
27
|
0
|
|
|
|
|
0
|
$self->{info}{archname} = $inf->{archname}; |
28
|
0
|
0
|
|
|
|
0
|
$self->{info}{is32bit} = $self->{info}{archname} !~ /64/ ? 1 : 0; |
29
|
0
|
0
|
|
|
|
0
|
$self->{info}{is64bit} = $self->{info}{archname} =~ /64/ ? 1 : 0; |
30
|
0
|
|
|
|
|
0
|
$self->{info}{source} = $inf->{source}; |
31
|
0
|
|
|
|
|
0
|
$self->{info}{wow64} = $inf->{wow64}; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
0
|
return $self->{info}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _GetArchName |
37
|
|
|
|
|
|
|
{ |
38
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
39
|
0
|
|
|
|
|
0
|
my @uname = POSIX::uname(); |
40
|
0
|
|
|
|
|
0
|
my @versions = Win32::GetOSVersion(); |
41
|
0
|
|
|
|
|
0
|
my $info = $self->_InterpretWin32Info(@versions); |
42
|
0
|
|
|
|
|
0
|
$self->_AddPOSIXInfo($info, \@uname); |
43
|
0
|
|
|
|
|
0
|
return $info; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _AddPOSIXInfo |
47
|
|
|
|
|
|
|
{ |
48
|
3
|
|
|
3
|
|
2882
|
my $self = shift; |
49
|
3
|
|
|
|
|
4
|
my $info = shift; |
50
|
3
|
|
|
|
|
5
|
my $uname = shift; |
51
|
3
|
|
|
|
|
5
|
my $arch = $uname->[4]; |
52
|
3
|
|
|
|
|
5
|
$info->{archname} = $arch; |
53
|
|
|
|
|
|
|
$info->{source} = { |
54
|
|
|
|
|
|
|
uname => $uname, |
55
|
|
|
|
|
|
|
GetOSVersion => $info->{source}, |
56
|
3
|
|
|
|
|
10
|
}; |
57
|
|
|
|
|
|
|
# used the tip from David Wang's blog, |
58
|
|
|
|
|
|
|
# http://blogs.msdn.com/b/david.wang/archive/2006/03/26/howto-detect-process-bitness.aspx |
59
|
3
|
100
|
|
|
|
9
|
if($ENV{'PROCESSOR_ARCHITEW6432'}) |
60
|
|
|
|
|
|
|
{ |
61
|
1
|
|
|
|
|
3
|
$info->{wow64} = 1; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
else |
64
|
|
|
|
|
|
|
{ |
65
|
2
|
|
|
|
|
3
|
$info->{wow64} = 0; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub _InterpretWin32Info |
70
|
|
|
|
|
|
|
{ |
71
|
16
|
|
|
16
|
|
5783
|
my $self = shift; |
72
|
16
|
|
|
|
|
37
|
my @versionInfo = @_; |
73
|
16
|
|
|
|
|
20
|
my ($string, $major, $minor, $build, $id, $spmajor, $spminor, $suitemask, $producttype, @extra) = @versionInfo; |
74
|
16
|
|
|
|
|
10
|
my ($osname, $oslabel, $version, $source); |
75
|
0
|
|
|
|
|
0
|
my %info; |
76
|
16
|
|
|
|
|
11
|
my $NTWORKSTATION = 1; |
77
|
16
|
100
|
100
|
|
|
253
|
if($major == 5 && $minor == 2 && $producttype == $NTWORKSTATION) |
|
|
100
|
100
|
|
|
|
|
|
|
100
|
100
|
|
|
|
|
|
|
100
|
66
|
|
|
|
|
|
|
100
|
100
|
|
|
|
|
|
|
100
|
66
|
|
|
|
|
|
|
100
|
100
|
|
|
|
|
|
|
100
|
100
|
|
|
|
|
|
|
100
|
100
|
|
|
|
|
|
|
100
|
66
|
|
|
|
|
|
|
100
|
66
|
|
|
|
|
|
|
100
|
100
|
|
|
|
|
|
|
100
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
78
|
|
|
|
|
|
|
{ |
79
|
1
|
|
|
|
|
3
|
$osname = 'Windows XP Pro 64'; |
80
|
|
|
|
|
|
|
} elsif($major == 5 && $minor == 2 && $producttype != $NTWORKSTATION) |
81
|
|
|
|
|
|
|
{ |
82
|
|
|
|
|
|
|
# server 2003, win home server |
83
|
|
|
|
|
|
|
# server 2003 R2 |
84
|
|
|
|
|
|
|
# I need more info from GetSystemMetrics |
85
|
|
|
|
|
|
|
# be sure about the exact details. |
86
|
3
|
|
|
|
|
4
|
$osname = 'Windows Server 2003'; |
87
|
|
|
|
|
|
|
} elsif($major == 5 && $minor == 1) |
88
|
|
|
|
|
|
|
{ |
89
|
1
|
|
|
|
|
2
|
$osname = 'Windows XP'; |
90
|
|
|
|
|
|
|
} elsif($major == 5 && $minor == 0) |
91
|
|
|
|
|
|
|
{ |
92
|
1
|
|
|
|
|
2
|
$osname = 'Windows 2000'; |
93
|
|
|
|
|
|
|
} elsif($major == 6 && $minor == 1 && $producttype == $NTWORKSTATION) |
94
|
|
|
|
|
|
|
{ |
95
|
1
|
|
|
|
|
1
|
$osname = 'Windows 7'; |
96
|
|
|
|
|
|
|
} elsif($major == 6 && $minor == 1 && $producttype != $NTWORKSTATION) |
97
|
|
|
|
|
|
|
{ |
98
|
1
|
|
|
|
|
1
|
$osname = 'Windows Server 2008 R2'; |
99
|
|
|
|
|
|
|
} elsif($major == 6 && $minor == 0 && $producttype == $NTWORKSTATION) |
100
|
|
|
|
|
|
|
{ |
101
|
1
|
|
|
|
|
2
|
$osname = 'Windows Vista'; |
102
|
|
|
|
|
|
|
} elsif($major == 6 && $minor == 0 && $producttype != $NTWORKSTATION) |
103
|
|
|
|
|
|
|
{ |
104
|
1
|
|
|
|
|
1
|
$osname = 'Windows Server 2008'; |
105
|
|
|
|
|
|
|
} elsif($major == 4 && $minor == 0 && $id == 1) |
106
|
|
|
|
|
|
|
{ |
107
|
1
|
|
|
|
|
2
|
$osname = "Windows 95"; |
108
|
|
|
|
|
|
|
} elsif($major == 4 && $minor == 10) |
109
|
|
|
|
|
|
|
{ |
110
|
1
|
|
|
|
|
2
|
$osname = "Windows 98"; |
111
|
|
|
|
|
|
|
} elsif($major == 4 && $minor == 90) |
112
|
|
|
|
|
|
|
{ |
113
|
1
|
|
|
|
|
2
|
$osname = "Windows Me"; |
114
|
|
|
|
|
|
|
} elsif($major == 4 && $minor == 0) |
115
|
|
|
|
|
|
|
{ |
116
|
1
|
|
|
|
|
2
|
$osname = 'Windows NT 4'; |
117
|
|
|
|
|
|
|
} elsif($major == 3 && $minor == 51) |
118
|
|
|
|
|
|
|
{ |
119
|
1
|
|
|
|
|
3
|
$osname = "Windows NT 3.51"; |
120
|
|
|
|
|
|
|
} else |
121
|
|
|
|
|
|
|
{ |
122
|
1
|
|
|
|
|
2
|
$osname = 'Unrecognised - please file an RT case'; |
123
|
|
|
|
|
|
|
} |
124
|
16
|
|
|
|
|
64
|
my $info = |
125
|
|
|
|
|
|
|
{ |
126
|
|
|
|
|
|
|
osName => 'Windows', |
127
|
|
|
|
|
|
|
osLabel => $osname, |
128
|
|
|
|
|
|
|
version => "$major.$minor.$build.$id", |
129
|
|
|
|
|
|
|
source => \@versionInfo, |
130
|
|
|
|
|
|
|
}; |
131
|
16
|
|
|
|
|
46
|
return $info; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
1; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
__END__ |