From d98c0d0d238081fbe7f0194b00dee50543e1be43 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Thu, 17 Nov 2016 22:48:39 +0000 Subject: [PATCH] [MSACM32] Sync with Wine Staging 1.9.23. CORE-12409 svn path=/trunk/; revision=73278 --- reactos/dll/win32/msacm32/msacm32_main.c | 2 ++ reactos/dll/win32/msacm32/stream.c | 40 ++++++++++++++---------- reactos/media/doc/README.WINE | 2 +- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/reactos/dll/win32/msacm32/msacm32_main.c b/reactos/dll/win32/msacm32/msacm32_main.c index bd5d10aa919..ae362f25cc5 100644 --- a/reactos/dll/win32/msacm32/msacm32_main.c +++ b/reactos/dll/win32/msacm32/msacm32_main.c @@ -72,6 +72,8 @@ DWORD WINAPI acmGetVersion(void) switch (version.dwPlatformId) { case VER_PLATFORM_WIN32_NT: return 0x04000565; /* 4.0.1381 */ + case VER_PLATFORM_WIN32s: + return 0x02010000; /* 2.1 */ default: FIXME("%x not supported\n", version.dwPlatformId); /* fall through */ diff --git a/reactos/dll/win32/msacm32/stream.c b/reactos/dll/win32/msacm32/stream.c index 44b972950e8..349a7ebc14e 100644 --- a/reactos/dll/win32/msacm32/stream.c +++ b/reactos/dll/win32/msacm32/stream.c @@ -37,6 +37,15 @@ static PWINE_ACMSTREAM ACM_GetStream(HACMSTREAM has) return (PWINE_ACMSTREAM)has; } +static BOOL ACM_ValidatePointers(PACMDRVSTREAMHEADER padsh) +{ + /* check that pointers have not been modified */ + return !(padsh->pbPreparedSrc != padsh->pbSrc || + padsh->cbPreparedSrcLength < padsh->cbSrcLength || + padsh->pbPreparedDst != padsh->pbDst || + padsh->cbPreparedDstLength < padsh->cbDstLength); +} + /*********************************************************************** * acmStreamClose (MSACM32.@) */ @@ -95,13 +104,9 @@ MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash, */ padsh = (PACMDRVSTREAMHEADER)pash; - /* check that pointers have not been modified */ - if (padsh->pbPreparedSrc != padsh->pbSrc || - padsh->cbPreparedSrcLength < padsh->cbSrcLength || - padsh->pbPreparedDst != padsh->pbDst || - padsh->cbPreparedDstLength < padsh->cbDstLength) { + if (!ACM_ValidatePointers(padsh)) { WARN("invalid parameter\n"); - return MMSYSERR_INVALPARAM; + return MMSYSERR_INVALPARAM; } padsh->fdwConvert = fdwConvert; @@ -289,14 +294,21 @@ MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, if ((was = ACM_GetStream(has)) == NULL) { WARN("invalid handle\n"); - return MMSYSERR_INVALHANDLE; + return MMSYSERR_INVALHANDLE; } if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER)) { WARN("invalid parameter\n"); - return MMSYSERR_INVALPARAM; + return MMSYSERR_INVALPARAM; + } + if (fdwPrepare) { + WARN("invalid use of reserved parameter\n"); + return MMSYSERR_INVALFLAG; + } + if (pash->cbSrcLength < was->drvInst.pwfxSrc->nBlockAlign) { + WARN("source smaller than block align (%d < %d)\n", + pash->cbSrcLength, was->drvInst.pwfxSrc->nBlockAlign); + return pash->cbSrcLength ? ACMERR_NOTPOSSIBLE : MMSYSERR_INVALPARAM; } - if (fdwPrepare) - ret = MMSYSERR_INVALFLAG; /* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same * size. some fields are private to msacm internals, and are exposed @@ -447,13 +459,9 @@ MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, */ padsh = (PACMDRVSTREAMHEADER)pash; - /* check that pointers have not been modified */ - if (padsh->pbPreparedSrc != padsh->pbSrc || - padsh->cbPreparedSrcLength < padsh->cbSrcLength || - padsh->pbPreparedDst != padsh->pbDst || - padsh->cbPreparedDstLength < padsh->cbDstLength) { + if (!ACM_ValidatePointers(padsh)) { WARN("invalid parameter\n"); - return MMSYSERR_INVALPARAM; + return MMSYSERR_INVALPARAM; } padsh->fdwConvert = fdwUnprepare; diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index f9337e81fd9..a4eb0c71969 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -100,7 +100,7 @@ reactos/dll/win32/mlang # Synced to WineStaging-1.9.16 reactos/dll/win32/mmdevapi # Synced to WineStaging-1.9.23 reactos/dll/win32/mpr # Synced to WineStaging-1.9.11 reactos/dll/win32/mprapi # Synced to WineStaging-1.9.11 -reactos/dll/win32/msacm32 # Synced to WineStaging-1.9.11 +reactos/dll/win32/msacm32 # Synced to WineStaging-1.9.23 reactos/dll/win32/msacm32.drv # Synced to WineStaging-1.9.11 reactos/dll/win32/msadp32.acm # Synced to WineStaging-1.9.11 reactos/dll/win32/mscat32 # Synced to WineStaging-1.9.11