Alex VillacÃs Lasso : msacm: Preserve value of cbStruct in acmDriverDetails.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Dec 20 04:56:27 CST 2005
Module: wine
Branch: refs/heads/master
Commit: 9a95aa7da20178737232bc8c99357943197e451c
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=9a95aa7da20178737232bc8c99357943197e451c
Author: Alex Villacís Lasso <a_villacis at palosanto.com>
Date: Tue Dec 20 11:48:01 2005 +0100
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.
---
dlls/msacm/driver.c | 7 +++++--
dlls/msacm/tests/msacm.c | 9 +++++++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/dlls/msacm/driver.c b/dlls/msacm/driver.c
index 808a36d..bfcc533 100644
--- a/dlls/msacm/driver.c
+++ b/dlls/msacm/driver.c
@@ -184,7 +184,8 @@ MMRESULT WINAPI acmDriverDetailsA(HACMDR
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(HACMDR
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;
diff --git a/dlls/msacm/tests/msacm.c b/dlls/msacm/tests/msacm.c
index d3abae6..1d585fd 100644
--- a/dlls/msacm/tests/msacm.c
+++ b/dlls/msacm/tests/msacm.c
@@ -120,6 +120,15 @@ static BOOL CALLBACK DriverEnumProc(HACM
"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);
More information about the wine-cvs
mailing list