msacm: Preserve value of cbStruct in acmDriverDetails.
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.
This commit is contained in:
parent
fe36b7baca
commit
9a95aa7da2
|
@ -184,7 +184,8 @@ MMRESULT WINAPI acmDriverDetailsA(HACMDRIVERID hadid, PACMDRIVERDETAILSA padd, D
|
|||
sizeof(padda.szLicensing), NULL, NULL );
|
||||
WideCharToMultiByte( CP_ACP, 0, addw.szFeatures, -1, padda.szFeatures,
|
||||
sizeof(padda.szFeatures), NULL, NULL );
|
||||
memcpy(padd, &padda, min(padd->cbStruct, sizeof(*padd)));
|
||||
padda.cbStruct = min(padd->cbStruct, sizeof(*padd));
|
||||
memcpy(padd, &padda, padda.cbStruct);
|
||||
}
|
||||
return mmr;
|
||||
}
|
||||
|
@ -217,10 +218,12 @@ MMRESULT WINAPI acmDriverDetailsW(HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, D
|
|||
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);
|
||||
memcpy(padd, &paddw, min(padd->cbStruct, sizeof(*padd)));
|
||||
paddw.cbStruct = min(padd->cbStruct, sizeof(*padd));
|
||||
memcpy(padd, &paddw, paddw.cbStruct);
|
||||
}
|
||||
|
||||
return mmr;
|
||||
|
|
|
@ -120,6 +120,15 @@ static BOOL CALLBACK DriverEnumProc(HACMDRIVERID hadid,
|
|||
"acmDriverDetails(): rc = %08x, should be %08x\n",
|
||||
rc, MMSYSERR_NOERROR);
|
||||
|
||||
/* cbStruct should contain size of returned data (at most sizeof(dd))
|
||||
TODO: should it be *exactly* sizeof(dd), as tested here?
|
||||
*/
|
||||
if (rc == MMSYSERR_NOERROR) {
|
||||
ok(dd.cbStruct == sizeof(dd),
|
||||
"acmDriverDetails(): cbStruct = %08lx, should be %08lx\n",
|
||||
dd.cbStruct, (unsigned long)sizeof(dd));
|
||||
}
|
||||
|
||||
if (rc == MMSYSERR_NOERROR && winetest_interactive) {
|
||||
trace(" Short name: %s\n", dd.szShortName);
|
||||
trace(" Long name: %s\n", dd.szLongName);
|
||||
|
|
Loading…
Reference in New Issue