Add AppDefaults app selection to control panel
[wine/gsoc-2012-control.git] / dlls / dsound / propset.c
blob242b23740b7d53ede56563f065dc0702c8643461
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 COBJMACROS
23 #define NONAMELESSSTRUCT
24 #define NONAMELESSUNION
25 #include <stdarg.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winuser.h"
30 #include "mmsystem.h"
31 #include "winternl.h"
32 #include "winnls.h"
33 #include "vfwmsgs.h"
34 #include "mmddk.h"
35 #include "wine/debug.h"
36 #include "dsound.h"
37 #include "dsound_private.h"
38 #include "dsconf.h"
40 #include "ksmedia.h"
41 #include "propkey.h"
42 #include "devpkey.h"
44 #ifdef NONAMELESSSTRUCT
45 # define S(x) (x).s
46 #else
47 # define S(x) (x)
48 #endif
50 WINE_DEFAULT_DEBUG_CHANNEL(dsound);
52 static WCHAR wInterface[] = { 'I','n','t','e','r','f','a','c','e',0 };
54 typedef struct IKsPrivatePropertySetImpl
56 IKsPropertySet IKsPropertySet_iface;
57 LONG ref;
58 } IKsPrivatePropertySetImpl;
60 static IKsPrivatePropertySetImpl *impl_from_IKsPropertySet(IKsPropertySet *iface)
62 return CONTAINING_RECORD(iface, IKsPrivatePropertySetImpl, IKsPropertySet_iface);
65 /*******************************************************************************
66 * IKsPrivatePropertySet
69 /* IUnknown methods */
70 static HRESULT WINAPI IKsPrivatePropertySetImpl_QueryInterface(
71 LPKSPROPERTYSET iface,
72 REFIID riid,
73 LPVOID *ppobj )
75 IKsPrivatePropertySetImpl *This = impl_from_IKsPropertySet(iface);
76 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
78 if (IsEqualIID(riid, &IID_IUnknown) ||
79 IsEqualIID(riid, &IID_IKsPropertySet)) {
80 *ppobj = iface;
81 IUnknown_AddRef(iface);
82 return S_OK;
84 *ppobj = NULL;
85 return E_NOINTERFACE;
88 static ULONG WINAPI IKsPrivatePropertySetImpl_AddRef(LPKSPROPERTYSET iface)
90 IKsPrivatePropertySetImpl *This = impl_from_IKsPropertySet(iface);
91 ULONG ref = InterlockedIncrement(&(This->ref));
92 TRACE("(%p) ref was %d\n", This, ref - 1);
93 return ref;
96 static ULONG WINAPI IKsPrivatePropertySetImpl_Release(LPKSPROPERTYSET iface)
98 IKsPrivatePropertySetImpl *This = impl_from_IKsPropertySet(iface);
99 ULONG ref = InterlockedDecrement(&(This->ref));
100 TRACE("(%p) ref was %d\n", This, ref + 1);
102 if (!ref) {
103 HeapFree(GetProcessHeap(), 0, This);
104 TRACE("(%p) released\n", This);
106 return ref;
109 struct search_data {
110 const WCHAR *tgt_name;
111 GUID *found_guid;
114 static BOOL CALLBACK search_callback(GUID *guid, const WCHAR *desc,
115 const WCHAR *module, void *user)
117 struct search_data *search = user;
119 if(!lstrcmpW(desc, search->tgt_name)){
120 *search->found_guid = *guid;
121 return FALSE;
124 return TRUE;
127 static HRESULT DSPROPERTY_WaveDeviceMappingW(
128 LPVOID pPropData,
129 ULONG cbPropData,
130 PULONG pcbReturned )
132 HRESULT hr;
133 PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA ppd = pPropData;
134 struct search_data search;
136 TRACE("(pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
137 pPropData,cbPropData,pcbReturned);
139 if (!ppd) {
140 WARN("invalid parameter: pPropData\n");
141 return DSERR_INVALIDPARAM;
144 search.tgt_name = ppd->DeviceName;
145 search.found_guid = &ppd->DeviceId;
147 if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER)
148 hr = enumerate_mmdevices(eRender, DSOUND_renderer_guids,
149 search_callback, &search);
150 else if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE)
151 hr = enumerate_mmdevices(eCapture, DSOUND_capture_guids,
152 search_callback, &search);
153 else
154 return DSERR_INVALIDPARAM;
156 if(hr != S_FALSE)
157 /* device was not found */
158 return DSERR_INVALIDPARAM;
160 if (pcbReturned)
161 *pcbReturned = cbPropData;
163 return DS_OK;
166 static HRESULT DSPROPERTY_WaveDeviceMappingA(
167 LPVOID pPropData,
168 ULONG cbPropData,
169 PULONG pcbReturned )
171 DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA *ppd = pPropData;
172 DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA data;
173 DWORD len;
174 HRESULT hr;
176 TRACE("(pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
177 pPropData,cbPropData,pcbReturned);
179 if (!ppd || !ppd->DeviceName) {
180 WARN("invalid parameter: ppd=%p\n", ppd);
181 return DSERR_INVALIDPARAM;
184 data.DataFlow = ppd->DataFlow;
185 len = MultiByteToWideChar(CP_ACP, 0, ppd->DeviceName, -1, NULL, 0);
186 data.DeviceName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
187 if (!data.DeviceName)
188 return E_OUTOFMEMORY;
189 MultiByteToWideChar(CP_ACP, 0, ppd->DeviceName, -1, data.DeviceName, len);
191 hr = DSPROPERTY_WaveDeviceMappingW(&data, cbPropData, pcbReturned);
192 HeapFree(GetProcessHeap(), 0, data.DeviceName);
193 ppd->DeviceId = data.DeviceId;
195 if (pcbReturned)
196 *pcbReturned = cbPropData;
198 return hr;
201 static HRESULT DSPROPERTY_DescriptionW(
202 LPVOID pPropData,
203 ULONG cbPropData,
204 PULONG pcbReturned )
206 PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA ppd = pPropData;
207 GUID dev_guid;
208 IMMDevice *mmdevice;
209 IPropertyStore *ps;
210 PROPVARIANT pv;
211 DWORD desclen;
212 HRESULT hr;
214 TRACE("pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
215 pPropData,cbPropData,pcbReturned);
217 TRACE("DeviceId=%s\n",debugstr_guid(&ppd->DeviceId));
218 if ( IsEqualGUID( &ppd->DeviceId , &GUID_NULL) ) {
219 /* default device of type specified by ppd->DataFlow */
220 if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE) {
221 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
222 ppd->DeviceId = DSDEVID_DefaultCapture;
223 } else if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER) {
224 TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
225 ppd->DeviceId = DSDEVID_DefaultPlayback;
226 } else {
227 WARN("DataFlow=Unknown(%d)\n", ppd->DataFlow);
228 return E_PROP_ID_UNSUPPORTED;
232 setup_dsound_options();
234 GetDeviceID(&ppd->DeviceId, &dev_guid);
236 hr = get_mmdevice(eRender, &dev_guid, &mmdevice);
237 if(FAILED(hr)){
238 hr = get_mmdevice(eCapture, &dev_guid, &mmdevice);
239 if(FAILED(hr))
240 return hr;
243 hr = IMMDevice_OpenPropertyStore(mmdevice, STGM_READ, &ps);
244 if(FAILED(hr)){
245 IMMDevice_Release(mmdevice);
246 WARN("OpenPropertyStore failed: %08x\n", hr);
247 return hr;
250 hr = IPropertyStore_GetValue(ps,
251 (const PROPERTYKEY *)&DEVPKEY_Device_FriendlyName, &pv);
252 if(FAILED(hr)){
253 IPropertyStore_Release(ps);
254 IMMDevice_Release(mmdevice);
255 WARN("GetValue(FriendlyName) failed: %08x\n", hr);
256 return hr;
259 desclen = lstrlenW(pv.u.pwszVal) + 1;
260 /* FIXME: Still a memory leak.. */
261 ppd->Description = HeapAlloc(GetProcessHeap(), 0, desclen * sizeof(WCHAR));
262 memcpy(ppd->Description, pv.u.pwszVal, desclen * sizeof(WCHAR));
263 ppd->Module = wine_vxd_drv;
264 ppd->Interface = wInterface;
265 ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
267 PropVariantClear(&pv);
268 IPropertyStore_Release(ps);
269 IMMDevice_Release(mmdevice);
271 if (pcbReturned) {
272 *pcbReturned = sizeof(*ppd);
273 TRACE("*pcbReturned=%d\n", *pcbReturned);
276 return S_OK;
279 static
280 BOOL CALLBACK enum_callback(GUID *guid, const WCHAR *desc, const WCHAR *module,
281 void *user)
283 PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA ppd = user;
284 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data;
285 DWORD len;
286 BOOL ret;
288 TRACE("%s %s %s %p\n", wine_dbgstr_guid(guid), wine_dbgstr_w(desc),
289 wine_dbgstr_w(module), user);
291 if(!guid)
292 return TRUE;
294 data.DeviceId = *guid;
296 len = lstrlenW(module) + 1;
297 data.Module = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
298 memcpy(data.Module, module, len * sizeof(WCHAR));
300 len = lstrlenW(desc) + 1;
301 data.Description = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
302 memcpy(data.Description, desc, len * sizeof(WCHAR));
304 data.Interface = wInterface;
306 ret = ppd->Callback(&data, ppd->Context);
308 HeapFree(GetProcessHeap(), 0, data.Module);
309 HeapFree(GetProcessHeap(), 0, data.Description);
311 return ret;
314 static HRESULT DSPROPERTY_EnumerateW(
315 LPVOID pPropData,
316 ULONG cbPropData,
317 PULONG pcbReturned )
319 PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA ppd = pPropData;
320 HRESULT hr;
322 TRACE("(pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
323 pPropData,cbPropData,pcbReturned);
325 if (pcbReturned)
326 *pcbReturned = 0;
328 if (!ppd || !ppd->Callback)
330 WARN("Invalid ppd %p\n", ppd);
331 return E_PROP_ID_UNSUPPORTED;
334 hr = enumerate_mmdevices(eRender, DSOUND_renderer_guids,
335 enum_callback, ppd);
337 if(hr == S_OK)
338 hr = enumerate_mmdevices(eCapture, DSOUND_capture_guids,
339 enum_callback, ppd);
341 return SUCCEEDED(hr) ? DS_OK : hr;
344 static BOOL DSPROPERTY_descWtoA(const DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA *dataW,
345 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA *dataA)
347 DWORD modlen, desclen;
348 static char Interface[] = "Interface";
350 modlen = WideCharToMultiByte(CP_ACP, 0, dataW->Module, -1, NULL, 0, NULL, NULL);
351 desclen = WideCharToMultiByte(CP_ACP, 0, dataW->Description, -1, NULL, 0, NULL, NULL);
352 dataA->Type = dataW->Type;
353 dataA->DataFlow = dataW->DataFlow;
354 dataA->DeviceId = dataW->DeviceId;
355 dataA->WaveDeviceId = dataW->WaveDeviceId;
356 dataA->Interface = Interface;
357 dataA->Module = HeapAlloc(GetProcessHeap(), 0, modlen);
358 dataA->Description = HeapAlloc(GetProcessHeap(), 0, desclen);
359 if (!dataA->Module || !dataA->Description)
361 HeapFree(GetProcessHeap(), 0, dataA->Module);
362 HeapFree(GetProcessHeap(), 0, dataA->Description);
363 dataA->Module = dataA->Description = NULL;
364 return FALSE;
367 WideCharToMultiByte(CP_ACP, 0, dataW->Module, -1, dataA->Module, modlen, NULL, NULL);
368 WideCharToMultiByte(CP_ACP, 0, dataW->Description, -1, dataA->Description, desclen, NULL, NULL);
369 return TRUE;
372 static void DSPROPERTY_descWto1(const DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA *dataW,
373 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA *data1)
375 data1->DeviceId = dataW->DeviceId;
376 lstrcpynW(data1->ModuleW, dataW->Module, sizeof(data1->ModuleW)/sizeof(*data1->ModuleW));
377 lstrcpynW(data1->DescriptionW, dataW->Description, sizeof(data1->DescriptionW)/sizeof(*data1->DescriptionW));
378 WideCharToMultiByte(CP_ACP, 0, data1->DescriptionW, -1, data1->DescriptionA, sizeof(data1->DescriptionA)-1, NULL, NULL);
379 WideCharToMultiByte(CP_ACP, 0, data1->ModuleW, -1, data1->ModuleA, sizeof(data1->ModuleA)-1, NULL, NULL);
380 data1->DescriptionA[sizeof(data1->DescriptionA)-1] = 0;
381 data1->ModuleA[sizeof(data1->ModuleA)-1] = 0;
382 data1->Type = dataW->Type;
383 data1->DataFlow = dataW->DataFlow;
384 data1->WaveDeviceId = data1->Devnode = dataW->WaveDeviceId;
387 static BOOL CALLBACK DSPROPERTY_enumWtoA(DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA *descW, void *data)
389 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA descA;
390 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA *ppd = data;
391 BOOL ret;
393 ret = DSPROPERTY_descWtoA(descW, &descA);
394 if (!ret)
395 return FALSE;
396 ret = ppd->Callback(&descA, ppd->Context);
397 HeapFree(GetProcessHeap(), 0, descA.Module);
398 HeapFree(GetProcessHeap(), 0, descA.Description);
399 return ret;
402 static HRESULT DSPROPERTY_EnumerateA(
403 LPVOID pPropData,
404 ULONG cbPropData,
405 PULONG pcbReturned)
407 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA *ppd = pPropData;
408 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA data;
410 if (!ppd || !ppd->Callback)
412 WARN("Invalid ppd %p\n", ppd);
413 return E_PROP_ID_UNSUPPORTED;
416 data.Callback = DSPROPERTY_enumWtoA;
417 data.Context = ppd;
419 return DSPROPERTY_EnumerateW(&data, cbPropData, pcbReturned);
422 static BOOL CALLBACK DSPROPERTY_enumWto1(DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA *descW, void *data)
424 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA desc1;
425 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA *ppd = data;
426 BOOL ret;
428 DSPROPERTY_descWto1(descW, &desc1);
429 ret = ppd->Callback(&desc1, ppd->Context);
430 return ret;
433 static HRESULT DSPROPERTY_Enumerate1(
434 LPVOID pPropData,
435 ULONG cbPropData,
436 PULONG pcbReturned)
438 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA *ppd = pPropData;
439 DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA data;
441 if (!ppd || !ppd->Callback)
443 WARN("Invalid ppd %p\n", ppd);
444 return E_PROP_ID_UNSUPPORTED;
447 data.Callback = DSPROPERTY_enumWto1;
448 data.Context = ppd;
450 return DSPROPERTY_EnumerateW(&data, cbPropData, pcbReturned);
453 static HRESULT DSPROPERTY_DescriptionA(
454 LPVOID pPropData,
455 ULONG cbPropData,
456 PULONG pcbReturned)
458 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data;
459 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA *ppd = pPropData;
460 HRESULT hr;
462 if (pcbReturned)
463 *pcbReturned = sizeof(*ppd);
464 if (!pPropData)
465 return S_OK;
467 data.DeviceId = ppd->DeviceId;
468 data.DataFlow = ppd->DataFlow;
469 hr = DSPROPERTY_DescriptionW(&data, sizeof(data), NULL);
470 if (FAILED(hr))
471 return hr;
472 if (!DSPROPERTY_descWtoA(&data, ppd))
473 hr = E_OUTOFMEMORY;
474 HeapFree(GetProcessHeap(), 0, data.Module);
475 HeapFree(GetProcessHeap(), 0, data.Interface);
476 return hr;
479 static HRESULT DSPROPERTY_Description1(
480 LPVOID pPropData,
481 ULONG cbPropData,
482 PULONG pcbReturned)
484 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data;
485 DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA *ppd = pPropData;
486 HRESULT hr;
488 if (pcbReturned)
489 *pcbReturned = sizeof(*ppd);
490 if (!pPropData)
491 return S_OK;
493 data.DeviceId = ppd->DeviceId;
494 data.DataFlow = ppd->DataFlow;
495 hr = DSPROPERTY_DescriptionW(&data, sizeof(data), NULL);
496 if (FAILED(hr))
497 return hr;
498 DSPROPERTY_descWto1(&data, ppd);
499 HeapFree(GetProcessHeap(), 0, data.Module);
500 HeapFree(GetProcessHeap(), 0, data.Interface);
501 return hr;
504 static HRESULT WINAPI IKsPrivatePropertySetImpl_Get(
505 LPKSPROPERTYSET iface,
506 REFGUID guidPropSet,
507 ULONG dwPropID,
508 LPVOID pInstanceData,
509 ULONG cbInstanceData,
510 LPVOID pPropData,
511 ULONG cbPropData,
512 PULONG pcbReturned )
514 IKsPrivatePropertySetImpl *This = impl_from_IKsPropertySet(iface);
515 TRACE("(iface=%p,guidPropSet=%s,dwPropID=%d,pInstanceData=%p,cbInstanceData=%d,pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
516 This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData,pcbReturned);
518 if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
519 switch (dwPropID) {
520 case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A:
521 return DSPROPERTY_WaveDeviceMappingA(pPropData,cbPropData,pcbReturned);
522 case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1:
523 return DSPROPERTY_Description1(pPropData,cbPropData,pcbReturned);
524 case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1:
525 return DSPROPERTY_Enumerate1(pPropData,cbPropData,pcbReturned);
526 case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W:
527 return DSPROPERTY_WaveDeviceMappingW(pPropData,cbPropData,pcbReturned);
528 case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A:
529 return DSPROPERTY_DescriptionA(pPropData,cbPropData,pcbReturned);
530 case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W:
531 return DSPROPERTY_DescriptionW(pPropData,cbPropData,pcbReturned);
532 case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A:
533 return DSPROPERTY_EnumerateA(pPropData,cbPropData,pcbReturned);
534 case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W:
535 return DSPROPERTY_EnumerateW(pPropData,cbPropData,pcbReturned);
536 default:
537 FIXME("unsupported ID: %d\n",dwPropID);
538 break;
540 } else {
541 FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet));
544 if (pcbReturned) {
545 *pcbReturned = 0;
546 FIXME("*pcbReturned=%d\n", *pcbReturned);
549 return E_PROP_ID_UNSUPPORTED;
552 static HRESULT WINAPI IKsPrivatePropertySetImpl_Set(
553 LPKSPROPERTYSET iface,
554 REFGUID guidPropSet,
555 ULONG dwPropID,
556 LPVOID pInstanceData,
557 ULONG cbInstanceData,
558 LPVOID pPropData,
559 ULONG cbPropData )
561 IKsPrivatePropertySetImpl *This = impl_from_IKsPropertySet(iface);
563 FIXME("(%p,%s,%d,%p,%d,%p,%d), stub!\n",This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData);
564 return E_PROP_ID_UNSUPPORTED;
567 static HRESULT WINAPI IKsPrivatePropertySetImpl_QuerySupport(
568 LPKSPROPERTYSET iface,
569 REFGUID guidPropSet,
570 ULONG dwPropID,
571 PULONG pTypeSupport )
573 IKsPrivatePropertySetImpl *This = impl_from_IKsPropertySet(iface);
574 TRACE("(%p,%s,%d,%p)\n",This,debugstr_guid(guidPropSet),dwPropID,pTypeSupport);
576 if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
577 switch (dwPropID) {
578 case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A:
579 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
580 return S_OK;
581 case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1:
582 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
583 return S_OK;
584 case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1:
585 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
586 return S_OK;
587 case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W:
588 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
589 return S_OK;
590 case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A:
591 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
592 return S_OK;
593 case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W:
594 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
595 return S_OK;
596 case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A:
597 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
598 return S_OK;
599 case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W:
600 *pTypeSupport = KSPROPERTY_SUPPORT_GET;
601 return S_OK;
602 default:
603 FIXME("unsupported ID: %d\n",dwPropID);
604 break;
606 } else {
607 FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet));
610 return E_PROP_ID_UNSUPPORTED;
613 static const IKsPropertySetVtbl ikspvt = {
614 IKsPrivatePropertySetImpl_QueryInterface,
615 IKsPrivatePropertySetImpl_AddRef,
616 IKsPrivatePropertySetImpl_Release,
617 IKsPrivatePropertySetImpl_Get,
618 IKsPrivatePropertySetImpl_Set,
619 IKsPrivatePropertySetImpl_QuerySupport
622 HRESULT IKsPrivatePropertySetImpl_Create(
623 REFIID riid,
624 IKsPropertySet **piks)
626 IKsPrivatePropertySetImpl *iks;
627 TRACE("(%s, %p)\n", debugstr_guid(riid), piks);
629 if (!IsEqualIID(riid, &IID_IUnknown) &&
630 !IsEqualIID(riid, &IID_IKsPropertySet)) {
631 *piks = 0;
632 return E_NOINTERFACE;
635 iks = HeapAlloc(GetProcessHeap(),0,sizeof(*iks));
636 iks->ref = 1;
637 iks->IKsPropertySet_iface.lpVtbl = &ikspvt;
639 *piks = &iks->IKsPropertySet_iface;
640 return S_OK;