summaryrefslogtreecommitdiff
path: root/nsis
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2017-04-06 17:25:35 -0700
committerH. Peter Anvin <hpa@zytor.com>2017-04-06 17:25:35 -0700
commit5d2e42e62139a50f38748adc78b5c88ef2053794 (patch)
treed70d2d25c025f715eacddf651894a6bdc3323c84 /nsis
parent9a714c98a28089b26a2244ff8ce725a21c11ed3f (diff)
parent63f68f5ea3ad00177e222ded3126418e8848014d (diff)
downloadnasm-5d2e42e62139a50f38748adc78b5c88ef2053794.tar.gz
Merge branch 'master' of ssh://repo.or.cz/nasm
Diffstat (limited to 'nsis')
-rw-r--r--nsis/getpearch.pl7
1 files changed, 4 insertions, 3 deletions
diff --git a/nsis/getpearch.pl b/nsis/getpearch.pl
index 8a48adac..e524372b 100644
--- a/nsis/getpearch.pl
+++ b/nsis/getpearch.pl
@@ -5,6 +5,7 @@
#
use strict;
+use bytes;
my %archnames = (
0x01de => 'am33',
@@ -37,9 +38,9 @@ open(my $fh, '<', $file)
read($fh, my $mz, 2);
exit 1 if ($mz ne 'MZ');
-exit 1 unless (seek($fh, 0x3c, 0));
-exit 1 unless (read($fh, my $pe_offset, 1) == 1);
-$pe_offset = unpack("C", $pe_offset);
+exit 0 unless (seek($fh, 0x3c, 0));
+exit 0 unless (read($fh, my $pe_offset, 4) == 4);
+$pe_offset = unpack("V", $pe_offset);
exit 1 unless (seek($fh, $pe_offset, 0));
read($fh, my $pe, 4);