Implement [ format specifier.
[wine] / dlls / msacm / filter.c
index 1072390..66ee816 100644 (file)
@@ -4,20 +4,36 @@
  *      MSACM32 library
  *
  *      Copyright 1998  Patrik Stridvall
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <string.h>
 #include "winbase.h"
+#include "winnls.h"
 #include "winerror.h"
 #include "mmsystem.h"
 #include "msacm.h"
 #include "msacmdrv.h"
 #include "wineacm.h"
-#include "debugtools.h"
+#include "wine/debug.h"
 
-DEFAULT_DEBUG_CHANNEL(msacm);
+WINE_DEFAULT_DEBUG_CHANNEL(msacm);
 
 /***********************************************************************
- *           acmFilterChooseA (MSACM32.13)
+ *           acmFilterChooseA (MSACM32.@)
  */
 MMRESULT WINAPI acmFilterChooseA(PACMFILTERCHOOSEA pafltrc)
 {
@@ -27,7 +43,7 @@ MMRESULT WINAPI acmFilterChooseA(PACMFILTERCHOOSEA pafltrc)
 }
 
 /***********************************************************************
- *           acmFilterChooseW (MSACM32.14)
+ *           acmFilterChooseW (MSACM32.@)
  */
 MMRESULT WINAPI acmFilterChooseW(PACMFILTERCHOOSEW pafltrc)
 {
@@ -37,9 +53,9 @@ MMRESULT WINAPI acmFilterChooseW(PACMFILTERCHOOSEW pafltrc)
 }
 
 /***********************************************************************
- *           acmFilterDetailsA (MSACM32.15)
+ *           acmFilterDetailsA (MSACM32.@)
  */
-MMRESULT WINAPI acmFilterDetailsA(HACMDRIVER had, PACMFILTERDETAILSA pafd, 
+MMRESULT WINAPI acmFilterDetailsA(HACMDRIVER had, PACMFILTERDETAILSA pafd,
                                  DWORD fdwDetails)
 {
     ACMFILTERDETAILSW  afdw;
@@ -48,23 +64,24 @@ MMRESULT WINAPI acmFilterDetailsA(HACMDRIVER had, PACMFILTERDETAILSA pafd,
     memset(&afdw, 0, sizeof(afdw));
     afdw.cbStruct = sizeof(afdw);
     afdw.dwFilterIndex = pafd->dwFilterIndex;
-    afdw.dwFilterTag = pafd->dwFilterTag; 
+    afdw.dwFilterTag = pafd->dwFilterTag;
     afdw.pwfltr = pafd->pwfltr;
     afdw.cbwfltr = pafd->cbwfltr;
 
     mmr = acmFilterDetailsW(had, &afdw, fdwDetails);
     if (mmr == MMSYSERR_NOERROR) {
-       pafd->dwFilterTag = afdw.dwFilterTag; 
-       pafd->fdwSupport = afdw.fdwSupport; 
-       lstrcpyWtoA(pafd->szFilter, afdw.szFilter);
+       pafd->dwFilterTag = afdw.dwFilterTag;
+       pafd->fdwSupport = afdw.fdwSupport;
+        WideCharToMultiByte( CP_ACP, 0, afdw.szFilter, -1, pafd->szFilter,
+                             sizeof(pafd->szFilter), NULL, NULL );
     }
     return mmr;
 }
 
 /***********************************************************************
- *           acmFilterDetailsW (MSACM32.16)
+ *           acmFilterDetailsW (MSACM32.@)
  */
-MMRESULT WINAPI acmFilterDetailsW(HACMDRIVER had, PACMFILTERDETAILSW pafd, 
+MMRESULT WINAPI acmFilterDetailsW(HACMDRIVER had, PACMFILTERDETAILSW pafd,
                                  DWORD fdwDetails)
 {
     MMRESULT                   mmr;
@@ -76,7 +93,7 @@ MMRESULT WINAPI acmFilterDetailsW(HACMDRIVER had, PACMFILTERDETAILSW pafd,
     aftd.cbStruct = sizeof(aftd);
 
     if (pafd->cbStruct < sizeof(*pafd)) return MMSYSERR_INVALPARAM;
-       
+
     switch (fdwDetails) {
     case ACM_FILTERDETAILSF_FILTER:
        if (pafd->dwFilterTag != pafd->pwfltr->dwFilterTag) {
@@ -89,23 +106,21 @@ MMRESULT WINAPI acmFilterDetailsW(HACMDRIVER had, PACMFILTERDETAILSW pafd,
            mmr = ACMERR_NOTPOSSIBLE;
            for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
                /* should check for codec only */
-               if (padid->bEnabled && 
+               if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
                    acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
                    mmr = MSACM_Message(had, ACMDM_FILTER_DETAILS,
                                        (LPARAM)pafd, (LPARAM)fdwDetails);
                    acmDriverClose(had, 0);
                    if (mmr == MMSYSERR_NOERROR) break;
                }
-           }               
+           }
        } else {
-           mmr = MSACM_Message(had, ACMDM_FILTER_DETAILS,
-                               (LPARAM)pafd, (LPARAM)fdwDetails);
+           mmr = MSACM_Message(had, ACMDM_FILTER_DETAILS, (LPARAM)pafd, fdwDetails);
        }
        break;
     case ACM_FILTERDETAILSF_INDEX:
        /* should check pafd->dwFilterIndex < aftd->cStandardFilters */
-       mmr = MSACM_Message(had, ACMDM_FILTER_DETAILS,
-                           (LPARAM)pafd, (LPARAM)fdwDetails);
+       mmr = MSACM_Message(had, ACMDM_FILTER_DETAILS, (LPARAM)pafd, fdwDetails);
        break;
     default:
        WARN("Unknown fdwDetails %08lx\n", fdwDetails);
@@ -124,28 +139,29 @@ struct MSACM_FilterEnumWtoA_Instance {
 };
 
 static BOOL CALLBACK MSACM_FilterEnumCallbackWtoA(HACMDRIVERID hadid,
-                                                 PACMFILTERDETAILSW pafdw,  
-                                                 DWORD dwInstance,             
+                                                 PACMFILTERDETAILSW pafdw,
+                                                 DWORD dwInstance,
                                                  DWORD fdwSupport)
 {
     struct MSACM_FilterEnumWtoA_Instance* pafei;
 
     pafei = (struct MSACM_FilterEnumWtoA_Instance*)dwInstance;
 
-    pafei->pafda->dwFilterIndex = pafdw->dwFilterIndex; 
-    pafei->pafda->dwFilterTag = pafdw->dwFilterTag; 
-    pafei->pafda->fdwSupport = pafdw->fdwSupport; 
-    lstrcpyWtoA(pafei->pafda->szFilter, pafdw->szFilter);
+    pafei->pafda->dwFilterIndex = pafdw->dwFilterIndex;
+    pafei->pafda->dwFilterTag = pafdw->dwFilterTag;
+    pafei->pafda->fdwSupport = pafdw->fdwSupport;
+    WideCharToMultiByte( CP_ACP, 0, pafdw->szFilter, -1, pafei->pafda->szFilter,
+                         sizeof(pafei->pafda->szFilter), NULL, NULL );
 
-    return (pafei->fnCallback)(hadid, pafei->pafda, 
+    return (pafei->fnCallback)(hadid, pafei->pafda,
                               pafei->dwInstance, fdwSupport);
 }
 
 /***********************************************************************
- *           acmFilterEnumA (MSACM32.17)
+ *           acmFilterEnumA (MSACM32.@)
  */
-MMRESULT WINAPI acmFilterEnumA(HACMDRIVER had, PACMFILTERDETAILSA pafda, 
-                              ACMFILTERENUMCBA fnCallback, DWORD dwInstance, 
+MMRESULT WINAPI acmFilterEnumA(HACMDRIVER had, PACMFILTERDETAILSA pafda,
+                              ACMFILTERENUMCBA fnCallback, DWORD dwInstance,
                               DWORD fdwEnum)
 {
     ACMFILTERDETAILSW          afdw;
@@ -162,52 +178,47 @@ MMRESULT WINAPI acmFilterEnumA(HACMDRIVER had, PACMFILTERDETAILSA pafda,
     afei.dwInstance = dwInstance;
     afei.fnCallback = fnCallback;
 
-    return acmFilterEnumW(had, &afdw, MSACM_FilterEnumCallbackWtoA, 
+    return acmFilterEnumW(had, &afdw, MSACM_FilterEnumCallbackWtoA,
                          (DWORD)&afei, fdwEnum);
 }
 
-static BOOL MSACM_FilterEnumHelper(PWINE_ACMDRIVERID padid, HACMDRIVER had, 
-                                  PACMFILTERDETAILSW pafd, 
-                                  ACMFILTERENUMCBW fnCallback, DWORD dwInstance,  
+static BOOL MSACM_FilterEnumHelper(PWINE_ACMDRIVERID padid, HACMDRIVER had,
+                                  PACMFILTERDETAILSW pafd,
+                                  ACMFILTERENUMCBW fnCallback, DWORD dwInstance,
                                   DWORD fdwEnum)
 {
-    ACMDRIVERDETAILSW          add;
     ACMFILTERTAGDETAILSW       aftd;
     int                                i, j;
 
-    add.cbStruct = sizeof(add);
-    
-    if (acmDriverDetailsW((HACMDRIVERID)padid, &add, 0) != MMSYSERR_NOERROR) return FALSE;
-
-    for (i = 0; i < add.cFilterTags; i++) {
+    for (i = 0; i < padid->cFilterTags; i++) {
        memset(&aftd, 0, sizeof(aftd));
        aftd.cbStruct = sizeof(aftd);
        aftd.dwFilterTagIndex = i;
        if (acmFilterTagDetailsW(had, &aftd, ACM_FILTERTAGDETAILSF_INDEX) != MMSYSERR_NOERROR)
            continue;
-       
-       if ((fdwEnum & ACM_FILTERENUMF_DWFILTERTAG) && 
+
+       if ((fdwEnum & ACM_FILTERENUMF_DWFILTERTAG) &&
            aftd.dwFilterTag != pafd->pwfltr->dwFilterTag)
            continue;
-       
+
        for (j = 0; j < aftd.cStandardFilters; j++) {
            pafd->dwFilterIndex = j;
            pafd->dwFilterTag = aftd.dwFilterTag;
-           if (acmFilterDetailsW(had, pafd, ACM_FILTERDETAILSF_INDEX) != MMSYSERR_NOERROR) 
+           if (acmFilterDetailsW(had, pafd, ACM_FILTERDETAILSF_INDEX) != MMSYSERR_NOERROR)
                continue;
-           
-           if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, add.fdwSupport))
-               return FALSE; 
+
+           if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, padid->fdwSupport))
+               return FALSE;
        }
     }
     return TRUE;
 }
 
 /***********************************************************************
- *           acmFilterEnumW (MSACM32.18)
+ *           acmFilterEnumW (MSACM32.@)
  */
-MMRESULT WINAPI acmFilterEnumW(HACMDRIVER had, PACMFILTERDETAILSW pafd, 
-                              ACMFILTERENUMCBW fnCallback, DWORD dwInstance, 
+MMRESULT WINAPI acmFilterEnumW(HACMDRIVER had, PACMFILTERDETAILSW pafd,
+                              ACMFILTERENUMCBW fnCallback, DWORD dwInstance,
                               DWORD fdwEnum)
 {
     PWINE_ACMDRIVERID          padid;
@@ -224,16 +235,18 @@ MMRESULT WINAPI acmFilterEnumW(HACMDRIVER had, PACMFILTERDETAILSW pafd,
     if (had) {
        HACMDRIVERID    hadid;
 
-       if (acmDriverID(had, &hadid, 0) != MMSYSERR_NOERROR)
+       if (acmDriverID((HACMOBJ)had, &hadid, 0) != MMSYSERR_NOERROR)
            return MMSYSERR_INVALHANDLE;
-       return MSACM_FilterEnumHelper(MSACM_GetDriverID(hadid), had, pafd,
-                                     fnCallback, dwInstance, fdwEnum);
+       MSACM_FilterEnumHelper(MSACM_GetDriverID(hadid), had, pafd,
+                              fnCallback, dwInstance, fdwEnum);
+       return MMSYSERR_NOERROR;
     }
     for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
            /* should check for codec only */
-           if (!padid->bEnabled || acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR)
+           if ((padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ||
+               acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR)
                continue;
-           ret = MSACM_FilterEnumHelper(padid, had, pafd, 
+           ret = MSACM_FilterEnumHelper(padid, had, pafd,
                                         fnCallback, dwInstance, fdwEnum);
            acmDriverClose(had, 0);
            if (!ret) break;
@@ -242,9 +255,9 @@ MMRESULT WINAPI acmFilterEnumW(HACMDRIVER had, PACMFILTERDETAILSW pafd,
 }
 
 /***********************************************************************
- *           acmFilterTagDetailsA (MSACM32.19)
+ *           acmFilterTagDetailsA (MSACM32.@)
  */
-MMRESULT WINAPI acmFilterTagDetailsA(HACMDRIVER had, PACMFILTERTAGDETAILSA paftda, 
+MMRESULT WINAPI acmFilterTagDetailsA(HACMDRIVER had, PACMFILTERTAGDETAILSA paftda,
                                     DWORD fdwDetails)
 {
     ACMFILTERTAGDETAILSW       aftdw;
@@ -257,20 +270,21 @@ MMRESULT WINAPI acmFilterTagDetailsA(HACMDRIVER had, PACMFILTERTAGDETAILSA paftd
 
     mmr = acmFilterTagDetailsW(had, &aftdw, fdwDetails);
     if (mmr == MMSYSERR_NOERROR) {
-       paftda->dwFilterTag = aftdw.dwFilterTag; 
+       paftda->dwFilterTag = aftdw.dwFilterTag;
        paftda->dwFilterTagIndex = aftdw.dwFilterTagIndex;
-       paftda->cbFilterSize = aftdw.cbFilterSize; 
-       paftda->fdwSupport = aftdw.fdwSupport; 
-       paftda->cStandardFilters = aftdw.cStandardFilters; 
-       lstrcpyWtoA(paftda->szFilterTag, aftdw.szFilterTag);
+       paftda->cbFilterSize = aftdw.cbFilterSize;
+       paftda->fdwSupport = aftdw.fdwSupport;
+       paftda->cStandardFilters = aftdw.cStandardFilters;
+        WideCharToMultiByte( CP_ACP, 0, aftdw.szFilterTag, -1, paftda->szFilterTag,
+                             sizeof(paftda->szFilterTag), NULL, NULL );
     }
     return mmr;
 }
 
 /***********************************************************************
- *           acmFilterTagDetailsW (MSACM32.20)
+ *           acmFilterTagDetailsW (MSACM32.@)
  */
-MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd, 
+MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd,
                                     DWORD fdwDetails)
 {
     PWINE_ACMDRIVERID  padid;
@@ -288,23 +302,21 @@ MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd
            mmr = ACMERR_NOTPOSSIBLE;
            for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
                /* should check for codec only */
-               if (padid->bEnabled && acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
-                   mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS,
-                                       (LPARAM)paftd, (LPARAM)fdwDetails);
+               if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
+                     acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
+                   mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS, (LPARAM)paftd, fdwDetails);
                    acmDriverClose(had, 0);
                    if (mmr == MMSYSERR_NOERROR) break;
                }
            }
        } else {
-           mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS,
-                               (LPARAM)paftd, (LPARAM)fdwDetails);
+           mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS, (LPARAM)paftd, fdwDetails);
        }
        break;
 
     case ACM_FILTERTAGDETAILSF_INDEX:
        /* FIXME should check paftd->dwFilterTagIndex < add.cFilterTags */
-       mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS,
-                           (LPARAM)paftd, (LPARAM)fdwDetails);
+       mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS, (LPARAM)paftd, fdwDetails);
        break;
 
     case ACM_FILTERTAGDETAILSF_LARGESTSIZE:
@@ -315,7 +327,7 @@ MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd
            mmr = ACMERR_NOTPOSSIBLE;
            for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
                /* should check for codec only */
-               if (padid->bEnabled && 
+               if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
                    acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
 
                    memset(&tmp, 0, sizeof(tmp));
@@ -323,20 +335,18 @@ MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd
                    tmp.dwFilterTag = ft;
 
                    if (MSACM_Message(had, ACMDM_FILTERTAG_DETAILS,
-                                     (LPARAM)&tmp, 
-                                     (LPARAM)fdwDetails) == MMSYSERR_NOERROR) {
+                                     (LPARAM)&tmp, fdwDetails) == MMSYSERR_NOERROR) {
                        if (mmr == ACMERR_NOTPOSSIBLE ||
                            paftd->cbFilterSize < tmp.cbFilterSize) {
                            *paftd = tmp;
                            mmr = MMSYSERR_NOERROR;
-                       } 
+                       }
                    }
                    acmDriverClose(had, 0);
                }
            }
        } else {
-           mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS,
-                               (LPARAM)paftd, (LPARAM)fdwDetails);
+           mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS, (LPARAM)paftd, fdwDetails);
        }
        break;
 
@@ -345,9 +355,10 @@ MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd
        mmr = MMSYSERR_ERROR;
     }
 
-    if (mmr == MMSYSERR_NOERROR && 
+    if (mmr == MMSYSERR_NOERROR &&
        paftd->dwFilterTag == WAVE_FORMAT_PCM && paftd->szFilterTag[0] == 0)
-       lstrcpyAtoW(paftd->szFilterTag, "PCM");
+        MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFilterTag,
+                             sizeof(paftd->szFilterTag)/sizeof(WCHAR) );
 
     return mmr;
 }
