[MSACM32] Sync with Wine Staging 1.9.23. CORE-12409
authorAmine Khaldi <amine.khaldi@reactos.org>
Thu, 17 Nov 2016 22:48:39 +0000 (22:48 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Thu, 17 Nov 2016 22:48:39 +0000 (22:48 +0000)
svn path=/trunk/; revision=73278

reactos/dll/win32/msacm32/msacm32_main.c
reactos/dll/win32/msacm32/stream.c
reactos/media/doc/README.WINE

index bd5d10a..ae362f2 100644 (file)
@@ -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 */
index 44b9729..349a7eb 100644 (file)
@@ -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;
index f9337e8..a4eb0c7 100644 (file)
@@ -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