[patch windres]: Fix binary import of version-info resource

Christopher Faylor cgf-use-the-mailinglist-please@sourceware.org
Tue Nov 27 16:21:00 GMT 2012


On Tue, Nov 27, 2012 at 10:38:46AM +0100, Kai Tietz wrote:
>Hi,
>
>This patch fixes a quirk about index/length calculation for binary
>versioninfo-resource.
>Eg for cygwin the following command './windres.exe
>/cygdrive/c/Windows/System32/ntdll.dll' failed in
>importing version-resource from system-DLL.
>
>ChangeLog
>
>2012-11-27  Kai Tietz
>
>	* resbin.c (bin_to_res_version):  Correct offset
>	and length calculation of resource.
>
>Tested for x86_64-w64-mingw32, i686-pc-cygwin, and i686-w64-mingw32.
>Ok for apply?
>
>Regards,
>Kai
>
>Index: resbin.c
>===================================================================
>RCS file: /cvs/src/src/binutils/resbin.c,v
>retrieving revision 1.18
>diff -p -u -r1.18 resbin.c
>--- resbin.c	11 Oct 2011 15:56:28 -0000	1.18
>+++ resbin.c	27 Nov 2012 09:34:48 -0000
>@@ -1045,6 +1045,7 @@ bin_to_res_version (windres_bfd *wrbfd,
>              since we round the subvariables in the loop.  */
>
> 	  verlen = (verlen + 3) &~ 3;
>+	  verlen -= off;

Rather than do this repeatedly could you just modify get_version_header
to do this automatically?  Then you only need to do it in one place.

cgf



More information about the Binutils mailing list