diff options
-rw-r--r-- | binutils/ChangeLog | 2 | ||||
-rw-r--r-- | binutils/resbin.c | 31 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/windres/dialogsignature.rc | 5 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/windres/dialogsignature.rsd | 8 |
4 files changed, 32 insertions, 14 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 7414ba1..8613965 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -10,6 +10,8 @@ encodes as binary 8. * resrc.c: Print style even if it is 0. + + * resbin.c: Use signature to identify DIALOGEX. 2002-04-09 Gunnar Degnbol <degnbol@danbbs.dk> diff --git a/binutils/resbin.c b/binutils/resbin.c index a545343..bd116a2 100644 --- a/binutils/resbin.c +++ b/binutils/resbin.c @@ -1,5 +1,5 @@ /* resbin.c -- manipulate the Windows binary resource format. - Copyright 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2002 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -68,6 +68,9 @@ static struct res_resource *bin_to_res_version PARAMS ((const unsigned char *, unsigned long, int)); static struct res_resource *bin_to_res_userdata PARAMS ((const unsigned char *, unsigned long, int)); +static void get_version_header + PARAMS ((const unsigned char *, unsigned long, int, const char *, + unichar **, int *, int *, int *, int *)); /* Given a resource type ID, a pointer to data, a length, return a res_resource structure which represents that resource. The caller @@ -460,7 +463,7 @@ bin_to_res_dialog (data, length, big_endian) unsigned long length; int big_endian; { - int version; + int signature; struct dialog *d; int c, sublen, i; unsigned int off; @@ -472,8 +475,8 @@ bin_to_res_dialog (data, length, big_endian) d = (struct dialog *) res_alloc (sizeof *d); - version = get_16 (big_endian, data); - if (version != 1) + signature = get_16 (big_endian, data + 2); + if (signature != 0xffff) { d->ex = NULL; d->style = get_32 (big_endian, data); @@ -482,11 +485,11 @@ bin_to_res_dialog (data, length, big_endian) } else { - int signature; - - signature = get_16 (big_endian, data + 2); - if (signature != 0xffff) - fatal (_("unexpected dialog signature %d"), signature); + int version; + + version = get_16 (big_endian, data); + if (version != 1) + fatal (_("unexpected DIALOGEX version %d"), version); d->ex = (struct dialog_ex *) res_alloc (sizeof (struct dialog_ex)); d->ex->help = get_32 (big_endian, data + 4); @@ -808,7 +811,7 @@ static struct res_resource * bin_to_res_rcdata (data, length, big_endian) const unsigned char *data; unsigned long length; - int big_endian; + int big_endian ATTRIBUTE_UNUSED; { struct rcdata_item *ri; struct res_resource *r; @@ -1019,7 +1022,7 @@ bin_to_res_version (data, length, big_endian) struct res_resource *r; get_version_header (data, length, big_endian, "VS_VERSION_INFO", - (unichar *) NULL, &verlen, &vallen, &type, &off); + (unichar **) NULL, &verlen, &vallen, &type, &off); if ((unsigned int) verlen != length) fatal (_("version length %d does not match resource length %lu"), @@ -1091,7 +1094,7 @@ bin_to_res_version (data, length, big_endian) vi->type = VERINFO_STRING; get_version_header (data, length, big_endian, "StringFileInfo", - (unichar *) NULL, &verlen, &vallen, &type, + (unichar **) NULL, &verlen, &vallen, &type, &off); if (vallen != 0) @@ -1163,7 +1166,7 @@ bin_to_res_version (data, length, big_endian) vi->type = VERINFO_VAR; get_version_header (data, length, big_endian, "VarFileInfo", - (unichar *) NULL, &verlen, &vallen, &type, + (unichar **) NULL, &verlen, &vallen, &type, &off); if (vallen != 0) @@ -1231,7 +1234,7 @@ static struct res_resource * bin_to_res_userdata (data, length, big_endian) const unsigned char *data; unsigned long length; - int big_endian; + int big_endian ATTRIBUTE_UNUSED; { struct rcdata_item *ri; struct res_resource *r; diff --git a/binutils/testsuite/binutils-all/windres/dialogsignature.rc b/binutils/testsuite/binutils-all/windres/dialogsignature.rc new file mode 100644 index 0000000..a05ce19 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/dialogsignature.rc @@ -0,0 +1,5 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +STYLE 1 +BEGIN + DEFPUSHBUTTON "OK",1,129,7,50,14 +END diff --git a/binutils/testsuite/binutils-all/windres/dialogsignature.rsd b/binutils/testsuite/binutils-all/windres/dialogsignature.rsd new file mode 100644 index 0000000..fbe7790 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/dialogsignature.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 36000000 20000000 ffff0500 ffff6500 6... .........e. + 0030 00000000 10100000 00000000 00000000 ................ + 0040 01000000 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 01000150 00000000 _..........P.... + 0060 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0070 4b000000 00000000 K....... |