PATCH: Fixes some other problems with listing codecs

Waldeck Schutzer schutzer at
Wed Jan 22 10:19:11 CST 2003

Certain applications will use acmStreamOpen in query mode to figure out 
what types of convertions an audio codec can do. Normally, in query mode 
the parameter phas should be NULL, but as it turns out some 
non-compliant applications will pass garbage causing acmStreamOpen to 
return an error. This prevents the application from using that codec. 
Instead, following a suggestion of Eric Pouech, we make sure the 
parameter phas is correct by setting it equal to NULL in query mode.


PS: Eric, the credit for this patch should be all yours. Have another 
beer for me! :-)
-------------- next part --------------
Index: wine/dlls/msacm/stream.c
RCS file: /home/wine/wine/dlls/msacm/stream.c,v
retrieving revision 1.12
diff -u -p -r1.12 stream.c
--- wine/dlls/msacm/stream.c	2 Dec 2002 18:10:59 -0000	1.12
+++ wine/dlls/msacm/stream.c	22 Jan 2003 16:00:58 -0000
@@ -147,7 +147,12 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREA
 	  pwfxDst->wFormatTag, pwfxDst->nChannels, pwfxDst->nSamplesPerSec, pwfxDst->nAvgBytesPerSec,
 	  pwfxDst->nBlockAlign, pwfxDst->wBitsPerSample, pwfxDst->cbSize);
-    if ((fdwOpen & ACM_STREAMOPENF_QUERY) && phas) return MMSYSERR_INVALPARAM;
+    /* (WS) In query mode, phas should be NULL. If it is not, then instead
+     * of returning an error we are making sure it is NULL, preventing some
+     * applications that pass garbage for phas from crashing.
+     */
+    if (fdwOpen & ACM_STREAMOPENF_QUERY) phas = NULL;
     if (pwfltr && (pwfxSrc->wFormatTag != pwfxDst->wFormatTag)) return MMSYSERR_INVALPARAM;
     wfxSrcSize = wfxDstSize = sizeof(WAVEFORMATEX);

More information about the wine-patches mailing list