[PATCH] windres (ungarbled): (7) don't confuse version and STYLE
Gunnar Degnbol
gunnar@danbbs.dk
Tue Mar 19 15:27:00 GMT 2002
More information about the Binutils mailing list
Tue Mar 19 15:27:00 GMT 2002
- Previous message (by thread): [PATCH] windres (ungarbled): (6) always define _WIN32
- Next message (by thread): [PATCH] windres (ungarbled): (8) print style even if it is 0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
windres dies with the message "unexpected dialog signature X" when decompiling a resource file with a DIALOG with STYLE 1 (WS_TABSTOP) style and no other bits set in the lower half of style. X is the upper 16 bits of style. The STYLE of a DIALOG overlaps with the version and signature of a DIALOGEX. windres identifies DIALOGEX resource by checking the version number (1), which is a valid value for the lower 16 bits of STYLE (dialogs used as controls may be tabstops), instead of checking the signature (0xffff), which is not valid for the upper 16 bits of STYLE (WS_POPUP cannot be combined with WS_CHILD). The fix is to swap the checks for version and signature in resbin.c. ChangeLog: 2002-03-19 Gunnar Degnbol <degnbol@danbbs.dk> * resbin.c: Use signature to identify DIALOGEX dialogsignature.rc: 101 DIALOG DISCARDABLE 0, 0, 186, 95 STYLE 1 BEGIN DEFPUSHBUTTON "OK",1,129,7,50,14 END Before patch: $ /bin/windres.exe -i dialogsignature.rc -o dialogsignature.o $ /bin/windres.exe -i dialogsignature.o /bin/windres.exe: unexpected dialog signature 32904 After patch: $ windres.exe -i dialogsignature.o LANGUAGE 0, 0 101 DIALOG 0, 0, 186, 95 STYLE 0x80880001 BEGIN DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14, 0x50010001 END dialogsignature.patch: --- binutils/resbin.c Sun Mar 17 14:51:23 2002 +++ binutils.new/resbin.c Sun Mar 17 14:51:34 2002 @@ -460,7 +460,7 @@ unsigned long length; int big_endian; { - int version; + int signature; struct dialog *d; int c, sublen, i; unsigned int off; @@ -472,8 +472,8 @@ 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 +482,11 @@ } 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);
- Previous message (by thread): [PATCH] windres (ungarbled): (6) always define _WIN32
- Next message (by thread): [PATCH] windres (ungarbled): (8) print style even if it is 0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list