| 1 | package Parse::Win32Registry::WinNT::Entry; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 13 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 13 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 13 | ▶ | use base qw(Parse::Win32Registry::Entry); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 13 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 13 | ▶ | use Parse::Win32Registry::Base qw(:all); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 13 | ▶ | use Parse::Win32Registry::WinNT::Key; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 13 | ▶ | use Parse::Win32Registry::WinNT::Value; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 13 | ▶ | use Parse::Win32Registry::WinNT::Security; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 70 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=12 SCAR=25.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 15 | 70 | my $class = shift; | |||||||||||||||||||||||||||
| 16 | 70 | my $regfile = shift; | |||||||||||||||||||||||||||
| 17 | 70 | my $offset = shift; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 70 | ▶ | croak 'Missing registry file' if !defined $regfile; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | 70 | ▶ | croak 'Missing offset' if !defined $offset; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 70 | my $fh = $regfile->get_filehandle; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 70 | sysseek($fh, $offset, 0); | |||||||||||||||||||||||||||
| 25 | 70 | my $bytes_read = sysread($fh, my $entry_header, 8); | |||||||||||||||||||||||||||
| 26 | 70 | ▶ | if ($bytes_read != 8) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | 0 | return; | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 70 | my ($length, | |||||||||||||||||||||||||||
| 31 | $tag) = unpack('Va2', $entry_header); | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 70 | my $allocated = 0; | |||||||||||||||||||||||||||
| 34 | 70 | ▶ | if ($length > 0x7fffffff) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 60 | $allocated = 1; | |||||||||||||||||||||||||||
| 36 | 60 | $length = (0xffffffff - $length) + 1; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 70 | ▶ | $tag = '' if $tag !~ /(nk|vk|lh|lf|li|ri|sk)/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 70 | ▶ | if ($tag eq 'nk') { | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 42 | 24 | ▶ | if (my $key = Parse::Win32Registry::WinNT::Key->new($regfile, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | $offset)) | ||||||||||||||||||||||||||||
| 44 | { | ||||||||||||||||||||||||||||
| 45 | 24 | $key->regenerate_path; | |||||||||||||||||||||||||||
| 46 | 24 | return $key; | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | elsif ($tag eq 'vk') { | ||||||||||||||||||||||||||||
| 50 | 10 | ▶ | if (my $value = Parse::Win32Registry::WinNT::Value->new($regfile, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | $offset)) | ||||||||||||||||||||||||||||
| 52 | { | ||||||||||||||||||||||||||||
| 53 | 10 | return $value; | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | elsif ($tag eq 'sk') { | ||||||||||||||||||||||||||||
| 57 | 2 | ▶ | if (my $value = Parse::Win32Registry::WinNT::Security->new($regfile, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | $offset)) | ||||||||||||||||||||||||||||
| 59 | { | ||||||||||||||||||||||||||||
| 60 | 2 | return $value; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 34 | my $self = {}; | |||||||||||||||||||||||||||
| 65 | $self->{_regfile} = $regfile, | ||||||||||||||||||||||||||||
| 66 | $self->{_offset} = $offset, | ||||||||||||||||||||||||||||
| 67 | $self->{_length} = $length, | ||||||||||||||||||||||||||||
| 68 | $self->{_tag} = $tag, | ||||||||||||||||||||||||||||
| 69 | 34 | $self->{_allocated} = $allocated, | |||||||||||||||||||||||||||
| 70 | bless $self, $class; | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 34 | return $self; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 34 | ▶ | sub as_string { | ||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=5 SCAR=18.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 76 | 34 | my $self = shift; | |||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 34 | my $tag = $self->{_tag}; | |||||||||||||||||||||||||||
| 79 | 34 | ▶ | if ($tag eq 'nk') { | ||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||
| 80 | 0 | return '(key entry)'; | |||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | elsif ($tag eq 'vk') { | ||||||||||||||||||||||||||||
| 83 | 0 | return '(value entry)'; | |||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | elsif ($tag eq 'sk') { | ||||||||||||||||||||||||||||
| 86 | 0 | return '(security entry)'; | |||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||
| 88 | elsif ($tag =~ /(lh|lf|li|ri)/) { | ||||||||||||||||||||||||||||
| 89 | 10 | return '(subkey list entry)'; | |||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | 24 | return '(unidentified entry)'; | |||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 0 | ▶ | sub parse_info { | ||||||||||||||||||||||||||
|
Subroutine
parse_info: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 95 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 0 | my $tag = $self->{_tag}; | |||||||||||||||||||||||||||
| 98 | 0 | ▶ | $tag = defined($tag) && $tag ne '' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $tag and $tag ne ""
MC/DC0%0/2
defined $tag and $tag ne ""
defined $tag
$tag ne ""
Truth table0%0/3
A and B
A= defined $tagB= $tag ne ""
| |||||||||||||||||||||||||||||
| 99 | ? $tag . ' ' | ||||||||||||||||||||||||||||
| 100 | : '.. '; | ||||||||||||||||||||||||||||
| 101 | my $info = sprintf '0x%x %slen=0x%x alloc=%d', | ||||||||||||||||||||||||||||
| 102 | $self->{_offset}, | ||||||||||||||||||||||||||||
| 103 | $tag, | ||||||||||||||||||||||||||||
| 104 | $self->{_length}, | ||||||||||||||||||||||||||||
| 105 | 0 | $self->{_allocated}; | |||||||||||||||||||||||||||
| 106 | 0 | return $info; | |||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 13 | 1; | |||||||||||||||||||||||||||