lib/Win32/Exe/PE/Header/PE32Plus.pm

filter: Statementstmt 100% 32 / 32 Branchbran 50.0% 1 / 2 Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 11 / 11 Podpod 0.0% 0 / 5 totaltotal 79.3% 46 / 58 CC 4 SCAR 5.0
CC
4
Cov
90%
st_to_id
3.2
id_to_st
2.3
BEGIN
1.0
CRAP 1.7
« lib/Win32/Exe/PE/Header/PE32.pm ↑ Summary lib/Win32/Exe/ResourceEntry/Name.pm »
1 #--------------------------------------------------------------------
2 # 64 bit PE+ header as per 'Microsoft PE and COFF Specification' from
3 # http://www.microsoft.com/whdc/system/platform/firmware/PECOFF.mspx
4 #--------------------------------------------------------------------
5  
6 package Win32::Exe::PE::Header::PE32Plus;
7 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use base 'Win32::Exe::PE::Header';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶use constant SUBFORMAT => (
Subroutine BEGIN: called CC=1 SCAR=0.0
11 ImageBase => 'a8',
12 SectionAlign => 'V',
13 FileAlign => 'V',
14 OSMajor => 'v',
15 OSMinor => 'v',
16 UserMajor => 'v',
17 UserMinor => 'v',
18 SubsysMajor => 'v',
19 SubsysMinor => 'v',
20 _ => 'a4',
21 ImageSize => 'V',
22 HeaderSize => 'V',
23 FileChecksum => 'V',
24 SubsystemTypeId => 'v',
25 DLLFlags => 'v',
26 StackReserve => 'a8',
27 StackCommit => 'a8',
28 HeapReserve => 'a8',
29 HeapCommit => 'a8',
30 LoaderFlags => 'V',
31 NumDataDirs => 'V',
32 'DataDirectory' => [
33 'a8', '{$NumDataDirs}', 1
34 ],
35 'Section' => [
36 'a40', '{$NumSections}', 1
37 ],
38 Data => 'a*',
39 2 );
40 2 ▶use constant SUBSYSTEM_TYPES => [qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
41 _ native windows console _
42 _ _ posix _ windowsce
43 2 )];
44 2 ▶use constant ST_TO_ID => {
Subroutine BEGIN: called CC=1 SCAR=0.0
45 2 map { (SUBSYSTEM_TYPES->[$_] => $_) } (0 .. $#{+SUBSYSTEM_TYPES})
46 2 };
47 2 ▶use constant ID_TO_ST => { reverse %{+ST_TO_ID} };
Subroutine BEGIN: called CC=1 SCAR=0.0
48  
49 2 ▶sub st_to_id {
Subroutine st_to_id: called CC=3 SCAR=11.7
Pod undocumented
50 2 my ($self, $name) = @_;
51 2 ▶ return $name unless $name =~ /\D/;
Branch: 1 branch
BranchTrueFalseTotal
unless $name =~ /\D/ 0 2 2
52 2 ▶ return(+ST_TO_ID->{lc($name)} || die "No such type: $name");
Condition50%1/2
{_ => 8, console => 3, native => 1, posix => 7, windows => 2, windowsce => 9}->{lc $name} || die("No such type: $name")
l!l
20
MC/DC0%0/1
{_ => 8, console => 3, native => 1, posix => 7, windows => 2, windowsce => 9}->{lc $name} || die("No such type: $name")
{_ => 8, console => 3, native => 1, posix => 7, windows => 2, windowsce => 9}->{lc $name}
Truth table50%1/2
A
A= {_ => 8, console => 3, native => 1, posix => 7, windows => 2, windowsce => 9}->{lc $name}
Aresult
11
00
53 }
54  
55 3 ▶sub id_to_st {
Subroutine id_to_st: called CC=2 SCAR=8.1
Pod undocumented
56 3 my ($self, $id) = @_;
57 3 ▶ return(+ID_TO_ST->{$id} || $id);
Condition33%1/3
{1 => 'native', 2 => 'windows', 3 => 'console', 7 => 'posix', 8 => '_', 9 => 'windowsce'}->{$id} || $id
l!l&&r!l&&!r
300
MC/DC0%0/2
{1 => 'native', 2 => 'windows', 3 => 'console', 7 => 'posix', 8 => '_', 9 => 'windowsce'}->{$id} || $id
{1 => 'native', 2 => 'windows', 3 => 'console', 7 => 'posix', 8 => '_', 9 => 'windowsce'}->{$id} $id
Truth table33%1/3
A || B
A= {1 => 'native', 2 => 'windows', 3 => 'console', 7 => 'posix', 8 => '_', 9 => 'windowsce'}->{$id}B= $id
ABresult
1X1
011
000
58 }
59  
60 3 ▶sub Subsystem {
Subroutine Subsystem: called CC=1 SCAR=0.0
Pod undocumented
61 3 my ($self) = @_;
62 3 return $self->id_to_st($self->SubsystemTypeId);
63 }
64  
65 2 ▶sub SetSubsystem {
Subroutine SetSubsystem: called CC=1 SCAR=0.0
Pod undocumented
66 2 my ($self, $type) = @_;
67 2 $self->SetSubsystemTypeId($self->st_to_id($type));
68 }
69  
70 5 ▶sub ExpectedOptHeaderSize { 240 };
Subroutine ExpectedOptHeaderSize: called CC=1 SCAR=0.0
Pod undocumented
71
72  
73 2 1;
« lib/Win32/Exe/PE/Header/PE32.pm ↑ Summary lib/Win32/Exe/ResourceEntry/Name.pm »