Skip to content

Commit

Permalink
Update bits-info.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ale5000-git authored Sep 26, 2024
1 parent a69ed4c commit 0df954e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/bits-info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ check_bitness_of_pe_file()

# More info: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format

hexdump 1>&2 -v -s 0x3C -n 4 -e '/1 "%02x\n"' -- "${1:?}" | tac | tr -d '\n'
if _pe_header_pos="$(hexdump -v -s 0x3C -n 4 -e '/1 "%02x\n"' -- "${1:?}" | tac | tr -d '\n')" && test -n "${_pe_header_pos?}" && _pe_header_pos="0x${_pe_header_pos:?}"; then
hexdump 1>&2 -v -s "${_pe_header_pos:?}" -n 6 -e '/1 "%02x"' -- "${1:?}"
if _pe_header="$(hexdump 2> /dev/null -v -s "${_pe_header_pos:?}" -n 6 -e '/1 "%02x"' -- "${1:?}")" && printf '%s\n' "${_pe_header?}" | grep -m 1 -q -e '^50450000'; then
# PE header => PE (0x50 0x45) + 0x00 0x00 + Machine field
case "${_pe_header?}" in
Expand Down

0 comments on commit 0df954e

Please sign in to comment.