[PATCH] windres (ungarbled): (4) sublang shift bug when decompiling

Gunnar Degnbol gunnar@danbbs.dk
Tue Mar 19 15:23:00 GMT 2002


The incorrect value 8 is still used in one place in resrc.c 
instead of SUBLANG_SHIFT (10). 

ChangeLog:

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

	* resrc.c: Fix overlooked sublang shift bug

sublang.rc:

LANGUAGE 9, 1
101 DIALOG DISCARDABLE  0, 0, 186, 95
BEGIN
    DEFPUSHBUTTON "OK",1,129,7,50,14
END

Before patch:

$ /bin/windres.exe -i sublang.rc
LANGUAGE 9, 4

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

After patch:

$ windres.exe -i sublang.rc
LANGUAGE 9, 1

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

sublang.patch:
--- binutils/resrc.c	Sun Mar 17 14:47:27 2002
+++ binutils.new/resrc.c	Sun Mar 17 14:47:38 2002
@@ -1592,7 +1592,8 @@
 	      && (re->id.u.id & 0xffff) == re->id.u.id)
 	    {
 	      fprintf (e, "LANGUAGE %lu, %lu\n",
-		       re->id.u.id & 0xff, (re->id.u.id >> 8) & 0xff);
+		       re->id.u.id & ((1<<SUBLANG_SHIFT)-1), 
+		       (re->id.u.id >> SUBLANG_SHIFT) & 0xff);
 	      *language = re->id.u.id;
 	    }
 	  break;



More information about the Binutils mailing list