Initial Commit

This commit is contained in:
Riley Schneider
2025-12-03 16:38:10 +01:00
parent c5e26bf594
commit b732d8d4b5
17680 changed files with 5977495 additions and 2 deletions

View File

@@ -0,0 +1,46 @@
# Copyright 2004 by Audrey Tang <cpan@audreyt.org>
package Win32::Exe::ResourceEntry::Id;
use strict;
use base 'Win32::Exe::ResourceEntry';
use constant SUBFORMAT => (
Id => 'V',
);
use constant RESOURCE_TYPES => [qw(
_ CURSOR BITMAP ICON MENU
DIALOG STRING FONTDIR FONT ACCELERATOR
RCDATA MESSAGETABLE GROUP_CURSOR _ GROUP_ICON
_ VERSION DLGINCLUDE _ PLUGPLAY
VXD ANICURSOR ANIICON HTML MANIFEST
)];
use constant RT_TO_ID => {
map { ('RT_'.RESOURCE_TYPES->[$_] => $_) }
(0 .. $#{+RESOURCE_TYPES})
};
use constant ID_TO_RT => { reverse %{+RT_TO_ID} };
sub Name {
my ($self) = @_;
my $id = $_[0]->Id;
$id = $self->id_to_rt($id) if $self->parent->depth < 1;
return "#$id";
}
sub SetName {
my ($self, $name) = @_;
$name =~ s/^#//;
$self->SetId( $self->rt_to_id($name) );
}
sub id_to_rt {
my ($self, $id) = @_;
return(+ID_TO_RT->{$id} || $id);
}
sub rt_to_id {
my ($self, $rt) = @_;
return(+RT_TO_ID->{$rt} || $rt);
}
1;

View File

@@ -0,0 +1,41 @@
# Copyright 2004 by Audrey Tang <cpan@audreyt.org>
package Win32::Exe::ResourceEntry::Name;
use strict;
use base 'Win32::Exe::ResourceEntry';
use constant SUBFORMAT => (
N_RVA => 'V',
);
sub NameAddress {
my ($self) = @_;
$self->N_RVA & ~($self->high_bit);
}
sub SetNameAddress {
my ($self, $data) = @_;
$self->SetN_RVA($data | $self->IsDirectory);
}
sub IsEscaped {
my ($self) = @_;
$self->N_RVA & ($self->high_bit);
}
sub Name {
my ($self) = @_;
my $section = $self->first_parent('Resources');
my $addr = $self->NameAddress;
my $size = unpack('v', $section->substr($addr, 2));
my $ustr = $section->substr($addr + 2, $size * 2);
my $name = $self->decode_ucs2($ustr);
$name =~ s{([%#/])}{sprintf('%%%02X', ord($1))}eg;
return $name;
}
sub SetName {
die "XXX unimplemented";
}
1;