widl #15: pad small strings to 8 bytes

Huw D M Davies h.davies1 at physics.ox.ac.uk
Tue Jan 18 06:02:27 CST 2005


        Huw Davies <huw at codeweavers.com>
        Pad small strings out to eight bytes.
        Fix 'has default values' flag.
-- 
Huw Davies
huw at codeweavers.com
Index: tools/widl/write_msft.c
===================================================================
RCS file: /home/wine/wine/tools/widl/write_msft.c,v
retrieving revision 1.11
diff -u -p -r1.11 write_msft.c
--- tools/widl/write_msft.c	18 Jan 2005 11:39:31 -0000	1.11
+++ tools/widl/write_msft.c	18 Jan 2005 11:59:05 -0000
@@ -333,6 +333,11 @@ static int ctl2_encode_string(
     converted_string[0] = length & 0xff;
     converted_string[1] = (length >> 8) & 0xff;
 
+    if(length < 3) { /* strings of this length are padded with upto 8 bytes incl the 2 byte length */
+        for(offset = 0; offset < 4; offset++)
+            converted_string[length + offset + 2] = 0x57;
+        length += 4;
+    }
     for (offset = (4 - (length + 2)) & 3; offset; offset--) converted_string[length + offset + 1] = 0x57;
 
     *result = converted_string;
@@ -1176,7 +1181,7 @@ static HRESULT add_func_desc(msft_typein
     typedata[2] = funcflags;
     typedata[3] = ((52 /*sizeof(FUNCDESC)*/ + decoded_size) << 16) | typeinfo->typeinfo->cbSizeVft;
     typedata[4] = (index << 16) | (callconv << 8) | 9;
-    if(num_defaults) typedata[4] |= 0x10;
+    if(num_defaults) typedata[4] |= 0x1000;
     typedata[5] = num_params;
 
     /* NOTE: High word of typedata[3] is total size of FUNCDESC + size of all ELEMDESCs for params + TYPEDESCs for pointer params and return types. */



More information about the wine-patches mailing list