[PATCH] windres: (3) don't print empty CAPTION when decompiling

Gunnar Degnbol degnbol@danbbs.dk
Tue Mar 19 12:54:00 GMT 2002


dialog->caption is always initialized, even if there is no
caption. This is wrong if it is supposed to be possible to
compile the decompiled file to the same resource as the
original, since CAPTION sets the WS_CAPTION style (with
previously posted patch or with rc.exe).

The patch sets dialog->caption to NULL if the length is 0.

ChangeLog:

2002-03-19 Gunnar Degnbol <degnbol@danbbs.dk>

	* resbin.c: Don't print empty dialog caption


nocaption.rc:
101 DIALOG DISCARDABLE  0, 0, 186, 95
BEGIN
     DEFPUSHBUTTON "OK",1,129,7,50,14
END

Before patch:

$ /bin/windres.exe -i nocaption.rc -o nocaption.o

$ /bin/windres.exe -i nocaption.o
LANGUAGE 0, 0

101 DIALOG 0, 0, 186, 95
STYLE 0x80880000
CAPTION ""
BEGIN
   DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14, 0x50010001
END

After patch:

$ windres.exe -i nocaption.o
LANGUAGE 0, 0

101 DIALOG 0, 0, 186, 95
STYLE 0x80880000
BEGIN
   DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14, 0x50010001
END

nocaption.patch:
--- binutils/resbin.c	Sun Mar 17 14:46:43 2002
+++ binutils.new/resbin.c	Sun Mar 17 14:46:54 2002
@@ -514,6 +514,8 @@

    d->caption = get_unicode (data + off, length - off, big_endian, 
&sublen);
    off += sublen * 2 + 2;
+  if (sublen == 0)
+    d->caption = NULL;

    if ((d->style & DS_SETFONT) == 0)
      {




More information about the Binutils mailing list