Is the DECIMAL variant type too long ?

Francois Gouget fgouget at free.fr
Wed May 9 19:53:03 CDT 2001


On Thu, 10 May 2001, gerard patel wrote:
[...]
> Could the DECIMAL type be a pointer to the real data ??

   No. The problem is the tagVARIANT type:
sizeof(DECIMAL) -> 16 in Windows, 16 in Wine
sizeof(VARIANT) -> 16 in Windows, 24 in Wine

   Oups, that's where the problem is. In Windows DECIMAL is not at the
same level as the other fields. It's part of an englobing union: you
basically have:

   union {
       struct {
           VARTYPE vt;
           WORD wReserved1;
           WORD wReserved2;
           WORD wReserved3;
           union {
               lots of fields...
           }
       }
       DECIMAL decVal;
   }

   In Wine decVal is with the other variant fields so the total size of
VARIANT is 2+2+2+2+16 -> 24

   Temporary fix: comment out decVal.
   Correct fix: add the global union and update lots of places in Wine
to match. Plus on Windows, just for VARIANT, they use n1, n2, n3 as the
dummy union/struct names.

   Hmm... this must be breaking lots of things, sending the quick fix to
wine-patches.

   Any volunteer for the right fix?


--
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
 Advice is what we ask for when we already know the answer but wish we didn't
                                 -- Eric Jong





More information about the wine-devel mailing list