Loop over an array to detect available extensions
[dsound-openal.git] / propset.c
blob242bb0b0b6d71e0cdf499684a7fe48c9ad558320
1 /* DirectSound
3 * Copyright 1998 Marcus Meissner
4 * Copyright 1998 Rob Riggs
5 * Copyright 2000-2002 TransGaming Technologies, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #define CONST_VTABLE
23 #include <stdarg.h>
24 #include <string.h>
26 #include <windows.h>
27 #include <dsound.h>
28 #include <mmsystem.h>
29 #include <mmdeviceapi.h>
30 #include <dsconf.h>
31 #include <devpropdef.h>
33 #include "dsound_private.h"
36 DEFINE_DEVPROPKEY(DEVPKEY_Device_FriendlyName, 0xa45c254e,0xdf1c,0x4efd,0x80,0x20,0x67,0xd1,0x46,0xa8,0x50,0xe0, 14);
38 static WCHAR *strdupW(const WCHAR *str)
40 WCHAR *ret;
41 int l = lstrlenW(str);
42 if(l < 0) return NULL;
44 ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (l+1)*sizeof(WCHAR));
45 if(!ret) return NULL;
47 memcpy(ret, str, l*sizeof(WCHAR));
48 return ret;
52 typedef struct IKsPrivatePropertySetImpl
54 IKsPropertySet IKsPropertySet_iface;
55 LONG ref;
56 } IKsPrivatePropertySetImpl;
58 static IKsPrivatePropertySetImpl *impl_from_IKsPropertySet(IKsPropertySet *iface)
60 return CONTAINING_RECORD(iface, IKsPrivatePropertySetImpl, IKsPropertySet_iface);
63 /*******************************************************************************
64 * IKsPrivatePropertySet
67 /* IUnknown methods */
68 static HRESULT WINAPI IKsPrivatePropertySetImpl_QueryInterface(
69 IKsPropertySet *iface, REFIID riid, void **ppobj)
71 IKsPrivatePropertySetImpl *This = impl_from_IKsPropertySet(iface);
72 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
74 if (IsEqualIID(riid, &IID_IUnknown) ||
75 IsEqualIID(riid, &IID_IKsPropertySet)) {
76 *ppobj = iface;
77 IKsPropertySet_AddRef(iface);
78 return S_OK;
80 *ppobj = NULL;
81 return E_NOINTERFACE;
84 static ULONG WINAPI IKsPrivatePropertySetImpl_AddRef(LPKSPROPERTYSET iface)
86 IKsPrivatePropertySetImpl *This = impl_from_IKsPropertySet(iface);
87 ULONG ref = InterlockedIncrement(&(This->ref));
88 TRACE("(%p) ref was %ld\n", This, ref - 1);
89 return ref;
92 static ULONG WINAPI IKsPrivatePropertySetImpl_Release(LPKSPROPERTYSET iface)
94 IKsPrivatePropertySetImpl *This = impl_from_IKsPropertySet(iface);
95 ULONG ref = InterlockedDecrement(&(This->ref));
96 TRACE("(%p) ref was %ld\n", This, ref + 1);
98 if(!ref)
100 HeapFree(GetProcessHeap(), 0, This);
101 TRACE("(%p) released\n", This);
103 return ref;
106 struct search_data {
107 const WCHAR *tgt_name;
108 GUID *found_guid;
111 static BOOL CALLBACK search_callback(GUID *guid, const WCHAR *desc,
112 const WCHAR *module, void *user)
114 struct search_data *search = user;
115 (void)module;
117 if(!lstrcmpW(desc, search->tgt_name)){
118 *search->found_guid = *guid;
119 return FALSE;
122 return TRUE;
125 static HRESULT DSPROPERTY_WaveDeviceMappingW(
126 LPVOID pPropData,
127 ULONG cbPropData,
128 PULONG pcbReturned )
130 HRESULT hr;
131 PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA ppd = pPropData;
132 struct search_data search;
134 TRACE("(pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
135 pPropData,cbPropData,pcbReturned);
137 if (!ppd)
139 WARN("invalid parameter: pPropData\n");
140 return DSERR_INVALIDPARAM;
143 search.tgt_name = ppd->DeviceName;
144 search.found_guid = &ppd->DeviceId;
146 if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER)
147 hr = enumerate_mmdevices(eRender, search_callback, &search);
148 else if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE)
149 hr = enumerate_mmdevices(eCapture, search_callback, &search);
150 else
151 return DSERR_INVALIDPARAM;
153 if(hr != S_FALSE)
154 /* device was not found */
155 return DSERR_INVALIDPARAM;
157 if (pcbReturned)
158 *pcbReturned = cbPropData;
160 return DS_OK;
163 static HRESULT DSPROPERTY_WaveDeviceMappingA(
164 LPVOID pPropData,
165 ULONG cbPropData,
166 PULONG pcbReturned )
168 DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA *ppd = pPropData;
169 DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA data;
170 DWORD len;
171 HRESULT hr;
173 TRACE("(pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
174 pPropData,cbPropData,pcbReturned);
176 if (!ppd || !ppd->DeviceName) {
177 WARN("invalid parameter: ppd=%p\n", ppd);
178 return DSERR_INVALIDPARAM;
181 data.DataFlow = ppd->DataFlow;
182 len = MultiByteToWideChar(CP_ACP, 0, ppd->DeviceName, -1, NULL, 0);
183 data.DeviceName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
184 if (!data.DeviceName)
185 return E_OUTOFMEMORY;
186 MultiByteToWideChar(CP_ACP, 0, ppd->DeviceName, -1, data.DeviceName, len);
188 hr = DSPROPERTY_WaveDeviceMappingW(&data, cbPropData, pcbReturned);
189 HeapFree(GetProcessHeap(), 0, data.DeviceName);
190 ppd->DeviceId = data.DeviceId;
192 if (pcbReturned)
193 *pcbReturned = cbPropData;
195 return hr;
198 static HRESULT DSPROPERTY_DescriptionW(
199 LPVOID pPropData,
200 ULONG cbPropData,
201 PULONG pcbReturned )
203 PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA ppd = pPropData;
204 GUID dev_guid;
205 IMMDevice *mmdevice;
206 IPropertyStore *ps;
207 PROPVARIANT pv;
208 HRESULT hr;
210 TRACE("pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
211 pPropData,cbPropData,pcbReturned);
213 TRACE("DeviceId=%s\n",debugstr_guid(&ppd->DeviceId));
214 if ( IsEqualGUID( &ppd->DeviceId , &GUID_NULL) ) {
215 /* default device of type specified by ppd->DataFlow */
216 if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE) {
217 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
218 ppd->DeviceId = DSDEVID_DefaultCapture;
219 } else if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER) {
220 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
221 ppd->DeviceId = DSDEVID_DefaultPlayback;
222 } else {
223 WARN("DataFlow=Unknown(%d)\n", ppd->DataFlow);
224 return E_PROP_ID_UNSUPPORTED;
228 GetDeviceID(&ppd->DeviceId, &dev_guid);
230 hr = get_mmdevice(eRender, &dev_guid, &mmdevice);
231 if(FAILED(hr)){
232 hr = get_mmdevice(eCapture, &dev_guid, &mmdevice);
233 if(FAILED(hr))
234 return hr;
237 hr = IMMDevice_OpenPropertyStore(mmdevice, STGM_READ, &ps);
238 if(FAILED(hr))
240 IMMDevice_Release(mmdevice);
241 WARN("OpenPropertyStore failed: %08lx\n", hr);
242 return hr;
245 hr = IPropertyStore_GetValue(ps, (const PROPERTYKEY*)&DEVPKEY_Device_FriendlyName, &pv);
246 if(FAILED(hr))
248 IPropertyStore_Release(ps);
249 IMMDevice_Release(mmdevice);
250 WARN("GetValue(FriendlyName) failed: %08lx\n", hr);
251 return hr;
254 ppd->Description = strdupW(pv.pwszVal);
255 ppd->Module = strdupW(wine_vxd_drv);
256 ppd->Interface = strdupW(L"Interface");
257 ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
259 PropVariantClear(&pv);
260 IPropertyStore_Release(ps);
261 IMMDevice_Release(mmdevice);
263 if (pcbReturned)
265 *pcbReturned = sizeof(*ppd);
266 TRACE("*pcbReturned=%ld\n", *pcbReturned);
269 return S_OK;
272 static
273 BOOL CALLBACK enum_callback(GUID *guid, const WCHAR *desc, const WCHAR *module,
274 void *user)
276 PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA ppd = user;
277 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data;
278 DWORD len;
279 BOOL ret;
281 TRACE("%s %ls %ls %p\n", debugstr_guid(guid), desc, module, user);
283 if(!guid)
284 return TRUE;
286 data.DeviceId = *guid;
288 len = lstrlenW(module) + 1;
289 data.Module = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
290 memcpy(data.Module, module, len * sizeof(WCHAR));
292 len = lstrlenW(desc) + 1;
293 data.Description = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
294 memcpy(data.Description, desc, len * sizeof(WCHAR));
296 data.Interface = L"Interface";
298 ret = ppd->Callback(&data, ppd->Context);
300 HeapFree(GetProcessHeap(), 0, data.Module);
301 HeapFree(GetProcessHeap(), 0, data.Description);
303 return ret;
306 static HRESULT DSPROPERTY_EnumerateW(
307 LPVOID pPropData,
308 ULONG cbPropData,
309 PULONG pcbReturned )
311 PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA ppd = pPropData;
312 HRESULT hr;
314 TRACE("(pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
315 pPropData,cbPropData,pcbReturned);
317 if (pcbReturned)
318 *pcbReturned = 0;
320 if (!ppd || !ppd->Callback)
322 WARN("Invalid ppd %p\n", ppd);
323 return E_PROP_ID_UNSUPPORTED;
326 hr = enumerate_mmdevices(eRender, enum_callback, ppd);
327 if(hr == S_OK)
328 hr = enumerate_mmdevices(eCapture, enum_callback, ppd);
330 return SUCCEEDED(hr) ? DS_OK : hr;
333 static BOOL DSPROPERTY_descWtoA(const DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA *dataW,
334 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA *dataA)
336 static char Interface[] = "Interface";
337 DWORD modlen, desclen;
339 modlen = WideCharToMultiByte(CP_ACP, 0, dataW->Module, -1, NULL, 0, NULL, NULL);
340 desclen = WideCharToMultiByte(CP_ACP, 0, dataW->Description, -1, NULL, 0, NULL, NULL);
341 dataA->Type = dataW->Type;
342 dataA->DataFlow = dataW->DataFlow;
343 dataA->DeviceId = dataW->DeviceId;
344 dataA->WaveDeviceId = dataW->WaveDeviceId;
345 dataA->Interface = Interface;
346 dataA->Module = HeapAlloc(GetProcessHeap(), 0, modlen);
347 dataA->Description = HeapAlloc(GetProcessHeap(), 0, desclen);
348 if (!dataA->Module || !dataA->Description)
350 HeapFree(GetProcessHeap(), 0, dataA->Module);
351 HeapFree(GetProcessHeap(), 0, dataA->Description);
352 dataA->Module = dataA->Description = NULL;
353 return FALSE;
356 WideCharToMultiByte(CP_ACP, 0, dataW->Module, -1, dataA->Module, modlen, NULL, NULL);
357 WideCharToMultiByte(CP_ACP, 0, dataW->Description, -1, dataA->Description, desclen, NULL, NULL);
358 return TRUE;
361 static void DSPROPERTY_descWto1(const DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA *dataW,
362 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA *data1)
364 data1->DeviceId = dataW->DeviceId;
365 lstrcpynW(data1->ModuleW, dataW->Module, sizeof(data1->ModuleW)/sizeof(*data1->ModuleW));
366 lstrcpynW(data1->DescriptionW, dataW->Description, sizeof(data1->DescriptionW)/sizeof(*data1->DescriptionW));
367 WideCharToMultiByte(CP_ACP, 0, data1->DescriptionW, -1, data1->DescriptionA, sizeof(data1->DescriptionA)-1, NULL, NULL);
368 WideCharToMultiByte(CP_ACP, 0, data1->ModuleW, -1, data1->ModuleA, sizeof(data1->ModuleA)-1, NULL, NULL);
369 data1->DescriptionA[sizeof(data1->DescriptionA)-1] = 0;
370 data1->ModuleA[sizeof(data1->ModuleA)-1] = 0;
371 data1->Type = dataW->Type;
372 data1->DataFlow = dataW->DataFlow;
373 data1->WaveDeviceId = data1->Devnode = dataW->WaveDeviceId;
376 static BOOL CALLBACK DSPROPERTY_enumWtoA(DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA *descW, void *data)
378 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA descA;
379 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA *ppd = data;
380 BOOL ret;
382 ret = DSPROPERTY_descWtoA(descW, &descA);
383 if (!ret)
384 return FALSE;
385 ret = ppd->Callback(&descA, ppd->Context);
386 HeapFree(GetProcessHeap(), 0, descA.Module);
387 HeapFree(GetProcessHeap(), 0, descA.Description);
388 return ret;
391 static HRESULT DSPROPERTY_EnumerateA(
392 LPVOID pPropData,
393 ULONG cbPropData,
394 PULONG pcbReturned)
396 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA *ppd = pPropData;
397 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA data;
399 if (!ppd || !ppd->Callback)
401 WARN("Invalid ppd %p\n", ppd);
402 return E_PROP_ID_UNSUPPORTED;
405 data.Callback = DSPROPERTY_enumWtoA;
406 data.Context = ppd;
408 return DSPROPERTY_EnumerateW(&data, cbPropData, pcbReturned);
411 static BOOL CALLBACK DSPROPERTY_enumWto1(DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA *descW, void *data)
413 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA desc1;
414 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA *ppd = data;
415 BOOL ret;
417 DSPROPERTY_descWto1(descW, &desc1);
418 ret = ppd->Callback(&desc1, ppd->Context);
419 return ret;
422 static HRESULT DSPROPERTY_Enumerate1(
423 LPVOID pPropData,
424 ULONG cbPropData,
425 PULONG pcbReturned)
427 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA *ppd = pPropData;
428 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA data;
430 if (!ppd || !ppd->Callback)
432 WARN("Invalid ppd %p\n", ppd);
433 return E_PROP_ID_UNSUPPORTED;
436 data.Callback = DSPROPERTY_enumWto1;
437 data.Context = ppd;
439 return DSPROPERTY_EnumerateW(&data, cbPropData, pcbReturned);
442 static HRESULT DSPROPERTY_DescriptionA(
443 LPVOID pPropData,
444 ULONG cbPropData,
445 PULONG pcbReturned)
447 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data;
448 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA *ppd = pPropData;
449 HRESULT hr;
451 if(cbPropData < sizeof(DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA))
452 return E_INVALIDARG;
453 if (pcbReturned)
454 *pcbReturned = sizeof(*ppd);
455 if (!pPropData)
456 return S_OK;
458 data.DeviceId = ppd->DeviceId;
459 data.DataFlow = ppd->DataFlow;
460 hr = DSPROPERTY_DescriptionW(&data, sizeof(data), NULL);
461 if (FAILED(hr))
462 return hr;
463 if (!DSPROPERTY_descWtoA(&data, ppd))
464 hr = E_OUTOFMEMORY;
465 HeapFree(GetProcessHeap(), 0, data.Description);
466 HeapFree(GetProcessHeap(), 0, data.Module);
467 HeapFree(GetProcessHeap(), 0, data.Interface);
468 return hr;
471 static HRESULT DSPROPERTY_Description1(
472 LPVOID pPropData,
473 ULONG cbPropData,
474 PULONG pcbReturned)
476 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data;
477 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA *ppd = pPropData;
478 HRESULT hr;
480 if(cbPropData < sizeof(DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA))
481 return E_INVALIDARG;
482 if (pcbReturned)
483 *pcbReturned = sizeof(*ppd);
484 if (!pPropData)
485 return S_OK;
487 data.DeviceId = ppd->DeviceId;
488 data.DataFlow = ppd->DataFlow;
489 hr = DSPROPERTY_DescriptionW(&data, sizeof(data), NULL);
490 if (FAILED(hr))
491 return hr;
492 DSPROPERTY_descWto1(&data, ppd);
493 HeapFree(GetProcessHeap(), 0, data.Description);
494 HeapFree(GetProcessHeap(), 0, data.Module);
495 HeapFree(GetProcessHeap(), 0, data.Interface);
496 return hr;
499 static HRESULT WINAPI IKsPrivatePropertySetImpl_Get(
500 LPKSPROPERTYSET iface,
501 REFGUID guidPropSet,
502 ULONG dwPropID,
503 LPVOID pInstanceData,
504 ULONG cbInstanceData,
505 LPVOID pPropData,
506 ULONG cbPropData,
507 PULONG pcbReturned )
509 IKsPrivatePropertySetImpl *This = impl_from_IKsPropertySet(iface);
510 TRACE("(iface=%p,guidPropSet=%s,dwPropID=%ld,pInstanceData=%p,cbInstanceData=%ld,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
511 This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData,pcbReturned);
513 if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
514 switch (dwPropID) {
515 case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A:
516 return DSPROPERTY_WaveDeviceMappingA(pPropData,cbPropData,pcbReturned);
517 case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1:
518 return DSPROPERTY_Description1(pPropData,cbPropData,pcbReturned);
519 case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1:
520 return DSPROPERTY_Enumerate1(pPropData,cbPropData,pcbReturned);
521 case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W:
522 return DSPROPERTY_WaveDeviceMappingW(pPropData,cbPropData,pcbReturned);
523 case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A:
524 return DSPROPERTY_DescriptionA(pPropData,cbPropData,pcbReturned);
525 case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W:
526 return DSPROPERTY_DescriptionW(pPropData,cbPropData,pcbReturned);
527 case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A:
528 return DSPROPERTY_EnumerateA(pPropData,cbPropData,pcbReturned);
529 case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W:
530 return DSPROPERTY_EnumerateW(pPropData,cbPropData,pcbReturned);
531 default:
532 FIXME("unsupported ID: %ld\n",dwPropID);
533 break;
535 } else {
536 FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet));
539 if (pcbReturned) {
540 *pcbReturned = 0;
541 FIXME("*pcbReturned=%ld\n", *pcbReturned);
544 return E_PROP_ID_UNSUPPORTED;
547 static HRESULT WINAPI IKsPrivatePropertySetImpl_Set(
548 LPKSPROPERTYSET iface,
549 REFGUID guidPropSet,
550 ULONG dwPropID,
551 LPVOID pInstanceData,
552 ULONG cbInstanceData,
553 LPVOID pPropData,
554 ULONG cbPropData )
556 IKsPrivatePropertySetImpl *This = impl_from_IKsPropertySet(iface);
558 FIXME("(%p,%s,%ld,%p,%ld,%p,%ld), stub!\n",This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData);
559 return E_PROP_ID_UNSUPPORTED;
562 static HRESULT WINAPI IKsPrivatePropertySetImpl_QuerySupport(
563 LPKSPROPERTYSET iface,
564 REFGUID guidPropSet,
565 ULONG dwPropID,
566 PULONG pTypeSupport )
568 IKsPrivatePropertySetImpl *This = impl_from_IKsPropertySet(iface);
569 TRACE("(%p,%s,%ld,%p)\n",This,debugstr_guid(guidPropSet),dwPropID,pTypeSupport);
571 if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
572 switch (dwPropID) {
573 case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A:
574 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
575 return S_OK;
576 case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1:
577 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
578 return S_OK;
579 case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1:
580 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
581 return S_OK;
582 case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W:
583 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
584 return S_OK;
585 case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A:
586 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
587 return S_OK;
588 case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W:
589 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
590 return S_OK;
591 case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A:
592 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
593 return S_OK;
594 case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W:
595 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
596 return S_OK;
597 default:
598 FIXME("unsupported ID: %ld\n",dwPropID);
599 break;
601 } else {
602 FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet));
605 return E_PROP_ID_UNSUPPORTED;
608 static const IKsPropertySetVtbl ikspvt = {
609 IKsPrivatePropertySetImpl_QueryInterface,
610 IKsPrivatePropertySetImpl_AddRef,
611 IKsPrivatePropertySetImpl_Release,
612 IKsPrivatePropertySetImpl_Get,
613 IKsPrivatePropertySetImpl_Set,
614 IKsPrivatePropertySetImpl_QuerySupport
617 HRESULT IKsPrivatePropertySetImpl_Create(REFIID riid, void **ppv)
619 IKsPrivatePropertySetImpl *iks;
620 HRESULT hr;
622 TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
624 iks = HeapAlloc(GetProcessHeap(), 0, sizeof(*iks));
625 if (!iks) {
626 WARN("out of memory\n");
627 return DSERR_OUTOFMEMORY;
630 iks->ref = 1;
631 iks->IKsPropertySet_iface.lpVtbl = &ikspvt;
633 hr = IKsPropertySet_QueryInterface(&iks->IKsPropertySet_iface, riid, ppv);
634 IKsPropertySet_Release(&iks->IKsPropertySet_iface);
636 return hr;