x64 breakage

9 views
Skip to first unread message

0vpn

unread,
Feb 11, 2009, 11:08:08 PM2/11/09
to pefile
pefile appears to have some x64 breakage. The crux of the problem is
that the struct.(pack|unpack) type specifier of 'L' is ambiguous --
while it's 32 bits on x86 and 64 bits on x64, the code seems to make
the assumption that it's always 32 bits.

For example, lines like these break on x64 because L maps to the C
long type which is 64 bits:

dword = struct.unpack('L', self.__data__[ i*4 : i*4+4 ])[0]

If you change the type specifier to 'I' then it should work on both
x86 and x64.

James

c1de0x

unread,
Feb 12, 2009, 4:20:20 AM2/12/09
to pef...@googlegroups.com
James,

Good catch, can you put together a patch?

Ero Carrera Ventura

unread,
Mar 1, 2009, 8:36:19 PM3/1/09
to pef...@googlegroups.com

You're totally right. I've fixed it in revision 63. It's on subversion
already and I'll make packages soon. Do let me know if you bump into
anything else.

--
ero
Reply all
Reply to author
Forward
0 new messages