MSACM: preserve value of cbStruct in acmDriverDetails (with tests) - patch 2 of 2

Alex Villací­s Lasso a_villacis at palosanto.com
Mon Dec 19 15:00:24 CST 2005


Eric Pouech wrote:

> Alex Villací­s Lasso wrote:
>
>> BTW, should wine-provided codecs duplicate this behavior?
>
> likely yes
>
> a couple of remarks
>
>> ------------------------------------------------------------------------
>>
>> --- wine-0.9.3-cvs/dlls/msacm/driver.c    2005-09-12 
>> 10:35:53.000000000 -0500
>> +++ wine-0.9.3-cvs-patch/dlls/msacm/driver.c    2005-12-18 
>> 22:28:21.000000000 -0500
>> @@ -184,6 +184,7 @@
>>                               sizeof(padda.szLicensing), NULL, NULL );
>>          WideCharToMultiByte( CP_ACP, 0, addw.szFeatures, -1, 
>> padda.szFeatures,
>>                               sizeof(padda.szFeatures), NULL, NULL );
>> +        padda.cbStruct = min(padd->cbStruct, sizeof(*padd));
>>          memcpy(padd, &padda, min(padd->cbStruct, sizeof(*padd)));
>
> why don't use reuse padda.cbStruct you've just computed ?
>
>>      }
>>      return mmr;
>> @@ -217,9 +218,11 @@
>>      mmr = acmDriverOpen(&acmDrvr, hadid, 0);
>>      if (mmr == MMSYSERR_NOERROR) {
>>          ACMDRIVERDETAILSW paddw;
>> +        paddw.cbStruct = sizeof(paddw);
>>          mmr = (MMRESULT)MSACM_Message(acmDrvr, ACMDM_DRIVER_DETAILS, 
>> (LPARAM)&paddw,  0);
>>  
>>      acmDriverClose(acmDrvr, 0);
>> +        paddw.cbStruct = min(padd->cbStruct, sizeof(*padd));
>>          memcpy(padd, &paddw, min(padd->cbStruct, sizeof(*padd)));
>
> ditto
> A+

In my haste to clean up the mess of bread crumbs I left behind while 
tracking the bug, it seems I forgot to add the optimization.

Changelog:
* Ensure that the cbStruct member of the ACMDRIVERDETAILS[AW] struct is 
filled with a valid value before returning.
* Fill the cbStruct member of the ACMDRIVERDETAILS[AW] before sending a 
ACMDM_DRIVER_DETAILS message to an installed codec that might be a 
native library: native ACM codecs expect cbStruct to be valid before 
filling the rest of the struct with any data.

Alex Villacís Lasso


-------------- next part --------------
A non-text attachment was scrubbed...
Name: wine-msacm-driver-cbStruct_try2.patch
Type: text/x-patch
Size: 1104 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20051219/40d53f0e/wine-msacm-driver-cbStruct_try2.patch


More information about the wine-patches mailing list