This is RT#74578 about Win32::API structs packing/unpacking. Can you help us?
------- Forwarded message ------- From: "Douglas Wilson via RT" <bug-win32-...@rt.cpan.org> Subject: [rt.cpan.org #74578] Win32::API::Struct not aligned on 64 bit Date: Wed, 01 Feb 2012 17:27:37 +0100 Queue: Win32-API Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=74578 > On Wed Feb 01 02:15:26 2012, COSIMO wrote:
Hi Doug, thanks for filing this. What do to about it? Not sure, other than CC'ing libwin32@perl.org as you did.
Cool, I didn't know RT cc'd the mailing list (maybe someone else will know what to do). What I've done is hack Struct.pm getPack() and getUnpack(): in getPack(): $type_align = (($packed_size + $type_size) % $type_size); # $packing .= "x" x $type_align . $type; $packing .= $type; $packed_size += $type_size; # $packed_size += $type_size + $type_align; } in getUnpack(): $type_align = (($packed_size + $type_size) % $type_size); # $packing .= "x" x $type_align . $type; $packing .= $type; # $packed_size += $type_size + $type_align; $packed_size += $type_size; push(@items, $name); } Perhaps if this change were wrapped in is_64bit() type logic, then it would work everywhere? I don't know enough about this to really know for sure, and I'm not even sure if I haven't broken something else. And if this change is headed in the right direction, there should probably be some changes to the align() and sizeof() methods. -- Using Opera's revolutionary email client: http://www.opera.com/mail/