@@ -359,30 +370,31 @@ struct MSACM_FilterTagEnumWtoA_Instance {
 };
 
 static BOOL CALLBACK MSACM_FilterTagEnumCallbackWtoA(HACMDRIVERID hadid,
-                                                    PACMFILTERTAGDETAILSW paftdw,  
-                                                    DWORD dwInstance,             
+                                                    PACMFILTERTAGDETAILSW paftdw,
+                                                    DWORD dwInstance,
                                                     DWORD fdwSupport)
 {
     struct MSACM_FilterTagEnumWtoA_Instance* paftei;
 
     paftei = (struct MSACM_FilterTagEnumWtoA_Instance*)dwInstance;
 
-    paftei->paftda->dwFilterTagIndex = paftdw->dwFilterTagIndex; 
-    paftei->paftda->dwFilterTag = paftdw->dwFilterTag; 
-    paftei->paftda->cbFilterSize = paftdw->cbFilterSize; 
-    paftei->paftda->fdwSupport = paftdw->fdwSupport; 
-    paftei->paftda->cStandardFilters = paftdw->cStandardFilters; 
-    lstrcpyWtoA(paftei->paftda->szFilterTag, paftdw->szFilterTag);
+    paftei->paftda->dwFilterTagIndex = paftdw->dwFilterTagIndex;
+    paftei->paftda->dwFilterTag = paftdw->dwFilterTag;
+    paftei->paftda->cbFilterSize = paftdw->cbFilterSize;
+    paftei->paftda->fdwSupport = paftdw->fdwSupport;
+    paftei->paftda->cStandardFilters = paftdw->cStandardFilters;
+    WideCharToMultiByte( CP_ACP, 0, paftdw->szFilterTag, -1, paftei->paftda->szFilterTag,
+                         sizeof(paftei->paftda->szFilterTag), NULL, NULL );
 
-    return (paftei->fnCallback)(hadid, paftei->paftda, 
+    return (paftei->fnCallback)(hadid, paftei->paftda,
                                paftei->dwInstance, fdwSupport);
 }
 
 /***********************************************************************
- *           acmFilterTagEnumA (MSACM32.21)
+ *           acmFilterTagEnumA (MSACM32.@)
  */
 MMRESULT WINAPI acmFilterTagEnumA(HACMDRIVER had, PACMFILTERTAGDETAILSA paftda,
-                                 ACMFILTERTAGENUMCBA fnCallback, DWORD dwInstance, 
+                                 ACMFILTERTAGENUMCBA fnCallback, DWORD dwInstance,
                                  DWORD fdwEnum)
 {
     ACMFILTERTAGDETAILSW       aftdw;
@@ -397,42 +409,38 @@ MMRESULT WINAPI acmFilterTagEnumA(HACMDRIVER had, PACMFILTERTAGDETAILSA paftda,
     aftei.dwInstance = dwInstance;
     aftei.fnCallback = fnCallback;
 
-    return acmFilterTagEnumW(had, &aftdw, MSACM_FilterTagEnumCallbackWtoA, 
+    return acmFilterTagEnumW(had, &aftdw, MSACM_FilterTagEnumCallbackWtoA,
                             (DWORD)&aftei, fdwEnum);
 }
 
 /***********************************************************************
- *           acmFilterTagEnumW (MSACM32.22)
+ *           acmFilterTagEnumW (MSACM32.@)
  */
 MMRESULT WINAPI acmFilterTagEnumW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd,
-                                 ACMFILTERTAGENUMCBW fnCallback, DWORD dwInstance, 
+                                 ACMFILTERTAGENUMCBW fnCallback, DWORD dwInstance,
                                  DWORD fdwEnum)
 {
     PWINE_ACMDRIVERID          padid;
-    ACMDRIVERDETAILSW          add;
     int                                i;
 
     TRACE("(0x%08x, %p, %p, %ld, %ld)\n",
-         had, paftd, fnCallback, dwInstance, fdwEnum); 
+         had, paftd, fnCallback, dwInstance, fdwEnum);
 
     if (paftd->cbStruct < sizeof(*paftd)) return MMSYSERR_INVALPARAM;
 
     if (had) FIXME("had != NULL, not supported\n");
-    
+
     for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
        /* should check for codec only */
-       if (padid->bEnabled && acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == MMSYSERR_NOERROR) {
-           add.cbStruct = sizeof(add);
-
-           if (acmDriverDetailsW((HACMDRIVERID)padid, &add, 0) == MMSYSERR_NOERROR) {
-               for (i = 0; i < add.cFilterTags; i++) {
-                   paftd->dwFilterTagIndex = i;
-                   if (acmFilterTagDetailsW(had, paftd, ACM_FILTERTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) {
-                       if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, 
-                                         add.fdwSupport)) {
-                           padid = NULL;
-                           break;
-                       }
+       if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
+           acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == MMSYSERR_NOERROR) {
+
+           for (i = 0; i < padid->cFilterTags; i++) {
+               paftd->dwFilterTagIndex = i;
+               if (acmFilterTagDetailsW(had, paftd, ACM_FILTERTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) {
+                   if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, padid->fdwSupport)) {
+                       padid = NULL;
+                       break;
                    }
                }
            }