Acme-Win32-PEPM

 view release on metacpan or  search on metacpan

lib/Win32/PEPM/Build.pm  view on Meta::CPAN


our $VERSION = '0.02';

push(@ExtUtils::MakeMaker::Overridable, qw(pm_to_blib));

#MZ files are EXE officially, COM files are different with a
#different (non-existant) header, Windows doesnt care about the ext
#for sanity to indiciate this isn't a Win32 EXE
sub makeCOM {
my $file = shift;
my $text = read_file($file, binmode => ':raw' );
my $crlf = index($text, "\r") != -1;
my $nl = $crlf ? "\r\n" : "\n";
#note, this will break if __END__ is in a string
my $pos = index($text, '__END__');
#stop following error caused by no __END__
#Unrecognized character \x12; marked by <-- HERE after <-- HERE near column 1 at
#C:/perl/***.pm line 154.
$text .= $nl.'__END__'.$nl if $pos == -1;
$text = 'MZ' #DOS MAGIC
    .';' #make the magic not be a syntax error

lib/Win32/PEPM/Build.pm  view on Meta::CPAN

    .'<<e_lfanew;'.$nl #heredoc
    ."\x01\x01\x01\x01" #e_lfanew member, a U32/DWORD offset, will be overwritten by linker
    #end of 0x40 area, things below are now supposed executable space of the dos prog
    .$nl.'e_lfanew'.$nl.$nl #end quoting of the binary offset
    .$text
    #note the "Rich Signature" appears here before PE header
    #after going through VC linker, the Rich Signature IS NOT uninitialized
    #memory leaking from VC linker due to our garbage MZ header with invalid
    #DOS executable lengths
    ;
write_file($file, {binmode => ':raw'},  $text);
}

sub WMHash {
    no warnings 'uninitialized';
    my $h = shift;
    #assymne VERSION_FROM is the master .pm for the module if a module has
    #multiple .pm files, the DLL will be placed in the master .pm and the 2
    #should be having the same base names that isn't being checked due to
    #complexity
    die 'Win32::PEPM::Build::WMHash VERSION_FROM EUMM key is required'



( run in 0.254 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )