gdi32: Add a GdiConvertToDevmodeW test, make it pass under Wine
Dmitry Timoshkov
dmitry at codeweavers.com
Tue Dec 18 09:19:02 CST 2007
"Robert Shearman" <rob at codeweavers.com> wrote:
>> - dmW_size = dmA->dmSize + CCHDEVICENAME;
>> - if (dmA->dmSize >= (const char *)dmA->dmFormName - (const char *)dmA + CCHFORMNAME)
>> + dmW_size = dmA->dmSize;
>> + if (dmW_size > sizeof(DEVMODEA))
>> + dmW_size = sizeof(DEVMODEA);
>>
>
> Shouldn't this be sizeof(DEVMODEW)?
No, because of below reasons.
>> +
>> + dmW_size += CCHDEVICENAME;
>>
>
> Shouldn't this be CCDEVICENAME * sizeof(WCHAR)?
>
>> + if (dmA->dmSize >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
>> dmW_size += CCHFORMNAME;
>>
>
> Shouldn't this be CCHFORMNAME * sizeof(WCHAR)?
DEVMODEA already allocates space for 1-byte buffers, by adding the size of
each buffer I effectively multiply the size of buffers in A structure by 2.
--
Dmitry.
More information about the wine-devel
mailing list