Use iphlpapi to implement SIO_GET_INTERFACE_LIST in WSAIoctl, and
[wine.git] / dlls / msacm / msacm32_main.c
blob82317dc740f496445df05102cef516fd26153256
1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
3 /*
4 * MSACM32 library
6 * Copyright 1998 Patrik Stridvall
7 * 1999 Eric Pouech
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "winbase.h"
25 #include "winerror.h"
26 #include "windef.h"
27 #include "wine/debug.h"
28 #include "msacm.h"
29 #include "msacmdrv.h"
30 #include "wineacm.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(msacm);
34 /**********************************************************************/
36 HINSTANCE MSACM_hInstance32 = 0;
38 /***********************************************************************
39 * DllMain (MSACM32.init)
41 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
43 TRACE("%p 0x%lx %p\n", hInstDLL, fdwReason, lpvReserved);
45 switch (fdwReason) {
46 case DLL_PROCESS_ATTACH:
47 MSACM_hHeap = HeapCreate(0, 0x10000, 0);
48 MSACM_hInstance32 = hInstDLL;
49 MSACM_RegisterAllDrivers();
50 break;
51 case DLL_PROCESS_DETACH:
52 MSACM_UnregisterAllDrivers();
53 HeapDestroy(MSACM_hHeap);
54 MSACM_hHeap = NULL;
55 MSACM_hInstance32 = NULL;
56 break;
57 case DLL_THREAD_ATTACH:
58 break;
59 case DLL_THREAD_DETACH:
60 break;
61 default:
62 break;
64 return TRUE;
67 /***********************************************************************
68 * XRegThunkEntry (MSACM32.1)
69 * FIXME
70 * No documentation found.
73 /***********************************************************************
74 * acmGetVersion (MSACM32.@)
76 DWORD WINAPI acmGetVersion(void)
78 OSVERSIONINFOA version;
80 version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
81 if (!GetVersionExA( &version ))
82 return 0x04030000;
84 switch (version.dwPlatformId) {
85 case VER_PLATFORM_WIN32_NT:
86 return 0x04000565; /* 4.0.1381 */
87 default:
88 FIXME("%lx not supported\n", version.dwPlatformId);
89 case VER_PLATFORM_WIN32_WINDOWS:
90 return 0x04030000; /* 4.3.0 */
94 /***********************************************************************
95 * acmMessage32 (MSACM32.35)
96 * FIXME
97 * No documentation found.
100 /***********************************************************************
101 * acmMetrics (MSACM32.@)
103 MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
105 PWINE_ACMOBJ pao = MSACM_GetObj(hao, WINE_ACMOBJ_DONTCARE);
106 BOOL bLocal = TRUE;
107 PWINE_ACMDRIVERID padid;
108 DWORD val = 0;
109 int i;
110 MMRESULT mmr = MMSYSERR_NOERROR;
112 TRACE("(%p, %d, %p);\n", hao, uMetric, pMetric);
114 #define CheckLocal(padid) (!bLocal || ((padid)->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_LOCAL))
116 switch (uMetric) {
117 case ACM_METRIC_COUNT_DRIVERS:
118 bLocal = FALSE;
119 /* fall through */
120 case ACM_METRIC_COUNT_LOCAL_DRIVERS:
121 if (hao) return MMSYSERR_INVALHANDLE;
122 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
123 if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) && CheckLocal(padid))
124 val++;
125 *(LPDWORD)pMetric = val;
126 break;
128 case ACM_METRIC_COUNT_CODECS:
129 bLocal = FALSE;
130 /* fall through */
131 case ACM_METRIC_COUNT_LOCAL_CODECS:
132 if (hao) return MMSYSERR_INVALHANDLE;
133 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
134 if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
135 (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CODEC) &&
136 CheckLocal(padid))
137 val++;
138 *(LPDWORD)pMetric = val;
139 break;
141 case ACM_METRIC_COUNT_CONVERTERS:
142 bLocal = FALSE;
143 /* fall through */
144 case ACM_METRIC_COUNT_LOCAL_CONVERTERS:
145 if (hao) return MMSYSERR_INVALHANDLE;
146 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
147 if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
148 (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CONVERTER) &&
149 CheckLocal(padid))
150 val++;
151 *(LPDWORD)pMetric = val;
152 break;
154 case ACM_METRIC_COUNT_FILTERS:
155 bLocal = FALSE;
156 /* fall through */
157 case ACM_METRIC_COUNT_LOCAL_FILTERS:
158 if (hao) return MMSYSERR_INVALHANDLE;
159 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
160 if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
161 (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_FILTER) &&
162 CheckLocal(padid))
163 val++;
164 *(LPDWORD)pMetric = val;
165 break;
167 case ACM_METRIC_COUNT_DISABLED:
168 bLocal = FALSE;
169 /* fall through */
170 case ACM_METRIC_COUNT_LOCAL_DISABLED:
171 if (hao) return MMSYSERR_INVALHANDLE;
172 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
173 if ((padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) && CheckLocal(padid))
174 val++;
175 *(LPDWORD)pMetric = val;
176 break;
178 case ACM_METRIC_MAX_SIZE_FORMAT:
179 if (hao == NULL) {
180 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
181 if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) {
182 for (i = 0; i < padid->cFormatTags; i++) {
183 if (val < padid->aFormatTag[i].cbwfx)
184 val = padid->aFormatTag[i].cbwfx;
188 } else if (pao != NULL) {
189 switch (pao->dwType) {
190 case WINE_ACMOBJ_DRIVER:
191 case WINE_ACMOBJ_DRIVERID:
192 padid = pao->pACMDriverID;
193 break;
194 default:
195 return MMSYSERR_INVALHANDLE;
197 if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) {
198 for (i = 0; i < padid->cFormatTags; i++) {
199 if (val < padid->aFormatTag[i].cbwfx)
200 val = padid->aFormatTag[i].cbwfx;
203 } else {
204 return MMSYSERR_INVALHANDLE;
206 *(LPDWORD)pMetric = val;
207 break;
209 case ACM_METRIC_COUNT_HARDWARE:
210 case ACM_METRIC_HARDWARE_WAVE_INPUT:
211 case ACM_METRIC_HARDWARE_WAVE_OUTPUT:
212 case ACM_METRIC_MAX_SIZE_FILTER:
213 case ACM_METRIC_DRIVER_SUPPORT:
214 case ACM_METRIC_DRIVER_PRIORITY:
215 default:
216 FIXME("(%p, %d, %p): stub\n", hao, uMetric, pMetric);
217 mmr = MMSYSERR_NOTSUPPORTED;
219 return mmr;