This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] windres: (7) don't confuse version and STYLE


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);



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]