| 1 | # Copyright 2004 by Audrey Tang <cpan@audreyt.org> | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | package Win32::Exe::PE::Header::PE32; | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 5 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 5 | ▶ | use base 'Win32::Exe::PE::Header'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 5 | ▶ | use constant SUBFORMAT => ( | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | BaseOfData => 'V', | ||||||||||||||||||||
| 9 | ImageBase => 'V', | ||||||||||||||||||||
| 10 | SectionAlign => 'V', | ||||||||||||||||||||
| 11 | FileAlign => 'V', | ||||||||||||||||||||
| 12 | OSMajor => 'v', | ||||||||||||||||||||
| 13 | OSMinor => 'v', | ||||||||||||||||||||
| 14 | UserMajor => 'v', | ||||||||||||||||||||
| 15 | UserMinor => 'v', | ||||||||||||||||||||
| 16 | SubsysMajor => 'v', | ||||||||||||||||||||
| 17 | SubsysMinor => 'v', | ||||||||||||||||||||
| 18 | _ => 'a4', | ||||||||||||||||||||
| 19 | ImageSize => 'V', | ||||||||||||||||||||
| 20 | HeaderSize => 'V', | ||||||||||||||||||||
| 21 | FileChecksum => 'V', | ||||||||||||||||||||
| 22 | SubsystemTypeId => 'v', | ||||||||||||||||||||
| 23 | DLLFlags => 'v', | ||||||||||||||||||||
| 24 | StackReserve => 'V', | ||||||||||||||||||||
| 25 | StackCommit => 'V', | ||||||||||||||||||||
| 26 | HeapReserve => 'V', | ||||||||||||||||||||
| 27 | HeapCommit => 'V', | ||||||||||||||||||||
| 28 | LoaderFlags => 'V', | ||||||||||||||||||||
| 29 | NumDataDirs => 'V', | ||||||||||||||||||||
| 30 | 'DataDirectory' => [ | ||||||||||||||||||||
| 31 | 'a8', '{$NumDataDirs}', 1 | ||||||||||||||||||||
| 32 | ], | ||||||||||||||||||||
| 33 | 'Section' => [ | ||||||||||||||||||||
| 34 | 'a40', '{$NumSections}', 1 | ||||||||||||||||||||
| 35 | ], | ||||||||||||||||||||
| 36 | Data => 'a*', | ||||||||||||||||||||
| 37 | 5 | ); | |||||||||||||||||||
| 38 | 5 | ▶ | use constant SUBSYSTEM_TYPES => [qw( | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 39 | _ native windows console _ | ||||||||||||||||||||
| 40 | _ _ posix _ windowsce | ||||||||||||||||||||
| 41 | 5 | )]; | |||||||||||||||||||
| 42 | 5 | ▶ | use constant ST_TO_ID => { | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 43 | 5 | map { (SUBSYSTEM_TYPES->[$_] => $_) } (0 .. $#{+SUBSYSTEM_TYPES}) | |||||||||||||||||||
| 44 | 5 | }; | |||||||||||||||||||
| 45 | 5 | ▶ | use constant ID_TO_ST => { reverse %{+ST_TO_ID} }; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | 2 | ▶ | sub st_to_id { | ||||||||||||||||||
|
Subroutine
st_to_id: called CC=3 SCAR=11.7
Pod
undocumented
| |||||||||||||||||||||
| 48 | 2 | my ($self, $name) = @_; | |||||||||||||||||||
| 49 | 2 | ▶ | return $name unless $name =~ /\D/; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 50 | 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")
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}
| |||||||||||||||||||||
| 51 | } | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 3 | ▶ | sub id_to_st { | ||||||||||||||||||
|
Subroutine
id_to_st: called CC=2 SCAR=8.1
Pod
undocumented
| |||||||||||||||||||||
| 54 | 3 | my ($self, $id) = @_; | |||||||||||||||||||
| 55 | 3 | ▶ | return(+ID_TO_ST->{$id} || $id); | ||||||||||||||||||
|
Condition33%1/3
{1 => 'native', 2 => 'windows', 3 => 'console', 7 => 'posix', 8 => '_', 9 => 'windowsce'}->{$id} || $id
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
| |||||||||||||||||||||
| 56 | } | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 3 | ▶ | sub Subsystem { | ||||||||||||||||||
|
Subroutine
Subsystem: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 59 | 3 | my ($self) = @_; | |||||||||||||||||||
| 60 | 3 | return $self->id_to_st($self->SubsystemTypeId); | |||||||||||||||||||
| 61 | } | ||||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | 2 | ▶ | sub SetSubsystem { | ||||||||||||||||||
|
Subroutine
SetSubsystem: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 64 | 2 | my ($self, $type) = @_; | |||||||||||||||||||
| 65 | 2 | $self->SetSubsystemTypeId($self->st_to_id($type)); | |||||||||||||||||||
| 66 | } | ||||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | 6 | ▶ | sub ExpectedOptHeaderSize { 224 }; | ||||||||||||||||||
|
Subroutine
ExpectedOptHeaderSize: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | 5 | 1; | |||||||||||||||||||